all repos — mgba @ eff48a77f1760287a74c6a5040f624c0fbe207a0

mGBA Game Boy Advance Emulator

src/platform/python/CMakeLists.txt (view raw)

 1find_program(PYTHON python)
 2
 3configure_file(${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in ${CMAKE_CURRENT_BINARY_DIR}/setup.py)
 4
 5get_property(INCLUDE_DIRECTORIES DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
 6set(INCLUDE_FLAGS)
 7foreach(DIR IN LISTS INCLUDE_DIRECTORIES)
 8	list(APPEND INCLUDE_FLAGS "-I${DIR}")
 9endforeach()
10add_custom_command(OUTPUT build/lib/${BINARY_NAME}/__init__.py
11                   COMMAND BINDIR=${CMAKE_CURRENT_BINARY_DIR}/.. CPPFLAGS="${INCLUDE_FLAGS}" ${PYTHON} ${CMAKE_CURRENT_BINARY_DIR}/setup.py build --build-base ${CMAKE_CURRENT_BINARY_DIR}
12                   WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
13                   DEPENDS ${BINARY_NAME}
14                   DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/setup.py
15                   DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/_builder.py)
16
17add_custom_target(${BINARY_NAME}-py ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/build/lib/${BINARY_NAME}/__init__.py)