Auto status change to "Under Review"
@@ -1,174 +1,173 | |||
|
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 | |
|
75 | 75 | SET (COPY_LIBS_DESTINATION LIBRARY) |
|
76 | 76 | if(APPLE) |
|
77 | 77 | SET (COPY_LIBS_DESTINATION RUNTIME) |
|
78 | 78 | endif() |
|
79 | 79 | |
|
80 | 80 | add_custom_command(TARGET ${SQPCORE_LIBRARY_NAME} POST_BUILD |
|
81 | 81 | COMMAND ${CMAKE_COMMAND} -E copy ${CATALOGUEAPI_LIBRARIES} ${EXECUTABLE_OUTPUT_PATH} |
|
82 | 82 | ) |
|
83 | 83 | |
|
84 | 84 | # Add the files to the list of files to be analyzed |
|
85 | 85 | LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES}) |
|
86 | 86 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES) |
|
87 | 87 | # Vera++ exclusion files |
|
88 | 88 | LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt) |
|
89 | 89 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES) |
|
90 | 90 | |
|
91 | 91 | # |
|
92 | 92 | # Compile the tests |
|
93 | 93 | # |
|
94 | 94 | IF(BUILD_TESTS) |
|
95 | 95 | INCLUDE_DIRECTORIES(${SOURCES_DIR}) |
|
96 | 96 | FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp) |
|
97 | 97 | FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h) |
|
98 | 98 | SET( TEST_LIBRARIES ${SQPCORE_LIBRARY_NAME}) |
|
99 | 99 | list(APPEND TEST_LIBRARIES ${CATALOGUEAPI_LIBRARIES}) |
|
100 | 100 | |
|
101 | 101 | SET(TARGETS_COV) |
|
102 | 102 | FOREACH( testFile ${TESTS_SOURCES} ) |
|
103 | 103 | GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY ) |
|
104 | 104 | GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE ) |
|
105 | 105 | |
|
106 | 106 | # Add to the list of sources files all the sources in the same |
|
107 | 107 | # directory that aren't another test |
|
108 | 108 | FILE (GLOB currentTestSources |
|
109 | 109 | ${testDirectory}/*.c |
|
110 | 110 | ${testDirectory}/*.cpp |
|
111 | 111 | ${testDirectory}/*.h) |
|
112 | 112 | LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES}) |
|
113 | 113 | # LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS}) |
|
114 | 114 | |
|
115 | 115 | ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources}) |
|
116 | 116 | set_property(TARGET ${testName} PROPERTY CXX_STANDARD 14) |
|
117 | 117 | set_property(TARGET ${testName} PROPERTY CXX_STANDARD_REQUIRED ON) |
|
118 | 118 | TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES}) |
|
119 | 119 | qt5_use_modules(${testName} Test) |
|
120 | 120 | |
|
121 | 121 | ADD_TEST( NAME ${testName} COMMAND ${testName} ) |
|
122 | 122 | |
|
123 | SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${CATALOGUEAPI_LIBRARIES}) | |
|
124 | 123 | set(Coverage_NAME ${testName}) |
|
125 | 124 | if(UNIX) |
|
126 | 125 | SETUP_TARGET_FOR_COVERAGE(TARGET ${testName}_coverage OUTPUT ${testFile}-path NAME ${testFile} EXECUTABLE ${testName}) |
|
127 | 126 | LIST( APPEND TARGETS_COV ${testName}_coverage) |
|
128 | 127 | endif(UNIX) |
|
129 | 128 | |
|
130 | 129 | ENDFOREACH( testFile ) |
|
131 | 130 | |
|
132 | 131 | add_custom_target(coverage) |
|
133 | 132 | |
|
134 | 133 | FOREACH( target_cov ${TARGETS_COV} ) |
|
135 | 134 | add_custom_command(TARGET coverage PRE_BUILD COMMAND make ${target_cov}) |
|
136 | 135 | ENDFOREACH( target_cov ) |
|
137 | 136 | |
|
138 | 137 | LIST(APPEND testFilesToFormat ${TESTS_SOURCES}) |
|
139 | 138 | LIST(APPEND testFilesToFormat ${TESTS_HEADERS}) |
|
140 | 139 | LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat}) |
|
141 | 140 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) |
|
142 | 141 | |
|
143 | 142 | ADD_DEFINITIONS(-DCORE_TESTS_RESOURCES_DIR="${TESTS_RESOURCES_DIR}") |
|
144 | 143 | ENDIF(BUILD_TESTS) |
|
145 | 144 | |
|
146 | 145 | # |
|
147 | 146 | # Set the files that must be formatted by clang-format. |
|
148 | 147 | # |
|
149 | 148 | LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES}) |
|
150 | 149 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) |
|
151 | 150 | |
|
152 | 151 | # |
|
153 | 152 | # Set the directories that doxygen must browse to generate the |
|
154 | 153 | # documentation. |
|
155 | 154 | # |
|
156 | 155 | # Source directories: |
|
157 | 156 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs") |
|
158 | 157 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") |
|
159 | 158 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS) |
|
160 | 159 | # Source directories to exclude from the documentation generation |
|
161 | 160 | #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*") |
|
162 | 161 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS) |
|
163 | 162 | |
|
164 | 163 | # |
|
165 | 164 | # Set the directories with the sources to analyze and propagate the |
|
166 | 165 | # modification to the parent scope |
|
167 | 166 | # |
|
168 | 167 | # Source directories to analyze: |
|
169 | 168 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") |
|
170 | 169 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests") |
|
171 | 170 | SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS) |
|
172 | 171 | # Source directories to exclude from the analysis |
|
173 | 172 | #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir") |
|
174 | 173 | SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS) |
General Comments 3
Status change > Approved
You need to be logged in to leave comments.
Login now