##// END OF EJS Templates
Update externalproject for windows compatibility
perrinel -
r1063:853587fd5b42
parent child
Show More
@@ -1,170 +1,169
1 1 ## core - CMakeLists.txt
2 2 STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX)
3 3 SET(SQPCORE_LIBRARY_NAME "${LIBRARY_PREFFIX}_core${DEBUG_SUFFIX}")
4 4 SET(SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/")
5 5 SET(INCLUDES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/")
6 6 SET(TESTS_RESOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/tests-resources")
7 7
8 8 # Include core directory
9 9 include_directories("${INCLUDES_DIR}")
10 10
11 11 # Set a variable to display a warning in the version files.
12 12 SET(SCIQLOP_CMAKE_GENERATION_WARNING "DON'T CHANGE THIS FILE. AUTOGENERATED BY CMAKE.")
13 13 # Generate the version file from the cmake version variables. The version
14 14 # variables are defined in the cmake/sciqlop_version.cmake file.
15 15 CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.h.in"
16 16 "${INCLUDES_DIR}/Version.h")
17 17 CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.cpp.in"
18 18 "${SOURCES_DIR}/Version.cpp")
19 19
20 20 # Find dependent modules
21 21 find_package(sciqlop-plugin)
22 22 INCLUDE_DIRECTORIES(${SCIQLOP-PLUGIN_INCLUDE_DIR})
23 23
24 24 #
25 25 # Find Qt modules
26 26 #
27 27 SCIQLOP_FIND_QT(Core Network)
28 28
29 29 #
30 30 # Compile the library library
31 31 #
32 32
33 33 ADD_DEFINITIONS(-DCORE_LIB)
34 34
35 35 FILE (GLOB_RECURSE MODULE_SOURCES
36 36 ${INCLUDES_DIR}/*.h
37 37 ${SOURCES_DIR}/*.c
38 38 ${SOURCES_DIR}/*.cpp
39 39 ${SOURCES_DIR}/*.h)
40 40
41 41 ADD_LIBRARY(${SQPCORE_LIBRARY_NAME} ${MODULE_SOURCES})
42 42 set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD 14)
43 43 set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
44 44 TARGET_LINK_LIBRARIES(${SQPCORE_LIBRARY_NAME})
45 45 qt5_use_modules(${SQPCORE_LIBRARY_NAME} Core Network)
46 46
47 47 # Find CATALOGUE_API
48 48 include_directories("${CATALOGUEAPI_INCLUDE}")
49 49 TARGET_LINK_LIBRARIES(${SQPCORE_LIBRARY_NAME} ${CATALOGUEAPI_LIBRARIES})
50 50 INSTALL(TARGETS ${SQPCORE_LIBRARY_NAME}
51 51 RUNTIME DESTINATION ${INSTALL_BINARY_DIR}
52 52 LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}
53 53 ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR}
54 54 )
55 55
56 56 add_dependencies(${SQPCORE_LIBRARY_NAME} CatalogueAPI)
57 57
58 58 # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html
59 59 # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order.
60 60 # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets
61 61 IF(BUILD_SHARED_LIBS)
62 62 SET_TARGET_PROPERTIES(${SQPCORE_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS "SCIQLOP_EXPORT")
63 63 ELSE()
64 64 TARGET_COMPILE_DEFINITIONS(${SQPCORE_LIBRARY_NAME} PUBLIC "SCIQLOP_STATIC_LIBRARIES")
65 65 ENDIF()
66 66
67 67 # Set the variable to parent scope so that the other projects can copy the
68 68 # dependent shared libraries
69 69 SCIQLOP_SET_TO_PARENT_SCOPE(SQPCORE_LIBRARY_NAME)
70 70
71 71 ## Copy extern shared libraries to the lib folder
72 72 #LIST (APPEND ${EXTERN_SHARED_LIBRARIES} ${CATALOGUEAPI_LIBRARIES})
73 73
74 74 #SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPCORE_LIBRARY_NAME} ${CATALOGUEAPI_LIBRARIES})
75 75 #if(APPLE)
76 76 #SCIQLOP_COPY_TO_TARGET(RUNTIME ${SQPCORE_LIBRARY_NAME} ${CATALOGUEAPI_LIBRARIES})
77 77 #endif()
78 #SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPCORE_LIBRARY_NAME} ${EXTERN_SHARED_LIBRARIES})
79 78
80 79 # Add the files to the list of files to be analyzed
81 80 LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES})
82 81 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES)
83 82 # Vera++ exclusion files
84 83 LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt)
85 84 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES)
86 85
87 86 #
88 87 # Compile the tests
89 88 #
90 89 IF(BUILD_TESTS)
91 90 INCLUDE_DIRECTORIES(${SOURCES_DIR})
92 91 FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp)
93 92 FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h)
94 93 SET( TEST_LIBRARIES ${SQPCORE_LIBRARY_NAME})
95 94 list(APPEND TEST_LIBRARIES ${CATALOGUEAPI_LIBRARIES})
96 95
97 96 SET(TARGETS_COV)
98 97 FOREACH( testFile ${TESTS_SOURCES} )
99 98 GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY )
100 99 GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE )
101 100
102 101 # Add to the list of sources files all the sources in the same
103 102 # directory that aren't another test
104 103 FILE (GLOB currentTestSources
105 104 ${testDirectory}/*.c
106 105 ${testDirectory}/*.cpp
107 106 ${testDirectory}/*.h)
108 107 LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES})
109 108 # LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS})
110 109
111 110 ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources})
112 111 set_property(TARGET ${testName} PROPERTY CXX_STANDARD 14)
113 112 set_property(TARGET ${testName} PROPERTY CXX_STANDARD_REQUIRED ON)
114 113 TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES})
115 114 qt5_use_modules(${testName} Test)
116 115
117 116 ADD_TEST( NAME ${testName} COMMAND ${testName} )
118 117
119 SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${EXTERN_SHARED_LIBRARIES})
118 SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${CATALOGUEAPI_LIBRARIES})
120 119 set(Coverage_NAME ${testName})
121 120 if(UNIX)
122 121 SETUP_TARGET_FOR_COVERAGE(TARGET ${testName}_coverage OUTPUT ${testFile}-path NAME ${testFile} EXECUTABLE ${testName})
123 122 LIST( APPEND TARGETS_COV ${testName}_coverage)
124 123 endif(UNIX)
125 124
126 125 ENDFOREACH( testFile )
127 126
128 127 add_custom_target(coverage)
129 128
130 129 FOREACH( target_cov ${TARGETS_COV} )
131 130 add_custom_command(TARGET coverage PRE_BUILD COMMAND make ${target_cov})
132 131 ENDFOREACH( target_cov )
133 132
134 133 LIST(APPEND testFilesToFormat ${TESTS_SOURCES})
135 134 LIST(APPEND testFilesToFormat ${TESTS_HEADERS})
136 135 LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat})
137 136 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
138 137
139 138 ADD_DEFINITIONS(-DCORE_TESTS_RESOURCES_DIR="${TESTS_RESOURCES_DIR}")
140 139 ENDIF(BUILD_TESTS)
141 140
142 141 #
143 142 # Set the files that must be formatted by clang-format.
144 143 #
145 144 LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES})
146 145 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
147 146
148 147 #
149 148 # Set the directories that doxygen must browse to generate the
150 149 # documentation.
151 150 #
152 151 # Source directories:
153 152 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs")
154 153 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
155 154 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS)
156 155 # Source directories to exclude from the documentation generation
157 156 #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*")
158 157 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS)
159 158
160 159 #
161 160 # Set the directories with the sources to analyze and propagate the
162 161 # modification to the parent scope
163 162 #
164 163 # Source directories to analyze:
165 164 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
166 165 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests")
167 166 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS)
168 167 # Source directories to exclude from the analysis
169 168 #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir")
170 169 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS)
@@ -1,50 +1,79
1 1 # - Clone and build CatalogueAPI Module
2 2 include(ExternalProject)
3 3
4 4 find_package(Git REQUIRED)
5 5
6 if(WIN32)
7 find_program(MesonExec meson PATHS C:/Appli/Meson)
8 if(NOT MesonExec)
9 Message("Error: Meson not found")
10 else()
11 message("Meson found: ${MesonExec}" )
12 endif()
13 find_program(NinjaExec ninja PATHS C:/Appli/Meson)
14 if(NOT NinjaExec)
15 Message("Error: Ninja not found")
16 else()
17 message("Ninja found: ${NinjaExec}" )
18 endif()
19 endif()
20 if(NOT MesonExec)
21 set (MesonExec meson)
22 endif()
23 if(NOT NinjaExec)
24 set (NinjaExec ninja)
25 endif()
26
6 27 SET(CATALOGUEAPI_SOURCES_PATH ${CMAKE_SOURCE_DIR}/3rdparty/CatalogueAPI)
7 28 SET(CATALOGUEAPI_BUILD_PATH ${CATALOGUEAPI_SOURCES_PATH}/build)
8 29 SET(CATALOGUEAPI_QXORM_LIB_PATH ${CATALOGUEAPI_BUILD_PATH}/subprojects/QxOrm)
9 30 SET(CatalogueAPI_build_type plain)
10 31
32 if(CMAKE_BUILD_TYPE STREQUAL "")
33 set(CMAKE_BUILD_TYPE Release)
34 endif()
11 35 string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER)
12 36
13 37 ExternalProject_Add(
14 38 CatalogueAPI
15 39
16 40 GIT_REPOSITORY https://perrinel@hephaistos.lpp.polytechnique.fr/rhodecode/GIT_REPOSITORIES/LPP/Users/mperrinel/CatalogueAPI
17 41 GIT_TAG develop
18 42
19 UPDATE_COMMAND git pull
43 UPDATE_COMMAND ${GIT_EXECUTABLE} pull
20 44 PATCH_COMMAND ""
21 45
22 46 SOURCE_DIR "${CATALOGUEAPI_SOURCES_PATH}"
23 CONFIGURE_COMMAND meson --prefix=${CATALOGUEAPI_SOURCES_PATH} --buildtype=${CMAKE_BUILD_TYPE_TOLOWER} "${CATALOGUEAPI_SOURCES_PATH}" "${CATALOGUEAPI_BUILD_PATH}"
47 CONFIGURE_COMMAND ${MesonExec} --prefix=${CATALOGUEAPI_SOURCES_PATH} --buildtype=${CMAKE_BUILD_TYPE_TOLOWER} "${CATALOGUEAPI_SOURCES_PATH}" "${CATALOGUEAPI_BUILD_PATH}"
24 48
25 BUILD_COMMAND ninja -C "${CATALOGUEAPI_BUILD_PATH}"
26 INSTALL_COMMAND ninja -C "${CATALOGUEAPI_BUILD_PATH}" install
27 TEST_COMMAND ninja -C "${CATALOGUEAPI_BUILD_PATH}" test
49 BUILD_COMMAND ${NinjaExec} -C "${CATALOGUEAPI_BUILD_PATH}"
50 INSTALL_COMMAND ${NinjaExec} -C "${CATALOGUEAPI_BUILD_PATH}" install
51 TEST_COMMAND ${NinjaExec} -C "${CATALOGUEAPI_BUILD_PATH}" test
28 52 LOG_DOWNLOAD 1
29 53 LOG_UPDATE 1
30 54 )
31 55
56 set(CATALOG_LIB_PATH lib)
57 if(WIN32)
58 set(CATALOG_LIB_PATH bin)
59 endif()
60
32 61 ExternalProject_Add_Step(
33 62 CatalogueAPI CopyToBin
34 COMMAND ${CMAKE_COMMAND} -E copy_directory ${CATALOGUEAPI_SOURCES_PATH}/lib64 ${CATALOGUEAPI_SOURCES_PATH}/lib
35 COMMAND ${CMAKE_COMMAND} -E copy_directory ${CATALOGUEAPI_QXORM_LIB_PATH} ${CATALOGUEAPI_SOURCES_PATH}/lib
63 COMMAND ${CMAKE_COMMAND} -E copy_directory ${CATALOGUEAPI_SOURCES_PATH}/lib64 ${CATALOGUEAPI_SOURCES_PATH}/${CATALOG_LIB_PATH}
64 COMMAND ${CMAKE_COMMAND} -E copy_directory ${CATALOGUEAPI_QXORM_LIB_PATH} ${CATALOGUEAPI_SOURCES_PATH}/${CATALOG_LIB_PATH}
36 65 DEPENDEES install
37 66 )
38 67
39 68
40 69 set(CATALOGUEAPI_INCLUDE ${CATALOGUEAPI_SOURCES_PATH}/src)
41 set(CATALOGUEAPI_LIBRARIES ${CATALOGUEAPI_SOURCES_PATH}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}CatalogueAPI${CMAKE_SHARED_LIBRARY_SUFFIX})
42 list(APPEND CATALOGUEAPI_LIBRARIES ${CATALOGUEAPI_SOURCES_PATH}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}QxOrm${CMAKE_SHARED_LIBRARY_SUFFIX})
70 set(CATALOGUEAPI_LIBRARIES ${CATALOGUEAPI_SOURCES_PATH}/${CATALOG_LIB_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}CatalogueAPI${CMAKE_SHARED_LIBRARY_SUFFIX})
71 list(APPEND CATALOGUEAPI_LIBRARIES ${CATALOGUEAPI_SOURCES_PATH}/${CATALOG_LIB_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}QxOrm${CMAKE_SHARED_LIBRARY_SUFFIX})
43 72
44 73 #message("CMAKE_SHARED_LIBRARY_PREFIX: ${CMAKE_SHARED_LIBRARY_PREFIX}")
45 74 #message("CMAKE_SHARED_LIBRARY_SUFFIX: ${CMAKE_SHARED_LIBRARY_SUFFIX}")
46 75 #message("CATALOGUEAPI_INCLUDE: ${CATALOGUEAPI_INCLUDE}")
47 76 #message("CATALOGUEAPI_LIBRARIES: ${CATALOGUEAPI_LIBRARIES}")
48 77
49 78 mark_as_advanced(CATALOGUEAPI_INCLUDE)
50 79 mark_as_advanced(CATALOGUEAPI_LIBRARIES)
General Comments 0
You need to be logged in to leave comments. Login now