12
12
# See the License for the specific language governing permissions and
13
13
# limitations under the License.
14
14
15
- cmake_minimum_required (VERSION 3.5 )
15
+ cmake_minimum_required (VERSION 3.15 )
16
16
17
17
project (mlir-extensions )
18
18
@@ -38,8 +38,28 @@ if (CMAKE_SYSTEM_NAME STREQUAL Windows)
38
38
# add_link_options(-INTEGRITYCHECK) # require signatures of libs, only recommended
39
39
endif ()
40
40
if (CMAKE_SYSTEM_NAME STREQUAL Linux )
41
- 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 )
42
- add_compile_options (-fstack-clash-protection -fcf-protection=full ) # v8.0 and newer
41
+ string (CONCAT WARN_FLAGS
42
+ "-Wall "
43
+ "-Wextra "
44
+ "-Winit-self "
45
+ "-Wunused-function "
46
+ "-Wuninitialized "
47
+ "-Wmissing-declarations "
48
+ "-fdiagnostics-color=auto "
49
+ "-Wno-deprecated-declarations "
50
+ )
51
+ string (CONCAT SDL_FLAGS
52
+ "-D_FORTIFY_SOURCE=2 "
53
+ "-Wformat "
54
+ "-Wformat-security "
55
+ "-Werror=format-security "
56
+ "-fno-delete-null-pointer-checks "
57
+ "-fstack-protector-strong "
58
+ "-fno-strict-overflow "
59
+ "-fstack-clash-protection "
60
+ "-fcf-protection=full "
61
+ )
62
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARN_FLAGS} ${SDL_FLAGS} " )
43
63
# add_compile_options(-mcet) # v8.0 and newer # unrecognized command line option '-mcet', only recommended
44
64
add_link_options (-Wl,-z,noexecstack,-z,relro,-z,now )
45
65
endif ()
@@ -49,18 +69,34 @@ if (CMAKE_SYSTEM_NAME STREQUAL Darwin)
49
69
# add_compile_options(-mcet) # v8.0 and newer # unrecognized command line option '-mcet', only recommended
50
70
endif ()
51
71
52
- option (DPNP_ENABLE "Use DPNP for some math functions" OFF )
53
- option (GPU_ENABLE "Enable GPU codegen" OFF )
54
- option (NUMBA_ENABLE "Enable numba-based python frontend" OFF )
55
- option (TBB_ENABLE "Enable TBB" OFF )
72
+ option (IMEX_USE_DPNP
73
+ "Use the dpnp Python NumPy-like library for some math functions"
74
+ OFF
75
+ )
76
+ option (IMEX_ENABLE_IGPU_DIALECT
77
+ "Enable GPU codegen"
78
+ OFF
79
+ )
80
+ option (IMEX_ENABLE_NUMBA_FE
81
+ "Enable numba-based python frontend"
82
+ OFF
83
+ )
84
+ option (IMEX_ENABLE_TBB_SUPPORT
85
+ "Enable TBB"
86
+ OFF
87
+ )
88
+ option (IMEX_ENABLE_TESTS
89
+ "Enable CTests"
90
+ OFF
91
+ )
92
+
93
+ message (STATUS "IMEX_USE_DPNP ${DPNIMEX_USE_DPNPP_ENABLE} " )
94
+ message (STATUS "IMEX_ENABLE_IGPU_DIALECT ${IMEX_ENABLE_IGPU_DIALECT} " )
95
+ message (STATUS "IMEX_ENABLE_TESTS ${IMEX_ENABLE_TESTS} " )
96
+ message (STATUS "IMEX_ENABLE_NUMBA_FE ${IMEX_ENABLE_NUMBA_FE} " )
97
+ message (STATUS "IMEX_ENABLE_TBB_SUPPORT ${IMEX_ENABLE_TBB_SUPPORT} " )
56
98
57
- message (STATUS "DPNP_ENABLE ${DPNP_ENABLE} " )
58
- message (STATUS "GPU_ENABLE ${GPU_ENABLE} " )
59
- message (STATUS "BUILD_TESTING ${BUILD_TESTING} " )
60
- message (STATUS "NUMBA_ENABLE ${NUMBA_ENABLE} " )
61
- message (STATUS "TBB_ENABLE ${TBB_ENABLE} " )
62
99
63
- include (CTest )
64
100
65
101
macro (apply_llvm_compile_flags target )
66
102
if (MSVC )
@@ -70,18 +106,19 @@ macro(apply_llvm_compile_flags target)
70
106
target_compile_definitions (${target} PRIVATE ${LLVM_DEFINITIONS} )
71
107
endmacro ()
72
108
73
- if (GPU_ENABLE )
109
+ if (IMEX_ENABLE_IGPU_DIALECT )
74
110
add_subdirectory (dpcomp_gpu_runtime )
75
111
endif ()
76
112
77
113
add_subdirectory (mlir )
78
114
add_subdirectory (dpcomp_runtime )
79
115
add_subdirectory (tools )
80
116
81
- if (NUMBA_ENABLE )
117
+ if (IMEX_ENABLE_NUMBA_FE )
82
118
add_subdirectory (numba_dpcomp )
83
119
endif ()
84
120
85
- if (BUILD_TESTING )
121
+ if (IMEX_ENABLE_TESTS )
122
+ include (CTest )
86
123
add_subdirectory (test )
87
124
endif ()
0 commit comments