@@ -1,96 +1,97 | |||||
1 | cmake_minimum_required(VERSION 3.6) |
|
1 | cmake_minimum_required(VERSION 3.6) | |
2 | project(SciQLOP CXX) |
|
2 | project(SciQLOP CXX) | |
3 |
|
3 | |||
4 | include(GNUInstallDirs) |
|
4 | include(GNUInstallDirs) | |
5 |
|
5 | |||
6 | SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/cmake") |
|
6 | SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/cmake") | |
7 |
|
7 | |||
8 | OPTION (CPPCHECK "Analyzes the source code with cppcheck" OFF) |
|
8 | OPTION (CPPCHECK "Analyzes the source code with cppcheck" OFF) | |
9 | OPTION (CLANG_TIDY "Analyzes the source code with Clang Tidy" OFF) |
|
9 | OPTION (CLANG_TIDY "Analyzes the source code with Clang Tidy" OFF) | |
10 | OPTION (IWYU "Analyzes the source code with Include What You Use" OFF) |
|
10 | OPTION (IWYU "Analyzes the source code with Include What You Use" OFF) | |
11 | OPTION (Coverage "Enables code coverage" OFF) |
|
11 | OPTION (Coverage "Enables code coverage" OFF) | |
12 | OPTION (BUILD_APP "Build SciQLop application" ON) |
|
12 | OPTION (BUILD_APP "Build SciQLop application" ON) | |
13 | OPTION (BUILD_CORE "Build SciQLop Core module" ON) |
|
13 | OPTION (BUILD_CORE "Build SciQLop Core module" ON) | |
14 | OPTION (BUILD_GUI "Build SciQLop GUI module" ON) |
|
14 | OPTION (BUILD_GUI "Build SciQLop GUI module" ON) | |
15 | OPTION (BUILD_PLUGINS "Build SciQLop plugins" ON) |
|
15 | OPTION (BUILD_PLUGINS "Build SciQLop plugins" ON) | |
|
16 | OPTION (ENABLE_WIN32_CONSOLE "Enables console on Win32 platfrom" OFF) | |||
16 |
|
17 | |||
17 | set(CMAKE_CXX_STANDARD 17) |
|
18 | set(CMAKE_CXX_STANDARD 17) | |
18 |
|
19 | |||
19 | set(CMAKE_AUTOMOC ON) |
|
20 | set(CMAKE_AUTOMOC ON) | |
20 | #https://gitlab.kitware.com/cmake/cmake/issues/15227 |
|
21 | #https://gitlab.kitware.com/cmake/cmake/issues/15227 | |
21 | #set(CMAKE_AUTOUIC ON) |
|
22 | #set(CMAKE_AUTOUIC ON) | |
22 | if(POLICY CMP0071) |
|
23 | if(POLICY CMP0071) | |
23 | cmake_policy(SET CMP0071 OLD) |
|
24 | cmake_policy(SET CMP0071 OLD) | |
24 | endif() |
|
25 | endif() | |
25 | set(CMAKE_AUTORCC ON) |
|
26 | set(CMAKE_AUTORCC ON) | |
26 | set(CMAKE_INCLUDE_CURRENT_DIR ON) |
|
27 | set(CMAKE_INCLUDE_CURRENT_DIR ON) | |
27 |
|
28 | |||
28 | if(NOT DEFINED CMAKE_INSTALL_RPATH_USE_LINK_PATH) |
|
29 | if(NOT DEFINED CMAKE_INSTALL_RPATH_USE_LINK_PATH) | |
29 | set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) |
|
30 | set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) | |
30 | endif() |
|
31 | endif() | |
31 | if(NOT DEFINED CMAKE_MACOSX_RPATH) |
|
32 | if(NOT DEFINED CMAKE_MACOSX_RPATH) | |
32 | set(CMAKE_MACOSX_RPATH TRUE) |
|
33 | set(CMAKE_MACOSX_RPATH TRUE) | |
33 | endif() |
|
34 | endif() | |
34 |
|
35 | |||
35 | if(NOT CMAKE_BUILD_TYPE) |
|
36 | if(NOT CMAKE_BUILD_TYPE) | |
36 | set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE) |
|
37 | set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE) | |
37 | endif() |
|
38 | endif() | |
38 | set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g3") |
|
39 | set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g3") | |
39 |
|
40 | |||
40 | find_package(Qt5 COMPONENTS Core Widgets Network PrintSupport Svg Test REQUIRED) |
|
41 | find_package(Qt5 COMPONENTS Core Widgets Network PrintSupport Svg Test REQUIRED) | |
41 |
|
42 | |||
42 | IF(CPPCHECK) |
|
43 | IF(CPPCHECK) | |
43 | set(CMAKE_CXX_CPPCHECK "cppcheck;--enable=warning,style") |
|
44 | set(CMAKE_CXX_CPPCHECK "cppcheck;--enable=warning,style") | |
44 | ENDIF(CPPCHECK) |
|
45 | ENDIF(CPPCHECK) | |
45 |
|
46 | |||
46 | IF(CLANG_TIDY) |
|
47 | IF(CLANG_TIDY) | |
47 | set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-style=file;-checks=*") |
|
48 | set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-style=file;-checks=*") | |
48 | ENDIF(CLANG_TIDY) |
|
49 | ENDIF(CLANG_TIDY) | |
49 |
|
50 | |||
50 | IF(IWYU) |
|
51 | IF(IWYU) | |
51 | set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "include-what-you-use") |
|
52 | set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "include-what-you-use") | |
52 | ENDIF(IWYU) |
|
53 | ENDIF(IWYU) | |
53 |
|
54 | |||
54 | IF(Coverage) |
|
55 | IF(Coverage) | |
55 | set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -g -O0 -Wall -W -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fprofile-arcs -ftest-coverage") |
|
56 | set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -g -O0 -Wall -W -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fprofile-arcs -ftest-coverage") | |
56 | set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g -O0 -Wall -W -Wshadow -Wunused-variable \ |
|
57 | set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g -O0 -Wall -W -Wshadow -Wunused-variable \ | |
57 | -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers \ |
|
58 | -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers \ | |
58 | -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fprofile-arcs -ftest-coverage") |
|
59 | -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fprofile-arcs -ftest-coverage") | |
59 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage") |
|
60 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage") | |
60 |
|
61 | |||
61 | add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gcov.html |
|
62 | add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gcov.html | |
62 | COMMAND gcovr --exclude='.*Test.*' --exclude='.*external.*' --object-directory ${CMAKE_BINARY_DIR} -r ${CMAKE_SOURCE_DIR} --html --html-details -o ${CMAKE_CURRENT_BINARY_DIR}/gcov.html |
|
63 | COMMAND gcovr --exclude='.*Test.*' --exclude='.*external.*' --object-directory ${CMAKE_BINARY_DIR} -r ${CMAKE_SOURCE_DIR} --html --html-details -o ${CMAKE_CURRENT_BINARY_DIR}/gcov.html | |
63 | ) |
|
64 | ) | |
64 | add_custom_target(gcovr |
|
65 | add_custom_target(gcovr | |
65 | DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gcov.html gcovr |
|
66 | DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gcov.html gcovr | |
66 | ) |
|
67 | ) | |
67 | add_custom_target(show_coverage |
|
68 | add_custom_target(show_coverage | |
68 | COMMAND xdg-open ${CMAKE_CURRENT_BINARY_DIR}/gcov.html |
|
69 | COMMAND xdg-open ${CMAKE_CURRENT_BINARY_DIR}/gcov.html | |
69 | DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gcov.html gcovr |
|
70 | DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gcov.html gcovr | |
70 | ) |
|
71 | ) | |
71 | ENDIF(Coverage) |
|
72 | ENDIF(Coverage) | |
72 |
|
73 | |||
73 | enable_testing() |
|
74 | enable_testing() | |
74 |
|
75 | |||
75 | if(BUILD_CORE) |
|
76 | if(BUILD_CORE) | |
76 | find_package(SciQLOPCore CONFIG QUIET) |
|
77 | find_package(SciQLOPCore CONFIG QUIET) | |
77 | if (NOT SciQLOPCore_FOUND) |
|
78 | if (NOT SciQLOPCore_FOUND) | |
78 | if(NOT IS_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/core) |
|
79 | if(NOT IS_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/core) | |
79 | message("Init submodule Core") |
|
80 | message("Init submodule Core") | |
80 | execute_process(COMMAND git submodule init core WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) |
|
81 | execute_process(COMMAND git submodule init core WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) | |
81 | execute_process(COMMAND git submodule update core WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) |
|
82 | execute_process(COMMAND git submodule update core WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) | |
82 | endif() |
|
83 | endif() | |
83 | add_subdirectory(core) |
|
84 | add_subdirectory(core) | |
84 | endif() |
|
85 | endif() | |
85 | endif() |
|
86 | endif() | |
86 |
|
87 | |||
87 | if(BUILD_GUI) |
|
88 | if(BUILD_GUI) | |
88 | add_subdirectory(gui) |
|
89 | add_subdirectory(gui) | |
89 | endif() |
|
90 | endif() | |
90 | if(BUILD_APP) |
|
91 | if(BUILD_APP) | |
91 | add_subdirectory(app) |
|
92 | add_subdirectory(app) | |
92 | endif() |
|
93 | endif() | |
93 | if(BUILD_PLUGINS) |
|
94 | if(BUILD_PLUGINS) | |
94 | add_subdirectory(plugins) |
|
95 | add_subdirectory(plugins) | |
95 | endif() |
|
96 | endif() | |
96 | #add_subdirectory(docs) |
|
97 | #add_subdirectory(docs) |
@@ -1,42 +1,47 | |||||
1 | include_directories(include) |
|
1 | include_directories(include) | |
2 |
|
2 | |||
3 | FILE (GLOB_RECURSE app_SRCS |
|
3 | FILE (GLOB_RECURSE app_SRCS | |
4 | include/*.h |
|
4 | include/*.h | |
5 | src/*.cpp |
|
5 | src/*.cpp | |
6 | resources/*.qrc |
|
6 | resources/*.qrc | |
7 | ) |
|
7 | ) | |
8 |
|
8 | |||
9 | QT5_WRAP_UI(UiGenerated_SRCS |
|
9 | QT5_WRAP_UI(UiGenerated_SRCS | |
10 | ui/MainWindow.ui |
|
10 | ui/MainWindow.ui | |
11 | ) |
|
11 | ) | |
12 |
|
12 | |||
13 | add_executable(sciqlopapp WIN32 ${app_SRCS} ${UiGenerated_SRCS}) |
|
13 | if(ENABLE_WIN32_CONSOLE) | |
|
14 | add_executable(sciqlopapp ${app_SRCS} ${UiGenerated_SRCS}) | |||
|
15 | else() | |||
|
16 | add_executable(sciqlopapp WIN32 ${app_SRCS} ${UiGenerated_SRCS}) | |||
|
17 | endif() | |||
|
18 | ||||
14 | if(NOT BUILD_SHARED_LIBS) |
|
19 | if(NOT BUILD_SHARED_LIBS) | |
15 | add_definitions(-DQT_STATICPLUGIN) |
|
20 | add_definitions(-DQT_STATICPLUGIN) | |
16 | if(BUILD_PLUGINS) |
|
21 | if(BUILD_PLUGINS) | |
17 | #target_link_libraries(sciqlopapp mockplugin) |
|
22 | #target_link_libraries(sciqlopapp mockplugin) | |
18 | #target_link_libraries(sciqlopapp amdaplugin) |
|
23 | #target_link_libraries(sciqlopapp amdaplugin) | |
19 | target_link_libraries(sciqlopapp python_providers) |
|
24 | target_link_libraries(sciqlopapp python_providers) | |
20 | endif() |
|
25 | endif() | |
21 | endif() |
|
26 | endif() | |
22 |
|
27 | |||
23 | if(NOT BUILD_PLUGINS) |
|
28 | if(NOT BUILD_PLUGINS) | |
24 | add_definitions(-DSQP_NO_PLUGINS) |
|
29 | add_definitions(-DSQP_NO_PLUGINS) | |
25 | endif() |
|
30 | endif() | |
26 |
|
31 | |||
27 | target_link_libraries(sciqlopapp |
|
32 | target_link_libraries(sciqlopapp | |
28 | Qt5::Core |
|
33 | Qt5::Core | |
29 | Qt5::Widgets |
|
34 | Qt5::Widgets | |
30 | Qt5::Network |
|
35 | Qt5::Network | |
31 | Qt5::PrintSupport |
|
36 | Qt5::PrintSupport | |
32 | Qt5::Svg |
|
37 | Qt5::Svg | |
33 | sciqlopgui |
|
38 | sciqlopgui | |
34 | sciqlopcore |
|
39 | sciqlopcore | |
35 | ) |
|
40 | ) | |
36 |
|
41 | |||
37 | install(TARGETS sciqlopapp DESTINATION ${CMAKE_INSTALL_BINDIR}) |
|
42 | install(TARGETS sciqlopapp DESTINATION ${CMAKE_INSTALL_BINDIR}) | |
38 | install(FILES resources/SciQLOP.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications/) |
|
43 | install(FILES resources/SciQLOP.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications/) | |
39 | install(FILES resources/SciQLOP.appdata.xml DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/metainfo/) |
|
44 | install(FILES resources/SciQLOP.appdata.xml DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/metainfo/) | |
40 | install(FILES resources/sciqlopLOGO.svg DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/SciQLOP/icons/) |
|
45 | install(FILES resources/sciqlopLOGO.svg DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/SciQLOP/icons/) | |
41 |
|
46 | |||
42 |
|
47 |
General Comments 0
You need to be logged in to leave comments.
Login now