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