vpn: add CMake snippet for VPN subsystem integration
This commit is contained in:
parent
d897c319f1
commit
999cecb21c
1 changed files with 64 additions and 0 deletions
64
app/vpn/CMakeLists_vpn.cmake
Normal file
64
app/vpn/CMakeLists_vpn.cmake
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
# app/vpn/CMakeLists_vpn.cmake
|
||||||
|
#
|
||||||
|
# Include this file from the top-level moonlight-qt CMakeLists.txt:
|
||||||
|
#
|
||||||
|
# include(app/vpn/CMakeLists_vpn.cmake)
|
||||||
|
#
|
||||||
|
# Prerequisites:
|
||||||
|
# Run scripts/build-boringtun.sh first to produce deps/boringtun/libboringtun.a
|
||||||
|
|
||||||
|
# ─── boringtun static library ─────────────────────────────────────────────────
|
||||||
|
|
||||||
|
set(BORINGTUN_LIB "${CMAKE_SOURCE_DIR}/deps/boringtun/libboringtun.a")
|
||||||
|
|
||||||
|
if(NOT EXISTS "${BORINGTUN_LIB}")
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"boringtun static library not found at ${BORINGTUN_LIB}\n"
|
||||||
|
"Run: bash scripts/build-boringtun.sh --universal\n"
|
||||||
|
"then re-run CMake.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_library(boringtun STATIC IMPORTED)
|
||||||
|
set_target_properties(boringtun PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${BORINGTUN_LIB}"
|
||||||
|
)
|
||||||
|
|
||||||
|
# ─── VPN source files ──────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
set(VPN_SOURCES
|
||||||
|
app/vpn/wireguardconfig.cpp
|
||||||
|
app/vpn/relayclient.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
if(APPLE)
|
||||||
|
list(APPEND VPN_SOURCES app/vpn/tunnelmanager_mac.mm)
|
||||||
|
elseif(WIN32)
|
||||||
|
list(APPEND VPN_SOURCES app/vpn/tunnelmanager_win.cpp) # future
|
||||||
|
elseif(UNIX)
|
||||||
|
list(APPEND VPN_SOURCES app/vpn/tunnelmanager_linux.cpp) # future
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# ─── Integration into moonlight-qt target ────────────────────────────────────
|
||||||
|
# Replace moonlight-qt below with whatever your top-level CMakeLists calls the app target.
|
||||||
|
|
||||||
|
target_sources(moonlight-qt PRIVATE ${VPN_SOURCES})
|
||||||
|
|
||||||
|
target_include_directories(moonlight-qt PRIVATE
|
||||||
|
"${CMAKE_SOURCE_DIR}/app/vpn"
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(moonlight-qt PRIVATE boringtun)
|
||||||
|
|
||||||
|
if(APPLE)
|
||||||
|
# Frameworks required by boringtun on macOS
|
||||||
|
target_link_libraries(moonlight-qt PRIVATE
|
||||||
|
"-framework Security"
|
||||||
|
"-framework Network"
|
||||||
|
"-framework SystemConfiguration"
|
||||||
|
)
|
||||||
|
# Objective-C++ needed for tunnelmanager_mac.mm
|
||||||
|
set_source_files_properties(
|
||||||
|
app/vpn/tunnelmanager_mac.mm
|
||||||
|
PROPERTIES COMPILE_FLAGS "-fobjc-arc"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
Loading…
Reference in a new issue