Skip to content

Commit

Permalink
Fix packaging of headers and pkgconfig .pc file.
Browse files Browse the repository at this point in the history
  • Loading branch information
rcurtin committed Dec 14, 2023
1 parent 4e1a9f3 commit 9deb411
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions python-install-headers.patch
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

+# Find all include files.
+include_files = []
+for (path, directories, filenames) in os.walk('include/'):
+for (path, directories, filenames) in os.walk('mlpack/include/'):
+ for filename in filenames:
+ include_files.append(os.path.join('..', path, filename))
+
Expand All @@ -17,7 +17,7 @@
install_requires=['cython>=0.24', 'numpy', 'pandas'],
package_dir={ '': '.' }, # Might be superfluous.
packages=['mlpack'],
+ package_data={ 'mlpack': include_files + ['../share/pkgconfig/mlpack.pc'] },
+ package_data={ 'mlpack': include_files + ['../mlpack/share/pkgconfig/mlpack.pc'] },
+ include_package_data=True,
cmdclass={ 'build_ext': build_ext },
ext_modules = modules,
Expand All @@ -32,16 +32,16 @@
+add_custom_command(TARGET python_copy PRE_BUILD
+ COMMAND ${CMAKE_COMMAND} ARGS -E copy_directory
+ ${CMAKE_SOURCE_DIR}/src/
+ ${CMAKE_BINARY_DIR}/src/mlpack/bindings/python/include/)
+ ${CMAKE_BINARY_DIR}/src/mlpack/bindings/python/mlpack/include/)
+
+# Generate pkgconfig file for easy use of included headers.
+add_custom_target(python_pkgconfig
+ COMMAND ${CMAKE_COMMAND}
+ -D GENERATE_CPP_IN=${CMAKE_SOURCE_DIR}/src/mlpack/bindings/python/mlpack.pc.in
+ -D GENERATE_CPP_OUT=${CMAKE_BINARY_DIR}/src/mlpack/bindings/python/share/pkgconfig/mlpack.pc
+ -D GENERATE_CPP_OUT=${CMAKE_BINARY_DIR}/src/mlpack/bindings/python/mlpack/share/pkgconfig/mlpack.pc
+ -D PACKAGE_VERSION="${PACKAGE_VERSION}"
+ -P "${CMAKE_SOURCE_DIR}/CMake/ConfigureFileOnly.cmake"
+ BYPRODUCTS "${CMAKE_BINARY_DIR}/src/mlpack/bindings/python/share/pkgconfig/mlpack.pc"
+ BYPRODUCTS "${CMAKE_BINARY_DIR}/src/mlpack/bindings/python/mlpack/share/pkgconfig/mlpack.pc"
+ COMMENT "Configuring Python mlpack.pc...")
+add_dependencies(python_copy python_pkgconfig)
+
Expand Down

0 comments on commit 9deb411

Please sign in to comment.