2 cmake_minimum_required(VERSION 3.5)
4 set(CGEN_INCLUDE_DIR ${CMAKE_BINARY_DIR}/include-generated)
6 set(CGEN_ITEMS fb bus gpu)
10 foreach(ITEM ${CGEN_ITEMS})
11 add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/cgen/${ITEM}.c ${CGEN_INCLUDE_DIR}/cgen/${ITEM}.h
13 ARGS -m ssot.gen_c ssot.${ITEM} ${CMAKE_BINARY_DIR} ${CGEN_INCLUDE_DIR}
14 MAIN_DEPENDENCY ../ssot/${ITEM}.py
15 DEPENDS ../ssot/cgen.py ../ssot/gen_c.py
16 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..
18 set(CGEN_SOURCES ${CGEN_SOURCES} ${CMAKE_BINARY_DIR}/cgen/${ITEM}.c)
19 set(CGEN_HEADERS ${CGEN_HEADERS} ${CGEN_INCLUDE_DIR}/cgen/${ITEM}.h)
22 add_library(cgen ${CGEN_SOURCES})
23 set_property(TARGET cgen PROPERTY POSITION_INDEPENDENT_CODE ON)