@@ -1,169 +1,174 | |||
|
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 | #SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPCORE_LIBRARY_NAME} ${CATALOGUEAPI_LIBRARIES}) | |
|
75 | #if(APPLE) | |
|
76 | #SCIQLOP_COPY_TO_TARGET(RUNTIME ${SQPCORE_LIBRARY_NAME} ${CATALOGUEAPI_LIBRARIES}) | |
|
77 | #endif() | |
|
74 | ||
|
75 | SET (COPY_LIBS_DESTINATION LIBRARY) | |
|
76 | if(APPLE) | |
|
77 | SET (COPY_LIBS_DESTINATION RUNTIME) | |
|
78 | endif() | |
|
79 | ||
|
80 | add_custom_command(TARGET ${SQPCORE_LIBRARY_NAME} POST_BUILD | |
|
81 | COMMAND ${CMAKE_COMMAND} -E copy ${CATALOGUEAPI_LIBRARIES} ${EXECUTABLE_OUTPUT_PATH} | |
|
82 | ) | |
|
78 | 83 | |
|
79 | 84 | # Add the files to the list of files to be analyzed |
|
80 | 85 | LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES}) |
|
81 | 86 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES) |
|
82 | 87 | # Vera++ exclusion files |
|
83 | 88 | LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt) |
|
84 | 89 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES) |
|
85 | 90 | |
|
86 | 91 | # |
|
87 | 92 | # Compile the tests |
|
88 | 93 | # |
|
89 | 94 | IF(BUILD_TESTS) |
|
90 | 95 | INCLUDE_DIRECTORIES(${SOURCES_DIR}) |
|
91 | 96 | FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp) |
|
92 | 97 | FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h) |
|
93 | 98 | SET( TEST_LIBRARIES ${SQPCORE_LIBRARY_NAME}) |
|
94 | 99 | list(APPEND TEST_LIBRARIES ${CATALOGUEAPI_LIBRARIES}) |
|
95 | 100 | |
|
96 | 101 | SET(TARGETS_COV) |
|
97 | 102 | FOREACH( testFile ${TESTS_SOURCES} ) |
|
98 | 103 | GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY ) |
|
99 | 104 | GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE ) |
|
100 | 105 | |
|
101 | 106 | # Add to the list of sources files all the sources in the same |
|
102 | 107 | # directory that aren't another test |
|
103 | 108 | FILE (GLOB currentTestSources |
|
104 | 109 | ${testDirectory}/*.c |
|
105 | 110 | ${testDirectory}/*.cpp |
|
106 | 111 | ${testDirectory}/*.h) |
|
107 | 112 | LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES}) |
|
108 | 113 | # LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS}) |
|
109 | 114 | |
|
110 | 115 | ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources}) |
|
111 | 116 | set_property(TARGET ${testName} PROPERTY CXX_STANDARD 14) |
|
112 | 117 | set_property(TARGET ${testName} PROPERTY CXX_STANDARD_REQUIRED ON) |
|
113 | 118 | TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES}) |
|
114 | 119 | qt5_use_modules(${testName} Test) |
|
115 | 120 | |
|
116 | 121 | ADD_TEST( NAME ${testName} COMMAND ${testName} ) |
|
117 | 122 | |
|
118 | 123 | SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${CATALOGUEAPI_LIBRARIES}) |
|
119 | 124 | set(Coverage_NAME ${testName}) |
|
120 | 125 | if(UNIX) |
|
121 | 126 | SETUP_TARGET_FOR_COVERAGE(TARGET ${testName}_coverage OUTPUT ${testFile}-path NAME ${testFile} EXECUTABLE ${testName}) |
|
122 | 127 | LIST( APPEND TARGETS_COV ${testName}_coverage) |
|
123 | 128 | endif(UNIX) |
|
124 | 129 | |
|
125 | 130 | ENDFOREACH( testFile ) |
|
126 | 131 | |
|
127 | 132 | add_custom_target(coverage) |
|
128 | 133 | |
|
129 | 134 | FOREACH( target_cov ${TARGETS_COV} ) |
|
130 | 135 | add_custom_command(TARGET coverage PRE_BUILD COMMAND make ${target_cov}) |
|
131 | 136 | ENDFOREACH( target_cov ) |
|
132 | 137 | |
|
133 | 138 | LIST(APPEND testFilesToFormat ${TESTS_SOURCES}) |
|
134 | 139 | LIST(APPEND testFilesToFormat ${TESTS_HEADERS}) |
|
135 | 140 | LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat}) |
|
136 | 141 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) |
|
137 | 142 | |
|
138 | 143 | ADD_DEFINITIONS(-DCORE_TESTS_RESOURCES_DIR="${TESTS_RESOURCES_DIR}") |
|
139 | 144 | ENDIF(BUILD_TESTS) |
|
140 | 145 | |
|
141 | 146 | # |
|
142 | 147 | # Set the files that must be formatted by clang-format. |
|
143 | 148 | # |
|
144 | 149 | LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES}) |
|
145 | 150 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) |
|
146 | 151 | |
|
147 | 152 | # |
|
148 | 153 | # Set the directories that doxygen must browse to generate the |
|
149 | 154 | # documentation. |
|
150 | 155 | # |
|
151 | 156 | # Source directories: |
|
152 | 157 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs") |
|
153 | 158 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") |
|
154 | 159 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS) |
|
155 | 160 | # Source directories to exclude from the documentation generation |
|
156 | 161 | #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*") |
|
157 | 162 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS) |
|
158 | 163 | |
|
159 | 164 | # |
|
160 | 165 | # Set the directories with the sources to analyze and propagate the |
|
161 | 166 | # modification to the parent scope |
|
162 | 167 | # |
|
163 | 168 | # Source directories to analyze: |
|
164 | 169 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") |
|
165 | 170 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests") |
|
166 | 171 | SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS) |
|
167 | 172 | # Source directories to exclude from the analysis |
|
168 | 173 | #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir") |
|
169 | 174 | SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS) |
@@ -1,79 +1,73 | |||
|
1 | 1 | # - Clone and build CatalogueAPI Module |
|
2 | 2 | include(ExternalProject) |
|
3 | 3 | |
|
4 | 4 | find_package(Git REQUIRED) |
|
5 | 5 | |
|
6 | 6 | if(WIN32) |
|
7 | 7 | find_program(MesonExec meson PATHS C:/Appli/Meson) |
|
8 | 8 | if(NOT MesonExec) |
|
9 | 9 | Message("Error: Meson not found") |
|
10 | 10 | else() |
|
11 | 11 | message("Meson found: ${MesonExec}" ) |
|
12 | 12 | endif() |
|
13 | 13 | find_program(NinjaExec ninja PATHS C:/Appli/Meson) |
|
14 | 14 | if(NOT NinjaExec) |
|
15 | 15 | Message("Error: Ninja not found") |
|
16 | 16 | else() |
|
17 | 17 | message("Ninja found: ${NinjaExec}" ) |
|
18 | 18 | endif() |
|
19 | 19 | endif() |
|
20 | 20 | if(NOT MesonExec) |
|
21 | 21 | set (MesonExec meson) |
|
22 | 22 | endif() |
|
23 | 23 | if(NOT NinjaExec) |
|
24 | 24 | set (NinjaExec ninja) |
|
25 | 25 | endif() |
|
26 | 26 | |
|
27 | 27 | SET(CATALOGUEAPI_SOURCES_PATH ${CMAKE_SOURCE_DIR}/3rdparty/CatalogueAPI) |
|
28 | 28 | SET(CATALOGUEAPI_BUILD_PATH ${CATALOGUEAPI_SOURCES_PATH}/build) |
|
29 | 29 | SET(CATALOGUEAPI_QXORM_LIB_PATH ${CATALOGUEAPI_BUILD_PATH}/subprojects/QxOrm) |
|
30 | 30 | SET(CatalogueAPI_build_type plain) |
|
31 | 31 | |
|
32 | 32 | if(CMAKE_BUILD_TYPE STREQUAL "") |
|
33 | 33 | set(CMAKE_BUILD_TYPE Release) |
|
34 | 34 | endif() |
|
35 | 35 | string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER) |
|
36 | 36 | |
|
37 | 37 | ExternalProject_Add( |
|
38 | 38 | CatalogueAPI |
|
39 | 39 | |
|
40 | 40 | GIT_REPOSITORY https://perrinel@hephaistos.lpp.polytechnique.fr/rhodecode/GIT_REPOSITORIES/LPP/Users/mperrinel/CatalogueAPI |
|
41 | 41 | GIT_TAG develop |
|
42 | 42 | |
|
43 | 43 | UPDATE_COMMAND ${GIT_EXECUTABLE} pull |
|
44 | 44 | PATCH_COMMAND "" |
|
45 | 45 | |
|
46 | 46 | SOURCE_DIR "${CATALOGUEAPI_SOURCES_PATH}" |
|
47 | 47 | CONFIGURE_COMMAND ${MesonExec} --prefix=${CATALOGUEAPI_SOURCES_PATH} --buildtype=${CMAKE_BUILD_TYPE_TOLOWER} "${CATALOGUEAPI_SOURCES_PATH}" "${CATALOGUEAPI_BUILD_PATH}" |
|
48 | 48 | |
|
49 | 49 | BUILD_COMMAND ${NinjaExec} -C "${CATALOGUEAPI_BUILD_PATH}" |
|
50 | 50 | INSTALL_COMMAND ${NinjaExec} -C "${CATALOGUEAPI_BUILD_PATH}" install |
|
51 | TEST_COMMAND ${NinjaExec} -C "${CATALOGUEAPI_BUILD_PATH}" test | |
|
52 | 51 | LOG_DOWNLOAD 1 |
|
53 | 52 | LOG_UPDATE 1 |
|
54 | 53 | ) |
|
55 | 54 | |
|
56 | 55 | set(CATALOG_LIB_PATH lib) |
|
57 | 56 | if(WIN32) |
|
58 | 57 | set(CATALOG_LIB_PATH bin) |
|
59 | 58 | endif() |
|
60 | 59 | |
|
61 | 60 | ExternalProject_Add_Step( |
|
62 | 61 | CatalogueAPI CopyToBin |
|
63 | 62 | COMMAND ${CMAKE_COMMAND} -E copy_directory ${CATALOGUEAPI_SOURCES_PATH}/lib64 ${CATALOGUEAPI_SOURCES_PATH}/${CATALOG_LIB_PATH} |
|
64 | 63 | COMMAND ${CMAKE_COMMAND} -E copy_directory ${CATALOGUEAPI_QXORM_LIB_PATH} ${CATALOGUEAPI_SOURCES_PATH}/${CATALOG_LIB_PATH} |
|
65 | 64 | DEPENDEES install |
|
66 | 65 | ) |
|
67 | 66 | |
|
68 | 67 | |
|
69 | 68 | set(CATALOGUEAPI_INCLUDE ${CATALOGUEAPI_SOURCES_PATH}/src) |
|
70 | 69 | set(CATALOGUEAPI_LIBRARIES ${CATALOGUEAPI_SOURCES_PATH}/${CATALOG_LIB_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}CatalogueAPI${CMAKE_SHARED_LIBRARY_SUFFIX}) |
|
71 | 70 | list(APPEND CATALOGUEAPI_LIBRARIES ${CATALOGUEAPI_SOURCES_PATH}/${CATALOG_LIB_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}QxOrm${CMAKE_SHARED_LIBRARY_SUFFIX}) |
|
72 | 71 | |
|
73 | #message("CMAKE_SHARED_LIBRARY_PREFIX: ${CMAKE_SHARED_LIBRARY_PREFIX}") | |
|
74 | #message("CMAKE_SHARED_LIBRARY_SUFFIX: ${CMAKE_SHARED_LIBRARY_SUFFIX}") | |
|
75 | #message("CATALOGUEAPI_INCLUDE: ${CATALOGUEAPI_INCLUDE}") | |
|
76 | #message("CATALOGUEAPI_LIBRARIES: ${CATALOGUEAPI_LIBRARIES}") | |
|
77 | ||
|
78 | 72 | mark_as_advanced(CATALOGUEAPI_INCLUDE) |
|
79 | 73 | mark_as_advanced(CATALOGUEAPI_LIBRARIES) |
General Comments 0
You need to be logged in to leave comments.
Login now