-
Notifications
You must be signed in to change notification settings - Fork 10
/
CMakeLists.txt
109 lines (95 loc) · 3.23 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
# SPDX-FileCopyrightText: 2021 - 2022 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
cmake_minimum_required(VERSION 3.20)
project(numba-mlir LANGUAGES CXX C)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
if(POLICY CMP0077)
cmake_policy(SET CMP0077 NEW)
endif()
if(POLICY CMP0116)
cmake_policy(SET CMP0116 OLD)
endif()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/")
# SDL
# set(CMAKE_VERBOSE_MAKEFILE on) # enable for debug
if (CMAKE_SYSTEM_NAME STREQUAL Windows)
add_compile_options(-GS -D_CRT_SECURE_NO_WARNINGS)
add_link_options(-DYNAMICBASE -NXCOMPAT -GUARD:CF)
# add_link_options(-INTEGRITYCHECK) # require signatures of libs, only recommended
endif()
if (CMAKE_SYSTEM_NAME STREQUAL Linux)
string(CONCAT WARN_FLAGS
"-Wall "
"-Wextra "
"-Winit-self "
"-Wunused-function "
"-Wuninitialized "
"-fdiagnostics-color=auto "
"-Wno-deprecated-declarations "
)
string(CONCAT SDL_FLAGS
"-D_FORTIFY_SOURCE=2 "
"-Wformat "
"-Wformat-security "
"-Werror=format-security "
"-fno-delete-null-pointer-checks "
"-fstack-protector-strong "
"-fno-strict-overflow "
"-fstack-clash-protection "
"-fcf-protection=full "
)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARN_FLAGS} ${SDL_FLAGS}")
# add_compile_options(-mcet) # v8.0 and newer # unrecognized command line option '-mcet', only recommended
add_link_options(-Wl,-z,noexecstack,-z,relro,-z,now)
endif()
if (CMAKE_SYSTEM_NAME STREQUAL Darwin)
add_compile_options(-D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security -fno-delete-null-pointer-checks -fstack-protector-strong -fno-strict-overflow -Wall)
add_compile_options(-fcf-protection=full) # v8.0 and newer
# add_compile_options(-mcet) # v8.0 and newer # unrecognized command line option '-mcet', only recommended
endif()
option(NUMBA_MLIR_USE_MKL
"Enable mkl support"
ON
)
option(NUMBA_MLIR_USE_SYCL
"Enable sycl support"
OFF
)
option(NUMBA_MLIR_ENABLE_IGPU_DIALECT
"Enable GPU codegen"
OFF
)
option(NUMBA_MLIR_ENABLE_NUMBA_FE
"Enable numba-based python frontend"
OFF
)
option(NUMBA_MLIR_ENABLE_TBB_SUPPORT
"Enable TBB"
OFF
)
option(NUMBA_MLIR_ENABLE_TESTS
"Enable CTests"
OFF
)
message(STATUS "NUMBA_MLIR_USE_MKL ${NUMBA_MLIR_USE_MKL}")
message(STATUS "NUMBA_MLIR_USE_SYCL ${NUMBA_MLIR_USE_SYCL}")
message(STATUS "NUMBA_MLIR_ENABLE_IGPU_DIALECT ${NUMBA_MLIR_ENABLE_IGPU_DIALECT}")
message(STATUS "NUMBA_MLIR_ENABLE_TESTS ${NUMBA_MLIR_ENABLE_TESTS}")
message(STATUS "NUMBA_MLIR_ENABLE_NUMBA_FE ${NUMBA_MLIR_ENABLE_NUMBA_FE}")
message(STATUS "NUMBA_MLIR_ENABLE_TBB_SUPPORT ${NUMBA_MLIR_ENABLE_TBB_SUPPORT}")
macro(apply_llvm_compile_flags target)
if (MSVC)
target_compile_options(${target} PRIVATE /EHsc)
endif ()
target_compile_definitions(${target} PRIVATE ${LLVM_DEFINITIONS})
endmacro()
add_subdirectory(mlir)
add_subdirectory(numba_mlir_runtime)
if(NUMBA_MLIR_ENABLE_NUMBA_FE)
add_subdirectory(numba_mlir)
endif()