From 0a221d038a36e9207554998d71f96c4456916af4 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Mon, 4 Sep 2017 11:35:18 -0700 Subject: [PATCH] Python: Improve dependencies --- src/platform/python/CMakeLists.txt | 5 +++-- src/platform/sdl/CMakeLists.txt | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/platform/python/CMakeLists.txt b/src/platform/python/CMakeLists.txt index 3bbeb6a83..a2c1a3568 100644 --- a/src/platform/python/CMakeLists.txt +++ b/src/platform/python/CMakeLists.txt @@ -20,9 +20,11 @@ if(NOT GIT_TAG) endif() configure_file(${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in ${CMAKE_CURRENT_BINARY_DIR}/setup.py) -add_custom_command(OUTPUT lib.c +add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lib.c COMMAND BINDIR=${CMAKE_CURRENT_BINARY_DIR}/.. CPPFLAGS="${INCLUDE_FLAGS}" ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/_builder.py + COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/lib.c DEPENDS ${PYTHON_HEADERS} + DEPENDS ${BINARY_NAME} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/_builder.py) set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/lib.c PROPERTIES GENERATED ON) @@ -31,7 +33,6 @@ file(GLOB PYTHON_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*.c) add_library(${BINARY_NAME}-pylib STATIC ${CMAKE_CURRENT_BINARY_DIR}/lib.c ${PYTHON_SRC}) set_target_properties(${BINARY_NAME}-pylib PROPERTIES INCLUDE_DIRECTORIES "${CMAKE_BINARY_DIR};${INCLUDE_DIRECTORIES}") set_target_properties(${BINARY_NAME}-pylib PROPERTIES COMPILE_DEFINITIONS "${OS_DEFINES};${FEATURE_DEFINES};${FUNCTION_DEFINES}") -set(PYTHON_LIBRARY ${BINARY_NAME}-pylib PARENT_SCOPE) add_custom_target(${BINARY_NAME}-py ALL COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/setup.py egg_info -e ${CMAKE_CURRENT_BINARY_DIR} ${PYLIB_VERSION} diff --git a/src/platform/sdl/CMakeLists.txt b/src/platform/sdl/CMakeLists.txt index f700062a5..8633a4fb2 100644 --- a/src/platform/sdl/CMakeLists.txt +++ b/src/platform/sdl/CMakeLists.txt @@ -88,7 +88,7 @@ endif() if(ENABLE_SCRIPTING) if(BUILD_PYTHON) - list(APPEND PLATFORM_LIBRARY "${PYTHON_LIBRARY}") + list(APPEND PLATFORM_LIBRARY ${BINARY_NAME}-pylib) endif() endif()