Auto status change to "Under Review"
@@ -0,0 +1,249 | |||||
|
1 | # Copyright (c) 2012 - 2017, Lars Bilke | |||
|
2 | # All rights reserved. | |||
|
3 | # | |||
|
4 | # Redistribution and use in source and binary forms, with or without modification, | |||
|
5 | # are permitted provided that the following conditions are met: | |||
|
6 | # | |||
|
7 | # 1. Redistributions of source code must retain the above copyright notice, this | |||
|
8 | # list of conditions and the following disclaimer. | |||
|
9 | # | |||
|
10 | # 2. Redistributions in binary form must reproduce the above copyright notice, | |||
|
11 | # this list of conditions and the following disclaimer in the documentation | |||
|
12 | # and/or other materials provided with the distribution. | |||
|
13 | # | |||
|
14 | # 3. Neither the name of the copyright holder nor the names of its contributors | |||
|
15 | # may be used to endorse or promote products derived from this software without | |||
|
16 | # specific prior written permission. | |||
|
17 | # | |||
|
18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | |||
|
19 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |||
|
20 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
|
21 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR | |||
|
22 | # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |||
|
23 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |||
|
24 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
|
25 | # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
|
26 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |||
|
27 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
|
28 | # | |||
|
29 | # CHANGES: | |||
|
30 | # | |||
|
31 | # 2012-01-31, Lars Bilke | |||
|
32 | # - Enable Code Coverage | |||
|
33 | # | |||
|
34 | # 2013-09-17, Joakim SΓΆderberg | |||
|
35 | # - Added support for Clang. | |||
|
36 | # - Some additional usage instructions. | |||
|
37 | # | |||
|
38 | # 2016-02-03, Lars Bilke | |||
|
39 | # - Refactored functions to use named parameters | |||
|
40 | # | |||
|
41 | # 2017-06-02, Lars Bilke | |||
|
42 | # - Merged with modified version from github.com/ufz/ogs | |||
|
43 | # | |||
|
44 | # | |||
|
45 | # USAGE: | |||
|
46 | # | |||
|
47 | # 1. Copy this file into your cmake modules path. | |||
|
48 | # | |||
|
49 | # 2. Add the following line to your CMakeLists.txt: | |||
|
50 | # include(CodeCoverage) | |||
|
51 | # | |||
|
52 | # 3. Append necessary compiler flags: | |||
|
53 | # APPEND_COVERAGE_COMPILER_FLAGS() | |||
|
54 | # | |||
|
55 | # 4. If you need to exclude additional directories from the report, specify them | |||
|
56 | # using the COVERAGE_EXCLUDES variable before calling SETUP_TARGET_FOR_COVERAGE. | |||
|
57 | # Example: | |||
|
58 | # set(COVERAGE_EXCLUDES 'dir1/*' 'dir2/*') | |||
|
59 | # | |||
|
60 | # 5. Use the function SETUP_TARGET_FOR_COVERAGE to create a custom make target | |||
|
61 | # which runs your test executable and produces a lcov code coverage report: | |||
|
62 | # Example: | |||
|
63 | # SETUP_TARGET_FOR_COVERAGE( | |||
|
64 | # my_coverage_target # Name for custom target. | |||
|
65 | # test_driver # Name of the test driver executable that runs the tests. | |||
|
66 | # # NOTE! This should always have a ZERO as exit code | |||
|
67 | # # otherwise the coverage generation will not complete. | |||
|
68 | # coverage # Name of output directory. | |||
|
69 | # ) | |||
|
70 | # | |||
|
71 | # 6. Build a Debug build: | |||
|
72 | # cmake -DCMAKE_BUILD_TYPE=Debug .. | |||
|
73 | # make | |||
|
74 | # make my_coverage_target | |||
|
75 | # | |||
|
76 | ||||
|
77 | include(CMakeParseArguments) | |||
|
78 | ||||
|
79 | # Check prereqs | |||
|
80 | find_program( GCOV_PATH gcov ) | |||
|
81 | find_program( LCOV_PATH lcov ) | |||
|
82 | find_program( GENHTML_PATH genhtml ) | |||
|
83 | find_program( GCOVR_PATH gcovr PATHS ${CMAKE_SOURCE_DIR}/scripts/test) | |||
|
84 | find_program( SIMPLE_PYTHON_EXECUTABLE python ) | |||
|
85 | ||||
|
86 | if(NOT GCOV_PATH) | |||
|
87 | message(FATAL_ERROR "gcov not found! Aborting...") | |||
|
88 | endif() # NOT GCOV_PATH | |||
|
89 | ||||
|
90 | if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?[Cc]lang") | |||
|
91 | if("${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS 3) | |||
|
92 | message(FATAL_ERROR "Clang version must be 3.0.0 or greater! Aborting...") | |||
|
93 | endif() | |||
|
94 | elseif(NOT CMAKE_COMPILER_IS_GNUCXX) | |||
|
95 | message(FATAL_ERROR "Compiler is not GNU gcc! Aborting...") | |||
|
96 | endif() | |||
|
97 | ||||
|
98 | set(COVERAGE_COMPILER_FLAGS "-g -O0 --coverage -fprofile-arcs -ftest-coverage" | |||
|
99 | CACHE INTERNAL "") | |||
|
100 | ||||
|
101 | set(CMAKE_CXX_FLAGS_COVERAGE | |||
|
102 | ${COVERAGE_COMPILER_FLAGS} | |||
|
103 | CACHE STRING "Flags used by the C++ compiler during coverage builds." | |||
|
104 | FORCE ) | |||
|
105 | set(CMAKE_C_FLAGS_COVERAGE | |||
|
106 | ${COVERAGE_COMPILER_FLAGS} | |||
|
107 | CACHE STRING "Flags used by the C compiler during coverage builds." | |||
|
108 | FORCE ) | |||
|
109 | set(CMAKE_EXE_LINKER_FLAGS_COVERAGE | |||
|
110 | "" | |||
|
111 | CACHE STRING "Flags used for linking binaries during coverage builds." | |||
|
112 | FORCE ) | |||
|
113 | set(CMAKE_SHARED_LINKER_FLAGS_COVERAGE | |||
|
114 | "" | |||
|
115 | CACHE STRING "Flags used by the shared libraries linker during coverage builds." | |||
|
116 | FORCE ) | |||
|
117 | mark_as_advanced( | |||
|
118 | CMAKE_CXX_FLAGS_COVERAGE | |||
|
119 | CMAKE_C_FLAGS_COVERAGE | |||
|
120 | CMAKE_EXE_LINKER_FLAGS_COVERAGE | |||
|
121 | CMAKE_SHARED_LINKER_FLAGS_COVERAGE ) | |||
|
122 | ||||
|
123 | if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") | |||
|
124 | message(WARNING "Code coverage results with an optimised (non-Debug) build may be misleading") | |||
|
125 | endif() # NOT CMAKE_BUILD_TYPE STREQUAL "Debug" | |||
|
126 | ||||
|
127 | message( CMAKE_BUILD_TYPE : ${CMAKE_BUILD_TYPE}) | |||
|
128 | if(CMAKE_COMPILER_IS_GNUCXX) | |||
|
129 | link_libraries(gcov) | |||
|
130 | else() | |||
|
131 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage") | |||
|
132 | endif() | |||
|
133 | ||||
|
134 | # Defines a target for running and collection code coverage information | |||
|
135 | # Builds dependencies, runs the given executable and outputs reports. | |||
|
136 | # NOTE! The executable should always have a ZERO as exit code otherwise | |||
|
137 | # the coverage generation will not complete. | |||
|
138 | # | |||
|
139 | # SETUP_TARGET_FOR_COVERAGE( | |||
|
140 | # NAME testrunner_coverage # New target name | |||
|
141 | # EXECUTABLE testrunner -j ${PROCESSOR_COUNT} # Executable in PROJECT_BINARY_DIR | |||
|
142 | # DEPENDENCIES testrunner # Dependencies to build first | |||
|
143 | # ) | |||
|
144 | function(SETUP_TARGET_FOR_COVERAGE) | |||
|
145 | ||||
|
146 | set(options NONE) | |||
|
147 | set(oneValueArgs NAME TARGET GCNO) | |||
|
148 | set(multiValueArgs EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES) | |||
|
149 | cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) | |||
|
150 | ||||
|
151 | if(NOT LCOV_PATH) | |||
|
152 | # message(FATAL_ERROR "lcov not found! Aborting...") | |||
|
153 | endif() # NOT LCOV_PATH | |||
|
154 | ||||
|
155 | if(NOT GENHTML_PATH) | |||
|
156 | # message(FATAL_ERROR "genhtml not found! Aborting...") | |||
|
157 | endif() # NOT GENHTML_PATH | |||
|
158 | message("Coverage target: " ${Coverage_TARGET}) | |||
|
159 | message("Coverage name: " ${Coverage_NAME}) | |||
|
160 | message("Coverage exe: " ${Coverage_EXECUTABLE}) | |||
|
161 | message("Coverage gcno: " ${Coverage_GCNO}) | |||
|
162 | ||||
|
163 | # Setup target | |||
|
164 | add_custom_target(${Coverage_TARGET} | |||
|
165 | ||||
|
166 | # Cleanup lcov | |||
|
167 | # COMMAND ${LCOV_PATH} --directory . --zerocounters | |||
|
168 | ||||
|
169 | # Run tests | |||
|
170 | COMMAND ${Coverage_EXECUTABLE} | |||
|
171 | # Capturing lcov counters and generating report | |||
|
172 | COMMAND gcov ${Coverage_NAME} --object-file ${Coverage_GCNO} | |||
|
173 | ||||
|
174 | # COMMAND ${LCOV_PATH} --directory . --capture --output-file ${Coverage_NAME}.info | |||
|
175 | # COMMAND ${LCOV_PATH} --remove ${Coverage_NAME}.info ${COVERAGE_EXCLUDES} --output-file ${Coverage_NAME}.info.cleaned | |||
|
176 | # COMMAND ${GENHTML_PATH} -o ${Coverage_NAME} ${Coverage_NAME}.info.cleaned | |||
|
177 | # COMMAND ${CMAKE_COMMAND} -E remove ${Coverage_NAME}.info ${Coverage_NAME}.info.cleaned | |||
|
178 | ||||
|
179 | WORKING_DIRECTORY ${PROJECT_BINARY_DIR} | |||
|
180 | DEPENDS ${Coverage_DEPENDENCIES} | |||
|
181 | COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report." | |||
|
182 | ) | |||
|
183 | ||||
|
184 | # Show info where to find the report | |||
|
185 | # message("Nome de la target ${Coverage_TARGET}") | |||
|
186 | # add_custom_command(TARGET ${Coverage_TARGET} POST_BUILD | |||
|
187 | # COMMAND ; | |||
|
188 | # COMMENT "Open ./${Coverage_NAME}/index.html in your browser to view the coverage report." | |||
|
189 | # ) | |||
|
190 | ||||
|
191 | endfunction() # SETUP_TARGET_FOR_COVERAGE | |||
|
192 | ||||
|
193 | # Defines a target for running and collection code coverage information | |||
|
194 | # Builds dependencies, runs the given executable and outputs reports. | |||
|
195 | # NOTE! The executable should always have a ZERO as exit code otherwise | |||
|
196 | # the coverage generation will not complete. | |||
|
197 | # | |||
|
198 | # SETUP_TARGET_FOR_COVERAGE_COBERTURA( | |||
|
199 | # NAME ctest_coverage # New target name | |||
|
200 | # EXECUTABLE ctest -j ${PROCESSOR_COUNT} # Executable in PROJECT_BINARY_DIR | |||
|
201 | # DEPENDENCIES executable_target # Dependencies to build first | |||
|
202 | # ) | |||
|
203 | function(SETUP_TARGET_FOR_COVERAGE_COBERTURA) | |||
|
204 | ||||
|
205 | set(options NONE) | |||
|
206 | set(oneValueArgs NAME) | |||
|
207 | set(multiValueArgs EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES) | |||
|
208 | cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) | |||
|
209 | ||||
|
210 | if(NOT SIMPLE_PYTHON_EXECUTABLE) | |||
|
211 | message(FATAL_ERROR "python not found! Aborting...") | |||
|
212 | endif() # NOT SIMPLE_PYTHON_EXECUTABLE | |||
|
213 | ||||
|
214 | if(NOT GCOVR_PATH) | |||
|
215 | message(FATAL_ERROR "gcovr not found! Aborting...") | |||
|
216 | endif() # NOT GCOVR_PATH | |||
|
217 | ||||
|
218 | # Combine excludes to several -e arguments | |||
|
219 | set(COBERTURA_EXCLUDES "") | |||
|
220 | foreach(EXCLUDE ${COVERAGE_EXCLUDES}) | |||
|
221 | set(COBERTURA_EXCLUDES "-e ${EXCLUDE} ${COBERTURA_EXCLUDES}") | |||
|
222 | endforeach() | |||
|
223 | ||||
|
224 | add_custom_target(${Coverage_NAME} | |||
|
225 | ||||
|
226 | # Run tests | |||
|
227 | ${Coverage_EXECUTABLE} | |||
|
228 | ||||
|
229 | # Running gcovr | |||
|
230 | COMMAND ${GCOVR_PATH} -x -r ${CMAKE_SOURCE_DIR} ${COBERTURA_EXCLUDES} | |||
|
231 | -o ${Coverage_NAME}.xml | |||
|
232 | WORKING_DIRECTORY ${PROJECT_BINARY_DIR} | |||
|
233 | DEPENDS ${Coverage_DEPENDENCIES} | |||
|
234 | COMMENT "Running gcovr to produce Cobertura code coverage report." | |||
|
235 | ) | |||
|
236 | ||||
|
237 | # Show info where to find the report | |||
|
238 | add_custom_command(TARGET ${Coverage_NAME} POST_BUILD | |||
|
239 | COMMAND ; | |||
|
240 | COMMENT "Cobertura code coverage report saved in ${Coverage_NAME}.xml." | |||
|
241 | ) | |||
|
242 | ||||
|
243 | endfunction() # SETUP_TARGET_FOR_COVERAGE_COBERTURA | |||
|
244 | ||||
|
245 | function(APPEND_COVERAGE_COMPILER_FLAGS) | |||
|
246 | set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} ${COVERAGE_COMPILER_FLAGS}" PARENT_SCOPE) | |||
|
247 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COVERAGE_COMPILER_FLAGS}" PARENT_SCOPE) | |||
|
248 | message(STATUS "Appending code coverage compiler flags: ${COVERAGE_COMPILER_FLAGS}") | |||
|
249 | endfunction() # APPEND_COVERAGE_COMPILER_FLAGS |
@@ -1,146 +1,148 | |||||
1 |
|
1 | |||
2 | ## sciqlop - CMakeLists.txt |
|
2 | ## sciqlop - CMakeLists.txt | |
3 | SET(EXECUTABLE_NAME "sciqlop") |
|
3 | SET(EXECUTABLE_NAME "sciqlop") | |
4 | SET(SOURCES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/) |
|
4 | SET(SOURCES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/) | |
5 | SET(INCLUDE_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/include) |
|
5 | SET(INCLUDE_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/include) | |
6 | SET(UI_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/src) |
|
6 | SET(UI_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/src) | |
7 | SET(RES_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/resources) |
|
7 | SET(RES_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/resources) | |
8 |
|
8 | |||
9 | # |
|
9 | # | |
10 | # Find Qt modules |
|
10 | # Find Qt modules | |
11 | # |
|
11 | # | |
12 | SCIQLOP_FIND_QT(Core Widgets) |
|
12 | SCIQLOP_FIND_QT(Core Widgets) | |
13 |
|
13 | |||
14 | # |
|
14 | # | |
15 | # Find dependent libraries |
|
15 | # Find dependent libraries | |
16 | # ======================== |
|
16 | # ======================== | |
17 | find_package(sciqlop-gui) |
|
17 | find_package(sciqlop-gui) | |
18 |
|
18 | |||
19 | SET(LIBRARIES ${SCIQLOP-GUI_LIBRARIES}) |
|
19 | SET(LIBRARIES ${SCIQLOP-GUI_LIBRARIES}) | |
20 | SET(EXTERN_SHARED_LIBRARIES) |
|
20 | SET(EXTERN_SHARED_LIBRARIES) | |
21 |
|
21 | |||
22 | INCLUDE_DIRECTORIES(${SCIQLOP-GUI_INCLUDE_DIR}) |
|
22 | INCLUDE_DIRECTORIES(${SCIQLOP-GUI_INCLUDE_DIR}) | |
23 |
|
23 | |||
24 | # Add sqpcore to the list of libraries to use |
|
24 | # Add sqpcore to the list of libraries to use | |
25 | list(APPEND LIBRARIES ${SQPCORE_LIBRARY_NAME}) |
|
25 | list(APPEND LIBRARIES ${SQPCORE_LIBRARY_NAME}) | |
26 |
|
26 | |||
27 | # Include core directory |
|
27 | # Include core directory | |
28 | include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../core/include") |
|
28 | include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../core/include") | |
29 |
|
29 | |||
30 | # Add dependent shared libraries |
|
30 | # Add dependent shared libraries | |
31 | list(APPEND SHARED_LIBRARIES ${SQPCORE_SHARED_LIBRARIES}) |
|
31 | list(APPEND SHARED_LIBRARIES ${SQPCORE_SHARED_LIBRARIES}) | |
32 |
|
32 | |||
33 | # Retrieve the location of the dynamic library to copy it to the output path |
|
33 | # Retrieve the location of the dynamic library to copy it to the output path | |
34 | #get_property(sqpcoreLocation TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY LOCATION) |
|
34 | #get_property(sqpcoreLocation TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY LOCATION) | |
35 | list(APPEND SHARED_LIBRARIES_FROM_TARGETS ${sqpcoreLocation}) |
|
35 | list(APPEND SHARED_LIBRARIES_FROM_TARGETS ${sqpcoreLocation}) | |
36 |
|
36 | |||
37 | # |
|
37 | # | |
38 | # Compile the application |
|
38 | # Compile the application | |
39 | # |
|
39 | # | |
40 | FILE (GLOB_RECURSE APPLICATION_SOURCES |
|
40 | FILE (GLOB_RECURSE APPLICATION_SOURCES | |
41 | ${SOURCES_DIR}/*.c |
|
41 | ${SOURCES_DIR}/*.c | |
42 | ${SOURCES_DIR}/*.cpp |
|
42 | ${SOURCES_DIR}/*.cpp | |
43 | ${SOURCES_DIR}/*.h) |
|
43 | ${SOURCES_DIR}/*.h) | |
44 |
|
44 | |||
45 | # Headers files (.h) |
|
45 | # Headers files (.h) | |
46 | FILE (GLOB_RECURSE PROJECT_HEADERS ${INCLUDE_FOLDER}/*.h) |
|
46 | FILE (GLOB_RECURSE PROJECT_HEADERS ${INCLUDE_FOLDER}/*.h) | |
47 |
|
47 | |||
48 | # Ui files |
|
48 | # Ui files | |
49 | FILE (GLOB_RECURSE PROJECT_FORMS ${UI_FOLDER}/*.ui) |
|
49 | FILE (GLOB_RECURSE PROJECT_FORMS ${UI_FOLDER}/*.ui) | |
50 |
|
50 | |||
51 | # Resources files |
|
51 | # Resources files | |
52 | FILE (GLOB_RECURSE PROJECT_RESOURCES ${RES_FOLDER}/*.qrc) |
|
52 | FILE (GLOB_RECURSE PROJECT_RESOURCES ${RES_FOLDER}/*.qrc) | |
53 |
|
53 | |||
54 | # Retrieve resources files |
|
54 | # Retrieve resources files | |
55 | FILE (GLOB_RECURSE APPLICATION_RESOURCES ${RES_FOLDER}/*.qrc) |
|
55 | FILE (GLOB_RECURSE APPLICATION_RESOURCES ${RES_FOLDER}/*.qrc) | |
56 |
|
56 | |||
57 | QT5_ADD_RESOURCES(RCC_HDRS ${APPLICATION_RESOURCES} ) |
|
57 | QT5_ADD_RESOURCES(RCC_HDRS ${APPLICATION_RESOURCES} ) | |
58 |
|
58 | |||
59 | QT5_WRAP_UI(UIS_HDRS |
|
59 | QT5_WRAP_UI(UIS_HDRS | |
60 | ${PROJECT_FORMS} |
|
60 | ${PROJECT_FORMS} | |
61 | ) |
|
61 | ) | |
62 |
|
62 | |||
63 |
|
63 | |||
64 | ADD_EXECUTABLE(${EXECUTABLE_NAME} ${APPLICATION_SOURCES} ${RCC_HDRS} ${UIS_HDRS}) |
|
64 | ADD_EXECUTABLE(${EXECUTABLE_NAME} ${APPLICATION_SOURCES} ${RCC_HDRS} ${UIS_HDRS}) | |
65 | set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD 14) |
|
65 | set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD 14) | |
66 | set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) |
|
66 | set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) | |
67 | target_link_libraries(${EXECUTABLE_NAME} |
|
67 | target_link_libraries(${EXECUTABLE_NAME} | |
68 | ${LIBRARIES}) |
|
68 | ${LIBRARIES}) | |
69 |
|
69 | |||
70 | # Link with Qt5 modules |
|
70 | # Link with Qt5 modules | |
71 | qt5_use_modules(${EXECUTABLE_NAME} Core Widgets) |
|
71 | qt5_use_modules(${EXECUTABLE_NAME} Core Widgets) | |
72 |
|
72 | |||
73 |
|
73 | |||
74 | # Add the files to the list of files to be analyzed |
|
74 | # Add the files to the list of files to be analyzed | |
75 | LIST(APPEND CHECKSTYLE_INPUT_FILES ${APPLICATION_SOURCES}) |
|
75 | LIST(APPEND CHECKSTYLE_INPUT_FILES ${APPLICATION_SOURCES}) | |
76 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES) |
|
76 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES) | |
77 | # Vera++ exclusion files |
|
77 | # Vera++ exclusion files | |
78 | LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt) |
|
78 | LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt) | |
79 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES) |
|
79 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES) | |
80 |
|
80 | |||
81 | # |
|
81 | # | |
82 | # Compile the tests |
|
82 | # Compile the tests | |
83 | # |
|
83 | # | |
84 | IF(BUILD_TESTS) |
|
84 | IF(BUILD_TESTS) | |
|
85 | ||||
85 | INCLUDE_DIRECTORIES(${SOURCES_DIR}) |
|
86 | INCLUDE_DIRECTORIES(${SOURCES_DIR}) | |
86 | FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp) |
|
87 | FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp) | |
87 | FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h) |
|
88 | FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h) | |
88 | SET( TEST_LIBRARIES ${LIBRARIES}) |
|
89 | SET( TEST_LIBRARIES ${LIBRARIES}) | |
89 |
|
90 | |||
90 | FOREACH( testFile ${TESTS_SOURCES} ) |
|
91 | FOREACH( testFile ${TESTS_SOURCES} ) | |
91 | GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY ) |
|
92 | GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY ) | |
92 |
|
|
93 | GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE ) | |
93 |
|
94 | |||
94 | # Add to the list of sources files all the sources in the same |
|
95 | # Add to the list of sources files all the sources in the same | |
95 | # directory that aren't another test |
|
96 | # directory that aren't another test | |
96 | FILE (GLOB currentTestSources |
|
97 | FILE (GLOB currentTestSources | |
97 | ${testDirectory}/*.c |
|
98 | ${testDirectory}/*.c | |
98 | ${testDirectory}/*.cpp |
|
99 | ${testDirectory}/*.cpp | |
99 | ${testDirectory}/*.h) |
|
100 | ${testDirectory}/*.h) | |
100 | LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES}) |
|
101 | LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES}) | |
101 | LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS}) |
|
102 | LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS}) | |
102 |
|
103 | |||
103 | ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources}) |
|
104 | ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources}) | |
104 |
|
|
105 | TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} gcov) | |
105 | qt5_use_modules(${testName} Test) |
|
106 | qt5_use_modules(${testName} Test) | |
106 |
|
107 | |||
107 | ADD_TEST( NAME ${testName} COMMAND ${testName} ) |
|
108 | ADD_TEST( NAME ${testName} COMMAND ${testName} ) | |
108 |
|
109 | |||
109 | SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName}) |
|
110 | SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName}) | |
110 | ENDFOREACH( testFile ) |
|
111 | ENDFOREACH( testFile ) | |
111 |
|
112 | |||
112 | LIST(APPEND testFilesToFormat ${TESTS_SOURCES}) |
|
113 | LIST(APPEND testFilesToFormat ${TESTS_SOURCES}) | |
113 | LIST(APPEND testFilesToFormat ${TESTS_HEADERS}) |
|
114 | LIST(APPEND testFilesToFormat ${TESTS_HEADERS}) | |
114 | LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat}) |
|
115 | LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat}) | |
|
116 | ||||
115 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) |
|
117 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) | |
116 | ENDIF(BUILD_TESTS) |
|
118 | ENDIF(BUILD_TESTS) | |
117 |
|
119 | |||
118 | # |
|
120 | # | |
119 | # Set the files that must be formatted by clang-format. |
|
121 | # Set the files that must be formatted by clang-format. | |
120 | # |
|
122 | # | |
121 | LIST (APPEND FORMATTING_INPUT_FILES ${APPLICATION_SOURCES}) |
|
123 | LIST (APPEND FORMATTING_INPUT_FILES ${APPLICATION_SOURCES}) | |
122 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) |
|
124 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) | |
123 |
|
125 | |||
124 | # |
|
126 | # | |
125 | # Set the directories that doxygen must browse to generate the |
|
127 | # Set the directories that doxygen must browse to generate the | |
126 | # documentation. |
|
128 | # documentation. | |
127 | # |
|
129 | # | |
128 | # Source directories: |
|
130 | # Source directories: | |
129 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs") |
|
131 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs") | |
130 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") |
|
132 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") | |
131 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS) |
|
133 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS) | |
132 | # Source directories to exclude from the documentation generation |
|
134 | # Source directories to exclude from the documentation generation | |
133 | #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*") |
|
135 | #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*") | |
134 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS) |
|
136 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS) | |
135 |
|
137 | |||
136 | # |
|
138 | # | |
137 | # Set the directories with the sources to analyze and propagate the |
|
139 | # Set the directories with the sources to analyze and propagate the | |
138 | # modification to the parent scope |
|
140 | # modification to the parent scope | |
139 | # |
|
141 | # | |
140 | # Source directories to analyze: |
|
142 | # Source directories to analyze: | |
141 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") |
|
143 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") | |
142 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests") |
|
144 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests") | |
143 | SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS) |
|
145 | SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS) | |
144 | # Source directories to exclude from the analysis |
|
146 | # Source directories to exclude from the analysis | |
145 | #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir") |
|
147 | #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir") | |
146 | SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS) |
|
148 | SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS) |
@@ -1,51 +1,53 | |||||
1 | # |
|
1 | # | |
2 | # Sciqlop_modules.cmake |
|
2 | # Sciqlop_modules.cmake | |
3 | # |
|
3 | # | |
4 | # Set ouptut directories |
|
4 | # Set ouptut directories | |
5 | # |
|
5 | # | |
6 | SET (EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist/${CMAKE_BUILD_TYPE}) |
|
6 | SET (EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist/${CMAKE_BUILD_TYPE}) | |
7 | SET (LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist/${CMAKE_BUILD_TYPE}) |
|
7 | SET (LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist/${CMAKE_BUILD_TYPE}) | |
8 | IF (UNIX) |
|
8 | IF (UNIX) | |
9 | SET (CONFIG_OUTPUT_PATH $ENV{HOME}/.config/QtProject) |
|
9 | SET (CONFIG_OUTPUT_PATH $ENV{HOME}/.config/QtProject) | |
10 | ELSEIF(WIN32) |
|
10 | ELSEIF(WIN32) | |
11 | SET (CONFIG_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist/${CMAKE_BUILD_TYPE}/app/QtProject) |
|
11 | SET (CONFIG_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist/${CMAKE_BUILD_TYPE}/app/QtProject) | |
12 | ELSE() |
|
12 | ELSE() | |
13 | SET (CONFIG_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist/${CMAKE_BUILD_TYPE}) |
|
13 | SET (CONFIG_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist/${CMAKE_BUILD_TYPE}) | |
14 | ENDIF() |
|
14 | ENDIF() | |
15 |
|
15 | |||
|
16 | INCLUDE ("cmake/sciqlop_code_coverage.cmake") | |||
|
17 | ||||
16 | # |
|
18 | # | |
17 | # Compile the diffents modules |
|
19 | # Compile the diffents modules | |
18 | # |
|
20 | # | |
19 | set(sciqlop-core_DIR "${CMAKE_SOURCE_DIR}/core/cmake") |
|
21 | set(sciqlop-core_DIR "${CMAKE_SOURCE_DIR}/core/cmake") | |
20 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${sciqlop-core_DIR}") |
|
22 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${sciqlop-core_DIR}") | |
21 | ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/core") |
|
23 | ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/core") | |
22 |
|
24 | |||
23 | set(sciqlop-gui_DIR "${CMAKE_SOURCE_DIR}/gui/cmake") |
|
25 | set(sciqlop-gui_DIR "${CMAKE_SOURCE_DIR}/gui/cmake") | |
24 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${sciqlop-gui_DIR}") |
|
26 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${sciqlop-gui_DIR}") | |
25 | ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/gui") |
|
27 | ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/gui") | |
26 |
|
28 | |||
27 | ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/app") |
|
29 | ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/app") | |
28 |
|
30 | |||
29 | # LOGGER |
|
31 | # LOGGER | |
30 | set(QTLOGGING_INI_FILE "${CMAKE_SOURCE_DIR}/config/QtProject/qtlogging.ini") |
|
32 | set(QTLOGGING_INI_FILE "${CMAKE_SOURCE_DIR}/config/QtProject/qtlogging.ini") | |
31 | FILE(COPY ${QTLOGGING_INI_FILE} DESTINATION ${CONFIG_OUTPUT_PATH}) |
|
33 | FILE(COPY ${QTLOGGING_INI_FILE} DESTINATION ${CONFIG_OUTPUT_PATH}) | |
32 |
|
34 | |||
33 |
|
35 | |||
34 | # |
|
36 | # | |
35 | # Code formatting |
|
37 | # Code formatting | |
36 | # |
|
38 | # | |
37 | # Vera++ exclusion files |
|
39 | # Vera++ exclusion files | |
38 | LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/formatting/vera-exclusions/exclusions.txt) |
|
40 | LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/formatting/vera-exclusions/exclusions.txt) | |
39 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES) |
|
41 | #SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES) | |
40 | INCLUDE ("cmake/sciqlop_formatting.cmake") |
|
42 | INCLUDE ("cmake/sciqlop_formatting.cmake") | |
41 |
|
43 | |||
42 | # |
|
44 | # | |
43 | # Documentation generation |
|
45 | # Documentation generation | |
44 | # |
|
46 | # | |
45 | INCLUDE ("cmake/sciqlop_doxygen.cmake") |
|
47 | INCLUDE ("cmake/sciqlop_doxygen.cmake") | |
46 |
|
48 | |||
47 | # |
|
49 | # | |
48 | # Source code analysis |
|
50 | # Source code analysis | |
49 | # |
|
51 | # | |
50 | INCLUDE ("cmake/sciqlop_code_analysis.cmake") |
|
52 | INCLUDE ("cmake/sciqlop_code_analysis.cmake") | |
51 | INCLUDE ("cmake/sciqlop_code_cppcheck.cmake") |
|
53 | INCLUDE ("cmake/sciqlop_code_cppcheck.cmake") |
@@ -1,88 +1,86 | |||||
1 | # |
|
1 | # | |
2 | # sciqlop_params : Define compilation parameters |
|
2 | # sciqlop_params : Define compilation parameters | |
3 | # |
|
3 | # | |
4 | # Debug or release |
|
4 | # Debug or release | |
5 | # |
|
5 | # | |
6 | # As the "NMake Makefiles" forces by default the CMAKE_BUILD_TYPE variable to Debug, SCIQLOP_BUILD_TYPE variable is used to be sure that the debug mode is a user choice |
|
6 | # As the "NMake Makefiles" forces by default the CMAKE_BUILD_TYPE variable to Debug, SCIQLOP_BUILD_TYPE variable is used to be sure that the debug mode is a user choice | |
7 | #SET(SCIQLOP_BUILD_TYPE "Release" CACHE STRING "Choose to compile in Debug or Release mode") |
|
7 | #SET(SCIQLOP_BUILD_TYPE "Release" CACHE STRING "Choose to compile in Debug or Release mode") | |
8 |
|
8 | |||
9 | IF(CMAKE_BUILD_TYPE MATCHES "Debug") |
|
9 | IF(CMAKE_BUILD_TYPE MATCHES "Debug") | |
10 | SET (CMAKE_BUILD_TYPE "Debug") |
|
|||
11 | SET (DEBUG_SUFFIX "d") |
|
10 | SET (DEBUG_SUFFIX "d") | |
12 | ELSE() |
|
11 | ELSE() | |
13 | MESSAGE (STATUS "Build in Release") |
|
12 | MESSAGE (STATUS "Build in Release") | |
14 | SET (SCIQLOP_BUILD_TYPE "Release") |
|
|||
15 | SET (DEBUG_SUFFIX "") |
|
13 | SET (DEBUG_SUFFIX "") | |
16 | ENDIF() |
|
14 | ENDIF() | |
17 |
|
15 | |||
18 | # |
|
16 | # | |
19 | # Need to compile tests? |
|
17 | # Need to compile tests? | |
20 | # |
|
18 | # | |
21 | OPTION (BUILD_TESTS "Build the tests" OFF) |
|
19 | OPTION (BUILD_TESTS "Build the tests" OFF) | |
22 | ENABLE_TESTING(${BUILD_TESTS}) |
|
20 | ENABLE_TESTING(${BUILD_TESTS}) | |
23 |
|
21 | |||
24 | # |
|
22 | # | |
25 | # Path to the folder for sciqlop's extern libraries. |
|
23 | # Path to the folder for sciqlop's extern libraries. | |
26 | # |
|
24 | # | |
27 | # When looking for an external library in sciqlop, we look to the following |
|
25 | # When looking for an external library in sciqlop, we look to the following | |
28 | # folders: |
|
26 | # folders: | |
29 | # - The specific folder for the library (generally of the form <LIBRARY>_ROOT_DIR |
|
27 | # - The specific folder for the library (generally of the form <LIBRARY>_ROOT_DIR | |
30 | # - The global Sciqlop extern folder |
|
28 | # - The global Sciqlop extern folder | |
31 | # - The system folders. |
|
29 | # - The system folders. | |
32 | # |
|
30 | # | |
33 | # If a dependency is found in the global extern folder or a specific folder for |
|
31 | # If a dependency is found in the global extern folder or a specific folder for | |
34 | # the library, then it is installed with the sciqlop libraries. If it is found |
|
32 | # the library, then it is installed with the sciqlop libraries. If it is found | |
35 | # in the system folders, it is not. This behavior can be overriden with the |
|
33 | # in the system folders, it is not. This behavior can be overriden with the | |
36 | # <LIBRARY>_COPY_SHARED_LIBRARIES flag. |
|
34 | # <LIBRARY>_COPY_SHARED_LIBRARIES flag. | |
37 | # |
|
35 | # | |
38 | set(SCIQLOP_EXTERN_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/extern" |
|
36 | set(SCIQLOP_EXTERN_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/extern" | |
39 | CACHE PATH "Path to the folder for sciqlop's extern libraries") |
|
37 | CACHE PATH "Path to the folder for sciqlop's extern libraries") | |
40 | option(SCIQLOP_FORCE_UPDATE_EXT_ROOT_DIR "Force the <LIBRARY>_ROOT_DIR to be updated to the global sciqlop extern folder" |
|
38 | option(SCIQLOP_FORCE_UPDATE_EXT_ROOT_DIR "Force the <LIBRARY>_ROOT_DIR to be updated to the global sciqlop extern folder" | |
41 | OFF) |
|
39 | OFF) | |
42 |
|
40 | |||
43 | if (SCIQLOP_FORCE_UPDATE_EXT_ROOT_DIR) |
|
41 | if (SCIQLOP_FORCE_UPDATE_EXT_ROOT_DIR) | |
44 | set(libRootDirForceValue FORCE) |
|
42 | set(libRootDirForceValue FORCE) | |
45 | else() |
|
43 | else() | |
46 | set(libRootDirForceValue) |
|
44 | set(libRootDirForceValue) | |
47 | endif() |
|
45 | endif() | |
48 |
|
46 | |||
49 |
|
47 | |||
50 |
|
48 | |||
51 | # |
|
49 | # | |
52 | # Static or shared libraries |
|
50 | # Static or shared libraries | |
53 | # |
|
51 | # | |
54 | OPTION (BUILD_SHARED_LIBS "Build the shared libraries" ON) |
|
52 | OPTION (BUILD_SHARED_LIBS "Build the shared libraries" ON) | |
55 |
|
53 | |||
56 | # Generate position independant code (-fPIC) |
|
54 | # Generate position independant code (-fPIC) | |
57 | SET(CMAKE_POSITION_INDEPENDENT_CODE TRUE) |
|
55 | SET(CMAKE_POSITION_INDEPENDENT_CODE TRUE) | |
58 |
|
56 | |||
59 | # |
|
57 | # | |
60 | # Configure installation directories |
|
58 | # Configure installation directories | |
61 | # |
|
59 | # | |
62 | IF (UNIX) |
|
60 | IF (UNIX) | |
63 | SET(defaultBin "bin") |
|
61 | SET(defaultBin "bin") | |
64 | SET(defaultInc "include/sciqlop") |
|
62 | SET(defaultInc "include/sciqlop") | |
65 |
|
63 | |||
66 | # 32 or 64 bits compiler |
|
64 | # 32 or 64 bits compiler | |
67 | IF( CMAKE_SIZEOF_VOID_P EQUAL 8 ) |
|
65 | IF( CMAKE_SIZEOF_VOID_P EQUAL 8 ) | |
68 | SET(defaultLib "lib64/sciqlop") |
|
66 | SET(defaultLib "lib64/sciqlop") | |
69 | ELSE() |
|
67 | ELSE() | |
70 | SET(defaultLib "lib/sciqlop") |
|
68 | SET(defaultLib "lib/sciqlop") | |
71 | ENDIF() |
|
69 | ENDIF() | |
72 |
|
70 | |||
73 | SET(defaultDoc "share/docs/sciqlop") |
|
71 | SET(defaultDoc "share/docs/sciqlop") | |
74 | ELSE() |
|
72 | ELSE() | |
75 | SET(defaultBin "bin") |
|
73 | SET(defaultBin "bin") | |
76 | SET(defaultInc "include/sciqlop") |
|
74 | SET(defaultInc "include/sciqlop") | |
77 | SET(defaultLib "lib/sciqlop") |
|
75 | SET(defaultLib "lib/sciqlop") | |
78 | SET(defaultDoc "docs/sciqlop") |
|
76 | SET(defaultDoc "docs/sciqlop") | |
79 | ENDIF() |
|
77 | ENDIF() | |
80 |
|
78 | |||
81 | SET(INSTALL_BINARY_DIR "${defaultBin}" CACHE STRING |
|
79 | SET(INSTALL_BINARY_DIR "${defaultBin}" CACHE STRING | |
82 | "Installation directory for binaries") |
|
80 | "Installation directory for binaries") | |
83 | SET(INSTALL_LIBRARY_DIR "${defaultLib}" CACHE STRING |
|
81 | SET(INSTALL_LIBRARY_DIR "${defaultLib}" CACHE STRING | |
84 | "Installation directory for libraries") |
|
82 | "Installation directory for libraries") | |
85 | SET(INSTALL_INCLUDE_DIR "${defaultInc}" CACHE STRING |
|
83 | SET(INSTALL_INCLUDE_DIR "${defaultInc}" CACHE STRING | |
86 | "Installation directory for headers") |
|
84 | "Installation directory for headers") | |
87 | SET(INSTALL_DOCUMENTATION_DIR "${defaultDoc}" CACHE STRING |
|
85 | SET(INSTALL_DOCUMENTATION_DIR "${defaultDoc}" CACHE STRING | |
88 | "Installation directory for documentations") |
|
86 | "Installation directory for documentations") |
@@ -1,130 +1,137 | |||||
1 |
|
1 | |||
2 | ## core - CMakeLists.txt |
|
2 | ## core - CMakeLists.txt | |
3 | STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX) |
|
3 | STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX) | |
4 | SET(SQPCORE_LIBRARY_NAME "${LIBRARY_PREFFIX}_core${DEBUG_SUFFIX}") |
|
4 | SET(SQPCORE_LIBRARY_NAME "${LIBRARY_PREFFIX}_core${DEBUG_SUFFIX}") | |
5 | SET(SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/") |
|
5 | SET(SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/") | |
6 | SET(INCLUDES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/") |
|
6 | SET(INCLUDES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/") | |
7 |
|
7 | |||
8 | # Include core directory |
|
8 | # Include core directory | |
9 | include_directories("${INCLUDES_DIR}") |
|
9 | include_directories("${INCLUDES_DIR}") | |
10 |
|
10 | |||
11 | # Set a variable to display a warning in the version files. |
|
11 | # Set a variable to display a warning in the version files. | |
12 | SET(SCIQLOP_CMAKE_GENERATION_WARNING "DON'T CHANGE THIS FILE. AUTOGENERATED BY CMAKE.") |
|
12 | SET(SCIQLOP_CMAKE_GENERATION_WARNING "DON'T CHANGE THIS FILE. AUTOGENERATED BY CMAKE.") | |
13 | # Generate the version file from the cmake version variables. The version |
|
13 | # Generate the version file from the cmake version variables. The version | |
14 | # variables are defined in the cmake/sciqlop_version.cmake file. |
|
14 | # variables are defined in the cmake/sciqlop_version.cmake file. | |
15 | CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.h.in" |
|
15 | CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.h.in" | |
16 | "${INCLUDES_DIR}/Version.h") |
|
16 | "${INCLUDES_DIR}/Version.h") | |
17 | CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.cpp.in" |
|
17 | CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.cpp.in" | |
18 | "${SOURCES_DIR}/Version.cpp") |
|
18 | "${SOURCES_DIR}/Version.cpp") | |
19 |
|
19 | |||
20 | # |
|
20 | # | |
21 | # Find Qt modules |
|
21 | # Find Qt modules | |
22 | # |
|
22 | # | |
23 | SCIQLOP_FIND_QT(Core) |
|
23 | SCIQLOP_FIND_QT(Core) | |
24 |
|
24 | |||
25 | # |
|
25 | # | |
26 | # Compile the library library |
|
26 | # Compile the library library | |
27 | # |
|
27 | # | |
28 | FILE (GLOB_RECURSE MODULE_SOURCES |
|
28 | FILE (GLOB_RECURSE MODULE_SOURCES | |
29 | ${INCLUDES_DIR}/*.h |
|
29 | ${INCLUDES_DIR}/*.h | |
30 | ${SOURCES_DIR}/*.c |
|
30 | ${SOURCES_DIR}/*.c | |
31 | ${SOURCES_DIR}/*.cpp |
|
31 | ${SOURCES_DIR}/*.cpp | |
32 | ${SOURCES_DIR}/*.h) |
|
32 | ${SOURCES_DIR}/*.h) | |
33 |
|
33 | |||
34 | ADD_LIBRARY(${SQPCORE_LIBRARY_NAME} ${MODULE_SOURCES}) |
|
34 | ADD_LIBRARY(${SQPCORE_LIBRARY_NAME} ${MODULE_SOURCES}) | |
35 | set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD 14) |
|
35 | set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD 14) | |
36 | set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) |
|
36 | set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) | |
37 | TARGET_LINK_LIBRARIES(${SQPCORE_LIBRARY_NAME}) |
|
37 | TARGET_LINK_LIBRARIES(${SQPCORE_LIBRARY_NAME}) | |
38 | qt5_use_modules(${SQPCORE_LIBRARY_NAME} Core) |
|
38 | qt5_use_modules(${SQPCORE_LIBRARY_NAME} Core) | |
39 |
|
39 | |||
40 | # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html |
|
40 | # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html | |
41 | # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order. |
|
41 | # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order. | |
42 | # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets |
|
42 | # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets | |
43 | IF(BUILD_SHARED_LIBS) |
|
43 | IF(BUILD_SHARED_LIBS) | |
44 | SET_TARGET_PROPERTIES(${SQPCORE_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS "SCIQLOP_EXPORT") |
|
44 | SET_TARGET_PROPERTIES(${SQPCORE_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS "SCIQLOP_EXPORT") | |
45 | ELSE() |
|
45 | ELSE() | |
46 | TARGET_COMPILE_DEFINITIONS(${SQPCORE_LIBRARY_NAME} PUBLIC "SCIQLOP_STATIC_LIBRARIES") |
|
46 | TARGET_COMPILE_DEFINITIONS(${SQPCORE_LIBRARY_NAME} PUBLIC "SCIQLOP_STATIC_LIBRARIES") | |
47 | ENDIF() |
|
47 | ENDIF() | |
48 |
|
48 | |||
49 | # Set the variable to parent scope so that the other projects can copy the |
|
49 | # Set the variable to parent scope so that the other projects can copy the | |
50 | # dependent shared libraries |
|
50 | # dependent shared libraries | |
51 | SCIQLOP_SET_TO_PARENT_SCOPE(SQPCORE_LIBRARY_NAME) |
|
51 | SCIQLOP_SET_TO_PARENT_SCOPE(SQPCORE_LIBRARY_NAME) | |
52 |
|
52 | |||
53 | # Copy extern shared libraries to the lib folder |
|
53 | # Copy extern shared libraries to the lib folder | |
54 | SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPCORE_LIBRARY_NAME} ${EXTERN_SHARED_LIBRARIES}) |
|
54 | SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPCORE_LIBRARY_NAME} ${EXTERN_SHARED_LIBRARIES}) | |
55 |
|
55 | |||
56 | # Add the files to the list of files to be analyzed |
|
56 | # Add the files to the list of files to be analyzed | |
57 | LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES}) |
|
57 | LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES}) | |
58 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES) |
|
58 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES) | |
59 | # Vera++ exclusion files |
|
59 | # Vera++ exclusion files | |
60 | LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt) |
|
60 | LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt) | |
61 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES) |
|
61 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES) | |
62 |
|
62 | |||
63 | # |
|
63 | # | |
64 | # Compile the tests |
|
64 | # Compile the tests | |
65 | # |
|
65 | # | |
66 | IF(BUILD_TESTS) |
|
66 | IF(BUILD_TESTS) | |
67 | INCLUDE_DIRECTORIES(${SOURCES_DIR}) |
|
67 | INCLUDE_DIRECTORIES(${SOURCES_DIR}) | |
68 | FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp) |
|
68 | FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp) | |
69 | FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h) |
|
69 | FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h) | |
70 | SET( TEST_LIBRARIES ${SQPCORE_LIBRARY_NAME}) |
|
70 | SET( TEST_LIBRARIES ${SQPCORE_LIBRARY_NAME}) | |
71 |
|
71 | |||
72 | FOREACH( testFile ${TESTS_SOURCES} ) |
|
72 | FOREACH( testFile ${TESTS_SOURCES} ) | |
73 | GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY ) |
|
73 | GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY ) | |
74 | GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE ) |
|
74 | GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE ) | |
75 |
|
75 | |||
76 | # Add to the list of sources files all the sources in the same |
|
76 | # Add to the list of sources files all the sources in the same | |
77 | # directory that aren't another test |
|
77 | # directory that aren't another test | |
78 | FILE (GLOB currentTestSources |
|
78 | FILE (GLOB currentTestSources | |
79 | ${testDirectory}/*.c |
|
79 | ${testDirectory}/*.c | |
80 | ${testDirectory}/*.cpp |
|
80 | ${testDirectory}/*.cpp | |
81 |
|
|
81 | ${testDirectory}/*.h) | |
82 | LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES}) |
|
82 | LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES}) | |
83 | # LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS}) |
|
83 | # LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS}) | |
84 |
|
84 | |||
85 |
|
|
85 | ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources}) | |
86 | set_property(TARGET ${testName} PROPERTY CXX_STANDARD 14) |
|
86 | set_property(TARGET ${testName} PROPERTY CXX_STANDARD 14) | |
87 | set_property(TARGET ${testName} PROPERTY CXX_STANDARD_REQUIRED ON) |
|
87 | set_property(TARGET ${testName} PROPERTY CXX_STANDARD_REQUIRED ON) | |
88 |
|
|
88 | TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} ) | |
89 |
|
|
89 | qt5_use_modules(${testName} Test) | |
90 |
|
90 | |||
91 |
|
|
91 | ADD_TEST( NAME ${testName} COMMAND ${testDirectory} ) | |
92 |
|
92 | |||
|
93 | set({testGCNO} ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${testName}.dir/tests/) | |||
|
94 | ||||
|
95 | # MESSAGE("Current build did :" ${testGCNO}) | |||
|
96 | MESSAGE("Current build did :" ${CMAKE_FILES_DIRECTORY}) | |||
|
97 | MESSAGE("Current build did :" ${currentTestSources}) | |||
93 | SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${EXTERN_SHARED_LIBRARIES}) |
|
98 | SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${EXTERN_SHARED_LIBRARIES}) | |
|
99 | set(Coverage_NAME ${testName}) | |||
|
100 | SETUP_TARGET_FOR_COVERAGE(TARGET ${testName}_coverage NAME ${testFile} EXECUTABLE ${testName}) | |||
94 |
|
|
101 | ENDFOREACH( testFile ) | |
95 |
|
102 | |||
96 | LIST(APPEND testFilesToFormat ${TESTS_SOURCES}) |
|
103 | LIST(APPEND testFilesToFormat ${TESTS_SOURCES}) | |
97 | LIST(APPEND testFilesToFormat ${TESTS_HEADERS}) |
|
104 | LIST(APPEND testFilesToFormat ${TESTS_HEADERS}) | |
98 | LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat}) |
|
105 | LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat}) | |
99 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) |
|
106 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) | |
100 | ENDIF(BUILD_TESTS) |
|
107 | ENDIF(BUILD_TESTS) | |
101 |
|
108 | |||
102 | # |
|
109 | # | |
103 | # Set the files that must be formatted by clang-format. |
|
110 | # Set the files that must be formatted by clang-format. | |
104 | # |
|
111 | # | |
105 | LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES}) |
|
112 | LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES}) | |
106 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) |
|
113 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) | |
107 |
|
114 | |||
108 | # |
|
115 | # | |
109 | # Set the directories that doxygen must browse to generate the |
|
116 | # Set the directories that doxygen must browse to generate the | |
110 | # documentation. |
|
117 | # documentation. | |
111 | # |
|
118 | # | |
112 | # Source directories: |
|
119 | # Source directories: | |
113 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs") |
|
120 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs") | |
114 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") |
|
121 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") | |
115 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS) |
|
122 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS) | |
116 | # Source directories to exclude from the documentation generation |
|
123 | # Source directories to exclude from the documentation generation | |
117 | #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*") |
|
124 | #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*") | |
118 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS) |
|
125 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS) | |
119 |
|
126 | |||
120 | # |
|
127 | # | |
121 | # Set the directories with the sources to analyze and propagate the |
|
128 | # Set the directories with the sources to analyze and propagate the | |
122 | # modification to the parent scope |
|
129 | # modification to the parent scope | |
123 | # |
|
130 | # | |
124 | # Source directories to analyze: |
|
131 | # Source directories to analyze: | |
125 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") |
|
132 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") | |
126 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests") |
|
133 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests") | |
127 | SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS) |
|
134 | SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS) | |
128 | # Source directories to exclude from the analysis |
|
135 | # Source directories to exclude from the analysis | |
129 | #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir") |
|
136 | #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir") | |
130 | SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS) |
|
137 | 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