aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2017-01-13 19:37:37 +0000
committerStephen Kelly <steveire@gmail.com>2017-01-13 19:41:14 +0000
commit29b9db8d67c67d4d1303e8dd9804f698fbaefbe1 (patch)
tree8817facd387fda7ce755ea5fcc86437f7bea2d8e
parent173d9984ef62c07b331f4cb1e6138e8993dfb92f (diff)
downloadextra-cmake-modules-29b9db8d67c67d4d1303e8dd9804f698fbaefbe1.tar.gz
extra-cmake-modules-29b9db8d67c67d4d1303e8dd9804f698fbaefbe1.tar.bz2
Bindings: Add a script to generate __init__.py file for bindings
Packagers can execute this script with cmake -D PYTHON_UMBRELLA_MODULE_FILE=/where/ever/PyKF5/__init__.py -P /path/to/ECM/find-modules/GeneratePythonBindingUmbrellaModule.cmake Soon, this is likely to do more than create an empty file.
-rw-r--r--find-modules/FindPythonModuleGeneration.cmake8
-rw-r--r--find-modules/GeneratePythonBindingUmbrellaModule.cmake7
2 files changed, 12 insertions, 3 deletions
diff --git a/find-modules/FindPythonModuleGeneration.cmake b/find-modules/FindPythonModuleGeneration.cmake
index 7a4f7d45..434c4381 100644
--- a/find-modules/FindPythonModuleGeneration.cmake
+++ b/find-modules/FindPythonModuleGeneration.cmake
@@ -422,9 +422,11 @@ headers = sipAPI${modulename_value}
"${CMAKE_CURRENT_BINARY_DIR}/pybuild/${pythonnamespace_value}/${modulename_value}")
foreach(pyversion ${_pyversions})
- file(MAKE_DIRECTORY
- "${CMAKE_CURRENT_BINARY_DIR}/py${pyversion}/${pythonnamespace_value}")
- execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${CMAKE_CURRENT_BINARY_DIR}/py${pyversion}/${pythonnamespace_value}/__init__.py")
+
+ execute_process(COMMAND "${CMAKE_COMMAND}"
+ "-DPYTHON_UMBRELLA_MODULE_FILE=${CMAKE_CURRENT_BINARY_DIR}/py${pyversion}/${pythonnamespace_value}/__init__.py"
+ -P "${GPB_MODULE_DIR}/GeneratePythonBindingUmbrellaModule.cmake"
+ )
add_library(Py${pyversion}KF5${modulename_value} MODULE
"${CMAKE_CURRENT_BINARY_DIR}/pybuild/${pythonnamespace_value}/${modulename_value}/unified${modulename_value}.cpp"
diff --git a/find-modules/GeneratePythonBindingUmbrellaModule.cmake b/find-modules/GeneratePythonBindingUmbrellaModule.cmake
new file mode 100644
index 00000000..35bbc2c5
--- /dev/null
+++ b/find-modules/GeneratePythonBindingUmbrellaModule.cmake
@@ -0,0 +1,7 @@
+cmake_minimum_required(VERSION 3.2)
+
+get_filename_component(PYTHON_UMBRELLA_MODULE_DIR ${PYTHON_UMBRELLA_MODULE_FILE} PATH)
+
+file(MAKE_DIRECTORY "${PYTHON_UMBRELLA_MODULE_DIR}")
+
+execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${PYTHON_UMBRELLA_MODULE_FILE}")