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 817a94bf authored by Shervin Nourbakhsh's avatar Shervin Nourbakhsh
Browse files

CMake installation of cameo-server + cameo-console + c++ and python api (optional)

parent f8a042c7
cmake_minimum_required(VERSION 3.12.0)
project(cameo
VERSION 1.0.2
LANGUAGES C
HOMEPAGE_URL "https://code.ill.fr/cameo/cameo"
)
option(CAMEO_API_CPP "Compile and install cameo C++ api" OFF)
option(CAMEO_API_PYTHON "Compile and install cameo Python api" OFF)
if(${CAMEO_API_CPP})
list(APPEND APIs cameo-api-cpp)
endif()
if(${CAMEO_API_PYTHON})
list(APPEND APIs cameo-api-cpp)
mark_as_advanced(CAMEO_API_CPP)
list(APPEND APIs cameo-api-python)
endif()
#------------------------------------------------------------
# This is a trick: for the subprojects metioned here,
# the find_package does nothing, since the targets will be defined
# by the add_subdirectory command
set(as_subproject cameo-api-cpp-static)
macro(find_package)
if(NOT "${ARGV0}" IN_LIST as_subproject)
_find_package(${ARGV})
endif()
endmacro()
#dependencies
foreach(package cameo-com-jzmq )
add_subdirectory(cameo-com/${package})
endforeach()
foreach(package cameo-server-jzmq cameo-console-jzmq
${APIs})
add_subdirectory(${package})
endforeach()
# common CPack configuration
#include(${CMAKE_SOURCE_DIR}/CPackConfigCommon.in)
#set(CPACK_PROJECT_CONFIG_FILE ${CMAKE_CURRENT_SOURCE_DIR}/packaging/CPackConfig.cmake)
#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")
#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)
......@@ -2,34 +2,41 @@
## Dependencies
- maven
- java (>=9)
### 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
```
Compile the Java sources:
### Option1: maven+cmake
Compile:
```
cd cameo
mvn clean install
cd cameo/
cmake -S . -B build/ -D<OPTION>
cmake --build build/
```
Install the jzmq version of the cameo-server:
Possible options are:
- CMAKE_INSTALL_PREFIX=<your_chosen_install_basepath>: to install in a non-standard directory
- CAMEO_API_CPP=ON: to build and install the C++ API
- CAMEO_API_PYTHON=ON: to build and install the Python API
Install:
```
install.sh 1.0.1
sudo cmake --build . --target install
```
Compile and install the C++ API sources into a temporary directory e.g. */tmp/cameo-install* :
### Option2: cmake + cpack = DEB package
It is also possible to build and create Debian packages. In this case, please use the build_and_package.sh script.
```
cd cameo-api-cpp
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX:PATH=/tmp/cameo-install ..
cmake --build . --target install
./build_and_package.sh <build_directory>
```
Get the include and so files from the temporary directory.
The script provides the following .deb packages located in <build_directory>/packages/
They can be installed using package manager.
......@@ -3,12 +3,17 @@ Please go to the [Wiki](https://code.ill.fr/cameo/cameo-commons/wikis/home).
# Running Dependencies
## Centos
## Centos 8
- YUM EPEL8 repository
- JAVA 9
```
yum install -y --enablerepo=epel java-latest-openjdk-devel java-latest-openjdk-headless java-latest-openjdk
```
Instructions about installation and compilation can be found [here](INSTALL.md)
## Ubuntu bionic
## Debian
Instructions about compilation and installation can be found in [INSTALL.md](INSTALL.md)
# cameo-api-cpp
- Fix symbol visibility with macros exported by CMake
#!/bin/bash
BASE_BUILD_DIR=${1:-/dev/shm/cameo/}
packages_dir=${BASE_BUILD_DIR}/packages
mkdir ${packages_dir} -p
#mvn install
function mvPack(){
mv ${build_dir}/packaging/*.deb ${packages_dir}/
}
#--------------- JAVA
for source_dir in cameo-server-jzmq cameo-console-jzmq
do
build_dir=$BASE_BUILD_DIR/$source_dir
cmake -S $source_dir -B $build_dir/ || exit 1
cmake --build $build_dir || exit 1
cpack --config $build_dir/CPackConfig.cmake -B $build_dir/packaging/ || exit 2
mvPack
done
#--------------- API
#---------- C++
cmake -S cameo-api-cpp -B $BASE_BUILD_DIR/cameo-api-cpp/
cmake --build $BASE_BUILD_DIR/cameo-api-cpp/
cpack --config $BASE_BUILD_DIR/cameo-api-cpp/CPackConfig.cmake -B $BASE_BUILD_DIR/cameo-api-cpp/packaging
mvPack
#---------- Python
build_dir=$BASE_BUILD_DIR/cameo-api-python/
cmake -S cameo-api-python -B $build_dir -DCMAKE_PREFIX_PATH=$BASE_BUILD_DIR/cameo-api-cpp/ || exit 1
cmake --build $build_dir || exit 1
cpack --config $build_dir/CPackConfig.cmake -B $build_dir/packaging/ || exit 1
mvPack
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