Commit 73cc9bd3 authored by Shervin Nourbakhsh's avatar Shervin Nourbakhsh
Browse files

CMake and CPack for installation of cameo-server

parent d226a3e6
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 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}
)
install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/../cameo-server/scripts/cameo-server
TYPE BIN
)
#------------------------------------------------------------
# CPack
if(${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME})
include(${CMAKE_CURRENT_SOURCE_DIR}/../CPackConfigCommon.in)
include(${CMAKE_CURRENT_SOURCE_DIR}/CPackConfig.in)
include(CPack)
endif()
#------------------------------------------------------------
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE all)
set(CPACK_RPM_PACKAGE_ARCHITECTURE noarch)
set(CPACK_DEBIAN_PACKAGE_DEPENDS "java9-sdk")
set(CPACK_DEBIAN_PACKAGE_PROVIDES "cameo-server (=${PROJECT_VERSION})")
#!/bin/sh
java -jar "/usr/local/share/java//cameo-server.jar" $@
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