1
1
cmake_minimum_required (VERSION 3.24 )
2
2
3
+ set (CMAKE_CXX_STANDARD 23 )
4
+ set (CMAKE_CXX_STANDARD_REQUIRED ON )
5
+
6
+ if (APPLE )
7
+ enable_language (OBJC )
8
+ set (CMAKE_OSX_DEPLOYMENT_TARGET 14 )
9
+ endif ()
10
+
3
11
project (BB_Launcher LANGUAGES CXX )
4
12
5
13
option (FORCE_UAC "Requires running as Admin on Windows" ON )
@@ -31,29 +39,55 @@ if (APPLE AND ARCHITECTURE STREQUAL "x86_64" AND CMAKE_SYSTEM_PROCESSOR STREQUAL
31
39
set (ENV{PKG_CONFIG_SYSROOT_DIR} ${CMAKE_SYSROOT} )
32
40
endif ()
33
41
34
- set (CMAKE_AUTOUIC ON )
35
- set (CMAKE_AUTOMOC ON )
36
- set (CMAKE_AUTORCC ON )
42
+ # Setup a custom clang-format target (if clang-format can be found) that will run
43
+ # against all the src files. This should be used before making a pull request.
37
44
38
- set (CMAKE_CXX_STANDARD 23 )
39
- set (CMAKE_CXX_STANDARD_REQUIRED ON )
45
+ if (CLANG_FORMAT )
46
+ set (SRCS ${PROJECT_SOURCE_DIR )
47
+ set (CCOMMENT "Running clang format against all the .h and .cpp files in src/" )
48
+ if (WIN32 )
49
+ add_custom_target (clang-format
50
+ COMMAND powershell.exe -Command "Get-ChildItem '${SRCS} /*' -Include *.cpp,*.h,*.mm -Recurse | Foreach {&'${CLANG_FORMAT} ' -i $_.fullname}"
51
+ COMMENT ${CCOMMENT} )
52
+ else ()
53
+ add_custom_target (clang-format
54
+ COMMAND find ${SRCS} -iname *.h -o -iname *.cpp -o -iname *.mm | xargs ${CLANG_FORMAT} -i
55
+ COMMENT ${CCOMMENT} )
56
+ endif ()
57
+ unset (SRCS )
58
+ unset (CCOMMENT )
59
+ endif ()
40
60
41
- if (APPLE )
42
- enable_language (OBJC )
43
- set (CMAKE_OSX_DEPLOYMENT_TARGET 14 )
61
+ list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR} /cmake" )
62
+
63
+ # generate git revision information
64
+ list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR} /settings/updater/cmake-modules/" )
65
+ include (GetGitRevisionDescription )
66
+ get_git_head_revision (GIT_REF_SPEC GIT_REV )
67
+ git_describe (GIT_DESC --always --long --dirty )
68
+ git_branch_name (GIT_BRANCH )
69
+ string (TIMESTAMP BUILD_DATE "%Y-%m-%d %H:%M:%S" )
70
+
71
+ configure_file ("${CMAKE_CURRENT_SOURCE_DIR} /settings/updater/BuildInfo.cpp.in" "${CMAKE_CURRENT_BINARY_DIR} /settings/updater/BuildInfo.cpp" @ONLY )
72
+
73
+ if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR NOT MSVC )
74
+ find_package (cryptopp 8.9.0 MODULE )
44
75
endif ()
45
76
77
+ add_subdirectory (externals )
78
+
46
79
find_package (QT NAMES Qt6 REQUIRED COMPONENTS Widgets Network )
47
80
find_package (Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Network )
48
81
82
+ set (CMAKE_AUTOUIC ON )
83
+ set (CMAKE_AUTOMOC ON )
84
+ set (CMAKE_AUTORCC ON )
85
+
86
+
49
87
if (UNIX AND NOT APPLE )
50
88
find_package (OpenSSL REQUIRED )
51
89
endif ()
52
90
53
- add_subdirectory (externals )
54
-
55
- qt_add_resources (RESOURCE_FILES dist/BBLauncher.qrc )
56
-
57
91
set (PROJECT_SOURCES
58
92
main.cpp
59
93
modules/bblauncher.cpp
@@ -108,40 +142,7 @@ set(PROJECT_SOURCES
108
142
${RESOURCE_FILES}
109
143
)
110
144
111
- # Setup a custom clang-format target (if clang-format can be found) that will run
112
- # against all the src files. This should be used before making a pull request.
113
-
114
- if (CLANG_FORMAT )
115
- set (SRCS ${PROJECT_SOURCE_DIR )
116
- set (CCOMMENT "Running clang format against all the .h and .cpp files in src/" )
117
- if (WIN32 )
118
- add_custom_target (clang-format
119
- COMMAND powershell.exe -Command "Get-ChildItem '${SRCS} /*' -Include *.cpp,*.h,*.mm -Recurse | Foreach {&'${CLANG_FORMAT} ' -i $_.fullname}"
120
- COMMENT ${CCOMMENT} )
121
- else ()
122
- add_custom_target (clang-format
123
- COMMAND find ${SRCS} -iname *.h -o -iname *.cpp -o -iname *.mm | xargs ${CLANG_FORMAT} -i
124
- COMMENT ${CCOMMENT} )
125
- endif ()
126
- unset (SRCS )
127
- unset (CCOMMENT )
128
- endif ()
129
-
130
- list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR} /cmake" )
131
-
132
- if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR NOT MSVC )
133
- find_package (cryptopp 8.9.0 MODULE )
134
- endif ()
135
-
136
- # generate git revision information
137
- list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR} /settings/updater/cmake-modules/" )
138
- include (GetGitRevisionDescription )
139
- get_git_head_revision (GIT_REF_SPEC GIT_REV )
140
- git_describe (GIT_DESC --always --long --dirty )
141
- git_branch_name (GIT_BRANCH )
142
- string (TIMESTAMP BUILD_DATE "%Y-%m-%d %H:%M:%S" )
143
-
144
- configure_file ("${CMAKE_CURRENT_SOURCE_DIR} /settings/updater/BuildInfo.cpp.in" "${CMAKE_CURRENT_BINARY_DIR} /settings/updater/BuildInfo.cpp" @ONLY )
145
+ qt_add_resources (RESOURCE_FILES dist/BBLauncher.qrc )
145
146
146
147
if (${QT_VERSION_MAJOR} GREATER_EQUAL 6 )
147
148
qt_add_executable (BB_Launcher
@@ -159,10 +160,12 @@ else()
159
160
endif ()
160
161
endif ()
161
162
162
- if (UNIX AND NOT APPLE )
163
- target_link_libraries (BB_Launcher PRIVATE ${OPENSSL_LIBRARIES} )
163
+ if (WIN32 )
164
+ target_sources (BB_Launcher PRIVATE dist/bblauncher.rc )
164
165
endif ()
165
166
167
+ target_include_directories (BB_Launcher PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} )
168
+
166
169
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND MSVC )
167
170
target_link_libraries (BB_Launcher PRIVATE cryptoppwin )
168
171
else ()
@@ -193,16 +196,14 @@ set_target_properties(BB_Launcher PROPERTIES
193
196
set_source_files_properties (dist/BBIcon.icns PROPERTIES
194
197
MACOSX_PACKAGE_LOCATION Resources )
195
198
196
- if (WIN32 )
197
- target_sources (BB_Launcher PRIVATE dist/bblauncher.rc )
198
- endif ()
199
-
200
199
if (WIN32 AND FORCE_UAC )
201
200
SET_TARGET_PROPERTIES (BB_Launcher PROPERTIES LINK_FLAGS "/MANIFESTUAC:\" level='requireAdministrator' uiAccess='false'\" " )
202
201
add_definitions (-DFORCE_UAC )
203
202
endif ()
204
203
205
- target_include_directories (BB_Launcher PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} )
204
+ if (UNIX AND NOT APPLE )
205
+ target_link_libraries (BB_Launcher PRIVATE ${OPENSSL_LIBRARIES} )
206
+ endif ()
206
207
207
208
install (TARGETS BB_Launcher BUNDLE DESTINATION . )
208
209
0 commit comments