blob: df387faf258869f384b1912db61634a467c3b8e6 (
plain)
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
|
cmake_minimum_required(VERSION 3.30)
project(
nes
LANGUAGES CXX OBJCXX OBJC
VERSION 1.0)
option(NES_ENABLE_SANITIZER_ADDRESS "Enable address sanitizer." OFF)
option(NES_ENABLE_SANITIZER_UNDEFINED_BEHAVIOR "Enable undefined behavior sanitizer." OFF)
option(NES_ENABLE_DEBUG_OUTPUT "Enable debug output." OFF)
option(NES_ENABLE_SNAPSHOTS "Enable snapshot functionality for debugging purposes." OFF)
add_library(nes_options INTERFACE)
add_library(nes::options ALIAS nes_options)
target_compile_features(nes_options INTERFACE cxx_std_17)
target_compile_options(nes_options
INTERFACE
-Wall
-Wextra
-Wno-changes-meaning # fuck off, gcc
-Wno-unused-function # fr
-Wnon-virtual-dtor
-Wcast-align
-Wunused
-Woverloaded-virtual
-Wpedantic
-Wdouble-promotion
-Wformat=2
-Wswitch-enum)
if(APPLE)
# Use automatic reference counting for Objective-C code.
target_compile_options(nes_options INTERFACE "-fobjc-arc")
endif()
if(NES_ENABLE_SANITIZER_ADDRESS AND NES_ENABLE_SANITIZER_UNDEFINED_BEHAVIOR)
message(FATAL_ERROR "Address sanitizer and undefined behavior sanitizer cannot be enabled at the same time.")
elseif(NES_ENABLE_SANITIZER_ADDRESS)
target_compile_options(nes_options INTERFACE -fsanitize=address)
elseif(NES_ENABLE_SANITIZER_UNDEFINED_BEHAVIOR)
target_compile_options(nes_options INTERFACE -fsanitize=undefined)
endif()
if(NES_ENABLE_DEBUG_OUTPUT)
include(FetchContent)
FetchContent_Declare(
spdlog
GIT_REPOSITORY https://github.com/gabime/spdlog.git
GIT_TAG v1.15.0)
FetchContent_MakeAvailable(spdlog)
endif()
add_subdirectory(tools)
add_subdirectory(lib)
add_subdirectory(app)
|