-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
108 lines (92 loc) · 2.94 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
cmake_minimum_required(VERSION 3.8)
project(kernel_slicer)
set(CMAKE_CXX_STANDARD 17)
set(LLVM_LINK_COMPONENTS support)
set(KSLICER_SOURCE_FILES
kslicer_main.cpp
kslicer_utils.cpp
kslicer_warnings.cpp
kslicer_def.cpp
attributes.cpp
block_expansion.cpp
initial_pass.cpp
initial_pass_compos.cpp
extractor.cpp
ast_matchers.cpp
class_gen.cpp
class_gen_ipv.cpp
class_gen_rtv.cpp
class_gen_vfh.cpp
class_data.cpp
template_rendering.cpp
template_rendering_host.cpp
rewrite_functions.cpp
rewrite_kernel.cpp
rewrite_kernel2.cpp
rewrite_kernel_info.cpp
rewrite_control.cpp
setter_process.cpp
reduction.cpp
shaders_clspv.cpp
shaders_glsl.cpp
shaders_ispc.cpp
shaders_slang.cpp)
include_directories("include")
option(KSLICER_LLVM_BUILD "Build kernel_slicer as a LLVM project module" OFF)
if(NOT KSLICER_LLVM_BUILD)
set(LLVM_VER "17")
set(LLVM_LIB "LLVM-${LLVM_VER}")
if(WIN32)
if(MSVC)
add_compile_options(/bigobj)
endif()
else()
set(PLATFORM_DEPENDENT_LIBS clang ${LLVM_LIB})
endif()
find_package(LLVM ${LLVM_VER} REQUIRED CONFIG)
find_package(Clang ${LLVM_VER} REQUIRED)
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
include_directories(${LLVM_INCLUDE_DIRS})
include_directories(${CLANG_INCLUDE_DIRS})
link_directories(${LLVM_LIBRARY_DIRS})
add_definitions(${LLVM_DEFINITIONS})
add_definitions(${CLANG_DEFINITIONS})
message("LLVM_INCLUDE_DIRS = ${LLVM_INCLUDE_DIRS}")
message("LLVM_LIBRARY_DIRS = ${LLVM_LIBRARY_DIRS}")
# message("CLANG_INCLUDE_DIRS = ${CLANG_INCLUDE_DIRS}")
# message("CLANG_LIBRARY_DIRS = ${CLANG_LIBRARY_DIRS}") set(CMAKE_MODULE_PATH
# ${CMAKE_MODULE_PATH} "${LLVM_CMAKE_DIR}")
add_executable(kslicer ${KSLICER_SOURCE_FILES})
target_link_libraries(
kslicer
PRIVATE ${PLATFORM_DEPENDENT_LIBS}
clangAST
clangTooling
clangBasic
clangASTMatchers
clangFrontendTool
clangFrontend
clangDriver
clangSerialization
clangCodeGen
clangParse
clangSema
clangStaticAnalyzerFrontend
clangStaticAnalyzerCheckers
clangStaticAnalyzerCore
clangAnalysis
clangIndex
clangARCMigrate
clangRewrite
clangLex
clangEdit)
else() # NOT DEFINED KSLICER_LLVM_BUILD
message(STATUS "kernel_slicer build with LLVM")
# file(GLOB_RECURSE SRC_DIR "include/*.h" "include/nlohmann/*.h" )
# set_source_files_properties(${SRC_DIR} PROPERTIES COMPILE_FLAGS "-w")
add_clang_executable(kslicer ${KSLICER_SOURCE_FILES})
target_compile_options(kslicer PRIVATE -fexceptions)
target_link_libraries(kslicer PRIVATE clang clangTooling clangBasic
clangASTMatchers)
endif() # DEFINED KSLICER_LLVM_BUILD