From 53bdb3e416f072b8816cd67c7de0e19e41715fb5 2017-12-04 17:36:08 From: mperrinel Date: 2017-12-04 17:36:08 Subject: [PATCH] Add CatalogueAPI external project with SciQLop cmake configuration --- diff --git a/CMakeLists.txt b/CMakeLists.txt index ab325b8..52bef36 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,13 @@ cmake_policy(VERSION 3.6) PROJECT(SCIQLOP) + +# +# build the CatalogueAPI dependencu +# +INCLUDE("extern/CatalogueAPI.cmake") + # # build the project # -INCLUDE("cmake/sciqlop.cmake") \ No newline at end of file +INCLUDE("cmake/sciqlop.cmake") diff --git a/cmake/find_libs.cmake b/cmake/find_libs.cmake index c87e8f4..f797685 100644 --- a/cmake/find_libs.cmake +++ b/cmake/find_libs.cmake @@ -13,13 +13,6 @@ FIND_PACKAGE(Qt5Test REQUIRED) FIND_PACKAGE(Qt5Gui REQUIRED) # -# CatalogueAPI -# -LIST( APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") -FIND_PACKAGE(CatalogueAPI) - - -# # doxygen tools # FIND_PACKAGE(Doxygen) diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 34265ba..0ce7cb4 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -1,4 +1,3 @@ - ## core - CMakeLists.txt STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX) SET(SQPCORE_LIBRARY_NAME "${LIBRARY_PREFFIX}_core${DEBUG_SUFFIX}") @@ -46,17 +45,16 @@ TARGET_LINK_LIBRARIES(${SQPCORE_LIBRARY_NAME}) qt5_use_modules(${SQPCORE_LIBRARY_NAME} Core Network) # Find CATALOGUE_API -if(CATALOGUEAPI_FOUND) - include_directories("${CATALOGUEAPI_INCLUDE_DIRS}") - TARGET_LINK_LIBRARIES(${SQPCORE_LIBRARY_NAME} ${CATALOGUEAPI_LIBRARIES}) -endif() - +include_directories("${CATALOGUEAPI_INCLUDE}") +TARGET_LINK_LIBRARIES(${SQPCORE_LIBRARY_NAME} ${CATALOGUEAPI_LIBRARIES}) INSTALL(TARGETS ${SQPCORE_LIBRARY_NAME} RUNTIME DESTINATION ${INSTALL_BINARY_DIR} LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR} ) +add_dependencies(${SQPCORE_LIBRARY_NAME} CatalogueAPI) + # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order. # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets @@ -70,14 +68,14 @@ ENDIF() # dependent shared libraries SCIQLOP_SET_TO_PARENT_SCOPE(SQPCORE_LIBRARY_NAME) -# Copy extern shared libraries to the lib folder -LIST (APPEND ${EXTERN_SHARED_LIBRARIES} ${CATALOGUEAPI_LIBRARIES}) +## Copy extern shared libraries to the lib folder +#LIST (APPEND ${EXTERN_SHARED_LIBRARIES} ${CATALOGUEAPI_LIBRARIES}) -SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPCORE_LIBRARY_NAME} ${CATALOGUEAPI_LIBRARIES}) -if(APPLE) -SCIQLOP_COPY_TO_TARGET(RUNTIME ${SQPCORE_LIBRARY_NAME} ${CATALOGUEAPI_LIBRARIES}) -endif() -SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPCORE_LIBRARY_NAME} ${EXTERN_SHARED_LIBRARIES}) +#SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPCORE_LIBRARY_NAME} ${CATALOGUEAPI_LIBRARIES}) +#if(APPLE) +#SCIQLOP_COPY_TO_TARGET(RUNTIME ${SQPCORE_LIBRARY_NAME} ${CATALOGUEAPI_LIBRARIES}) +#endif() +#SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPCORE_LIBRARY_NAME} ${EXTERN_SHARED_LIBRARIES}) # Add the files to the list of files to be analyzed LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES}) @@ -94,6 +92,7 @@ IF(BUILD_TESTS) FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp) FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h) SET( TEST_LIBRARIES ${SQPCORE_LIBRARY_NAME}) + list(APPEND TEST_LIBRARIES ${CATALOGUEAPI_LIBRARIES}) SET(TARGETS_COV) FOREACH( testFile ${TESTS_SOURCES} ) @@ -112,7 +111,7 @@ IF(BUILD_TESTS) ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources}) set_property(TARGET ${testName} PROPERTY CXX_STANDARD 14) set_property(TARGET ${testName} PROPERTY CXX_STANDARD_REQUIRED ON) - TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} ) + TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES}) qt5_use_modules(${testName} Test) ADD_TEST( NAME ${testName} COMMAND ${testName} ) diff --git a/extern/CatalogueAPI.cmake b/extern/CatalogueAPI.cmake new file mode 100644 index 0000000..2bba60d --- /dev/null +++ b/extern/CatalogueAPI.cmake @@ -0,0 +1,50 @@ +# - Clone and build CatalogueAPI Module +include(ExternalProject) + +find_package(Git REQUIRED) + +SET(CATALOGUEAPI_SOURCES_PATH ${CMAKE_SOURCE_DIR}/3rdparty/CatalogueAPI) +SET(CATALOGUEAPI_BUILD_PATH ${CATALOGUEAPI_SOURCES_PATH}/build) +SET(CATALOGUEAPI_QXORM_LIB_PATH ${CATALOGUEAPI_BUILD_PATH}/subprojects/QxOrm) +SET(CatalogueAPI_build_type plain) + +string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER) + +ExternalProject_Add( + CatalogueAPI + + GIT_REPOSITORY https://perrinel@hephaistos.lpp.polytechnique.fr/rhodecode/GIT_REPOSITORIES/LPP/Users/mperrinel/CatalogueAPI + GIT_TAG develop + + UPDATE_COMMAND git pull + PATCH_COMMAND "" + + SOURCE_DIR "${CATALOGUEAPI_SOURCES_PATH}" + CONFIGURE_COMMAND meson --prefix=${CATALOGUEAPI_SOURCES_PATH} --buildtype=${CMAKE_BUILD_TYPE_TOLOWER} "${CATALOGUEAPI_SOURCES_PATH}" "${CATALOGUEAPI_BUILD_PATH}" + + BUILD_COMMAND ninja -C "${CATALOGUEAPI_BUILD_PATH}" + INSTALL_COMMAND ninja -C "${CATALOGUEAPI_BUILD_PATH}" install + TEST_COMMAND ninja -C "${CATALOGUEAPI_BUILD_PATH}" test + LOG_DOWNLOAD 1 + LOG_UPDATE 1 +) + +ExternalProject_Add_Step( + CatalogueAPI CopyToBin + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CATALOGUEAPI_SOURCES_PATH}/lib64 ${CATALOGUEAPI_SOURCES_PATH}/lib + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CATALOGUEAPI_QXORM_LIB_PATH} ${CATALOGUEAPI_SOURCES_PATH}/lib + DEPENDEES install +) + + +set(CATALOGUEAPI_INCLUDE ${CATALOGUEAPI_SOURCES_PATH}/src) +set(CATALOGUEAPI_LIBRARIES ${CATALOGUEAPI_SOURCES_PATH}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}CatalogueAPI${CMAKE_SHARED_LIBRARY_SUFFIX}) +list(APPEND CATALOGUEAPI_LIBRARIES ${CATALOGUEAPI_SOURCES_PATH}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}QxOrm${CMAKE_SHARED_LIBRARY_SUFFIX}) + +#message("CMAKE_SHARED_LIBRARY_PREFIX: ${CMAKE_SHARED_LIBRARY_PREFIX}") +#message("CMAKE_SHARED_LIBRARY_SUFFIX: ${CMAKE_SHARED_LIBRARY_SUFFIX}") +#message("CATALOGUEAPI_INCLUDE: ${CATALOGUEAPI_INCLUDE}") +#message("CATALOGUEAPI_LIBRARIES: ${CATALOGUEAPI_LIBRARIES}") + +mark_as_advanced(CATALOGUEAPI_INCLUDE) +mark_as_advanced(CATALOGUEAPI_LIBRARIES)