-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
47 lines (36 loc) · 2.31 KB
/
CMakeLists.txt
File metadata and controls
47 lines (36 loc) · 2.31 KB
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
# Running with sanitizers:
# Create a _new_ build directory and run cmake with the -DSANITIZE=<option> command line option. The various options that should work are: address, thread, undefined
# You may need to run "export ASAN_OPTIONS=detect_leaks=0" before running any of the tests with the address sanitizer.
cmake_minimum_required(VERSION 3.10)
# Note, this MUST NOT be compile with -ffinite-math or -ffast-math (or any optimization option that affects nan of inf representations), this will break nan operations that we need for correct SPIRV simulation.
# In general, leave the -fno-fast-math option below alone so that we keep full IEEE 754 compliance.
project(spirv_simulator VERSION 0.0.1 DESCRIPTION "SPIRV simulator for finding memory and pointer usage information from shaders" LANGUAGES CXX)
enable_testing()
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(SANITIZE)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(SANITIZER -fsanitize=${SANITIZE} -fstack-protector-all -fsanitize-undefined-trap-on-error)
else()
set(SANITIZER -fsanitize=${SANITIZE} -fstack-protector-all -fsanitize-undefined-trap-on-error -fuse-ld=gold)
endif()
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_compile_definitions(DEBUG_BUILD)
endif()
if(MSVC)
set(COMPILE_OPTIONS /W4 /permissive- /fp:strict)
else()
set(COMPILE_OPTIONS -Wall -Wextra -Wpedantic -Wshadow -fno-fast-math)
endif()
add_subdirectory(framework)
add_subdirectory(test)
add_executable(spirv_simulator ${PROJECT_SOURCE_DIR}/main.cpp)
target_compile_options(spirv_simulator PRIVATE ${SANITIZER} ${COMPILE_OPTIONS})
target_link_libraries(spirv_simulator PRIVATE ${SANITIZER} spirv_simulator_lib)
target_compile_definitions(spirv_simulator PRIVATE PROJECT_VERSION_MAJOR=${PROJECT_VERSION_MAJOR} PROJECT_VERSION_MINOR=${PROJECT_VERSION_MINOR} PROJECT_VERSION_PATCH=${PROJECT_VERSION_PATCH})
add_executable(spirv_opcode_support_checker ${PROJECT_SOURCE_DIR}/main_opcode_checker.cpp)
target_compile_options(spirv_opcode_support_checker PRIVATE ${SANITIZER} ${COMPILE_OPTIONS})
target_link_libraries(spirv_opcode_support_checker PRIVATE ${SANITIZER} spirv_simulator_lib)
add_executable(memory_flag_tracker ${PROJECT_SOURCE_DIR}/main_memory_flag_tracker.cpp)
target_compile_options(memory_flag_tracker PRIVATE ${SANITIZER} ${COMPILE_OPTIONS})