-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
117 lines (90 loc) · 2.93 KB
/
CMakeLists.txt
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
cmake_minimum_required(VERSION 3.17)
include(CMakeDependentOption)
project(SVGStationPlanEditor VERSION 1.0.0 LANGUAGES CXX)
option(UPDATE_TS "Update translations" OFF)
option(UPDATE_TS_KEEP_OBSOLETE "Keep obsolete entries when updating translations" ON)
option(BUILD_DOXYGEN "Build Doxygen documentation" OFF)
if (WIN32)
option(RUN_WINDEPLOYQT "Run windeployqt after executable is installed" ON)
endif()
## Defines ##
set(APP_PRODUCT_NAME "SVGStationPlanEditor")
set(APP_DISPLAY_NAME "SVG StationPlan Editor")
set(APP_COMPANY_NAME "Train Software")
set(PROJECT_HOMEPAGE_URL "https://github.com/gfgit/SVGStationPlanEditor")
set(APP_HELP_URL ${PROJECT_HOMEPAGE_URL})
set(APP_UPDATE_URL ${PROJECT_HOMEPAGE_URL})
set(PROJECT_DESCRIPTION "${APP_DISPLAY_NAME} lets you create station plan SVGs")
#set(APP_ICON ${CMAKE_SOURCE_DIR}/files/icons/icon.ico)
## defines end ##
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
#set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(SSP_PROJECT_DEFINITIONS ${SSP_PROJECT_DEFINITIONS} -DAPPVERSION="${PROJECT_VERSION}" -DQT_DEPRECATED_WARNINGS)
# Include our custom FindXXX moudules in '/cmake' subdirectory
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
find_package(Qt6 REQUIRED
COMPONENTS
Core
Gui
Widgets
Svg
LinguistTools)
find_package(Qt6
COMPONENTS
Xml)
if(BUILD_DOXYGEN)
find_package(Doxygen)
endif()
if(MSVC)
set(SSP_COMPILE_OPTIONS
/WX
/wd4267
/wd4244
/experimental:external
/external:anglebrackets
/external:W0
"$<$<CONFIG:RELEASE>:/O2>"
"$<$<COMPILE_LANGUAGE:CXX>:/MP>")
else()
set(SSP_COMPILE_OPTIONS
"$<$<CONFIG:RELEASE>:-O2>"
#-Werror
-Wuninitialized
-pedantic-errors
-Wall
-Wextra
-Wno-unused-parameter
-Wshadow)
endif()
include(LocateWinDeployQt)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Create main targets
set(SSP_LIBRARY_TARGET "ssplib")
set(SSP_LIBRARY_EDIT_TARGET "sspeditlib")
set(SSP_EDITOR_TARGET "sspeditor")
set(SSP_VIEWER_TARGET "sspviewer")
add_subdirectory(editor)
add_subdirectory(library)
add_subdirectory(viewer)
## Install and Deploy ##
if(WIN32)
if(RUN_WINDEPLOYQT)
if(NOT TARGET windeployqt_exe)
message(FATAL_ERROR "In order to run windeployqt you must first set the exe path in WINDEPLOYQT_EXE_DIR")
endif()
install(CODE "
message(STATUS \"Running windeployqt ${windeployqt_exe}\")
execute_process(COMMAND ${windeployqt_exe} ${CMAKE_INSTALL_PREFIX}/bin
WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/bin
OUTPUT_VARIABLE WINDEPLOYQT_EXE_RESULT
ERROR_VARIABLE WINDEPLOYQT_EXE_RESULT)
message(STATUS \${WINDEPLOYQT_EXE_RESULT})
message(STATUS \"${windeployqt_exe} Done.\")
")
endif()
endif()
## Install end ##