##// END OF EJS Templates
Unit tests for plugin loading (1)...
Alexandre Leroux -
r70:b8e5d4af3bed
parent child
Show More
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644
NO CONTENT: new file 100644
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
@@ -1,145 +1,149
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 # Find dependent modules
20 # Find dependent modules
21 find_package(sciqlop-plugin)
21 find_package(sciqlop-plugin)
22 INCLUDE_DIRECTORIES(${SCIQLOP-PLUGIN_INCLUDE_DIR})
22 INCLUDE_DIRECTORIES(${SCIQLOP-PLUGIN_INCLUDE_DIR})
23
23
24 #
24 #
25 # Find Qt modules
25 # Find Qt modules
26 #
26 #
27 SCIQLOP_FIND_QT(Core)
27 SCIQLOP_FIND_QT(Core)
28
28
29 #
29 #
30 # Compile the library library
30 # Compile the library library
31 #
31 #
32 FILE (GLOB_RECURSE MODULE_SOURCES
32 FILE (GLOB_RECURSE MODULE_SOURCES
33 ${INCLUDES_DIR}/*.h
33 ${INCLUDES_DIR}/*.h
34 ${SOURCES_DIR}/*.c
34 ${SOURCES_DIR}/*.c
35 ${SOURCES_DIR}/*.cpp
35 ${SOURCES_DIR}/*.cpp
36 ${SOURCES_DIR}/*.h)
36 ${SOURCES_DIR}/*.h)
37
37
38 ADD_LIBRARY(${SQPCORE_LIBRARY_NAME} ${MODULE_SOURCES})
38 ADD_LIBRARY(${SQPCORE_LIBRARY_NAME} ${MODULE_SOURCES})
39 set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD 14)
39 set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD 14)
40 set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
40 set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
41 TARGET_LINK_LIBRARIES(${SQPCORE_LIBRARY_NAME})
41 TARGET_LINK_LIBRARIES(${SQPCORE_LIBRARY_NAME})
42 qt5_use_modules(${SQPCORE_LIBRARY_NAME} Core)
42 qt5_use_modules(${SQPCORE_LIBRARY_NAME} Core)
43
43
44 # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html
44 # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html
45 # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order.
45 # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order.
46 # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets
46 # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets
47 IF(BUILD_SHARED_LIBS)
47 IF(BUILD_SHARED_LIBS)
48 SET_TARGET_PROPERTIES(${SQPCORE_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS "SCIQLOP_EXPORT")
48 SET_TARGET_PROPERTIES(${SQPCORE_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS "SCIQLOP_EXPORT")
49 ELSE()
49 ELSE()
50 TARGET_COMPILE_DEFINITIONS(${SQPCORE_LIBRARY_NAME} PUBLIC "SCIQLOP_STATIC_LIBRARIES")
50 TARGET_COMPILE_DEFINITIONS(${SQPCORE_LIBRARY_NAME} PUBLIC "SCIQLOP_STATIC_LIBRARIES")
51 ENDIF()
51 ENDIF()
52
52
53 # Set the variable to parent scope so that the other projects can copy the
53 # Set the variable to parent scope so that the other projects can copy the
54 # dependent shared libraries
54 # dependent shared libraries
55 SCIQLOP_SET_TO_PARENT_SCOPE(SQPCORE_LIBRARY_NAME)
55 SCIQLOP_SET_TO_PARENT_SCOPE(SQPCORE_LIBRARY_NAME)
56
56
57 # Copy extern shared libraries to the lib folder
57 # Copy extern shared libraries to the lib folder
58 SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPCORE_LIBRARY_NAME} ${EXTERN_SHARED_LIBRARIES})
58 SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPCORE_LIBRARY_NAME} ${EXTERN_SHARED_LIBRARIES})
59
59
60 # Add the files to the list of files to be analyzed
60 # Add the files to the list of files to be analyzed
61 LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES})
61 LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES})
62 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES)
62 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES)
63 # Vera++ exclusion files
63 # Vera++ exclusion files
64 LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt)
64 LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt)
65 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES)
65 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES)
66
66
67 #
67 #
68 # Compile the tests
68 # Compile the tests
69 #
69 #
70 IF(BUILD_TESTS)
70 IF(BUILD_TESTS)
71 INCLUDE_DIRECTORIES(${SOURCES_DIR})
71 INCLUDE_DIRECTORIES(${SOURCES_DIR})
72 FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp)
72 FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp)
73 FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h)
73 FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h)
74 SET( TEST_LIBRARIES ${SQPCORE_LIBRARY_NAME})
74 SET( TEST_LIBRARIES ${SQPCORE_LIBRARY_NAME})
75
75
76 # Set tests resources path
77 SET(RESOURCES_PATH ${CMAKE_CURRENT_SOURCE_DIR}/tests-resources/)
78 add_definitions(-DSCQCORE_TESTS_RESOURCES_PATH="${RESOURCES_PATH}")
79
76 SET(TARGETS_COV)
80 SET(TARGETS_COV)
77 FOREACH( testFile ${TESTS_SOURCES} )
81 FOREACH( testFile ${TESTS_SOURCES} )
78 GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY )
82 GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY )
79 GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE )
83 GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE )
80
84
81 # Add to the list of sources files all the sources in the same
85 # Add to the list of sources files all the sources in the same
82 # directory that aren't another test
86 # directory that aren't another test
83 FILE (GLOB currentTestSources
87 FILE (GLOB currentTestSources
84 ${testDirectory}/*.c
88 ${testDirectory}/*.c
85 ${testDirectory}/*.cpp
89 ${testDirectory}/*.cpp
86 ${testDirectory}/*.h)
90 ${testDirectory}/*.h)
87 LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES})
91 LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES})
88 # LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS})
92 # LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS})
89
93
90 ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources})
94 ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources})
91 set_property(TARGET ${testName} PROPERTY CXX_STANDARD 14)
95 set_property(TARGET ${testName} PROPERTY CXX_STANDARD 14)
92 set_property(TARGET ${testName} PROPERTY CXX_STANDARD_REQUIRED ON)
96 set_property(TARGET ${testName} PROPERTY CXX_STANDARD_REQUIRED ON)
93 TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} )
97 TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} )
94 qt5_use_modules(${testName} Test)
98 qt5_use_modules(${testName} Test)
95
99
96 ADD_TEST( NAME ${testName} COMMAND ${testName} )
100 ADD_TEST( NAME ${testName} COMMAND ${testName} )
97
101
98 SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${EXTERN_SHARED_LIBRARIES})
102 SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${EXTERN_SHARED_LIBRARIES})
99 set(Coverage_NAME ${testName})
103 set(Coverage_NAME ${testName})
100 SETUP_TARGET_FOR_COVERAGE(TARGET ${testName}_coverage OUTPUT ${testFile}-path NAME ${testFile} EXECUTABLE ${testName})
104 SETUP_TARGET_FOR_COVERAGE(TARGET ${testName}_coverage OUTPUT ${testFile}-path NAME ${testFile} EXECUTABLE ${testName})
101 LIST( APPEND TARGETS_COV ${testName}_coverage)
105 LIST( APPEND TARGETS_COV ${testName}_coverage)
102
106
103 ENDFOREACH( testFile )
107 ENDFOREACH( testFile )
104
108
105 add_custom_target(coverage)
109 add_custom_target(coverage)
106
110
107 FOREACH( target_cov ${TARGETS_COV} )
111 FOREACH( target_cov ${TARGETS_COV} )
108 add_custom_command(TARGET coverage PRE_BUILD COMMAND make ${target_cov})
112 add_custom_command(TARGET coverage PRE_BUILD COMMAND make ${target_cov})
109 ENDFOREACH( target_cov )
113 ENDFOREACH( target_cov )
110
114
111 LIST(APPEND testFilesToFormat ${TESTS_SOURCES})
115 LIST(APPEND testFilesToFormat ${TESTS_SOURCES})
112 LIST(APPEND testFilesToFormat ${TESTS_HEADERS})
116 LIST(APPEND testFilesToFormat ${TESTS_HEADERS})
113 LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat})
117 LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat})
114 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
118 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
115 ENDIF(BUILD_TESTS)
119 ENDIF(BUILD_TESTS)
116
120
117 #
121 #
118 # Set the files that must be formatted by clang-format.
122 # Set the files that must be formatted by clang-format.
119 #
123 #
120 LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES})
124 LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES})
121 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
125 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
122
126
123 #
127 #
124 # Set the directories that doxygen must browse to generate the
128 # Set the directories that doxygen must browse to generate the
125 # documentation.
129 # documentation.
126 #
130 #
127 # Source directories:
131 # Source directories:
128 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs")
132 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs")
129 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
133 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
130 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS)
134 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS)
131 # Source directories to exclude from the documentation generation
135 # Source directories to exclude from the documentation generation
132 #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*")
136 #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*")
133 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS)
137 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS)
134
138
135 #
139 #
136 # Set the directories with the sources to analyze and propagate the
140 # Set the directories with the sources to analyze and propagate the
137 # modification to the parent scope
141 # modification to the parent scope
138 #
142 #
139 # Source directories to analyze:
143 # Source directories to analyze:
140 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
144 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
141 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests")
145 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests")
142 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS)
146 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS)
143 # Source directories to exclude from the analysis
147 # Source directories to exclude from the analysis
144 #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir")
148 #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir")
145 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS)
149 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS)
General Comments 5
Under Review
author

Pull request updated. Auto status change to "Under Review"

Changed commits:
  * 1 added
  * 0 removed

Changed files:
  * M core/CMakeLists.txt
Approved
author

Status change > Approved

You need to be logged in to leave comments. Login now