-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathcmake.toml
More file actions
132 lines (119 loc) · 4.04 KB
/
cmake.toml
File metadata and controls
132 lines (119 loc) · 4.04 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# Reference: https://build-cpp.github.io/cmkr/cmake-toml
[project]
name = "kananlib"
cmake-before="""
add_compile_options($<$<CXX_COMPILER_ID:MSVC>:/MP>)
"""
cmake-after="""
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
# The project is being built standalone
message(STATUS "kananlib: Building standalone")
set(KANANLIB_STANDALONE_BUILD ON)
else()
# The project is being included as part of another project
message(STATUS "kananlib: Building as part of another project")
set(KANANLIB_STANDALONE_BUILD OFF)
endif()
# Add cmake module path
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
# DIA SDK Detection
if(KANANLIB_USE_DIA_SDK)
message(STATUS "kananlib: DIA SDK support requested")
find_package(DIASDK)
if(DIASDK_FOUND)
set(KANANLIB_DIA_SDK_FOUND TRUE)
message(STATUS "kananlib: DIA SDK support will be enabled")
else()
set(KANANLIB_DIA_SDK_FOUND FALSE)
message(WARNING "kananlib: DIA SDK not found. Symbol resolution will be disabled.")
message(STATUS "kananlib: Install Visual Studio with C++ workload to get DIA SDK")
endif()
else()
message(STATUS "kananlib: DIA SDK support disabled (set KANANLIB_USE_DIA_SDK=ON to enable)")
set(KANANLIB_DIA_SDK_FOUND FALSE)
endif()
"""
[options]
KANANLIB_FETCH_BDDISASM = false
KANANLIB_FETCH_SPDLOG = false
KANANLIB_STANDALONE_BUILD = false
KANANLIB_USE_DIA_SDK = false
[conditions]
fetch-bddisasm = "KANANLIB_FETCH_BDDISASM OR KANANLIB_STANDALONE_BUILD"
fetch-spdlog = "KANANLIB_FETCH_SPDLOG OR KANANLIB_STANDALONE_BUILD"
[fetch-content.bddisasm]
condition = "fetch-bddisasm"
git = "https://github.com/bitdefender/bddisasm"
tag = "v1.37.0"
shallow = true
[fetch-content.spdlog]
condition = "fetch-spdlog"
git = "https://github.com/gabime/spdlog"
tag = "v1.12.0"
shallow = true
[template.kananlib-template]
type = "static"
sources = ["src/*.cpp", "include/**.hpp"]
include-directories = ["include"]
compile-features = ["cxx_std_20"]
link-libraries = [
"bddisasm::bddisasm",
"spdlog::spdlog",
"shlwapi"
]
[target.kananlib]
type = "kananlib-template"
cmake-after="""
if (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")
message(STATUS "MSVC")
target_compile_options(kananlib PRIVATE /EHa)
else()
message(STATUS "CLANG")
target_compile_options(kananlib PRIVATE
-fasynchronous-unwind-tables
-fexceptions
-fms-extensions
)
endif()
# Configure DIA SDK if found
if(KANANLIB_DIA_SDK_FOUND)
target_compile_definitions(kananlib PRIVATE KANANLIB_USE_DIA_SDK)
target_link_libraries(kananlib PRIVATE DIASDK::DIASDK)
if (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")
target_link_options(kananlib PRIVATE /DELAYLOAD:msdia140.dll)
target_link_libraries(kananlib PRIVATE delayimp)
endif()
message(STATUS "kananlib: DIA SDK support enabled for kananlib target")
endif()
"""
[target.kananlib-nolog]
type = "kananlib-template"
compile-definitions = ["SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_OFF"]
cmake-after="""
if (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")
target_compile_options(kananlib-nolog PRIVATE /EHa)
else()
target_compile_options(kananlib-nolog PRIVATE
-fasynchronous-unwind-tables
-fexceptions
-fms-extensions
)
endif()
# Configure DIA SDK if found
if(KANANLIB_DIA_SDK_FOUND)
target_compile_definitions(kananlib-nolog PRIVATE KANANLIB_USE_DIA_SDK)
target_link_libraries(kananlib-nolog PRIVATE DIASDK::DIASDK)
if (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")
target_link_options(kananlib-nolog PRIVATE /DELAYLOAD:msdia140.dll)
target_link_libraries(kananlib-nolog PRIVATE delayimp)
endif()
message(STATUS "kananlib: DIA SDK support enabled for kananlib-nolog target")
endif()
"""
# TODO: define a target for each of your executables/libraries like this:
#[target.myexecutable]
#type = "executable" # static, shared
#sources = ["src/kananlib/*.cpp", "include/kananlib/*.hpp"]
#include-directories = ["include"]
#compile-features = ["cxx_std_11"]
#link-libraries = ["target-or-library"]