-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
98 lines (79 loc) · 2.87 KB
/
Copy pathCMakeLists.txt
File metadata and controls
98 lines (79 loc) · 2.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
cmake_minimum_required(VERSION 3.16)
project(MedRewrite)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Og")
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
include_directories(include)
# Find dependencies
find_package(PkgConfig REQUIRED)
find_package(Qt6 COMPONENTS Core Widgets Gui UiTools REQUIRED)
pkg_search_module(JSONCPP REQUIRED jsoncpp)
pkg_search_module(ICU REQUIRED icu-uc icu-i18n)
include_directories(include ${JSONCPP_INCLUDE_DIRS} ${ICU_INCLUDE_DIRS})
# Core Library
file(GLOB med_SRC "src/med/*.cpp")
add_library(med_core SHARED ${med_SRC})
target_link_libraries(med_core pthread ${JSONCPP_LIBRARIES} ${ICU_LIBRARIES})
# UI
set(ui_SRC
src/ui/main.cpp
src/ui/MainWindow.cpp
src/ui/MedWorker.cpp
src/ui/ProcessDialog.cpp
src/ui/ComboBoxDelegate.cpp
src/ui/CheckBoxDelegate.cpp
src/ui/MemEditor.cpp
include/ui/MainWindow.hpp
include/ui/MedWorker.hpp
include/ui/ProcessDialog.hpp
include/ui/ComboBoxDelegate.hpp
include/ui/CheckBoxDelegate.hpp
include/ui/MemEditor.hpp
med.qrc
)
add_executable(med-ui ${ui_SRC})
target_link_libraries(med-ui med_core Qt6::Widgets Qt6::UiTools Qt6::Gui Qt6::Core)
# testfile
set(testfile_SRC
src/testfile.cpp)
add_executable(testfile ${testfile_SRC})
# Installation
include(GNUInstallDirs)
install(TARGETS med-ui
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(TARGETS med_core
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
# Set RPATH for med-ui so it can find med_core in ../lib
set_target_properties(med-ui PROPERTIES
INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}"
INSTALL_RPATH_USE_LINK_PATH TRUE
)
# Testing
find_package(CxxTest)
if(CXXTEST_FOUND)
enable_testing()
include_directories(${CXXTEST_INCLUDE_DIR})
CXXTEST_ADD_TEST(TestPhase1 TestPhase1.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tests/TestPhase1.hpp)
target_link_libraries(TestPhase1 med_core)
CXXTEST_ADD_TEST(TestPhase2 TestPhase2.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tests/TestPhase2.hpp)
target_link_libraries(TestPhase2 med_core)
CXXTEST_ADD_TEST(TestNamedScans TestNamedScans.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tests/TestNamedScans.hpp)
target_link_libraries(TestNamedScans med_core)
CXXTEST_ADD_TEST(TestArrayScan TestArrayScan.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tests/TestArrayScan.hpp)
target_link_libraries(TestArrayScan med_core)
CXXTEST_ADD_TEST(TestCustomSearch TestCustomSearch.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tests/TestCustomSearch.hpp)
target_link_libraries(TestCustomSearch med_core)
CXXTEST_ADD_TEST(TestLastDigitScope TestLastDigitScope.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tests/TestLastDigitScope.hpp)
target_link_libraries(TestLastDigitScope med_core)
endif()