-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathCMakeLists.txt
73 lines (66 loc) · 2.29 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
65
66
67
68
69
70
71
72
73
cmake_minimum_required(VERSION 3.10.0)
project(draconity)
set(CMAKE_MACOSX_RPATH 1)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
set(CMAKE_SKIP_BUILD_RPATH TRUE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
if (VENDOR_PATH)
set(CMAKE_FIND_ROOT_PATH "${CMAKE_FIND_ROOT_PATH}" "${VENDOR_PATH}")
endif()
link_directories(${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
include_directories(src)
if (ASAN)
add_definitions(-fsanitize=address)
link_libraries("-fsanitize=address")
endif()
if (DEBUG OR ASAN)
add_definitions(-O0 -ggdb -fno-omit-frame-pointer)
else()
add_definitions(-O2)
endif()
find_path(BSON_INCLUDE libbson-1.0/bson.h)
set(BSON_INCLUDE ${BSON_INCLUDE}/libbson-1.0)
find_library(BSON NAMES libbson-static-1.0.a)
if (NOT BSON OR NOT BSON_INCLUDE)
message(FATAL_ERROR "libbson not found")
endif()
find_path(ZYDIS_INCLUDE Zydis/Zydis.h)
find_library(ZYDIS NAMES libzydis.a zydis Zydis)
if (NOT ZYDIS OR NOT ZYDIS_INCLUDE)
message(FATAL_ERROR "libzydis not found")
endif()
find_library(UV NAMES libuv_a.a libuv.a)
if (NOT UV)
message(FATAL_ERROR, "libuv not found")
endif()
include_directories(${BSON_INCLUDE} ${ZYDIS_INCLUDE} vendor/uvw/src vendor/cpptoml)
file(GLOB_RECURSE SOURCE src/*.c src/*.cpp)
if (APPLE)
file(GLOB_RECURSE OBJC_SOURCE src/*.m src/*.mm)
set(SOURCE ${SOURCE} ${OBJC_SOURCE})
endif()
if (TALON_BUILD)
add_definitions(-DTALON_BUILD)
set(SOURCE ${SOURCE} ../draconity.mm)
endif()
add_library(draconity SHARED ${SOURCE})
target_link_libraries(draconity m ${UV} ${ZYDIS} ${BSON})
if(APPLE)
add_definitions(-fobjc-arc -fmodules -fcxx-modules -Wno-module-import-in-extern-c)
include_directories(/usr/local/include)
target_link_libraries(draconity -F/System/Library/PrivateFrameworks "-framework CoreSymbolication -framework AppKit")
endif()
if(MINGW)
target_link_libraries(draconity ws2_32 psapi iphlpapi userenv -static-libgcc -static-libstdc++ "-Wl,-Bstatic -lpthread -Wl,-Bdynamic")
endif()
set_target_properties(draconity PROPERTIES
CXX_STANDARD 17
CXX_EXTENSIONS OFF
)
install(TARGETS draconity
RUNTIME DESTINATION lib
LIBRARY DESTINATION lib
COMPONENT library)