Commit e57995bc authored by Sylvain Fargier's avatar Sylvain Fargier 🐾
Browse files

Merge branch 'wip-cmake' into 'master'

cmake

See merge request apc/experiments/ntof/addh!5
parents ad3f078f 5c7e0a7f
Pipeline #1929179 passed with stages
in 8 minutes and 40 seconds
[submodule "deps/dim"]
path = deps/dim
url = https://:@gitlab.cern.ch:8443/apc/common/dim.git
branch = master
[submodule "deps/ntofutils"]
path = deps/ntofutils
url = https://:@gitlab.cern.ch:8443/apc/experiments/ntof/ntofutils.git
branch = master
......@@ -3,8 +3,7 @@ include(xProject)
include(Cern)
xProject_Add(DIM
GIT_REPOSITORY "${CERN_GITLAB}/apc/common/dim.git"
GIT_TAG "master"
GIT_SUBMODULE
CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=
-DJDIM=OFF
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
......@@ -12,3 +11,5 @@ xProject_Add(DIM
INSTALL_COMMAND $(MAKE) install "DESTDIR=${CMAKE_BINARY_DIR}/instroot"
LIBRARIES "${CMAKE_BINARY_DIR}/instroot/${CMAKE_INSTALL_LIBDIR}/libdim.a"
INCLUDE_DIRS "${CMAKE_BINARY_DIR}/instroot/${CMAKE_INSTALL_INCLUDEDIR}/dim")
list(APPEND DIM_LIBRARIES "pthread")
......@@ -7,8 +7,7 @@ set(cache_file ${CMAKE_BINARY_DIR}/xProjectCache.cmake)
create_initial_cache(${cache_file})
xProject_Add(NTOFUTILS
GIT_REPOSITORY "${CERN_GITLAB}/apc/experiments/ntof/ntofutils.git"
GIT_TAG "master"
GIT_SUBMODULE
CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=
-DEXT_CACHE:path=${CMAKE_BINARY_DIR}
-DEXTERNAL_DEPENDENCIES=ON -C ${cache_file}
......
......@@ -7,8 +7,15 @@ include(ExtCache)
set_directory_properties(PROPERTIES
EP_BASE "${CMAKE_BINARY_DIR}/external")
if(NOT GIT_EXE)
find_package(Git)
if(GIT_FOUND)
set(GIT_EXE ${GIT_EXECUTABLE})
endif(GIT_FOUND)
endif(NOT GIT_EXE)
function(xExternalProject_Add TARGET)
cmake_parse_arguments(P "NOPREFETCH;AUTO_UPDATE" "GIT_REPOSITORY;GIT_TAG;LIBDIR" "INCLUDE_DIRS;LIBRARIES" ${ARGN})
cmake_parse_arguments(P "NOPREFETCH;AUTO_UPDATE;GIT_SUBMODULE" "GIT_REPOSITORY;GIT_TAG;LIBDIR" "INCLUDE_DIRS;LIBRARIES" ${ARGN})
string(TOLOWER "${TARGET}" TARGET_LOW)
if(${TARGET}_GIT_REPOSITORY)
......@@ -28,15 +35,24 @@ function(xExternalProject_Add TARGET)
endif(NOT P_LIBDIR)
if(NOT "${TARGET}_SRC_DIR")
if(P_GIT_REPOSITORY)
set(P_ARG
GIT_REPOSITORY "${P_GIT_REPOSITORY}"
GIT_TAG "${P_GIT_TAG}")
endif(P_GIT_REPOSITORY)
if(P_GIT_REPOSITORY)
set(P_ARG
GIT_REPOSITORY "${P_GIT_REPOSITORY}"
GIT_TAG "${P_GIT_TAG}")
endif()
set(${TARGET}_SRC_DIR "${CMAKE_SOURCE_DIR}/deps/${TARGET_LOW}")
else(NOT "${TARGET}_SRC_DIR")
else()
message(STATUS "Using ${TARGET} source dir: ${${TARGET}_SRC_DIR}")
endif(NOT "${TARGET}_SRC_DIR")
endif()
# Git submodule support
if(P_GIT_SUBMODULE AND NOT P_NOPREFETCH)
if(NOT EXISTS "${${TARGET}_SRC_DIR}/.git")
message("Initializing git submodules")
execute_process(COMMAND ${GIT_EXE} "submodule" "update" "--init"
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
endif()
endif()
ExternalProject_Add(${TARGET}
${P_ARG}
......@@ -78,7 +94,7 @@ function(xExternalProject_Add TARGET)
set(${TARGET}_LIBRARIES "${P_LIBRARIES}" CACHE PATH "" FORCE)
set(${TARGET}_LIBDIR "${P_LIBDIR}" CACHE PATH "" FORCE)
if(NOT P_NOPREFETCH)
if(NOT P_NOPREFETCH AND NOT P_GIT_SUBMODULE)
get_property(stamp TARGET ${TARGET} PROPERTY _EP_STAMP_DIR)
get_property(command TARGET ${TARGET} PROPERTY _EP_download_COMMAND)
message(STATUS "Prefetching ${TARGET}")
......@@ -86,7 +102,7 @@ function(xExternalProject_Add TARGET)
# Handling multi-commands
set(P_SUB "")
foreach(PART ${command})
if (PART STREQUAL "COMMAND")
if(PART STREQUAL "COMMAND")
execute_process(COMMAND ${P_SUB})
set(P_SUB "")
else()
......@@ -106,8 +122,10 @@ function(xProject_register TARGET)
add_custom_target(xProject-download)
endif(NOT TARGET xProject-download)
get_property(command TARGET ${TARGET} PROPERTY _EP_download_COMMAND)
add_custom_command(TARGET xProject-download
COMMAND ${command})
if(command)
add_custom_command(TARGET xProject-download
COMMAND ${command})
endif()
if(NOT TARGET xProject-update)
add_custom_target(xProject-update)
......
dim @ 6b3ff895
Subproject commit 6b3ff8959dec7e122b76f8e4a9015b275244f993
ntofutils @ a0a58473
Subproject commit a0a58473d7c7c43a351a74c2982336fde650003b
......@@ -26,8 +26,8 @@ template class ntof::utils::Singleton<ntof::addh::Config>;
namespace ntof {
namespace addh {
const std::string Config::configFile = "/root/config/nTOF_ADDH.xml";
const std::string Config::configMiscFile = "/root/config/misc.xml";
const std::string Config::configFile = "/etc/ntof/nTOF_ADDH.xml";
const std::string Config::configMiscFile = "/etc/ntof/misc.xml";
Config::Config(const std::string &file, const std::string &miscFile) :
ConfigMisc(miscFile)
......
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