The code.ill.fr has been recreated and upgraded with the latest version this weekend, If you encounter any problem please inform the Helpdesk.

Commit 93ab541b authored by Shervin Nourbakhsh's avatar Shervin Nourbakhsh
Browse files

Merge commit '46e44691' into mer

     - API version number set by CMake in cameo.h header file taking it from the project version set in CMakeLists.txt
     - add Threads as public dependency
     - CPack generating DEB packages
     - split installation into components to create separate .deb packages with cpack
     - the dynamic library is set to be installed
     - the static library is also produced but not installed, it can only be used setting the build tree in the CMAKE_PREFIX_PATH of another project
       This is done in order to embed the C++ API library into the python .so
     - Improved README documentation about how to compile and install
parents 5ff36030 46e44691
......@@ -7,3 +7,4 @@
/Makefile.in
/.settings/
/Debug/
build/
\ No newline at end of file
if(NOT DEFINED PROJECT_NAME)
cmake_minimum_required(VERSION 3.7.2)
# Project name and version
project(cameo VERSION 1.1.0 LANGUAGES CXX)
#cmake_policy(SET CMP0048 NEW)
endif()
message("========================================")
message("Project ${PROJECT_NAME}, major version: ${PROJECT_VERSION_MAJOR}, version ${PROJECT_VERSION}")
cmake_minimum_required(VERSION 3.12.0)
project(cameo-api-cpp
VERSION 1.1.0
LANGUAGES CXX
HOMEPAGE_URL "https://code.ill.fr/cameo/cameo"
)
#--------------- Helpers
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
include(FetchContent)
if(NOT DEFINED BUILD_SHARED_LIBS)
option(BUILD_SHARED_LIBS "Building dynamic (ON) or static (OFF)" ON)
#set(BUILD_SHARED_LIBS True)
endif()
# name of the target library
set(LIBNAME ${PROJECT_NAME})
set(NAMESPACE Cameo)
set(INSTALL_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR}/cameo/api)
set(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/cmake)
set(component_runtime CAMEO_API_CPP_RUNTIME)
set(component_development CAMEO_API_CPP_DEVELOPMENT)
#--------------- Options
option(CAMEO_API_CPP_TESTS "Compiling the test programs" OFF)
if(NOT DEFINED ${CMAKE_BUILD_TYPE})
set(CMAKE_BUILD_TYPE "Release") # set Release by default
endif()
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
# fix the RPATH for the linker
#if(not APPLE)
# set(CMAKE_INSTALL_RPATH $ORIGIN)
#endif()
if(NOT APPLE)
set(CMAKE_INSTALL_RPATH $ORIGIN)
endif()
#------------------------------------------------------------
# Dependencies
#------------------------------------------------------------
# this is needed when including this file as subdir
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
find_package(ZeroMQ REQUIRED)
find_package(Rapidjson QUIET)
find_package (Threads REQUIRED)
find_package(Rapidjson 1.1.0 QUIET)
if(NOT Rapidjson_FOUND)
message(WARNING "Using Rapidjson from GIT repository")
FetchContent_Declare(rapidjson
GIT_REPOSITORY https://github.com/Tencent/rapidjson.git
GIT_TAG v1.1.0
GIT_SHALLOW True
#INSTALL_COMMAND "make install"
)
FetchContent_GetProperties(rapidjson)
FetchContent_Populate(rapidjson)
......@@ -44,118 +52,177 @@ if(NOT Rapidjson_FOUND)
set(Rapidjson_ROOT ${rapidjson_SOURCE_DIR})
find_package(Rapidjson REQUIRED)
endif()
message(${Rapidjson_INCLUDE_DIRS})
message(STATUS "Rapidjson found here: ${Rapidjson_INCLUDE_DIRS}")
#------------------------------------------------------------
#------------------------------------------------------------
# Libraries
#------------------------------------------------------------
#---------------
# Files
file(GLOB_RECURSE CAMEO_SOURCE_FILES "src/*.cpp")
file(GLOB_RECURSE CAMEO_SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
configure_file(include/cameo.h.in ${INSTALL_INCLUDEDIR}/cameo.h )
add_library(cameo ${CAMEO_SOURCE_FILES})
target_link_libraries(cameo PRIVATE zmq)
target_include_directories(cameo
add_library(${LIBNAME}-obj OBJECT ${CAMEO_SOURCE_FILES})
target_link_libraries(${LIBNAME}-obj PUBLIC zmq Threads::Threads)
target_include_directories(${LIBNAME}-obj
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/ # all the private headers
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include> # here's the version
PUBLIC $<INSTALL_INTERFACE:${INSTALL_INCLUDEDIR}>
)
target_include_directories(cameo
SYSTEM PRIVATE ${Rapidjson_INCLUDE_DIRS}/
target_include_directories(${LIBNAME}-obj
SYSTEM PRIVATE ${Rapidjson_INCLUDE_DIRS}/
)
#target_include_directories(cameo PRIVATE ${DOCTEST_INCLUDE_DIR})
target_compile_features(cameo PUBLIC cxx_std_17)
target_compile_features(${LIBNAME}-obj PUBLIC cxx_std_17)
set_target_properties(cameo PROPERTIES
set_target_properties(${LIBNAME}-obj PROPERTIES
SOVERSION ${PROJECT_VERSION_MAJOR}
VERSION ${PROJECT_VERSION}
POSITION_INDEPENDENT_CODE 1 # this is needed for static compilation for cameo-api-python
)
#---------------
# Library version
write_basic_package_version_file(cameoConfigVersion.cmake
COMPATIBILITY SameMajorVersion
add_library(${LIBNAME}-static STATIC $<TARGET_OBJECTS:${LIBNAME}-obj>)
add_library(${LIBNAME} $<TARGET_OBJECTS:${LIBNAME}-obj>)
set_target_properties(${LIBNAME} PROPERTIES
SOVERSION ${PROJECT_VERSION_MAJOR}
VERSION ${PROJECT_VERSION}
POSITION_INDEPENDENT_CODE 1 # this is needed for static compilation for cameo-api-python
)
#------------------------------------------------------------
# Tests
add_library(${NAMESPACE}::${LIBNAME} ALIAS ${LIBNAME})
add_library(${NAMESPACE}::${LIBNAME}-obj ALIAS ${LIBNAME}-obj)
add_library(${NAMESPACE}::${LIBNAME}-static ALIAS ${LIBNAME}-static)
target_include_directories(${LIBNAME}-static
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include> # here's the version
)
target_compile_features(${LIBNAME}-static PUBLIC cxx_std_17)
target_link_libraries(${LIBNAME}-static PUBLIC zmq Threads::Threads)
#------------------------------------------------------------
# Note: execute ctest --verbose to have more details
enable_testing()
add_subdirectory(tests)
include(GenerateExportHeader)
generate_export_header(${LIBNAME}
EXPORT_MACRO_NAME ${LIBNAME}_EXPORT
EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/${INSTALL_INCLUDEDIR}/export.h
)
#------------------------------------------------------------
# Install
#------------------------------------------------------------
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cameoConfigVersion.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt
DESTINATION ${CMAKE_INSTALL_DOCDIR}/
RENAME copyright
COMPONENT ${component_runtime}
)
#---------------
# Library version
write_basic_package_version_file(${PROJECT_NAME}-config-version.cmake
COMPATIBILITY SameMajorVersion
VERSION ${PROJECT_VERSION}
)
write_basic_package_version_file(${PROJECT_NAME}-static-config-version.cmake
COMPATIBILITY SameMajorVersion
VERSION ${PROJECT_VERSION}
)
install(TARGETS ${LIBNAME}
EXPORT cameoTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} # windows
COMPONENT ${component_runtime}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/cameo/ # dynamic
COMPONENT ${component_runtime}
NAMELINK_COMPONENT ${component_development} #from CMake 3.12
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/cameo/ # static
COMPONENT ${component_development}
PUBLIC_HEADER DESTINATION ${INSTALL_INCLUDEDIR}
COMPONENT ${component_development}
INCLUDES DESTINATION ${INSTALL_INCLUDEDIR}
COMPONENT ${component_development}
)
# this is to install the headers
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ # don't forget the trailing /
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}
DESTINATION ${INSTALL_INCLUDEDIR}
COMPONENT ${component_development}
FILES_MATCHING PATTERN *.h
)
# this is to install the version header that is generated by cmake
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/ # don't forget the trailing /
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
COMPONENT ${component_development}
FILES_MATCHING PATTERN *.h
)
# in CMake 3.14 you just need #install(TARGETS cameo)
install(TARGETS cameo
EXPORT cameoexport
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} # windows
COMPONENT cameo_Runtime
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} # dynamic
COMPONENT cameo_Runtime
# NAMELINK_COMPONENT cameo_Development #from CMake 3.12
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} # static
COMPONENT cameo_Development
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
# this is for cameo-api-python to compile from the local build tree
export(TARGETS ${LIBNAME}-static
NAMESPACE ${NAMESPACE}::
FILE ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-static-targets.cmake
)
export(EXPORT cameoTargets
# FILE ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-${type}-targets.cmake
FILE ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-targets.cmake
NAMESPACE ${NAMESPACE}::
)
configure_package_config_file(cmake/${PROJECT_NAME}-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake
INSTALL_DESTINATION ${ConfigPackageLocation}
)
configure_file(cmake/${PROJECT_NAME}-static-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-static-config.cmake
COPYONLY
)
install(EXPORT cameoTargets
FILE ${PROJECT_NAME}-targets.cmake
# FILE ${PROJECT_NAME}Config.cmake #${PROJECT_NAME}Targets.cmake
NAMESPACE ${NAMESPACE}::
DESTINATION ${ConfigPackageLocation}
COMPONENT ${component_development}
)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake
DESTINATION ${ConfigPackageLocation}
COMPONENT ${component_development}
)
# This makes the project importable from the install directory
# Put config file in per-project dir (name MUST match), can also
# just go into 'cmake'.
install(EXPORT cameoexport
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake
FILE ${PROJECT_NAME}Config.cmake
)
# makes the project importable from the build directory
export(TARGETS cameo FILE ${CMAKE_BINARY_DIR}/${PROJECT_NAME}Config.cmake)
# the install_manifest file is created only after the installation....
#install(FILES ${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt
# DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake
# RENAME cameo_install_manifest.txt
# )
#enable_testing()
#add_subdirectory(test)
# include(ExternalProject)
# find_package(Git REQUIRED)
# ExternalProject_Add(
# doctest
# PREFIX ${CMAKE_BINARY_DIR}/doctest
# GIT_REPOSITORY https://github.com/onqtam/doctest.git
# TIMEOUT 10
# UPDATE_COMMAND ${GIT_EXECUTABLE} pull
# CONFIGURE_COMMAND ""
# BUILD_COMMAND ""
# INSTALL_COMMAND ""
# LOG_DOWNLOAD ON
# )
# # Expose required variable (DOCTEST_INCLUDE_DIR) to parent scope
# ExternalProject_Get_Property(doctest source_dir)
# set(DOCTEST_INCLUDE_DIR ${source_dir}/doctest CACHE INTERNAL "Path to include folder for doctest")
#include(CMakeFindDependencyMacro)
#find_dependency(
#include("${CMAKE_CURRENT_LIST_DIR}/cameo.cmake")
################ Doc
find_package(Doxygen)
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 ${component_runtime}
)
endif(UNIX)
#------------------------------------------------------------
# Doc
#------------------------------------------------------------
find_package(Doxygen QUIET)
if (DOXYGEN_FOUND)
# set input and output files
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in)
......@@ -175,4 +242,17 @@ else (DOXYGEN_FOUND)
message("Doxygen need to be installed to generate the doxygen documentation")
endif (DOXYGEN_FOUND)
#------------------------------------------------------------
# CPack
#------------------------------------------------------------
include(${CMAKE_CURRENT_SOURCE_DIR}/packaging/CPackConfig.cmake)
include(CPack)
#------------------------------------------------------------
# Tests
#------------------------------------------------------------
if(CAMEO_API_CPP_TESTS)
# Note: execute ctest --verbose to have more details
enable_testing()
add_subdirectory(tests)
endif(CAMEO_API_CPP_TESTS)
## Development
How to find the list of public headers and check that they are all in the include/ directory
1. move all the headers in src/
2. move cameo.h to include/
3. run the following command multiple times until there is no output
```
#!/bin/fish
set -l ORIG_DIR src
for f in (for file in include/*; grep include $file | grep '"'; end | sort | uniq | sed 's|.* "||;s|"||'); if [ -e $ORIG_DIR/$f ] ; echo $f; git mv $ORIG_DIR/$f include/; end; end
```
set(CPACK_PACKAGE_NAME cameo)
set (CPACK_PACKAGE_CHECKSUM MD5)
set (CPACK_COMPONENT_DEV_REQUIRED ON)
set (CPACK_COMPONENT_LIB_REQUIRED ON)
set (CPACK_COMPONENT_DEV_DEPENDS LIB )
set (CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON )
set (CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON )
set (CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY ">=" )
#set (CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS ON)
#set (DEBIAN_PACKAGE_BUILDS_DEPENDS "gcc (>=8), gcc-c++ (>=8), cmake (>=${CMAKE_MINIMUM_REQUIRED_VERSION})" )
set (CPACK_DEBIAN_LIB_PACKAGE_DEPENDS "cameo-server(>=1.0.2)" )
set(CPACK_DEBIAN_DEV_PACKAGE_NAME ${LIBNAME}-dev)
set(CPACK_DEBIAN_DEV_PACKAGE_NAME ${LIBNAME}-dev )
set(CPACK_DEBIAN_LIB_PACKAGE_NAME ${LIBNAME}-lib)
set(CPACK_DEBIAN_LIB_PACKAGE_NAME ${LIBNAME}-lib )
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 )
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 )
#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}")
# cpack_add_component(lib
# DISPLAY_NAME "LIBB"
# DESCRIPTION "runtime library"
# REQUIRED #[HIDDEN | REQUIRED | DISABLED ]
# GROUP LIBBB
# #DEPENDS
# #[INSTALL_TYPES type1 type2 ... ]
# #[DOWNLOADED]
# #[ARCHIVE_FILE filename]
# #[PLIST filename]
# )
# cpack_add_component(dev
# DISPLAY_NAME "DEVV"
# DESCRIPTION "library development"
# #REQUIRED #[HIDDEN | REQUIRED | DISABLED ]
# GROUP DEVVV
# DEPENDS lib
# #[INSTALL_TYPES type1 type2 ... ]
# #[DOWNLOADED]
# #[ARCHIVE_FILE filename]
# #[PLIST filename]
# )
include(CPackConfig.cmake)
set( CPACK_INSTALL_CMAKE_PROJECTS "build/;cameo-api-cpp;ALL;/")
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}")
# cameo-api-cpp
## Dependencies
- cmake 3.7.2
This library provides the C++ API for Cameo.
## Compilation dependencies
- cmake 3.12.0
- cppzmq
- rapidjson
- [rapidjson](https://github.com/Tencent/rapidjson)
If not found on the system it is automatically downloaded and installed
- doxygen (optional)
### CENTOS 8
For convenience, the packages for some major distributions are listed in the following:
List of packages:
- cmake
- cppzmq-devel
- rapidjson-devel
- CENTOS 8: `yum install -y cmake cppzmq-devel rapidjson-devel`
- Debian 10:
- Ubuntu : `sudo apt install cmake libzmq3-dev rapidjson-dev`
## How to compile and install
```
pkgs="cmake zeromq-devel rapidjson-devel"
yum install -y $pkgs
cmake -S . -B <build directory> -D<OPTION>
cmake --build <build directory>
```
Possible options are:
- CMAKE_INSTALL_PREFIX=<your_chosen_install_basepath>: to install in a non-standard directory
### Debian XXX
In order to install from source:
```
cmake --build <build directory> --target install
```
Debian packages can also be created by:
```
cpack -G DEB --config <build directory>/CPackConfig.cmake -B <build directory>/packaging
```
and be found in `<build directory>/packaging`
### Ubuntu XXX
```sudo apt install cmake libzmq3-dev rapidjson-dev```
Two packages are created:
- -lib: the runtime library for the user
- -dev: the development package with the public headers and cmake config files
## Compilation instructions
## Running tests
To compile also the with the test programs:
```
mkdir build/
cd build/
cmake ..
cmake --build .
cmake -S . -B build/ -DCAMEO_API_CPP_TESTS=ON ..
cmake --build build/
```
## Development
How to find the list of public headers and check that they are all in the include/ directory
1. move all the headers in src/
2. move cameo.h to include/
3. run the following command multiple times until there is no output
```
#!/bin/fish
set -l ORIG_DIR src
for f in (for file in include/*; grep include $file | grep '"'; end | sort | uniq | sed 's|.* "||;s|"||'); if [ -e $ORIG_DIR/$f ] ; echo $f; git mv $ORIG_DIR/$f include/; end; end
```
Developers can follow the instructions [here](doc/DEVEL.md)
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
find_dependency(ZeroMQ)
find_dependency (Threads)
if(NOT TARGET ${NAMESPACE}::${LIBNAME})
include(${CMAKE_CURRENT_LIST_DIR}/${PROJECT_NAME}-targets.cmake)
endif()
include(CMakeFindDependencyMacro)
find_dependency(ZeroMQ)
find_dependency (Threads)
include(${CMAKE_CURRENT_LIST_DIR}/cameo-api-cpp-static-targets.cmake)
......@@ -17,9 +17,9 @@
#ifndef CAMEO_H_
#define CAMEO_H_
#define CAMEO_API_VERSION_MAJOR 1
#define CAMEO_API_VERSION_MINOR 0
#define CAMEO_API_VERSION_REVISION 2
#define CAMEO_API_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
#define CAMEO_API_VERSION_MINOR @PROJECT_VERSION_MINOR@
#define CAMEO_API_VERSION_REVISION @PROJECT_VERSION_PATCH@
#include "Application.h"
#include "Server.h"
......
set(CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION ON)
set(CPACK_PACKAGE_CHECKSUM MD5)
set(CPACK_PACKAGE_CONTACT "Yannick Le Goc <legoc@ill.fr>")
set(CPACK_PACKAGE_VENDOR "ILL")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Cameo C++ API")
set(CPACK_GENERATOR "DEB")
# #set(CPACK_PACKAGE_DESCRIPTION_FILE "/home/andy/vtk/CMake/Copyright.txt")
set(CPACK_PACKAGE_DESCRIPTION "Long description")
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)
set(CPACK_DEB_COMPONENT_INSTALL TRUE)
set(CPACK_RPM_COMPONENT_INSTALL TRUE)
set(CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS ON)
set(CPACK_COMPONENT_${component_runtime}_REQUIRED ON)
set(CPACK_COMPONENT_${component_development}_REQUIRED OFF)
set(CPACK_COMPONENT_${component_development}_DEPENDS ${component_runtime} )
set(CPACK_COMPONENT_${component_runtime}_DEPENDS "" )
set(CPACK_COMPONENT_${component_runtime}_DESCRIPTION "Shared library of the C++ API")
set(CPACK_COMPONENT_${component_development}_DESCRIPTION "Headers and development files for the C++ API")
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON )
set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY ">=")
set(CPACK_DEBIAN_${component_runtime}_PACKAGE_DEPENDS "cameo-server(>=1.0.2)")
set(CPACK_DEBIAN_${component_development}_PACKAGE_DEPENDS "")
set(CPACK_DEBIAN_${component_runtime}_PACKAGE_NAME ${LIBNAME}-lib)
set(CPACK_DEBIAN_${component_development}_PACKAGE_NAME ${LIBNAME}-dev)
set(CPACK_DEBIAN_${component_development}_PACKAGE_SECTION "libdevel")
# #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}")<