IAP GITLAB

Commit 62097ee9 authored by Ralf Ulrich's avatar Ralf Ulrich Committed by Ralf Ulrich

better structure of install area

parent 5e0fc35f
......@@ -49,7 +49,7 @@ endif ()
# cmake path dir, and cmake config
#
set (CORSIKA8_CMAKE_DIR "${PROJECT_SOURCE_DIR}/cmake")
set (CMAKE_MODULE_PATH "${CORSIKA8_CMAKE_DIR}" ${CMAKE_MODULE_PATH})
set (CMAKE_MODULE_PATH "${CORSIKA8_CMAKE_DIR}" ${CMAKE_MODULE_PATH})
include (CorsikaUtilities) # extra cmake function
set (CMAKE_VERBOSE_MAKEFILE OFF) # this can be done with `make VERBOSE=1`
# ignore many irrelevant Up-to-date messages during install
......@@ -285,7 +285,7 @@ install (
install (DIRECTORY corsika DESTINATION include)
write_basic_package_version_file (
${PROJECT_BINARY_DIR}/CORSIKA8ConfigVersion.cmake
${PROJECT_BINARY_DIR}/corsikaConfigVersion.cmake
VERSION ${c8_version}
COMPATIBILITY SameMajorVersion
)
......@@ -293,50 +293,52 @@ write_basic_package_version_file (
# export targets in build tree
export (
EXPORT CORSIKA8PublicTargets
FILE "${CMAKE_CURRENT_BINARY_DIR}/CORSIKA8Targets.cmake"
FILE "${CMAKE_CURRENT_BINARY_DIR}/corsikaTargets.cmake"
NAMESPACE CORSIKA8::
)
# export targets in install tree
install (
EXPORT CORSIKA8PublicTargets
FILE CORSIKA8Targets.cmake
FILE corsikaTargets.cmake
NAMESPACE CORSIKA8::
DESTINATION lib/cmake/CORSIKA8
DESTINATION lib/cmake/corsika
)
# config for build tree
configure_package_config_file (
cmake/CORSIKA8Config.cmake.in
${PROJECT_BINARY_DIR}/CORSIKA8Config.cmake
cmake/corsikaConfig.cmake.in
${PROJECT_BINARY_DIR}/corsikaConfig.cmake
INSTALL_DESTINATION ${CMAKE_BINARY_DIR}/do_not_need_this
)
# config for install tree
set (Pythia8_PREFIX ${Pythia8_PREFIX_INSTALL}) # overwrite with install location
# overwrite with install location (if it was build as part of corsika)
set (Pythia8_INCDIR ${Pythia8_INCDIR_INSTALL})
set (Pythia8_LIBDIR ${Pythia8_LIBDIR_INSTALL})
configure_package_config_file (
cmake/CORSIKA8Config.cmake.in
${PROJECT_BINARY_DIR}/cmake/CORSIKA8Config.cmake
cmake/corsikaConfig.cmake.in
${PROJECT_BINARY_DIR}/cmake/corsikaConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}
)
install (FILES
${CMAKE_BINARY_DIR}/conanbuildinfo.cmake
${CMAKE_BINARY_DIR}/conaninfo.txt
${CMAKE_BINARY_DIR}/CORSIKA8Config.cmake
${CMAKE_BINARY_DIR}/CORSIKA8ConfigVersion.cmake
DESTINATION lib/cmake/CORSIKA8
${CMAKE_BINARY_DIR}/corsikaConfig.cmake
${CMAKE_BINARY_DIR}/corsikaConfigVersion.cmake
DESTINATION lib/cmake/corsika
)
#
# examples
#
install (DIRECTORY examples DESTINATION share/)
install (DIRECTORY examples DESTINATION share/corsika)
#
# tools
#
install (DIRECTORY tools DESTINATION share/)
install (DIRECTORY tools DESTINATION share/corsika)
......
......@@ -24,9 +24,9 @@ conan_basic_setup (TARGETS)
add_library (C8::ext::pythia8 STATIC IMPORTED GLOBAL)
set_target_properties (
C8::ext::pythia8 PROPERTIES
IMPORTED_LOCATION @Pythia8_PREFIX@/lib/libpythia8.a
IMPORTED_LOCATION @Pythia8_LIBDIR@/libpythia8.a
IMPORTED_LINK_INTERFACE_LIBRARIES dl
INTERFACE_INCLUDE_DIRECTORIES @Pythia8_PREFIX@/include
INTERFACE_INCLUDE_DIRECTORIES @Pythia8_INCDIR@
)
set (Pythia8_FOUND @Pythia8_FOUND@)
message (STATUS "Pythia8 at: @Pythia8_PREFIX@")
......@@ -35,5 +35,5 @@ message (STATUS "Pythia8 at: @Pythia8_PREFIX@")
#++++++++++++++++++++++++++++++
# import CORSIKA8
#
include ("${CMAKE_CURRENT_LIST_DIR}/CORSIKA8Targets.cmake")
check_required_components (CORSIKA8)
include ("${CMAKE_CURRENT_LIST_DIR}/corsikaTargets.cmake")
check_required_components (corsika)
......@@ -4,7 +4,7 @@ project (CORSIKA8_examples)
set (CMAKE_VERBOSE_MAKEFILE OFF) # this can be changed with `make VERBOSE=1`
# this is enough to use CORSIKA8
find_package (CORSIKA8 CONFIG REQUIRED)
find_package (corsika CONFIG REQUIRED)
# this is only for CORSIKA_REGISTER_EXAMPLE
include ("${CMAKE_CURRENT_SOURCE_DIR}/CMakeHelper.cmake")
......
......@@ -21,18 +21,18 @@ target_include_directories (
cnpy
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:external/cnpy/include>
$<INSTALL_INTERFACE:corsika_external/cnpy/include>
)
install (
FILES cnpy.hpp
DESTINATION external/cnpy/include
DESTINATION corsika_external/cnpy/include
)
install (
TARGETS cnpy
EXPORT CORSIKA8PublicTargets
LIBRARY DESTINATION external/cnpy/lib
ARCHIVE DESTINATION external/cnpy/lib
LIBRARY DESTINATION corsika_external/cnpy/lib
ARCHIVE DESTINATION corsika_external/cnpy/lib
)
cmake_minimum_required(VERSION 3.8)
if(CMAKE_PROJECT_NAME STREQUAL corsika)
message(STATUS "Including PROPOSAL as part of CORSIKA8")
set (IN_CORSIKA8 ON)
else(CMAKE_PROJECT_NAME STREQUAL corsika)
set (IN_CORSIKA8 OFF)
cmake_minimum_required(VERSION 3.8)
project(PROPOSAL VERSION 6.1.2 LANGUAGES CXX)
endif(CMAKE_PROJECT_NAME STREQUAL corsika)
project(PROPOSAL VERSION 6.1.2 LANGUAGES CXX)
......@@ -74,8 +75,8 @@ else (NOT IN_CORSIKA8)
install(
TARGETS PROPOSAL
EXPORT CORSIKA8PublicTargets
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib/corsika
ARCHIVE DESTINATION lib/corsika
)
endif (NOT IN_CORSIKA8)
......@@ -97,12 +98,12 @@ target_include_directories(
else (NOT IN_CORSIKA8)
install(
FILES ${PROJECT_BINARY_DIR}/include/PROPOSAL/version.h
DESTINATION include/PROPOSAL
DESTINATION include/corsika_modules/PROPOSAL
)
target_include_directories(
PROPOSAL PUBLIC
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include/>
$<INSTALL_INTERFACE:include/corsika_modules>
)
endif (NOT IN_CORSIKA8)
......@@ -118,7 +119,7 @@ else (NOT IN_CORSIKA8)
foreach(INC_FILE ${INC_FILES})
file(RELATIVE_PATH REL_FILE ${PROJECT_SOURCE_DIR}/include/ ${INC_FILE})
get_filename_component(DIR ${REL_FILE} DIRECTORY)
install(FILES include/${REL_FILE} DESTINATION include/${DIR})
install(FILES include/${REL_FILE} DESTINATION include/corsika_modules/${DIR})
endforeach()
endif (NOT IN_CORSIKA8)
......
......@@ -38,8 +38,13 @@ if ("x_${USE_Pythia8_C8}" STREQUAL "x_SYSTEM")
set (CORSIKA_Pythia8_LOCATION ${Pythia8_PREFIX}) # build and install location, pythia8 is external
configure_file (Pythia8ConfigurationDirectory.hpp.in ${CORSIKA_Pythia8_MODULE_DIR}/Pythia8ConfigurationDirectory.hpp @ONLY)
configure_file (Pythia8ConfigurationDirectory.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/Pythia8ConfigurationDirectory_install.hpp @ONLY)
set (Pythia8_PREFIX_INSTALL ${Pythia8_PREFIX}) # install and build are both the same here
# install and build are both the same here since it is external
set (Pythia8_PREFIX_INSTALL ${Pythia8_PREFIX})
set (Pythia8_LIBDIR ${Pythia8_LIBRARY})
set (Pythia8_LIBDIR_INSTALL ${Pythia8_LIBRARY})
set (Pythia8_INCDIR ${Pythia8_INCLUDE_DIR})
set (Pythia8_INCDIR_INSTALL ${Pythia8_INCLUDE_DIR})
message (STATUS "Pythia8 (system) at ${Pythia8_PREFIX}")
......@@ -48,46 +53,55 @@ else ()
set (_C8_Pythia8_VERSION "8245")
message (STATUS "Building modules/pythia8 using pythia${_C8_Pythia8_VERSION}-stripped.tar.bz2")
message (STATUS "This will take a bit.....")
# this is not a full Pythia8 install, it is a bit simplified, e.g. no pythia8-config
# this is not a full Pythia8 install, it is a bit simplified, e.g. no pythia8-config, no examples
# and also, it is fitted into the normal CORSIKA8 install "include/corsika_modules/Pythia8, lib/corsika"
ExternalProject_Add (pythia8
URL ${CMAKE_CURRENT_SOURCE_DIR}/pythia${_C8_Pythia8_VERSION}-stripped.tar.bz2
URL_MD5 d3e951a2f101e8cfec26405cb61db83b
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/pythia8/source"
INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/pythia8/install"
CONFIGURE_COMMAND ./configure --cxx-common=\\"${CMAKE_CXX_FLAGS} -O2 -fPIC\\" --prefix=${CMAKE_CURRENT_BINARY_DIR}/pythia8/install
INSTALL_COMMAND make install COMMAND rm -rf ${CMAKE_CURRENT_BINARY_DIR}/pythia8/install/bin ${CMAKE_CURRENT_BINARY_DIR}/pythia8/install/share/Pythia8/examples
INSTALL_COMMAND make install
COMMAND rm -rf ${CMAKE_CURRENT_BINARY_DIR}/pythia8/install/bin
COMMAND rm -rf ${CMAKE_CURRENT_BINARY_DIR}/pythia8/install/share/Pythia8/examples
COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/pythia8/install/include/corsika_modules
COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/pythia8/install/lib/corsika
COMMAND rm -rf ${CMAKE_CURRENT_BINARY_DIR}/pythia8/install/include/corsika_modules/Pythia8
COMMAND mv -f ${CMAKE_CURRENT_BINARY_DIR}/pythia8/install/include/Pythia8 ${CMAKE_CURRENT_BINARY_DIR}/pythia8/install/include/corsika_modules/
COMMAND mv ${CMAKE_CURRENT_BINARY_DIR}/pythia8/install/lib/libpythia8.a ${CMAKE_CURRENT_BINARY_DIR}/pythia8/install/lib/corsika/
BUILD_IN_SOURCE ON
EXCLUDE_FROM_ALL TRUE
)
)
set (Pythia8_FOUND 1 PARENT_SCOPE)
set (Pythia8_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/externals/pythia8)
set (Pythia8_PREFIX_INSTALL ${Pythia8_INSTALL_DIR})
set (Pythia8_PREFIX_INSTALL ${CMAKE_INSTALL_PREFIX}) # this is "make install"
ExternalProject_Get_Property (pythia8 INSTALL_DIR) # this is "make"
set (Pythia8_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/externals/pythia8) # this is "make install"
set (Pythia8_VERSION ${_C8_Pythia8_VERSION} CACHE STRING "Version of Pythia8")
set (Pythia8_PREFIX ${INSTALL_DIR})
set (Pythia8_INCLUDE_DIR ${Pythia8_PREFIX}/include)
set (Pythia8_LIBRARY ${Pythia8_PREFIX}/lib)
set (Pythia8_INCLUDE_DIR ${Pythia8_PREFIX}/include/corsika_modules)
set (Pythia8_LIBDIR ${Pythia8_PREFIX}/lib/corsika)
set (Pythia8_LIBDIR_INSTALL ${Pythia8_PREFIX_INSTALL}/lib/corsika)
set (Pythia8_INCDIR ${Pythia8_PREFIX}/include/corsika_modules)
set (Pythia8_INCDIR_INSTALL ${Pythia8_PREFIX_INSTALL}/include/corsika_modules)
add_dependencies (C8::ext::pythia8 pythia8)
set (CORSIKA_Pythia8_LOCATION ${Pythia8_PREFIX}) # build location
configure_file (Pythia8ConfigurationDirectory.hpp.in ${CORSIKA_Pythia8_MODULE_DIR}/Pythia8ConfigurationDirectory.hpp @ONLY)
set (CORSIKA_Pythia8_LOCATION ${Pythia8_INSTALL_DIR}) # install location
set (CORSIKA_Pythia8_LOCATION ${Pythia8_PREFIX_INSTALL}) # install location
configure_file (Pythia8ConfigurationDirectory.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/Pythia8ConfigurationDirectory_install.hpp @ONLY)
install (DIRECTORY ${INSTALL_DIR}/ DESTINATION ${Pythia8_INSTALL_DIR})
install (DIRECTORY ${Pythia8_PREFIX}/ DESTINATION ${Pythia8_PREFIX_INSTALL})
set (Pythia8_INCLUDE_DIRS ${Pythia8_INCLUDE_DIR})
set_target_properties (
C8::ext::pythia8
PROPERTIES
IMPORTED_LOCATION ${Pythia8_LIBRARY}/libpythia8.a
IMPORTED_LOCATION ${Pythia8_LIBDIR}/libpythia8.a
IMPORTED_LINK_INTERFACE_LIBRARIES dl
INTERFACE_INCLUDE_DIRECTORIES "${Pythia8_INCLUDE_DIRS}"
)
message (STATUS "Pythia8 build at: ${INSTALL_DIR}, final install to: ${Pythia8_INSTALL_DIR}, include dirs: ${Pythia8_INCLUDE_DIRS}")
message (STATUS "Pythia8 build at: ${Pythia8_PREFIX}, final install to: ${Pythia8_PREFIX_INSTALL}")
endif ()
# the install location of Pythia8
......@@ -103,5 +117,7 @@ target_link_libraries (CORSIKA8 INTERFACE C8::ext::pythia8)
# we need those for exporting targets and dependencies:
set (Pythia8_FOUND 1 PARENT_SCOPE)
set (Pythia8_PREFIX ${Pythia8_PREFIX} PARENT_SCOPE)
set (Pythia8_PREFIX_INSTALL ${Pythia8_PREFIX_INSTALL} PARENT_SCOPE)
set (Pythia8_INCDIR ${Pythia8_INCDIR} PARENT_SCOPE)
set (Pythia8_INCDIR_INSTALL ${Pythia8_INCDIR_INSTALL} PARENT_SCOPE)
set (Pythia8_LIBDIR ${Pythia8_LIBDIR} PARENT_SCOPE)
set (Pythia8_LIBDIR_INSTALL ${Pythia8_LIBDIR_INSTALL} PARENT_SCOPE)
cmake_minimum_required (VERSION 3.1)
project (libQGSJetII)
set (
MODEL_SOURCES
qgsjet-II-04-mod1.f
......@@ -25,7 +21,7 @@ target_include_directories (
QGSJetII
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include/qgsjetII>
$<INSTALL_INTERFACE:include/corsika_modules/qgsjetII>
)
target_link_libraries (QGSJetII CorsikaData)
......@@ -40,26 +36,26 @@ target_include_directories (
QGSJetII_static
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include/qgsjetII>
$<INSTALL_INTERFACE:include/corsika_modules/qgsjetII>
)
target_link_libraries (QGSJetII_static CorsikaData)
install (
FILES
${MODEL_HEADERS}
DESTINATION include/qgsjetII
DESTINATION include/corsika_modules/qgsjetII
)
install (
TARGETS QGSJetII
EXPORT CORSIKA8PublicTargets
DESTINATION lib
DESTINATION lib/corsika
)
install (
TARGETS QGSJetII_static
EXPORT CORSIKA8PublicTargets
DESTINATION lib
DESTINATION lib/corsika
)
# add qgsjetII to corsika8 build
......
......@@ -33,14 +33,14 @@ target_include_directories (
Sibyll
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include/sibyll>
$<INSTALL_INTERFACE:include/corsika_modules/sibyll>
)
target_include_directories (
Sibyll_static
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include/sibyll>
$<INSTALL_INTERFACE:include/corsika_modules/sibyll>
)
target_link_libraries (
......@@ -52,19 +52,19 @@ target_link_libraries (
install (
FILES
${MODEL_HEADERS}
DESTINATION include/sibyll
DESTINATION include/corsika_modules/sibyll
)
install (
TARGETS Sibyll
EXPORT CORSIKA8PublicTargets
LIBRARY DESTINATION lib
LIBRARY DESTINATION lib/corsika
)
install (
TARGETS Sibyll_static
EXPORT CORSIKA8PublicTargets
ARCHIVE DESTINATION lib
ARCHIVE DESTINATION lib/corsika
)
# add sibyll to corsika8 build
......
......@@ -47,7 +47,7 @@ enable_language (Fortran)
add_library (UrQMD SHARED ${MODEL_SOURCES})
target_include_directories (UrQMD PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include/urqmd>
$<INSTALL_INTERFACE:include/corsika_modules/urqmd>
)
set_target_properties (
UrQMD
......@@ -58,7 +58,7 @@ set_target_properties (
add_library (UrQMD_static STATIC ${MODEL_SOURCES})
target_include_directories (UrQMD_static PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include/urqmd>
$<INSTALL_INTERFACE:include/corsika_modules/urqmd>
)
set_target_properties (
UrQMD_static
......@@ -69,23 +69,21 @@ set_target_properties (
install (
FILES
${MODEL_HEADERS}
DESTINATION include/urqmd
DESTINATION include/corsika_modules/urqmd
)
install (
TARGETS UrQMD
EXPORT CORSIKA8PublicTargets
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
INCLUDES DESTINATION include/urqmd
LIBRARY DESTINATION lib/corsika
INCLUDES DESTINATION include/corsika_modules/urqmd
)
install (
TARGETS UrQMD_static
EXPORT CORSIKA8PublicTargets
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
INCLUDES DESTINATION include/urqmd
ARCHIVE DESTINATION lib/corsika
INCLUDES DESTINATION include/corsika_modules/urqmd
)
# add UrQMD to CORSIKA8 build
......
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