-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
executable file
·162 lines (140 loc) · 4.36 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
project(spirit)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RELEASE)
endif()
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(MIN_QT_VERSION "5.6.0")
if (APPLE)
enable_language(OBJC)
set(CMAKE_EXE_LINKER_FLAGS
"-framework Cocoa -framework AppKit -framework CoreData -framework Foundation")
endif()
if (CONAN_BUILD)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR})
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR})
include(conan.cmake)
conan_cmake_autodetect(settings)
conan_cmake_install(PATH_OR_REFERENCE ${CMAKE_SOURCE_DIR}/conanfile.py
BUILD missing
REMOTE conancenter
SETTINGS ${settings})
endif()
find_package(Qt5 COMPONENTS Core Widgets Network Multimedia)
# KWindowSystem
if (UNIX AND NOT APPLE)
find_package(Qt5 COMPONENTS X11Extras)
find_package(KF5WindowSystem)
endif()
# QArchive
find_package(QArchive)
# CivetWeb
find_package(civetweb)
# Include Directories.
include_directories(.)
include_directories(include)
include_directories(${CMAKE_BINARY_DIR})
if(ENABLE_DEBUGGING)
add_definitions(-DENABLE_DEBUGGING)
endif()
if(SPIRIT_VERSION)
add_compile_definitions(SPIRIT_VERSION="${SPIRIT_VERSION}")
else()
add_compile_definitions(SPIRIT_VERSION="v1")
endif()
if(SPIRIT_COMMIT)
add_compile_definitions(SPIRIT_COMMIT="${SPIRIT_COMMIT}")
else()
add_compile_definitions(SPIRIT_COMMIT="none")
endif()
if(SPIRIT_BUILD)
add_compile_definitions(SPIRIT_BUILD="${SPIRIT_BUILD}")
else()
add_compile_definitions(SPIRIT_BUILD="1")
endif()
SET(source)
list(APPEND source include/termcolor.hpp
include/helpers_p.hpp
include/spiritenums.hpp
include/activewindowtracker_p.hpp
include/activewindowtracker.hpp
include/spiritworker_p.hpp
include/spiritworker.hpp
include/spirit.hpp
include/windowquirks.hpp
include/spiritsettings.hpp
include/spiritconfig.hpp
include/spiritdaemon_p.hpp
include/spiritdaemon.hpp
include/spiritapp.hpp
include/spiritmanager.hpp
include/guiapp.hpp
src/guiapp.cc
src/spiritmanager.cc
src/spiritapp.cc
src/activewindowtracker_p.cc
src/activewindowtracker.cc
src/spiritworker_p.cc
src/spiritworker.cc
src/spirit.cc
src/windowquirks.cc
src/spiritsettings.cc
src/spiritconfig.cc
src/spiritdaemon_p.cc
src/spiritdaemon.cc
src/helpers_p.cc
src/main.cc
# Resources
resources.qrc)
if (APPLE)
list(APPEND source include/macos_p.h
src/macos_p.m)
endif()
if (WIN32)
add_executable(spirit WIN32 ${source})
elseif(APPLE)
add_executable(spirit MACOSX_BUNDLE ${source})
else()
add_executable(spirit ${source})
endif()
target_link_libraries(spirit PUBLIC Qt5::Core Qt5::Widgets Qt5::Network Qt5::Multimedia)
if (UNIX AND NOT APPLE)
target_link_libraries(spirit PUBLIC KF5::WindowSystem Qt5::X11Extras)
endif()
if (UNIX)
target_link_libraries(spirit PUBLIC QArchive)
else()
target_link_libraries(spirit PUBLIC QArchive::QArchive)
endif()
target_link_libraries(spirit PUBLIC civetweb::civetweb civetweb::civetweb-cpp)
if (WIN32 AND CONAN_BUILD)
include(${CMAKE_CURRENT_BINARY_DIR}/conanbuildinfo.cmake)
add_custom_command(
TARGET spirit POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${CONAN_BIN_DIRS_QARCHIVE}/QArchive.dll
${CMAKE_CURRENT_BINARY_DIR}/Release/QArchive.dll)
add_custom_command(
TARGET spirit POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${CONAN_BIN_DIRS_CIVETWEB}/civetweb.dll
${CMAKE_CURRENT_BINARY_DIR}/Release/civetweb.dll)
add_custom_command(
TARGET spirit POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${CONAN_BIN_DIRS_CIVETWEB}/civetweb-cpp.dll
${CMAKE_CURRENT_BINARY_DIR}/Release/civetweb-cpp.dll)
add_custom_command(
TARGET spirit POST_BUILD
COMMAND ${CONAN_BIN_DIRS_QT}/windeployqt.exe
${CMAKE_CURRENT_BINARY_DIR}/Release/spirit.exe)
endif()
# Hotfix for CI/CD
if (UNIX AND NOT APPLE)
target_link_libraries(spirit PUBLIC pthread dl util)
endif ()