From a644684e5ecfda33511db2d4c6976c6cc67e5d68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 2 May 2019 20:09:11 +0200 Subject: [PATCH] python: oh of course, $ is too new to be useful. --- src/python/CMakeLists.txt | 18 +++++++++++++++++- src/python/setup.py.cmake | 12 ++++++------ 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index d6ac2fc..7c5831d 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -36,5 +36,21 @@ endif() add_subdirectory(corrade) add_subdirectory(magnum) +# This would be bad enough already, but $ 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 $) + 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) diff --git a/src/python/setup.py.cmake b/src/python/setup.py.cmake index 488409d..138a289 100644 --- a/src/python/setup.py.cmake +++ b/src/python/setup.py.cmake @@ -33,12 +33,12 @@ extension_paths = { # Filled in by cmake 'corrade.containers': '$', 'magnum._magnum': '$', - 'magnum.gl': '$<$:$>', - 'magnum.shaders': '$<$:$>', - 'magnum.platform.egl': '$<$:$>', - 'magnum.platform.glx': '$<$:$>', - 'magnum.platform.glfw': '$<$:$>', - '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):