-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
132 lines (101 loc) · 3.33 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
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
cmake_minimum_required( VERSION 3.22 )
project( cthpp C CXX )
set( CMAKE_CXX_STANDARD 23 )
set( CMAKE_EXPORT_COMPILE_COMMANDS ON )
message( STATUS "~ ~ ~ ~ ~ ${PROJECT_NAME} ~ ~ ~ ~ ~" )
if ( DEV )
link_directories( $ENV{VCPKG_ROOT}/installed/x64-${TARGET_OS}/debug/lib )
link_directories( $ENV{VCPKG_ROOT}/installed/x64-${TARGET_OS}/debug/bin )
else ()
link_directories( $ENV{VCPKG_ROOT}/installed/x64-${TARGET_OS}/lib )
link_directories( $ENV{VCPKG_ROOT}/installed/x64-${TARGET_OS}/bin )
endif ()
# linker options
if ( ${WIN32} )
add_link_options(
/SUBSYSTEM:CONSOLE
#/FORCE:MULTIPLE
)
endif ()
# compiler options
if ( ${WIN32} )
add_compile_options(
/utf-8
/MP
/EHa
/GS
/GF
/GR
/GA
/wd4996
/openmp
/FS
/VERBOSE
)
add_link_options( /VERBOSE )
elseif ( ${LINUX} )
add_compile_options( -finput-charset=UTF-8
-fexceptions
-fstack-protector
-frtti
-fexceptions
-Wno-deprecated-declarations
-fopenmp )
endif ()
add_compile_definitions(
UNICODE
_UNICODE
_CONSOLE
NOMINMAX
)
if ( CMAKE_BUILD_TYPE STREQUAL "Debug" )
add_compile_definitions( _DEBUG DEBUG )
else ()
add_compile_definitions( NDEBUG )
endif ()
add_executable( ${PROJECT_NAME}
src/main.cpp
)
set_target_properties( ${PROJECT_NAME} PROPERTIES
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL"
)
find_package( unofficial-libgit2 CONFIG REQUIRED )
find_package( jsoncons CONFIG REQUIRED )
find_package( LLVM CONFIG REQUIRED )
find_package( Clang CONFIG REQUIRED )
find_package( fmt CONFIG REQUIRED )
list( APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}" )
message( STATUS "LLVM_CMAKE_DIR: ${LLVM_CMAKE_DIR}" )
include( HandleLLVMOptions )
add_definitions( ${LLVM_DEFINITIONS} )
target_include_directories( ${PROJECT_NAME} PRIVATE ${LLVM_INCLUDE_DIRS} )
llvm_map_components_to_libnames( llvm_libs
support core irreader analysis
)
target_link_libraries( ${PROJECT_NAME} PRIVATE ${llvm_libs} )
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/src )
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/third-party/libfiglet/src )
set( CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL" )
target_link_libraries( ${PROJECT_NAME} PRIVATE
jsoncons
unofficial::libgit2::libgit2
fmt::fmt-header-only
clangTooling
clangBasic
clangAST
clangASTMatchers
clangAnalysis
clangCodeGen
clangDynamicASTMatchers
# clangFronted
clangFormat
# clangFrontedTool
clangHandleCXX
clangHandleLLVM
clangLex
clangParse
clangRewrite
clangSupport
clangToolingSyntax
clangTransformer
)