diff --git a/.gitignore b/.gitignore index 19738ff..362d0e1 100644 --- a/.gitignore +++ b/.gitignore @@ -86,3 +86,4 @@ output/ .idea/ scratch/ +subprojects/.wraplock diff --git a/meson.build b/meson.build index 578a618..d895fb3 100644 --- a/meson.build +++ b/meson.build @@ -18,11 +18,32 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # *********************************************************************** # -project('libconstants', 'cpp', version: 'v1.1.5', default_options: ['cpp_std=c++23'], meson_version: '>=1.5.0') +project('libconstants', 'cpp', version: 'v1.1.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') +if get_option('build_python') + local_py_install = import('python').find_installation('python3', pure: false) + fourdst_pkg = local_py_install.get_install_dir() / 'fourdst' + + constants_libdir = fourdst_pkg / 'lib' + constants_header_install_dir = fourdst_pkg / 'include' / 'fourdst' / 'constants' + + vendor_lib_dir = fourdst_pkg / 'lib' / 'vendor' + vendor_header_dir = fourdst_pkg / 'include' / 'fourdst' / 'vendor' + + message('Installing libconfig in python mode. Install locations are...') +else + constants_libdir = get_option('libdir') + constants_header_install_dir = get_option('includedir') / 'fourdst' / 'constants' + + message('Installing libconfig in non python (normal) mode. Install locations are...') +endif +message(' Libraries: ' + constants_libdir) +message(' Headers: ' + constants_header_install_dir) + + cpp = meson.get_compiler('cpp') subdir('assets/static') @@ -45,7 +66,6 @@ if get_option('pkg_config') description: 'Physical Constants for SERiF and related projects', version: meson.project_version(), libraries: [libconst, '-Wl,-rpath,${libdir}'], - subdirs: ['fourdst'], filebase: 'fourdst_constants', install_dir: join_paths(get_option('libdir'), 'pkgconfig') ) diff --git a/meson_options.txt b/meson_options.txt index 1c193f1..fa431bf 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,5 +1,4 @@ option('pkg_config', type: 'boolean', value: true, description: 'generate pkg-config file for libconstants (fourdst_constants.pc)') option('build_tests', type: 'boolean', value: true, description: 'control if tests are built or not') option('build_examples', type: 'boolean', value: true, description: 'control if examples is built or not') -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.') \ No newline at end of file +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.') diff --git a/src/constants/meson.build b/src/constants/meson.build index 80676d1..64478b9 100644 --- a/src/constants/meson.build +++ b/src/constants/meson.build @@ -5,14 +5,13 @@ const_sources = files( # Define the libconst library so it can be linked against by other parts of the build system -fourdst_component_libdir = get_option('lib_install_dir') != '' ? get_option('lib_install_dir') : get_option('libdir') libconst = library('const', const_sources, include_directories: include_directories('include'), cpp_args: ['-fvisibility=default'], dependencies: [const_data_dep], install : true, - install_dir: fourdst_component_libdir) + install_dir: constants_libdir) const_dep = declare_dependency( include_directories: include_directories('include'), @@ -24,8 +23,4 @@ const_headers = files( 'include/fourdst/constants/const.h' ) - -constants_header_install_dir = get_option('header_install_dir') != '' \ - ? get_option('header_install_dir') / 'fourdst' / 'constants' \ - : get_option('includedir') / 'fourdst' / 'constants' install_headers(const_headers, install_dir: constants_header_install_dir)