This repository has been archived by the owner on Jul 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathCMakeLists.txt
64 lines (50 loc) · 1.99 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
cmake_minimum_required(VERSION 3.16)
project(lpvpn)
message(STATUS "Platform: ${PLATFORM}")
message(STATUS "Generator Platform: ${CMAKE_GENERATOR_PLATFORM}")
set(DISCORD_APP_ID 801910914370240553)
include(FetchContent)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/tmp")
if (NOT DEFINED BINARY_PLATFORM)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set (BINARY_PLATFORM "x64")
elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
set (BINARY_PLATFORM "win32")
endif()
endif()
include(cmake/discord.cmake)
include(cmake/wintun.cmake)
include(cmake/wxWidgets.cmake)
include(cmake/CMakeRC.cmake)
include(cmake/MemoryModule.cmake)
if (WIN32)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()
file(GLOB_RECURSE RESOURCES RELATIVE ${CMAKE_SOURCE_DIR} "resources/cmrc/*")
cmrc_add_resource_library(lpvpn-resources ALIAS lpvpn::rc NAMESPACE lpvpn)
cmrc_add_resources(lpvpn-resources WHENCE resources/cmrc ${RESOURCES})
cmrc_add_resources(lpvpn-resources WHENCE ${DiscordGameSDK_REDISTRIBUTABLE_DIR} ${DiscordGameSDK_REDISTRIBUTABLE})
cmrc_add_resources(lpvpn-resources WHENCE ${Wintun_REDISTRIBUTABLE_DIR} ${Wintun_REDISTRIBUTABLE})
file(GLOB_RECURSE SOURCES RELATIVE ${CMAKE_SOURCE_DIR} "src/*.cpp")
add_executable(lpvpn ${SOURCES} ${DiscordGameSDK_CPP_SOURCES} resources/windows/app.rc)
set_property(TARGET lpvpn PROPERTY CXX_STANDARD 20)
target_include_directories(lpvpn PRIVATE ${DiscordGameSDK_CPP_INCLUDE_DIR})
target_compile_definitions(
lpvpn PUBLIC
DISCORD_APP_ID=${DISCORD_APP_ID}
)
if (WIN32)
set_target_properties(lpvpn PROPERTIES
LINK_FLAGS "/MANIFESTUAC:\"level='requireAdministrator' uiAccess='false'\" /SUBSYSTEM:WINDOWS"
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>"
)
endif()
target_link_libraries(lpvpn PRIVATE wxmono lpvpn::rc Wintun DiscordGameSDK MemoryModule)
# copy LICENSE
add_custom_command(
TARGET lpvpn POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CMAKE_SOURCE_DIR}/LICENSE"
$<TARGET_FILE_DIR:lpvpn>
)