From 853587fd5b4232266f474dbf261da2497e3d68da 2017-12-04 17:36:09 From: mperrinel Date: 2017-12-04 17:36:09 Subject: [PATCH] Update externalproject for windows compatibility --- diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 0ce7cb4..4b095c8 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -75,7 +75,6 @@ SCIQLOP_SET_TO_PARENT_SCOPE(SQPCORE_LIBRARY_NAME) #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}) @@ -116,7 +115,7 @@ IF(BUILD_TESTS) ADD_TEST( NAME ${testName} COMMAND ${testName} ) - SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${EXTERN_SHARED_LIBRARIES}) + SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${CATALOGUEAPI_LIBRARIES}) set(Coverage_NAME ${testName}) if(UNIX) SETUP_TARGET_FOR_COVERAGE(TARGET ${testName}_coverage OUTPUT ${testFile}-path NAME ${testFile} EXECUTABLE ${testName}) diff --git a/extern/CatalogueAPI.cmake b/extern/CatalogueAPI.cmake index 2bba60d..1a37731 100644 --- a/extern/CatalogueAPI.cmake +++ b/extern/CatalogueAPI.cmake @@ -3,11 +3,35 @@ include(ExternalProject) find_package(Git REQUIRED) +if(WIN32) + find_program(MesonExec meson PATHS C:/Appli/Meson) + if(NOT MesonExec) + Message("Error: Meson not found") + else() + message("Meson found: ${MesonExec}" ) + endif() + find_program(NinjaExec ninja PATHS C:/Appli/Meson) + if(NOT NinjaExec) + Message("Error: Ninja not found") + else() + message("Ninja found: ${NinjaExec}" ) + endif() +endif() +if(NOT MesonExec) + set (MesonExec meson) +endif() +if(NOT NinjaExec) + set (NinjaExec ninja) +endif() + 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) +if(CMAKE_BUILD_TYPE STREQUAL "") + set(CMAKE_BUILD_TYPE Release) +endif() string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER) ExternalProject_Add( @@ -16,30 +40,35 @@ ExternalProject_Add( GIT_REPOSITORY https://perrinel@hephaistos.lpp.polytechnique.fr/rhodecode/GIT_REPOSITORIES/LPP/Users/mperrinel/CatalogueAPI GIT_TAG develop - UPDATE_COMMAND git pull + UPDATE_COMMAND ${GIT_EXECUTABLE} 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}" + CONFIGURE_COMMAND ${MesonExec} --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 + BUILD_COMMAND ${NinjaExec} -C "${CATALOGUEAPI_BUILD_PATH}" + INSTALL_COMMAND ${NinjaExec} -C "${CATALOGUEAPI_BUILD_PATH}" install + TEST_COMMAND ${NinjaExec} -C "${CATALOGUEAPI_BUILD_PATH}" test LOG_DOWNLOAD 1 LOG_UPDATE 1 ) +set(CATALOG_LIB_PATH lib) +if(WIN32) + set(CATALOG_LIB_PATH bin) +endif() + 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 + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CATALOGUEAPI_SOURCES_PATH}/lib64 ${CATALOGUEAPI_SOURCES_PATH}/${CATALOG_LIB_PATH} + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CATALOGUEAPI_QXORM_LIB_PATH} ${CATALOGUEAPI_SOURCES_PATH}/${CATALOG_LIB_PATH} 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}) +set(CATALOGUEAPI_LIBRARIES ${CATALOGUEAPI_SOURCES_PATH}/${CATALOG_LIB_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}CatalogueAPI${CMAKE_SHARED_LIBRARY_SUFFIX}) +list(APPEND CATALOGUEAPI_LIBRARIES ${CATALOGUEAPI_SOURCES_PATH}/${CATALOG_LIB_PATH}/${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}")