Commit 1865deb2 authored by Simon Spannagel's avatar Simon Spannagel
Browse files

Add possibility for binary releases

parent 4113a094
......@@ -27,6 +27,9 @@ PROJECT(Corryvreckan VERSION ${SIMPLE_VERSION} LANGUAGES NONE)
# Access the project name (for install locations) in the source
ADD_DEFINITIONS(-DCORRYVRECKAN_PROJECT_NAME="${CMAKE_PROJECT_NAME}" -DCORRYVRECKAN_PROJECT_VERSION="${CORRYVRECKAN_VERSION}")
INCLUDE(cmake/CPackConfig.cmake)
INCLUDE(CPack)
###############################################
# Setup the environment for the documentation #
###############################################
......@@ -118,6 +121,8 @@ ENDIF()
SET(CORRYVRECKAN_DEPS_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS})
SET(CORRYVRECKAN_DEPS_LIBRARIES ${ROOT_LIBRARIES} ${ROOT_COMPONENT_LIBRARIES})
# Add "thisroot.sh" as runtime dependency for setup.sh file:
ADD_RUNTIME_DEP(thisroot.sh)
###################################
# Load cpp format and check tools #
......@@ -150,3 +155,24 @@ ADD_SUBDIRECTORY(src/modules)
# Build the executable
ADD_SUBDIRECTORY(src/exec)
#############################
# Create a local setup file #
#############################
# Add compiler if necessary:
GET_FILENAME_COMPONENT(CMP_PATH ${CMAKE_CXX_COMPILER} DIRECTORY)
GET_FILENAME_COMPONENT(PARENT_PATH ${CMP_PATH} DIRECTORY)
IF(EXISTS ${PARENT_PATH}/setup.sh)
LIST(APPEND CORRY_RUNTIME_DEPS "${PARENT_PATH}/setup.sh")
ENDIF()
# Build configuration string with commands
FOREACH(dep ${CORRY_RUNTIME_DEPS})
SET(SETUP_FILE_DEPS "${SETUP_FILE_DEPS}source ${dep}\n")
ENDFOREACH()
FOREACH(dep ${CORRY_RUNTIME_LIBS})
SET(SETUP_FILE_DEPS "${SETUP_FILE_DEPS}export LD_LIBRARY_PATH=\"${dep}:$LD_LIBRARY_PATH\"\n")
ENDFOREACH()
# Create setup file
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/cmake/setup.cmake.sh" "${CMAKE_CURRENT_BINARY_DIR}/setup/setup.sh" @ONLY)
# Packaging configuration
SET(CPACK_PACKAGE_NAME "corryvreckan")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The Maelstrom for Your Test Beam Data")
SET(CPACK_PACKAGE_VENDOR "The Corryvreckan Authors")
SET(CPACK_PACKAGE_CONTACT "The Corryvreckan Authors <corryvreckan.info@cern.ch>")
SET(CPACK_PACKAGE_ICON "doc/logo_small.png")
SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE.md")
# Figure out, which system we are running on:
IF(DEFINED ENV{BUILD_FLAVOUR})
SET(CPACK_SYSTEM_NAME $ENV{BUILD_FLAVOUR})
ELSE()
SET(CPACK_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}")
ENDIF()
# Set version dervied from project version, or "latest" for untagged:
IF(NOT TAG_FOUND)
SET(CPACK_PACKAGE_VERSION "latest")
ELSE()
SET(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
ENDIF()
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}")
# Configure the targets and components to include
SET(CPACK_GENERATOR "TGZ")
SET(CPACK_COMPONENTS_ALL application modules)
SET(CPACK_INSTALLED_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/setup/;.")
Corryvreckan_version="@CORRYVRECKAN_VERSION@"
# Dependencies
@SETUP_FILE_DEPS@
THIS_BASH=$BASH
if [[ $THIS_BASH == "" ]]; then
THIS_HERE=$(dirname $0)
else
THIS_HERE=$(dirname ${BASH_SOURCE[0]})
fi
CLIC_Corryvreckan_home=$THIS_HERE
# Export path for executable, library path and data path for detector models
export PATH=${CLIC_Corryvreckan_home}/bin:${PATH}
export LD_LIBRARY_PATH=${CLIC_Corryvreckan_home}/lib:${LD_LIBRARY_PATH}
export XDG_DATA_DIRS=${CLIC_Corryvreckan_home}/share:${XDG_DATA_DIRS}
......@@ -30,3 +30,19 @@ FUNCTION(get_version PROJECT_VERSION)
# Set the project version in the parent scope
SET(${PROJECT_VERSION} ${${PROJECT_VERSION}} PARENT_SCOPE)
ENDFUNCTION()
FUNCTION(add_runtime_dep RUNTIME_NAME)
GET_FILENAME_COMPONENT(THISPROG ${RUNTIME_NAME} PROGRAM)
LIST(APPEND CORRY_RUNTIME_DEPS ${THISPROG})
LIST(REMOVE_DUPLICATES CORRY_RUNTIME_DEPS)
SET(CORRY_RUNTIME_DEPS ${CORRY_RUNTIME_DEPS} CACHE INTERNAL "CORRY_RUNTIME_DEPS")
ENDFUNCTION()
FUNCTION(add_runtime_lib RUNTIME_NAME)
FOREACH(name ${RUNTIME_NAME})
GET_FILENAME_COMPONENT(THISLIB ${name} DIRECTORY)
LIST(APPEND CORRY_RUNTIME_LIBS ${THISLIB})
LIST(REMOVE_DUPLICATES CORRY_RUNTIME_LIBS)
SET(CORRY_RUNTIME_LIBS ${CORRY_RUNTIME_LIBS} CACHE INTERNAL "CORRY_RUNTIME_LIBS")
ENDFOREACH()
ENDFUNCTION()
Supports Markdown
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