~alderwick/pico-uxn

pico-uxn/CMakeLists.txt -rw-r--r-- 1.3 KiB
2027e62dAndrew Alderwick Update to latest Uxn. 4 months ago
                                                                                
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
cmake_minimum_required(VERSION 3.12)

# initialize pico_sdk from submodule
# note: this must happen before project()
include(lib/pico-sdk/pico_sdk_init.cmake)

project(my_project)

# initialize the Pico SDK
pico_sdk_init()

# rest of your project
add_executable(uxn
	main.c
	lib/uxn/src/uxn-fast.c
	)

target_include_directories(uxn PRIVATE ${CMAKE_CURRENT_LIST_DIR} lib/uxn/src)

target_link_libraries(uxn PRIVATE
	pico_stdlib
	pico_multicore
	hardware_pio
	hardware_dma
	hardware_irq
	)
pico_add_extra_outputs(uxn)

set(uxn_init_definitions "")
set(uxn_init_calls "")
macro(add_init_function FNNAME)
	set(uxn_init_definitions "${uxn_init_definitions} extern void ${FNNAME}(Uxn *u)\;")
	set(uxn_init_calls "${uxn_init_calls} ${FNNAME}(&u)\;")
endmacro()

set(uxn_tasks "")
macro(add_main_loop_task FNNAME)
	set(uxn_init_definitions "${uxn_init_definitions} extern void ${FNNAME}(Uxn *u)\;")
	set(uxn_tasks "${uxn_tasks} ${FNNAME}(&u)\;")
endmacro()

file(GLOB plugin_cmakes plugins/*/plugin.cmake)
foreach(plugin_cmake ${plugin_cmakes})
	include(${plugin_cmake})
endforeach()

target_compile_definitions(uxn PRIVATE "UXN_INIT_DEFINITIONS=${uxn_init_definitions}")
target_compile_definitions(uxn PRIVATE "UXN_INIT_CALLS=${uxn_init_calls}")
target_compile_definitions(uxn PRIVATE "UXN_TASKS=${uxn_tasks}")