##// END OF EJS Templates
Add dependencies between target to avoid bug compilation when building...
perrinel -
r104:e9600607c0d7
parent child
Show More
@@ -1,147 +1,152
1
1
2 ## sciqlop - CMakeLists.txt
2 ## sciqlop - CMakeLists.txt
3 SET(EXECUTABLE_NAME "sciqlop")
3 SET(EXECUTABLE_NAME "sciqlop")
4 SCIQLOP_SET_TO_PARENT_SCOPE(EXECUTABLE_NAME)
4 SCIQLOP_SET_TO_PARENT_SCOPE(EXECUTABLE_NAME)
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 SET(UI_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/ui)
7 SET(UI_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/ui)
8 SET(RES_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/resources)
8 SET(RES_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/resources)
9
9
10 # Include gui directory
10 # Include gui directory
11 include_directories("${INCLUDES_DIR}")
11 include_directories("${INCLUDES_DIR}")
12
12
13 #
13 #
14 # Find Qt modules
14 # Find Qt modules
15 #
15 #
16 SCIQLOP_FIND_QT(Core Widgets)
16 SCIQLOP_FIND_QT(Core Widgets)
17
17
18
18 #
19 #
19 # Find dependent libraries
20 # Find dependent libraries
20 # ========================
21 # ========================
21 find_package(sciqlop-gui)
22 find_package(sciqlop-gui)
22
23
23 SET(LIBRARIES ${SCIQLOP-GUI_LIBRARIES})
24 SET(LIBRARIES ${SCIQLOP-GUI_LIBRARIES})
24 SET(EXTERN_SHARED_LIBRARIES)
25 SET(EXTERN_SHARED_LIBRARIES)
25
26
26 INCLUDE_DIRECTORIES(${SCIQLOP-GUI_INCLUDE_DIR})
27 INCLUDE_DIRECTORIES(${SCIQLOP-GUI_INCLUDE_DIR})
27
28
28 # Add sqpcore to the list of libraries to use
29 # Add sqpcore to the list of libraries to use
29 list(APPEND LIBRARIES ${SQPCORE_LIBRARY_NAME})
30 list(APPEND LIBRARIES ${SQPCORE_LIBRARY_NAME})
30
31
31 # Include core directory
32 # Include core directory
32 include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../core/include")
33 include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../core/include")
33
34
34 # Add dependent shared libraries
35 # Add dependent shared libraries
35 list(APPEND SHARED_LIBRARIES ${SQPCORE_SHARED_LIBRARIES})
36 list(APPEND SHARED_LIBRARIES ${SQPCORE_SHARED_LIBRARIES})
36
37
37 # Retrieve the location of the dynamic library to copy it to the output path
38 # Retrieve the location of the dynamic library to copy it to the output path
38 #get_property(sqpcoreLocation TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY LOCATION)
39 #get_property(sqpcoreLocation TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY LOCATION)
39 list(APPEND SHARED_LIBRARIES_FROM_TARGETS ${sqpcoreLocation})
40 list(APPEND SHARED_LIBRARIES_FROM_TARGETS ${sqpcoreLocation})
40
41
41 # Ui files
42 # Ui files
42 FILE (GLOB_RECURSE PROJECT_FORMS ${UI_FOLDER}/*.ui)
43 FILE (GLOB_RECURSE PROJECT_FORMS ${UI_FOLDER}/*.ui)
43
44
44 #
45 #
45 # Compile the application
46 # Compile the application
46 #
47 #
47 FILE (GLOB_RECURSE APPLICATION_SOURCES
48 FILE (GLOB_RECURSE APPLICATION_SOURCES
48 ${INCLUDES_DIR}/*.h
49 ${INCLUDES_DIR}/*.h
49 ${SOURCES_DIR}/*.c
50 ${SOURCES_DIR}/*.c
50 ${SOURCES_DIR}/*.cpp
51 ${SOURCES_DIR}/*.cpp
51 ${SOURCES_DIR}/*.h
52 ${SOURCES_DIR}/*.h
52 ${PROJECT_FORMS})
53 ${PROJECT_FORMS})
53
54
54 FILE (GLOB_RECURSE APPLICATION_RESOURCES ${RES_FOLDER}/*.qrc)
55 FILE (GLOB_RECURSE APPLICATION_RESOURCES ${RES_FOLDER}/*.qrc)
55
56
56 QT5_ADD_RESOURCES(RCC_HDRS ${APPLICATION_RESOURCES} )
57 QT5_ADD_RESOURCES(RCC_HDRS ${APPLICATION_RESOURCES} )
57
58
58 QT5_WRAP_UI(UIS_HDRS
59 QT5_WRAP_UI(UIS_HDRS
59 ${PROJECT_FORMS}
60 ${PROJECT_FORMS}
60 )
61 )
61
62
62
63
63 ADD_EXECUTABLE(${EXECUTABLE_NAME} ${APPLICATION_SOURCES} ${RCC_HDRS} ${UIS_HDRS})
64 ADD_EXECUTABLE(${EXECUTABLE_NAME} ${APPLICATION_SOURCES} ${RCC_HDRS} ${UIS_HDRS})
64 set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD 14)
65 set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD 14)
65 set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
66 set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
66 target_link_libraries(${EXECUTABLE_NAME}
67 target_link_libraries(${EXECUTABLE_NAME}
67 ${LIBRARIES})
68 ${LIBRARIES})
68
69
69 # Link with Qt5 modules
70 # Link with Qt5 modules
70 qt5_use_modules(${EXECUTABLE_NAME} Core Widgets)
71 qt5_use_modules(${EXECUTABLE_NAME} Core Widgets)
71
72
72
73
74 add_dependencies(${EXECUTABLE_NAME} ${SQPGUI_LIBRARY_NAME} ${SQPCORE_LIBRARY_NAME})
75
76
77
73 # Add the files to the list of files to be analyzed
78 # Add the files to the list of files to be analyzed
74 LIST(APPEND CHECKSTYLE_INPUT_FILES ${APPLICATION_SOURCES})
79 LIST(APPEND CHECKSTYLE_INPUT_FILES ${APPLICATION_SOURCES})
75 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES)
80 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES)
76 # Vera++ exclusion files
81 # Vera++ exclusion files
77 LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt)
82 LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt)
78 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES)
83 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES)
79
84
80 #
85 #
81 # Compile the tests
86 # Compile the tests
82 #
87 #
83 IF(BUILD_TESTS)
88 IF(BUILD_TESTS)
84
89
85 INCLUDE_DIRECTORIES(${SOURCES_DIR})
90 INCLUDE_DIRECTORIES(${SOURCES_DIR})
86 FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp)
91 FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp)
87 FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h)
92 FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h)
88 SET( TEST_LIBRARIES ${LIBRARIES})
93 SET( TEST_LIBRARIES ${LIBRARIES})
89
94
90 FOREACH( testFile ${TESTS_SOURCES} )
95 FOREACH( testFile ${TESTS_SOURCES} )
91 GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY )
96 GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY )
92 GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE )
97 GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE )
93
98
94 # Add to the list of sources files all the sources in the same
99 # Add to the list of sources files all the sources in the same
95 # directory that aren't another test
100 # directory that aren't another test
96 FILE (GLOB currentTestSources
101 FILE (GLOB currentTestSources
97 ${testDirectory}/*.c
102 ${testDirectory}/*.c
98 ${testDirectory}/*.cpp
103 ${testDirectory}/*.cpp
99 ${testDirectory}/*.h)
104 ${testDirectory}/*.h)
100 LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES})
105 LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES})
101 LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS})
106 LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS})
102
107
103 ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources})
108 ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources})
104 TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES})
109 TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES})
105 qt5_use_modules(${testName} Test)
110 qt5_use_modules(${testName} Test)
106
111
107 ADD_TEST( NAME ${testName} COMMAND ${testName} )
112 ADD_TEST( NAME ${testName} COMMAND ${testName} )
108
113
109 SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName})
114 SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName})
110 ENDFOREACH( testFile )
115 ENDFOREACH( testFile )
111
116
112 LIST(APPEND testFilesToFormat ${TESTS_SOURCES})
117 LIST(APPEND testFilesToFormat ${TESTS_SOURCES})
113 LIST(APPEND testFilesToFormat ${TESTS_HEADERS})
118 LIST(APPEND testFilesToFormat ${TESTS_HEADERS})
114 LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat})
119 LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat})
115
120
116 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
121 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
117 ENDIF(BUILD_TESTS)
122 ENDIF(BUILD_TESTS)
118
123
119 #
124 #
120 # Set the files that must be formatted by clang-format.
125 # Set the files that must be formatted by clang-format.
121 #
126 #
122 LIST (APPEND FORMATTING_INPUT_FILES ${APPLICATION_SOURCES})
127 LIST (APPEND FORMATTING_INPUT_FILES ${APPLICATION_SOURCES})
123 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
128 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
124
129
125 #
130 #
126 # Set the directories that doxygen must browse to generate the
131 # Set the directories that doxygen must browse to generate the
127 # documentation.
132 # documentation.
128 #
133 #
129 # Source directories:
134 # Source directories:
130 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs")
135 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs")
131 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
136 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
132 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS)
137 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS)
133 # Source directories to exclude from the documentation generation
138 # Source directories to exclude from the documentation generation
134 #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*")
139 #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*")
135 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS)
140 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS)
136
141
137 #
142 #
138 # Set the directories with the sources to analyze and propagate the
143 # Set the directories with the sources to analyze and propagate the
139 # modification to the parent scope
144 # modification to the parent scope
140 #
145 #
141 # Source directories to analyze:
146 # Source directories to analyze:
142 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
147 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
143 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests")
148 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests")
144 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS)
149 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS)
145 # Source directories to exclude from the analysis
150 # Source directories to exclude from the analysis
146 #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir")
151 #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir")
147 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS)
152 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS)
@@ -1,60 +1,59
1 #
1 #
2 # Generate the source package of SciqLop.
2 # Generate the source package of SciqLop.
3 #
3 #
4
4
5 install(DIRECTORY
5 install(DIRECTORY
6 ${EXECUTABLE_OUTPUT_PATH}
6 ${EXECUTABLE_OUTPUT_PATH}
7 DESTINATION "."
7 DESTINATION "."
8 USE_SOURCE_PERMISSIONS
8 USE_SOURCE_PERMISSIONS
9 COMPONENT CORE
9 COMPONENT CORE
10 PATTERN "*.a" EXCLUDE
10 PATTERN "*.a" EXCLUDE
11 )
11 )
12
12
13 set(EXECUTABLEDOTEXTENSION)
13 set(EXECUTABLEDOTEXTENSION)
14 if(WIN32)
14 if(WIN32)
15 set(EXECUTABLEDOTEXTENSION ".exe")
15 set(EXECUTABLEDOTEXTENSION ".exe")
16 endif(WIN32)
16 endif(WIN32)
17 set (SCIQLOP_EXE_LOCATION ${EXECUTABLE_OUTPUT_PATH}/${EXECUTABLE_NAME}${EXECUTABLEDOTEXTENSION})
17 set (SCIQLOP_EXE_LOCATION ${EXECUTABLE_OUTPUT_PATH}/${EXECUTABLE_NAME}${EXECUTABLEDOTEXTENSION})
18
18
19 if(WIN32)
19 if(WIN32)
20 include ("cmake/sciqlop_package_qt.cmake")
20 include ("cmake/sciqlop_package_qt.cmake")
21 endif(WIN32)
21 endif(WIN32)
22
22
23
23
24 SET (CPACK_PACKAGE_VENDOR "CNRS")
24 SET (CPACK_PACKAGE_VENDOR "CNRS")
25 SET (CPACK_PACKAGE_VERSION_MAJOR "${SCIQLOP_VERSION_MAJOR}")
25 SET (CPACK_PACKAGE_VERSION_MAJOR "${SCIQLOP_VERSION_MAJOR}")
26 SET (CPACK_PACKAGE_VERSION_MINOR "${SCIQLOP_VERSION_MINOR}")
26 SET (CPACK_PACKAGE_VERSION_MINOR "${SCIQLOP_VERSION_MINOR}")
27 SET (CPACK_PACKAGE_VERSION_PATCH "${SCIQLOP_VERSION_PATCH}${SCIQLOP_VERSION_SUFFIX}")
27 SET (CPACK_PACKAGE_VERSION_PATCH "${SCIQLOP_VERSION_PATCH}${SCIQLOP_VERSION_SUFFIX}")
28 SET (CPACK_PACKAGE_VERSION "${SCIQLOP_VERSION}")
28 SET (CPACK_PACKAGE_VERSION "${SCIQLOP_VERSION}")
29 SET (CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE)
29 SET (CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE)
30 SET (CPACK_PACKAGE_CONTACT "nicolas.aunai@lpp.polytechnique.fr")
30 SET (CPACK_PACKAGE_CONTACT "nicolas.aunai@lpp.polytechnique.fr")
31 SET(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_CURRENT_SOURCE_DIR}/README.md)
31 SET(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_CURRENT_SOURCE_DIR}/README.md)
32 # SET(CPACK_RESOURCE_FILE_WELCOME ${CMAKE_CURRENT_SOURCE_DIR}/WARN.txt)
32 # SET(CPACK_RESOURCE_FILE_WELCOME ${CMAKE_CURRENT_SOURCE_DIR}/WARN.txt)
33 SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE)
33 SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE)
34 # SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${PROJECT_NAME}-${PROJECT_VERSION})
34 # SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${PROJECT_NAME}-${PROJECT_VERSION})
35 SET(FULLBUILD ON)
35 SET(FULLBUILD ON)
36
36
37 SET(CPACK_PACKAGE_NAME ${PROJECT_NAME})
37 SET(CPACK_PACKAGE_NAME ${PROJECT_NAME})
38 SET(CPACK_GENERATOR "NSIS")
38 SET(CPACK_GENERATOR "NSIS")
39 SET(CPACK_MONOLITHIC_INSTALL 1)
39 SET(CPACK_MONOLITHIC_INSTALL 1)
40 #SET(CPACK_COMPONENTS_ALL sciqlop qt)
40 #SET(CPACK_COMPONENTS_ALL sciqlop qt)
41 SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-Setup")
41 SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-Setup")
42 SET(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_NAME})
42 SET(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_NAME})
43
43
44 set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME})
44 set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME})
45 message("exepath" ${CPACK_PACKAGE_INSTALL_DIRECTORY})
46
45
47 if (WIN32)
46 if (WIN32)
48 SET(CPACK_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
47 SET(CPACK_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
49 SET(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
48 SET(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
50 SET(CPACK_NSIS_COMPONENT_INSTALL ON)
49 SET(CPACK_NSIS_COMPONENT_INSTALL ON)
51 SET(CPACK_SYSTEM_NAME "MinGW32")
50 SET(CPACK_SYSTEM_NAME "MinGW32")
52 SET(CPACK_PACKAGING_INSTALL_PREFIX "")
51 SET(CPACK_PACKAGING_INSTALL_PREFIX "")
53 #SET(CPACK_GENERATOR "NSIS")
52 #SET(CPACK_GENERATOR "NSIS")
54 SET(CPACK_NSIS_DISPLAY_NAME ${PROJECT_NAME})
53 SET(CPACK_NSIS_DISPLAY_NAME ${PROJECT_NAME})
55 SET(CPACK_NSIS_MUI_FINISHPAGE_RUN ${SCIQLOP_EXECUTABLE_NAME})
54 SET(CPACK_NSIS_MUI_FINISHPAGE_RUN ${SCIQLOP_EXECUTABLE_NAME})
56 SET(CPACK_NSIS_MUI_ICON ${SCIQLOP_EXECUTABLE_ICON_LOCATION})
55 SET(CPACK_NSIS_MUI_ICON ${SCIQLOP_EXECUTABLE_ICON_LOCATION})
57 SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\${SCIQLOP_EXECUTABLE_NAME}.exe")
56 SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\${SCIQLOP_EXECUTABLE_NAME}.exe")
58 endif (WIN32)
57 endif (WIN32)
59
58
60 INCLUDE(CPack)
59 INCLUDE(CPack)
@@ -1,160 +1,163
1
1
2 ## gui - CMakeLists.txt
2 ## gui - CMakeLists.txt
3 STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX)
3 STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX)
4 SET(SQPGUI_LIBRARY_NAME "${LIBRARY_PREFFIX}_gui${DEBUG_SUFFIX}")
4 SET(SQPGUI_LIBRARY_NAME "${LIBRARY_PREFFIX}_gui${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 SET(UI_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/ui")
7 SET(UI_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/ui")
8 SET(RES_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/resources")
8 SET(RES_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/resources")
9
9
10 # Include gui directory
10 # Include gui directory
11 include_directories("${INCLUDES_DIR}")
11 include_directories("${INCLUDES_DIR}")
12 include_directories("${CMAKE_CURRENT_BINARY_DIR}")
12 include_directories("${CMAKE_CURRENT_BINARY_DIR}")
13
13
14 # Set a variable to display a warning in the version files.
14 # Set a variable to display a warning in the version files.
15 SET(SCIQLOP_CMAKE_GENERATION_WARNING "DON'T CHANGE THIS FILE. AUTOGENERATED BY CMAKE.")
15 SET(SCIQLOP_CMAKE_GENERATION_WARNING "DON'T CHANGE THIS FILE. AUTOGENERATED BY CMAKE.")
16
16
17 #
17 #
18 # Find Qt modules
18 # Find Qt modules
19 #
19 #
20 SCIQLOP_FIND_QT(Core Widgets PrintSupport)
20 SCIQLOP_FIND_QT(Core Widgets PrintSupport)
21
21
22 #
22 #
23 # Find dependent libraries
23 # Find dependent libraries
24 # ========================
24 # ========================
25 find_package(sciqlop-core)
25 find_package(sciqlop-core)
26
26
27 SET(LIBRARIES ${SCIQLOP-CORE_LIBRARIES})
27 SET(LIBRARIES ${SCIQLOP-CORE_LIBRARIES})
28
28
29 INCLUDE_DIRECTORIES(${SCIQLOP-CORE_INCLUDE_DIR})
29 INCLUDE_DIRECTORIES(${SCIQLOP-CORE_INCLUDE_DIR})
30
30
31 # Add sqpcore to the list of libraries to use
31 # Add sqpcore to the list of libraries to use
32 list(APPEND LIBRARIES ${SQPCORE_LIBRARY_NAME})
32 list(APPEND LIBRARIES ${SQPCORE_LIBRARY_NAME})
33
33
34 # Add dependent shared libraries
34 # Add dependent shared libraries
35 list(APPEND SHARED_LIBRARIES ${SQPCORE_SHARED_LIBRARIES})
35 list(APPEND SHARED_LIBRARIES ${SQPCORE_SHARED_LIBRARIES})
36
36
37
37
38 # Ui files
38 # Ui files
39 FILE (GLOB_RECURSE PROJECT_FORMS ${UI_FOLDER}/*.ui)
39 FILE (GLOB_RECURSE PROJECT_FORMS ${UI_FOLDER}/*.ui)
40
40
41 # Resources files
41 # Resources files
42 FILE (GLOB_RECURSE PROJECT_RESOURCES ${RES_FOLDER}/*.qrc)
42 FILE (GLOB_RECURSE PROJECT_RESOURCES ${RES_FOLDER}/*.qrc)
43
43
44 #
44 #
45 # Compile the library library
45 # Compile the library library
46 #
46 #
47 FILE (GLOB_RECURSE MODULE_SOURCES
47 FILE (GLOB_RECURSE MODULE_SOURCES
48 ${INCLUDES_DIR}/*.h
48 ${INCLUDES_DIR}/*.h
49 ${SOURCES_DIR}/*.c
49 ${SOURCES_DIR}/*.c
50 ${SOURCES_DIR}/*.cpp
50 ${SOURCES_DIR}/*.cpp
51 ${SOURCES_DIR}/*.h
51 ${SOURCES_DIR}/*.h
52 ${PROJECT_FORMS})
52 ${PROJECT_FORMS})
53
53
54 QT5_ADD_RESOURCES(RCC_HDRS
54 QT5_ADD_RESOURCES(RCC_HDRS
55 ${PROJECT_RESOURCES}
55 ${PROJECT_RESOURCES}
56 )
56 )
57
57
58 QT5_WRAP_UI(UIS_HDRS
58 QT5_WRAP_UI(UIS_HDRS
59 ${PROJECT_FORMS}
59 ${PROJECT_FORMS}
60 )
60 )
61
61
62
62
63 ADD_LIBRARY(${SQPGUI_LIBRARY_NAME} ${MODULE_SOURCES} ${UIS_HDRS} ${RCC_HDRS})
63 ADD_LIBRARY(${SQPGUI_LIBRARY_NAME} ${MODULE_SOURCES} ${UIS_HDRS} ${RCC_HDRS})
64 set_property(TARGET ${SQPGUI_LIBRARY_NAME} PROPERTY CXX_STANDARD 14)
64 set_property(TARGET ${SQPGUI_LIBRARY_NAME} PROPERTY CXX_STANDARD 14)
65 set_property(TARGET ${SQPGUI_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
65 set_property(TARGET ${SQPGUI_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
66
66
67 TARGET_LINK_LIBRARIES(${SQPGUI_LIBRARY_NAME} ${LIBRARIES})
67 TARGET_LINK_LIBRARIES(${SQPGUI_LIBRARY_NAME} ${LIBRARIES})
68 qt5_use_modules(${SQPGUI_LIBRARY_NAME} Core Widgets PrintSupport)
68 qt5_use_modules(${SQPGUI_LIBRARY_NAME} Core Widgets PrintSupport)
69
69
70 add_dependencies(${SQPGUI_LIBRARY_NAME} ${SQPCORE_LIBRARY_NAME})
71
72
70 # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html
73 # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html
71 # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order.
74 # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order.
72 # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets
75 # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets
73 IF(BUILD_SHARED_LIBS)
76 IF(BUILD_SHARED_LIBS)
74 SET_TARGET_PROPERTIES(${SQPGUI_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS "SCIQLOP_EXPORT")
77 SET_TARGET_PROPERTIES(${SQPGUI_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS "SCIQLOP_EXPORT")
75 ELSE()
78 ELSE()
76 TARGET_COMPILE_DEFINITIONS(${SQPGUI_LIBRARY_NAME} PUBLIC "SCIQLOP_STATIC_LIBRARIES")
79 TARGET_COMPILE_DEFINITIONS(${SQPGUI_LIBRARY_NAME} PUBLIC "SCIQLOP_STATIC_LIBRARIES")
77 ENDIF()
80 ENDIF()
78
81
79 # Set the variable to parent scope so that the other projects can copy the
82 # Set the variable to parent scope so that the other projects can copy the
80 # dependent shared libraries
83 # dependent shared libraries
81 SCIQLOP_SET_TO_PARENT_SCOPE(SQPGUI_LIBRARY_NAME)
84 SCIQLOP_SET_TO_PARENT_SCOPE(SQPGUI_LIBRARY_NAME)
82
85
83 # Copy extern shared libraries to the lib folder
86 # Copy extern shared libraries to the lib folder
84 SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPGUI_LIBRARY_NAME})
87 SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPGUI_LIBRARY_NAME})
85
88
86 # Add the files to the list of files to be analyzed
89 # Add the files to the list of files to be analyzed
87 LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES})
90 LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES})
88 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES)
91 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES)
89 # Vera++ exclusion files
92 # Vera++ exclusion files
90 LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt)
93 LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt)
91 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES)
94 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES)
92
95
93 #
96 #
94 # Compile the tests
97 # Compile the tests
95 #
98 #
96 IF(BUILD_TESTS)
99 IF(BUILD_TESTS)
97 INCLUDE_DIRECTORIES(${SOURCES_DIR})
100 INCLUDE_DIRECTORIES(${SOURCES_DIR})
98 FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp)
101 FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp)
99 FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h)
102 FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h)
100 SET( TEST_LIBRARIES ${SQPGUI_LIBRARY_NAME})
103 SET( TEST_LIBRARIES ${SQPGUI_LIBRARY_NAME})
101
104
102 FOREACH( testFile ${TESTS_SOURCES} )
105 FOREACH( testFile ${TESTS_SOURCES} )
103 GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY )
106 GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY )
104 GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE )
107 GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE )
105
108
106 # Add to the list of sources files all the sources in the same
109 # Add to the list of sources files all the sources in the same
107 # directory that aren't another test
110 # directory that aren't another test
108 FILE (GLOB currentTestSources
111 FILE (GLOB currentTestSources
109 ${testDirectory}/*.c
112 ${testDirectory}/*.c
110 ${testDirectory}/*.cpp
113 ${testDirectory}/*.cpp
111 ${testDirectory}/*.h)
114 ${testDirectory}/*.h)
112 LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES})
115 LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES})
113 # LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS})
116 # LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS})
114
117
115 ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources})
118 ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources})
116 set_property(TARGET ${testName} PROPERTY CXX_STANDARD 14)
119 set_property(TARGET ${testName} PROPERTY CXX_STANDARD 14)
117 set_property(TARGET ${testName} PROPERTY CXX_STANDARD_REQUIRED ON)
120 set_property(TARGET ${testName} PROPERTY CXX_STANDARD_REQUIRED ON)
118 TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} )
121 TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} )
119 qt5_use_modules(${testName} Test)
122 qt5_use_modules(${testName} Test)
120
123
121 ADD_TEST( NAME ${testName} COMMAND ${testName} )
124 ADD_TEST( NAME ${testName} COMMAND ${testName} )
122
125
123 SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${EXTERN_SHARED_LIBRARIES})
126 SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${EXTERN_SHARED_LIBRARIES})
124 ENDFOREACH( testFile )
127 ENDFOREACH( testFile )
125
128
126 LIST(APPEND testFilesToFormat ${TESTS_SOURCES})
129 LIST(APPEND testFilesToFormat ${TESTS_SOURCES})
127 LIST(APPEND testFilesToFormat ${TESTS_HEADERS})
130 LIST(APPEND testFilesToFormat ${TESTS_HEADERS})
128 LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat})
131 LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat})
129 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
132 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
130 ENDIF(BUILD_TESTS)
133 ENDIF(BUILD_TESTS)
131
134
132 #
135 #
133 # Set the files that must be formatted by clang-format.
136 # Set the files that must be formatted by clang-format.
134 #
137 #
135 LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES})
138 LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES})
136 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
139 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
137
140
138 #
141 #
139 # Set the directories that doxygen must browse to generate the
142 # Set the directories that doxygen must browse to generate the
140 # documentation.
143 # documentation.
141 #
144 #
142 # Source directories:
145 # Source directories:
143 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs")
146 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs")
144 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
147 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
145 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS)
148 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS)
146 # Source directories to exclude from the documentation generation
149 # Source directories to exclude from the documentation generation
147 #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*")
150 #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*")
148 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS)
151 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS)
149
152
150 #
153 #
151 # Set the directories with the sources to analyze and propagate the
154 # Set the directories with the sources to analyze and propagate the
152 # modification to the parent scope
155 # modification to the parent scope
153 #
156 #
154 # Source directories to analyze:
157 # Source directories to analyze:
155 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
158 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
156 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests")
159 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests")
157 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS)
160 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS)
158 # Source directories to exclude from the analysis
161 # Source directories to exclude from the analysis
159 #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir")
162 #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir")
160 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS)
163 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS)
General Comments 0
You need to be logged in to leave comments. Login now