Skip to content

Commit 3e8cf4a

Browse files
author
Diptorup Deb
committed
Rename imex Cmake options.
1 parent 468d64b commit 3e8cf4a

File tree

1 file changed

+53
-16
lines changed

1 file changed

+53
-16
lines changed

CMakeLists.txt

Lines changed: 53 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
cmake_minimum_required(VERSION 3.5)
15+
cmake_minimum_required(VERSION 3.15)
1616

1717
project(mlir-extensions)
1818

@@ -38,8 +38,28 @@ if (CMAKE_SYSTEM_NAME STREQUAL Windows)
3838
# add_link_options(-INTEGRITYCHECK) # require signatures of libs, only recommended
3939
endif()
4040
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}")
4363
# add_compile_options(-mcet) # v8.0 and newer # unrecognized command line option '-mcet', only recommended
4464
add_link_options(-Wl,-z,noexecstack,-z,relro,-z,now)
4565
endif()
@@ -49,18 +69,34 @@ if (CMAKE_SYSTEM_NAME STREQUAL Darwin)
4969
# add_compile_options(-mcet) # v8.0 and newer # unrecognized command line option '-mcet', only recommended
5070
endif()
5171

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}")
5698

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}")
6299

63-
include(CTest)
64100

65101
macro(apply_llvm_compile_flags target)
66102
if (MSVC)
@@ -70,18 +106,19 @@ macro(apply_llvm_compile_flags target)
70106
target_compile_definitions(${target} PRIVATE ${LLVM_DEFINITIONS})
71107
endmacro()
72108

73-
if(GPU_ENABLE)
109+
if(IMEX_ENABLE_IGPU_DIALECT)
74110
add_subdirectory(dpcomp_gpu_runtime)
75111
endif()
76112

77113
add_subdirectory(mlir)
78114
add_subdirectory(dpcomp_runtime)
79115
add_subdirectory(tools)
80116

81-
if(NUMBA_ENABLE)
117+
if(IMEX_ENABLE_NUMBA_FE)
82118
add_subdirectory(numba_dpcomp)
83119
endif()
84120

85-
if(BUILD_TESTING)
121+
if(IMEX_ENABLE_TESTS)
122+
include(CTest)
86123
add_subdirectory(test)
87124
endif()

0 commit comments

Comments
 (0)