-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
82 lines (65 loc) · 2.13 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
cmake_minimum_required(VERSION 3.13)
option(TARGET_NATIVE "Build for build platform" OFF)
if(TARGET_NATIVE)
project(game-engine CXX C ASM)
include_directories(include)
file(GLOB_RECURSE SOURCES src/*.cpp)
file(GLOB_RECURSE RESOURCES res/build/generated/*.cpp)
add_subdirectory(lib)
add_executable(build
native_main.cpp
${SOURCES}
${RESOURCES}
)
target_compile_options(build PRIVATE -Winline)
find_package(SDL2 REQUIRED)
target_include_directories(build PUBLIC include)
target_include_directories(build PUBLIC lodepng)
target_include_directories(build PUBLIC ${SDL2_INCLUDE_DIRS})
target_link_directories(build PRIVATE lodepng)
set_target_properties(build PROPERTIES COMPILE_FLAGS "-g -lSDL2")
set_target_properties(build PROPERTIES LINK_FLAGS "-fsanitize=undefined")
set_property(TARGET build PROPERTY CXX_STANDARD 20)
add_compile_definitions(PLATFORM_NATIVE=1)
target_link_libraries(
build
lodepng
${SDL2_LIBRARIES}
)
else()
include(pico-sdk/pico_sdk_init.cmake)
project(game-engine CXX C ASM)
pico_sdk_init()
include_directories(include)
file(GLOB_RECURSE SOURCES src/*.cpp)
file(GLOB_RECURSE RESOURCES res/build/generated/*.cpp)
add_subdirectory(lib)
add_executable(build
main.cpp
${SOURCES}
${RESOURCES}
)
target_link_libraries(build
pico_stdlib
pico_multicore
hardware_gpio
hardware_pio
hardware_pwm
hardware_spi
hardware_dma
hardware_adc
)
pico_generate_pio_header(build
${CMAKE_CURRENT_LIST_DIR}/src/hardware/screen_double.pio
)
pico_add_extra_outputs(build)
target_compile_options(build PRIVATE -DPARAM_ASSERTIONS_ENABLE_ALL=1)
add_compile_definitions(PLATFORM_PICO=1)
target_compile_features(build PUBLIC cxx_std_20)
if (TARGET tinyusb_device)
pico_enable_stdio_usb(build 1)
pico_enable_stdio_uart(build 0)
elseif(PICO_ON_DEVICE)
message(WARNING "not building because TinyUSB submodule is not initialized in the SDK")
endif()
endif()