summaryrefslogtreecommitdiffstats
path: root/emulator/CMakeLists.txt
blob: 2f44837875ff9850d0f0f35af579b29ddb4ce2b2 (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
53
54
include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake.global)

include(FindPythonLibs)
include(FindPythonInterp)

include_directories(${PYTHON_INCLUDE_PATH})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../librazer)

macro(ADD_PYTHON_MODULE _NAME _STATIC_SRCS)
	if (NOT PYTHONINTERP_FOUND)
		message(FATAL_ERROR "Python scripting language not found.")
	endif (NOT PYTHONINTERP_FOUND)

	add_library(${_NAME} MODULE ${ARGN})

	set_target_properties(${_NAME} PROPERTIES
			      PREFIX "" # Remove the "lib" prefix
			      )

	install(CODE "exec_program(${PYTHON_EXECUTABLE}
		      ARGS ${CMAKE_CURRENT_SOURCE_DIR}/install.py ${CMAKE_CURRENT_BINARY_DIR}
		      RETURN_VALUE err)
		      if (NOT err EQUAL 0)
			message(FATAL_ERROR \"Failed to install python module ${_NAME}\")
		      endif (NOT err EQUAL 0)")
endmacro (ADD_PYTHON_MODULE)


option(RUNTIME_SANITY_CHECKS "Enable runtime sanity checks" ON)
if (RUNTIME_SANITY_CHECKS)
	add_definitions(-DRUNTIME_SANITY_CHECKS)
endif (RUNTIME_SANITY_CHECKS)

# Built-in devices
set(SRC_DEVICES devices/ports.c
		devices/timers.c)

# The emulator core
set(SRC_CORE cpu.c
	     devprocess.c
	     hardware.c
	     ipc.c
	     memory.c
	     pinout.c
	     python.c
	     subprocess.c
	     util.c)

add_python_module(pyavr8emu SHARED ${SRC_CORE} ${SRC_DEVICES})

set_target_properties(pyavr8emu PROPERTIES
		      COMPILE_FLAGS "${AVREMU_CFLAGS} -I${CMAKE_CURRENT_SOURCE_DIR}")
target_link_libraries(pyavr8emu pthread rt)

bues.ch cgit interface