build(meson): more robust python version building

This commit is contained in:
2026-06-11 10:55:15 -04:00
parent 404b0bd757
commit 82428f9e6e
4 changed files with 27 additions and 15 deletions

View File

@@ -48,7 +48,7 @@ PROJECT_NAME = fourdst::libcomposition
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = v2.4.5
PROJECT_NUMBER = v2.4.6
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewers a

View File

@@ -18,13 +18,31 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# *********************************************************************** #
project('libcomposition', 'cpp', version: 'v2.4.5', default_options: ['cpp_std=c++23'], meson_version: '>=1.5.0')
project('libcomposition', 'cpp', version: 'v2.4.6', default_options: ['cpp_std=c++23'], meson_version: '>=1.5.0')
# Add default visibility for all C++ targets
add_project_arguments('-fvisibility=default', language: 'cpp')
# Disable shadow warnings
add_project_arguments('-Wno-shadow', language: 'cpp')
if get_option('build_python')
local_py_install = import('python').find_installation('python3', pure: false)
fourdst_pkg = local_py_install.get_install_dir() / 'fourdst'
composition_libdir = fourdst_pkg / 'lib'
composition_header_install_dir = fourdst_pkg / 'include' / 'fourdst' / 'composition'
vendor_lib_dir = fourdst_pkg / 'lib' / 'vendor'
vendor_header_dir = fourdst_pkg / 'include' / 'fourdst' / 'vendor'
message('Installing libcomposition in python mode. Install locations are...')
else
composition_libdir = get_option('libdir')
composition_header_install_dir = get_option('includedir') / 'fourdst' / 'composition'
message('Installing libcomposition in non python (normal) mode. Install locations are...')
endif
message(' Libraries: ' + composition_libdir)
message(' Headers: ' + composition_header_install_dir)
cpp = meson.get_compiler('cpp')
subdir('build-config')

View File

@@ -2,5 +2,4 @@ option('pkg_config', type: 'boolean', value: true, description: 'generate pkg-co
option('build_tests', type: 'boolean', value: true, description: 'build unit tests (uses gtest)')
option('build_examples', type: 'boolean', value: true, description: 'build example programs')
option('build_benchmarks', type: 'boolean', value: false, description: 'build benchmark programs')
option('lib_install_dir', type: 'string', value: '', description: 'Override install dir for the shared library (used by the fourdst umbrella to place libs inside the Python package in wheel builds). Empty = default libdir.')
option('header_install_dir', type: 'string', value: '', description: 'Override the header install root (used by the fourdst umbrella to place headers inside the Python package in wheel builds). Empty = default includedir.')
option('build_python', type: 'boolean', value: false, description: 'Build in python mode. Note that this does not generate a wheel; rather, this is the appropriate option to turn on when packaging this component inside of a wheel.')

View File

@@ -37,14 +37,13 @@ dependencies = [
xxhash_dep
]
fourdst_component_libdir = get_option('lib_install_dir') != '' ? get_option('lib_install_dir') : get_option('libdir')
libcomposition = library('composition',
composition_sources,
cpp_args: ['-fvisibility=default'],
dependencies: dependencies,
install: true,
install_dir: fourdst_component_libdir)
composition_sources,
cpp_args: ['-fvisibility=default'],
dependencies: dependencies,
install: true,
install_dir: composition_libdir
)
composition_dep = declare_dependency(
@@ -53,10 +52,6 @@ composition_dep = declare_dependency(
sources: composition_sources,
)
composition_header_install_dir = get_option('header_install_dir') != '' \
? get_option('header_install_dir') / 'fourdst' / 'composition' \
: get_option('includedir') / 'fourdst' / 'composition'
# Make headers accessible
composition_headers = files(
'include/fourdst/composition/composition.h',