-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathCMakeLists.txt
45 lines (38 loc) · 1.12 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
cmake_minimum_required(VERSION 3.12)
project(xray C CXX)
set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/build/lib/${PROJECT_NAME})
add_subdirectory(pybind11)
pybind11_add_module(${PROJECT_NAME} src/xray.cpp)
if (WIN32)
if (MINGW)
target_compile_options(${PROJECT_NAME} PRIVATE "-Wa,-mbig-obj")
target_link_options(
${PROJECT_NAME} PRIVATE
"-static-libgcc" "-static-libstdc++"
"-Wl,-Bstatic,--whole-archive"
"-lwinpthread"
"-Wl,--no-whole-archive"
)
endif ()
target_link_libraries(
${PROJECT_NAME} PRIVATE
${CMAKE_SOURCE_DIR}/gobuild/xray.lib
)
else()
target_link_libraries(
${PROJECT_NAME} PRIVATE
${CMAKE_SOURCE_DIR}/gobuild/xray.a
"-lresolv"
)
if (APPLE)
target_link_libraries(
${PROJECT_NAME} PRIVATE
"-framework CoreFoundation"
"-framework Security"
)
endif ()
endif ()
target_include_directories(${PROJECT_NAME} PRIVATE gobuild)