Browse Source

python: oh of course, $<TARGET_EXISTS> is too new to be useful.

pull/1/head
Vladimír Vondruš 7 years ago
parent
commit
a644684e5e
  1. 18
      src/python/CMakeLists.txt
  2. 12
      src/python/setup.py.cmake

18
src/python/CMakeLists.txt

@ -36,5 +36,21 @@ endif()
add_subdirectory(corrade)
add_subdirectory(magnum)
# This would be bad enough already, but $<TARGET_EXISTS> doesn't exist until
# CMake 3.12, so I need to do two passes, first replacing variables using
# configure_file() and then replacing generator expressions with file(GENERATE)
foreach(target
magnum_gl
magnum_shaders
magnum_platform_egl
magnum_platform_glx
magnum_platform_glfw
magnum_platform_sdl2)
if(TARGET ${target})
set(${target}_file $<TARGET_FILE:${target}>)
endif()
endforeach()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/setup.py.cmake
${CMAKE_CURRENT_BINARY_DIR}/setup.py.in)
file(GENERATE OUTPUT ${output_dir}/setup.py
INPUT ${CMAKE_CURRENT_SOURCE_DIR}/setup.py.cmake)
INPUT ${CMAKE_CURRENT_BINARY_DIR}/setup.py.in)

12
src/python/setup.py.cmake

@ -33,12 +33,12 @@ extension_paths = {
# Filled in by cmake
'corrade.containers': '$<TARGET_FILE:corrade_containers>',
'magnum._magnum': '$<TARGET_FILE:magnum>',
'magnum.gl': '$<$<TARGET_EXISTS:magnum_gl>:$<TARGET_FILE:magnum_gl>>',
'magnum.shaders': '$<$<TARGET_EXISTS:magnum_shaders>:$<TARGET_FILE:magnum_shaders>>',
'magnum.platform.egl': '$<$<TARGET_EXISTS:magnum_platform_egl>:$<TARGET_FILE:magnum_platform_egl>>',
'magnum.platform.glx': '$<$<TARGET_EXISTS:magnum_platform_glx>:$<TARGET_FILE:magnum_platform_glx>>',
'magnum.platform.glfw': '$<$<TARGET_EXISTS:magnum_platform_glfw>:$<TARGET_FILE:magnum_platform_glfw>>',
'magnum.platform.sdl2': '$<$<TARGET_EXISTS:magnum_platform_sdl2>:$<TARGET_FILE:magnum_platform_sdl2>>',
'magnum.gl': '${magnum_gl_file}',
'magnum.shaders': '${magnum_shaders_file}',
'magnum.platform.egl': '${magnum_platform_egl_file}',
'magnum.platform.glx': '${magnum_platform_glx_file}',
'magnum.platform.glfw': '${magnum_platform_glfw_file}',
'magnum.platform.sdl2': '${magnum_platform_sdl2_file}',
}
class TheExtensionIsAlreadyBuiltWhyThisHasToBeSoDamnComplicated(build_ext):

Loading…
Cancel
Save