84 lines
2.4 KiB
CMake
84 lines
2.4 KiB
CMake
cmake_minimum_required(VERSION 3.15)
|
||
project(ghost_macos)
|
||
|
||
set(CMAKE_CXX_STANDARD 17)
|
||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||
|
||
# macOS deployment target
|
||
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13" CACHE STRING "Minimum macOS version")
|
||
|
||
# Universal Binary (Intel + Apple Silicon)
|
||
set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "Build architectures")
|
||
|
||
include_directories(../)
|
||
include_directories(../client)
|
||
include_directories(../compress)
|
||
|
||
# Source files
|
||
set(SOURCES
|
||
main.mm
|
||
../client/Buffer.cpp
|
||
../client/IOCPClient.cpp
|
||
../client/sign_shim_unix.cpp
|
||
ScreenHandler.mm
|
||
InputHandler.mm
|
||
SystemManager.mm
|
||
Permissions.mm
|
||
H264Encoder.mm
|
||
)
|
||
|
||
# Create executable
|
||
add_executable(ghost ${SOURCES})
|
||
|
||
# Include directories
|
||
target_include_directories(ghost PRIVATE
|
||
${CMAKE_CURRENT_SOURCE_DIR}
|
||
)
|
||
|
||
# Find and link macOS frameworks
|
||
find_library(COCOA_FRAMEWORK Cocoa REQUIRED)
|
||
find_library(COREGRAPHICS_FRAMEWORK CoreGraphics REQUIRED)
|
||
find_library(IOKIT_FRAMEWORK IOKit REQUIRED)
|
||
find_library(IOSURFACE_FRAMEWORK IOSurface REQUIRED)
|
||
find_library(APPLICATIONSERVICES_FRAMEWORK ApplicationServices REQUIRED)
|
||
find_library(SECURITY_FRAMEWORK Security REQUIRED)
|
||
find_library(CARBON_FRAMEWORK Carbon REQUIRED)
|
||
find_library(VIDEOTOOLBOX_FRAMEWORK VideoToolbox REQUIRED)
|
||
find_library(COREMEDIA_FRAMEWORK CoreMedia REQUIRED)
|
||
find_library(COREVIDEO_FRAMEWORK CoreVideo REQUIRED)
|
||
find_library(ACCELERATE_FRAMEWORK Accelerate REQUIRED)
|
||
find_library(ICONV_LIBRARY iconv REQUIRED)
|
||
|
||
target_link_libraries(ghost PRIVATE
|
||
${COCOA_FRAMEWORK}
|
||
${COREGRAPHICS_FRAMEWORK}
|
||
${IOKIT_FRAMEWORK}
|
||
${IOSURFACE_FRAMEWORK}
|
||
${APPLICATIONSERVICES_FRAMEWORK}
|
||
${SECURITY_FRAMEWORK}
|
||
${CARBON_FRAMEWORK}
|
||
${VIDEOTOOLBOX_FRAMEWORK}
|
||
${COREMEDIA_FRAMEWORK}
|
||
${COREVIDEO_FRAMEWORK}
|
||
${ACCELERATE_FRAMEWORK}
|
||
${ICONV_LIBRARY}
|
||
"${CMAKE_SOURCE_DIR}/lib/libzstd.a"
|
||
# 私有签名库(提供 signMessage / verifyMessage,源码不开源)
|
||
# 该库由 SimplePlugins 仓库本地构建后放置于 lib/,构建机需先准备好
|
||
# libsign.a 内部使用 macOS CommonCrypto(HMAC-SHA256),CCHmac 在 libSystem
|
||
# 中已被 Cocoa/CoreFoundation 等链接自动引入,故此处无需额外 framework
|
||
"${CMAKE_SOURCE_DIR}/lib/libsign.a"
|
||
)
|
||
|
||
# Compiler flags
|
||
target_compile_options(ghost PRIVATE
|
||
-Wall
|
||
-Wextra
|
||
-fobjc-arc
|
||
)
|
||
|
||
# Output directory
|
||
set_target_properties(ghost PROPERTIES
|
||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||
)
|