Commit 72a376c4 authored by Shervin Nourbakhsh's avatar Shervin Nourbakhsh Committed by Shervin Nourbakhsh
Browse files

WIP: modifications for cpack to generate correctly RPM packages

parent e41fad3b
cmake_minimum_required(VERSION 3.18.0)
project(cameo
VERSION 1.0.2
LANGUAGES C
HOMEPAGE_URL "https://code.ill.fr/cameo/cameo"
)
#dependencies
set(CPACK_PACKAGE_NAME ${PROJECT_NAME})
foreach(package cameo-com-jzmq )
add_subdirectory(cameo-com/${package})
endforeach()
set(CPACK_PACKAGE_NAME ${PROJECT_NAME})
foreach(package cameo-server-jzmq cameo-console-jzmq cameo-api-cpp)
add_subdirectory(${package})
endforeach()
# common CPack configuration
include(${CMAKE_SOURCE_DIR}/CPackConfigCommon.in)
include(CPack)
#set(CPACK_PROJECT_CONFIG_FILE ${CMAKE_CURRENT_SOURCE_DIR}/CPackConfig.in)
set (CPACK_PACKAGE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set (CPACK_PACKAGE_CONTACT "Yannick Le Goc <legoc@ill.fr>")
set(CPACK_GENERATOR "DEB;RPM")
#set(CPACK_PACKAGE_DESCRIPTION_FILE "/home/andy/vtk/CMake/Copyright.txt")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Description summary ")
set(CPACK_PACKAGE_DESCRIPTION "Long description")
set(CPACK_PACKAGE_VENDOR "ILL")
set(CPACK_RESOURCE_FILE_README ${CMAKE_CURRENT_SOURCE_DIR}/README.md)
set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
set(CPACK_RPM_FILE_NAME RPM-DEFAULT)
set (CPACK_RPM_BUILDREQUIRES "cmake >= ${CMAKE_MINIMUM_REQUIRED_VERSION}")
set (CPACK_DEBIAN_PACKAGE_SECTION lib)
set (CPACK_RPM_PACKAGE_RELOCATABLE ON)
set (CPACK_RPM_PACKAGE_LICENSE "EUPL v1.1")
#set (CPACK_COMPONENTS_IGNORE_GROUPS ON)
unset (CPACK_MONOLITHIC_INSTALL)
set (CPACK_DEB_COMPONENT_INSTALL TRUE)
set(CPACK_RPM_COMPONENT_INSTALL TRUE)
set (CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS ON)
......@@ -4,15 +4,19 @@
- maven
### Centos 8
``` yum install -y maven```
``` yum install -y maven java-latest-openjdk-devel ```
Update to the most recent version of JAVA
```sudo /sbin/alternatives --config java_sdk_openjdk```
``` sudo /sbin/alternatives --config java_sdk_openjdk ```
## Instructions
Download the version:
```
git clone -b v1.1 --depth 1 https://code.ill.fr/cameo/cameo.git
```
### Option1:
Compile the Java sources:
```
cd cameo
......@@ -23,6 +27,25 @@ Install the jzmq version of the cameo-server:
install.sh 1.0.1
```
### Option2:
```
mkdir build/
cd build/
cmake ..
cmake --build .
```
Packages can be installed directly:
```
cmake --build . --target install
```
or they can be first packaged in either DEB or RPM format
```
cpack -G RPM|DEB
```
and then installed with your package manager
Compile and install the C++ API sources into a temporary directory e.g. */tmp/cameo-install* :
```
......
if(NOT DEFINED PROJECT_NAME)
cmake_minimum_required(VERSION 3.12.0)
endif()
cmake_minimum_required(VERSION 3.12.0)
project(cameo-api-cpp
VERSION 1.1.0
......@@ -88,7 +86,7 @@ set_target_properties(${LIBNAME} PROPERTIES
#------------------------------------------------------------
# Install
#------------------------------------------------------------
install(FILES ${CMAKE_SOURCE_DIR}/LICENSE.txt
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt
DESTINATION ${CMAKE_INSTALL_DOCDIR}/
RENAME copyright
COMPONENT lib
......@@ -146,6 +144,26 @@ write_basic_package_version_file(${PROJECT_NAME}ConfigVersion.cmake
# makes the project importable from the build directory
export(TARGETS ${LIBNAME} FILE ${CMAKE_BINARY_DIR}/${PROJECT_NAME}Config.cmake)
if(UNIX)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/changelog.gz
COMMAND gzip -cn9 ${CMAKE_CURRENT_SOURCE_DIR}/ChangeLog ${CMAKE_CURRENT_BINARY_DIR}/changelog.gz
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/changelog"
COMMENT "Compressing changelog"
)
add_custom_target(changelog
ALL
# DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/changelog.gz
COMMAND gzip -cn9 ${CMAKE_CURRENT_SOURCE_DIR}/ChangeLog > ${CMAKE_CURRENT_BINARY_DIR}/changelog.gz
)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/changelog.gz"
DESTINATION "${CMAKE_INSTALL_DOCDIR}"
COMPONENT lib
)
endif(UNIX)
################ Doc
find_package(Doxygen)
......@@ -169,47 +187,18 @@ else (DOXYGEN_FOUND)
endif (DOXYGEN_FOUND)
######
set (CPACK_PACKAGE_VENDOR "ILL")
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Cameo C++ API")
set (CPACK_PACKAGE_DESCRIPTION "This is the long description")
#set (CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_SOURCE_DIR}/DESCRIPTION)
set (CPACK_PACKAGE_CONTACT "Shervin Nourbakhsh <shervin.nourbakhsh@ill.fr>")
set (CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE.txt)
set (CPACK_RESOURCE_FILE_README ${CMAKE_SOURCE_DIR}/README.md)
set (CPACK_PACKAGE_CHECKSUM MD5)
set (CPACK_COMPONENTS_IGNORE_GROUPS ON)
set (CPACK_GENERATOR "DEB")
set (CPACK_DEB_COMPONENT_INSTALL ON)
#set (CPACK_MONOLITHIC_INSTALL OFF)
#set (CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
###### Common CPACK
if(${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME})
include(${CMAKE_CURRENT_SOURCE_DIR}/../CPackConfigCommon.in)
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Cameo C++ API")
set (CPACK_PACKAGE_DESCRIPTION "This is the long description")
endif()
set (CPACK_COMPONENT_DEV_REQUIRED ON)
set (CPACK_COMPONENT_LIB_REQUIRED ON)
set (CPACK_COMPONENT_DEV_DEPENDS LIB)
include(${CMAKE_CURRENT_SOURCE_DIR}/CPackConfig.in)
set (CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
set (CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON)
set (CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
set (CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY ">=")
#set (CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS ON)
set (CPACK_DEBIAN_PACKAGE_DEPENDS ON)
set (CPACK_DEBIAN_LIB_PACKAGE_DEPENDS "cameo(>=1.0.0), libzmq (>=5)")
set (CPACK_DEBIAN_LIB_PACKAGE_SECTION lib)
set (CPACK_DEBIAN_DEV_PACKAGE_DEPENDS "${LIBNAME}-lib (=${PROJECT_VERSION}), libzmq3-dev")
set (CPACK_DEBIAN_DEV_PACKAGE_RECOMMENDS "rapidjson-dev (>=5)")
set (CPACK_DEBIAN_DEV_PACKAGE_SECTION libdevel)
set (CPACK_DEBIAN_PACKAGE_PRIORITY optional)
if((${CMAKE_BUILD_TYPE} EQUAL "Debug") OR (${CMAKE_BUILD_TYPE} EQUAL "RelWithDebInfo"))
set (CPACK_DEBIAN_DEBUGINFO_PACKAGE ON)
endif()
......
set (CPACK_PACKAGE_CHECKSUM MD5)
set (CPACK_COMPONENT_DEV_REQUIRED ON)
set (CPACK_COMPONENT_LIB_REQUIRED ON)
set (CPACK_COMPONENT_DEV_DEPENDS LIB PARENT_SCOPE)
set (CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON PARENT_SCOPE)
set (CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON PARENT_SCOPE)
set (CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY ">=" PARENT_SCOPE)
#set (CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS ON)
#set (DEBIAN_PACKAGE_BUILDS_DEPENDS "gcc (>=8), gcc-c++ (>=8), cmake (>=${CMAKE_MINIMUM_REQUIRED_VERSION})" PARENT_SCOPE)
set (CPACK_DEBIAN_LIB_PACKAGE_DEPENDS "cameo-server(>=1.0.2)" PARENT_SCOPE)
set(CPACK_DEBIAN_DEV_PACKAGE_NAME ${LIBNAME}-dev)
set(CPACK_DEBIAN_DEV_PACKAGE_NAME ${LIBNAME}-dev PARENT_SCOPE)
set(CPACK_DEBIAN_LIB_PACKAGE_NAME ${LIBNAME}-lib)
set(CPACK_DEBIAN_LIB_PACKAGE_NAME ${LIBNAME}-lib PARENT_SCOPE)
set(CPACK_DEBIAN_DEV_PACKAGE_ARCHITECTURE "amd64")
set(CPACK_DEBIAN_DEV_FILE_NAME ${CPACK_DEBIAN_DEV_PACKAGE_NAME}_${PROJECT_VERSION}_${CPACK_DEBIAN_DEV_PACKAGE_ARCHITECTURE}.deb PARENT_SCOPE)
set(CPACK_DEBIAN_LIB_PACKAGE_ARCHITECTURE "amd64")
set(CPACK_DEBIAN_LIB_FILE_NAME ${CPACK_DEBIAN_LIB_PACKAGE_NAME}_${PROJECT_VERSION}_${CPACK_DEBIAN_LIB_PACKAGE_ARCHITECTURE}.deb PARENT_SCOPE)
#if((${CMAKE_BUILD_TYPE} EQUAL "Debug") OR (${CMAKE_BUILD_TYPE} EQUAL "RelWithDebInfo"))
# set (CPACK_DEBIAN_DEBUGINFO_PACKAGE ON)
# set (CPACK_RPM_DEBUGINFO_PACKAGE ON)
#endif()
####### CPACK RPM
#message("CPACK SYSTEM NAME: ${CMAKE_SYSTEM_NAME}")
cmake_minimum_required(VERSION 3.18.0)
project(cameo-com-jzmq
VERSION 0.0.4
HOMEPAGE_URL "https://code.ill.fr/cameo/cameo"
)
# find the jar file produced by MAVEN
set(PROJECT_JAR ${PROJECT_TARGET_DIR}/${PROJECT_NAME}${JAVA_JZMQ}-${PROJECT_VERSION}-full.jar)
add_custom_command(
OUTPUT ${PROJECT_JAR}
COMMAND mvn install
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
VERBATIM
)
add_custom_target(${PROJECT_NAME}
# ALL
DEPENDS ${PROJECT_JAR}
)
cmake_minimum_required(VERSION 3.18.0)
project(cameo-console-jzmq
VERSION 1.0.0
HOMEPAGE_URL "https://code.ill.fr/cameo/cameo"
)
include(GNUInstallDirs)
if(NOT DEFINED CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Relase)
endif()
# find the jar file produced by MAVEN
set(PROJECT_TARGET_DIR "${CMAKE_CURRENT_SOURCE_DIR}/target")
set(PROJECT_JAR ${PROJECT_TARGET_DIR}/${PROJECT_NAME}${JAVA_JZMQ}-${PROJECT_VERSION}-full.jar)
set(JAVA_INSTALL_DIR ${CMAKE_INSTALL_DATAROOTDIR}/java/cameo)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/installed/${JAVA_INSTALL_DIR})
add_custom_command(
OUTPUT ${PROJECT_JAR}
COMMAND mvn clean install
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
VERBATIM
)
add_custom_target(console
ALL
DEPENDS ${PROJECT_JAR}
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_JAR} ${CMAKE_CURRENT_BINARY_DIR}/installed/${JAVA_INSTALL_DIR}
)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/installed/${JAVA_INSTALL_DIR}/
DESTINATION ${JAVA_INSTALL_DIR}
COMPONENT console
)
include(${CMAKE_CURRENT_SOURCE_DIR}/CPackConfig.in)
set(ARCH "noarch")
set(CPACK_DEBIAN_CONSOLE_PACKAGE_ARCHITECTURE ${ARCH} PARENT_SCOPE)
set(CPACK_RPM_CONSOLE_PACKAGE_ARCHITECTURE ${ARCH} PARENT_SCOPE)
set(CPACK_DEBIAN_CONSOLE_PACKAGE_NAME cameo-console)
set(CPACK_DEBIAN_CONSOLE_PACKAGE_NAME ${CPACK_DEBIAN_CONSOLE_PACKAGE_NAME} PARENT_SCOPE)
set(CPACK_DEBIAN_CONSOLE_FILE_NAME ${CPACK_DEBIAN_CONSOLE_PACKAGE_NAME}_${PROJECT_VERSION}_${ARCH}.deb PARENT_SCOPE)
set(CPACK_RPM_CONSOLE_PACKAGE_REQUIRES ${CMAKE_PROJECT_NAME}-server PARENT_SCOPE)
set(CPACK_DEBIAN_CONSOLE_PACKAGE_DEPENDS ${CMAKE_PROJECT_NAME}-server PARENT_SCOPE)
#if(NOT DEFINED CPACK_PACKAGE_NAME)
#
#set(CPACK_PACKAGE_NAME ${PROJECT_NAME})
#include(../CPackConfig.cmake.in)
#set(CPACK_INSTALLED_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}/installed/${JAVA_INSTALL_DIR} usr/${JAVA_INSTALL_DIR})
#
#include(CPack)
#endif()
cmake_minimum_required(VERSION 3.18.0)
project(cameo-server-jzmq
VERSION 1.0.2
HOMEPAGE_URL "https://code.ill.fr/cameo/cameo"
)
include(GNUInstallDirs)
if(NOT DEFINED CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Relase)
endif()
# find the jar file produced by MAVEN
set(PROJECT_TARGET_DIR "${CMAKE_CURRENT_SOURCE_DIR}/target")
set(PROJECT_JAR ${PROJECT_TARGET_DIR}/${PROJECT_NAME}${JAVA_JZMQ}-${PROJECT_VERSION}-full.jar)
set(JAVA_INSTALL_DIR ${CMAKE_INSTALL_DATAROOTDIR}/java/cameo)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/installed/${JAVA_INSTALL_DIR})
add_custom_command(
OUTPUT ${PROJECT_JAR}
COMMAND mvn clean install
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../
VERBATIM
)
add_custom_target(server
ALL
DEPENDS ${PROJECT_JAR}
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_JAR} ${CMAKE_CURRENT_BINARY_DIR}/installed/${JAVA_INSTALL_DIR}
)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/installed/${JAVA_INSTALL_DIR}/
DESTINATION ${JAVA_INSTALL_DIR}
COMPONENT server
)
include(${CMAKE_CURRENT_SOURCE_DIR}/CPackConfig.in)
if(${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME})
include(${CMAKE_CURRENT_SOURCE_DIR}/../CPackConfigCommon.in)
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Cameo C++ API")
set (CPACK_PACKAGE_DESCRIPTION "This is the long description")
include(CPack)
endif()
set(ARCH "noarch")
set(CPACK_DEBIAN_SERVER_PACKAGE_ARCHITECTURE ${ARCH} PARENT_SCOPE)
set(CPACK_RPM_SERVER_PACKAGE_ARCHITECTURE ${ARCH} PARENT_SCOPE)
set(CPACK_DEBIAN_SERVER_PACKAGE_NAME cameo-server)
set(CPACK_DEBIAN_SERVER_PACKAGE_NAME ${CPACK_DEBIAN_SERVER_PACKAGE_NAME} PARENT_SCOPE)
set(CPACK_DEBIAN_SERVER_FILE_NAME ${CPACK_DEBIAN_SERVER_PACKAGE_NAME}_${PROJECT_VERSION}_${ARCH}.deb PARENT_SCOPE)
cmake_minimum_required(VERSION 3.18.0)
project(cameo-server-jzmq
VERSION 1.0.2
HOMEPAGE_URL "https://code.ill.fr/cameo/cameo"
)
include(GNUInstallDirs)
if(NOT DEFINED CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Relase)
endif()
# find the jar file produced by MAVEN
set(PROJECT_TARGET_DIR "${CMAKE_CURRENT_SOURCE_DIR}/target")
set(PROJECT_JAR ${PROJECT_TARGET_DIR}/${PROJECT_NAME}${JAVA_JZMQ}-${PROJECT_VERSION}-full.jar)
set(JAVA_INSTALL_DIR ${CMAKE_INSTALL_DATAROOTDIR}/java/cameo)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/installed/${JAVA_INSTALL_DIR})
add_custom_command(
OUTPUT ${PROJECT_JAR}
COMMAND mvn clean install
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
VERBATIM
)
add_custom_target(server
ALL
DEPENDS ${PROJECT_JAR}
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_JAR} ${CMAKE_CURRENT_BINARY_DIR}/installed/${JAVA_INSTALL_DIR}
)
if(${UNIX})
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
#add_custom_command(
# OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/changelog.gz
# COMMAND gzip -cn9 "${CMAKE_CURRENT_SOURCE_DIR}/changelog" "${CMAKE_CURRENT_SOURCE_DIR}/changelog.gz"
#WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
# DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/changelog"
# COMMENT "Compressing changelog"
#)
#add_custom_target(changelog ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/changelog.gz")
#install(FILES "${CMAKE_CURRENT_BINARY_DIR}/changelog.gz"
# DESTINATION "${CMAKE_INSTALL_DOCDIR}"
#)
endif()
endif(${UNIX})
if(${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME})
include(${CMAKE_CURRENT_SOURCE_DIR}/../CPackConfigCommon.in)
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Cameo server java")
set (CPACK_PACKAGE_DESCRIPTION "This is the long description")
endif()
include(${CMAKE_CURRENT_SOURCE_DIR}/CPackConfig.in)
#include(../CPackConfig.cmake.in)
set(CPACK_INSTALLED_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}/installed/${JAVA_INSTALL_DIR} usr/${JAVA_INSTALL_DIR})
include(CPack)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment