-
Notifications
You must be signed in to change notification settings - Fork 10
Add Meson build system as alternative to CMake #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
munechika-koyo
wants to merge
35
commits into
iterorganization:develop
Choose a base branch
from
munechika-koyo:feature/meson
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
cf8a574
Add Meson build configuration and source files for al-core library
munechika-koyo a83d76a
Update Meson version requirement and improve section formatting in me…
munechika-koyo fb947cb
Refactor Meson build configuration to use external al-core installati…
munechika-koyo c7de00b
Add Meson build configuration for Python extension module
munechika-koyo 58407e0
Add Meson build configuration for test executables
munechika-koyo cf45462
Fix version comparison syntax in Meson build configuration for UDA de…
munechika-koyo 662586d
Add versioning support in Meson build configuration and create _versi…
munechika-koyo 06b1922
Update Meson build configuration
munechika-koyo e5fe0e2
Format comment bars
munechika-koyo fbc8419
Update version retrieval command in Meson build configuration to use …
munechika-koyo 5e9b832
Fix variable name for UDA fat client dependency in Meson build config…
munechika-koyo 0b4a380
Replace Windows thread dependency with pthreads and update dlfcn-win3…
munechika-koyo cf9a7ea
Add conditional compiler flags for HDF5 on Windows
munechika-koyo ee653f5
Format
munechika-koyo 2c641fe
Refactor Meson build configuration for al_defs.h and public headers
munechika-koyo 06edbaf
Add include directories section to Meson build configuration
munechika-koyo 613bf1a
Enhance Meson build configuration with warning flags and refactor sou…
munechika-koyo ab5bee6
Add MDSplus backend support in Meson build configuration
munechika-koyo aeff008
Add additional warning flags for Darwin in Meson build configuration
munechika-koyo b3c08f6
Refactor Meson build configuration to remove 'required' flag from dep…
munechika-koyo 8e5ceb4
Remove '-Wno-switch' from warning flags in Meson build configuration
munechika-koyo 829a2b7
Merge branch 'iterorganization:develop' into feature/meson
munechika-koyo b4170b6
Refactor Meson build configuration to use C++ for HDF5 dependency and…
munechika-koyo f5debf6
Update Meson build configuration to conditionally add C++ language su…
munechika-koyo c3894e0
Use find_program() func for python and git
munechika-koyo 0599eed
Revert c/c++ std config
munechika-koyo 5edba1e
Remove default warning flags from Meson build configuration
munechika-koyo d949a4f
Remove version specification from al_core library definition
munechika-koyo 73a337b
Add 'fix_include_windows.h' to the list of installed public headers
munechika-koyo 12344ba
fixed search numpy on SDCC
prasad-sawantdesai e7c37f0
Refactor numpy dependency handling in meson.build
munechika-koyo 072346e
Migrate to cpp compile for cython transpile
munechika-koyo 8456945
Refactor Python dependency handling in Meson build configuration
munechika-koyo a71d1d4
Merge branch 'feature/meson' into pr-10
munechika-koyo 8cd89a1
Merge pull request #1 from prasad-sawantdesai/pr-10
munechika-koyo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| # ============================================================================= | ||
| # Configuration Data for al_defs.h | ||
| # ============================================================================= | ||
|
|
||
| cdata = configuration_data() | ||
|
|
||
| # Version information | ||
| cdata.set('PROJECT_VERSION', meson.project_version()) | ||
|
|
||
| # Generate Config Headers | ||
| al_defs_h = configure_file( | ||
| input: 'al_defs.h.in', | ||
| output: 'al_defs.h', | ||
| configuration: cdata, | ||
| ) | ||
|
|
||
| install_headers(al_defs_h, subdir: 'al_core') | ||
|
|
||
| # ============================================================================= | ||
| # Install Public Headers | ||
| # ============================================================================= | ||
|
|
||
| install_headers( | ||
| 'access_layer_base_plugin.h', | ||
| 'access_layer_plugin.h', | ||
| 'access_layer_plugin_manager.h', | ||
| 'al_backend.h', | ||
| 'al_const.h', | ||
| 'al_context.h', | ||
| 'al_exception.h', | ||
| 'al_lowlevel.h', | ||
| 'data_interpolation.h', | ||
| 'extended_access_layer_plugin.h', | ||
| 'fix_include_windows.h', | ||
| 'provenance_plugin_feature.h', | ||
| 'readback_plugin_feature.h', | ||
| 'uri_parser.h', | ||
| subdir: 'al_core', | ||
| ) | ||
|
|
||
| # ============================================================================= | ||
| # Include Directories | ||
| # ============================================================================= | ||
| public_inc = include_directories('.') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| project( | ||
| 'imas-core', | ||
| 'cpp', | ||
| license: 'LGPL-3.0-or-later', | ||
| meson_version: '>=1.1.0', | ||
| version: run_command( | ||
| find_program('python3'), | ||
| '-m', 'setuptools_scm', | ||
| '--strip-dev', | ||
| check: true, | ||
| ).stdout().strip(), | ||
| default_options: [ | ||
| 'cpp_std=c++17', | ||
| 'buildtype=debugoptimized', | ||
| ], | ||
| ) | ||
|
|
||
| # ============================================================================= | ||
| # Compiler and System Setup | ||
| # ============================================================================= | ||
| cxx = meson.get_compiler('cpp') | ||
| host_system = host_machine.system() | ||
| host_cpu = host_machine.cpu_family() | ||
|
|
||
| # ============================================================================= | ||
| # Warning Flags | ||
| # ============================================================================= | ||
| warning_flags = [] | ||
| if host_system == 'darwin' | ||
| warning_flags += [ | ||
| '-Wno-deprecated-declarations', | ||
| '-Wno-inconsistent-missing-override', | ||
| '-Wno-delete-non-abstract-non-virtual-dtor', | ||
| '-Wno-unused-but-set-variable', | ||
| '-Wno-unused-variable', | ||
| '-Wno-misleading-indentation', | ||
| '-Wno-reorder-ctor', | ||
| '-Wno-pessimizing-move', | ||
| '-Wno-sometimes-uninitialized', | ||
| ] | ||
| endif | ||
|
|
||
| # ============================================================================= | ||
| # Access Layer core (al-core) Library | ||
| # ============================================================================= | ||
| if get_option('al_core') | ||
| subdir('include') | ||
| subdir('src') | ||
| else | ||
| # Use external al-core installation | ||
| al_core_dep = dependency('al-core') | ||
| endif | ||
|
|
||
| # ============================================================================= | ||
| # Dummy Executable for version printing | ||
| # ============================================================================= | ||
| if get_option('al_dummy_exe') | ||
| imas_print_version = executable( | ||
| 'imas_print_version', | ||
| 'tests/imas_print_version.cpp', | ||
| dependencies: [al_core_dep], | ||
| install: true, | ||
| ) | ||
| test('imas_print_version_test', imas_print_version) | ||
| endif | ||
|
|
||
| # ============================================================================= | ||
| # Test Low-level C API (al-core) | ||
| # ============================================================================= | ||
| if get_option('al_test') | ||
| # subdir('tests') # TODO: fix test sources | ||
| endif | ||
|
|
||
| # ============================================================================= | ||
| # Python Bindings (imas-core) | ||
| # ============================================================================= | ||
| if get_option('python_bindings') | ||
| subdir('python') | ||
| endif | ||
|
|
||
| # ============================================================================= | ||
| # MDSplus Models | ||
| # ============================================================================= | ||
| if get_option('mdsplus_models') | ||
| warning('MDSplus models are not yet supported in Meson build system.') | ||
| # subdir('models/mdsplus') | ||
| endif | ||
|
|
||
| # ============================================================================= | ||
| # Summary | ||
| # ============================================================================= | ||
| if get_option('al_core') | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we add github workflow for testing meson build? |
||
| summary( | ||
| { | ||
| 'HDF5': get_option('al_backend_hdf5'), | ||
| 'UDA': get_option('al_backend_uda'), | ||
| 'MDSplus': get_option('al_backend_mdsplus'), | ||
| }, | ||
| section: 'Backends', | ||
| ) | ||
| summary( | ||
| { | ||
| 'Core Arguments': core_args, | ||
| 'Warning Flags': warning_flags, | ||
| }, | ||
| section: 'Compiler Arguments', | ||
| ) | ||
| endif | ||
|
|
||
| if get_option('python_bindings') | ||
| summary( | ||
| { | ||
| 'Python Version': py.language_version(), | ||
| 'Buildtime Python Path': py.full_path(), | ||
| 'Cython Arguments': cython_args, | ||
| }, | ||
| section: 'Python Bindings', | ||
| ) | ||
| endif | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| # ============================================================================= | ||
| # Libraries to build | ||
| # ============================================================================= | ||
|
|
||
| option( | ||
| 'al_core', | ||
| type: 'boolean', | ||
| value: true, | ||
| description: 'Build internal core library, or use external installation', | ||
| ) | ||
|
|
||
| option( | ||
| 'al_dummy_exe', | ||
| type: 'boolean', | ||
| value: false, | ||
| description: 'Build dummy executable that prints version information.', | ||
| ) | ||
|
|
||
| option( | ||
| 'al_test', | ||
| type: 'boolean', | ||
| value: false, | ||
| description: 'Build tests for al-core library', | ||
| ) | ||
|
|
||
| option( | ||
| 'python_bindings', | ||
| type: 'boolean', | ||
| value: true, | ||
| description: 'Build Python wrapper', | ||
| ) | ||
|
|
||
| option( | ||
| 'mdsplus_models', | ||
| type: 'boolean', | ||
| value: false, | ||
| description: 'Build MDSplus models (requires MDSplus installation)', | ||
| ) | ||
|
|
||
| # ============================================================================= | ||
| # Backends Options | ||
| # ============================================================================= | ||
|
|
||
| option( | ||
| 'al_backend_hdf5', | ||
| type: 'boolean', | ||
| value: true, | ||
| description: 'Enable HDF5 backend', | ||
| ) | ||
|
|
||
| option( | ||
| 'al_backend_mdsplus', | ||
| type: 'boolean', | ||
| value: false, | ||
| description: 'Enable MDSplus backend', | ||
| ) | ||
|
|
||
| option( | ||
| 'al_backend_uda', | ||
| type: 'boolean', | ||
| value: true, | ||
| description: 'Enable UDA backend', | ||
| ) | ||
|
|
||
| option( | ||
| 'uda_fat', | ||
| type: 'boolean', | ||
| value: false, | ||
| description: 'Use UDA FAT client libraries', | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| __all__ = [ | ||
| "__version__", | ||
| "__version_tuple__", | ||
| "version", | ||
| "version_tuple", | ||
| "__commit_id__", | ||
| "commit_id", | ||
| ] | ||
|
|
||
| TYPE_CHECKING = False | ||
| if TYPE_CHECKING: | ||
| from typing import Tuple | ||
| from typing import Union | ||
|
|
||
| VERSION_TUPLE = Tuple[Union[int, str], ...] | ||
| COMMIT_ID = Union[str, None] | ||
| else: | ||
| VERSION_TUPLE = object | ||
| COMMIT_ID = object | ||
|
|
||
| version: str | ||
| __version__: str | ||
| __version_tuple__: VERSION_TUPLE | ||
| version_tuple: VERSION_TUPLE | ||
| commit_id: COMMIT_ID | ||
| __commit_id__: COMMIT_ID | ||
|
|
||
| __version__ = version = "@VERSION@" | ||
| __version_tuple__ = version_tuple = @VERSION_TUPLE@ | ||
|
|
||
| __commit_id__ = commit_id = "@COMMIT_ID@" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| add_languages('cython', native: false) | ||
|
|
||
| # ============================================================================= | ||
| # Version File | ||
| # ============================================================================= | ||
| # Get version using setuptools-scm | ||
| version = run_command( | ||
| find_program('python3'), | ||
| '-m', 'setuptools_scm', | ||
| check: true, | ||
| ).stdout().strip() | ||
|
|
||
| # Create tuple: split version like "5.5.2", ignoring dirty suffix etc. | ||
| split_ver = version.split('.') | ||
| ver_tuple = '(@0@, @1@, @2@)'.format( | ||
| split_ver[0], | ||
| split_ver[1], | ||
| split_ver[2], | ||
| ) | ||
|
|
||
| # Get commit id | ||
| git_commit = run_command( | ||
| find_program('git'), | ||
| 'rev-parse', | ||
| '--short', 'HEAD', | ||
| check: false, | ||
| ).stdout().strip() | ||
|
|
||
| if git_commit == '' | ||
| git_commit = 'None' | ||
| endif | ||
|
|
||
| # Generate _version.py | ||
| version_file = configure_file( | ||
| input: '_version.py.in', | ||
| output: '_version.py', | ||
| configuration: { | ||
| 'VERSION': version, | ||
| 'VERSION_TUPLE': ver_tuple, | ||
| 'COMMIT_ID': git_commit, | ||
| }, | ||
| ) | ||
|
|
||
| # ============================================================================= | ||
| # Modules and Dependencies | ||
| # ============================================================================= | ||
| fs = import('fs') | ||
| py = import('python').find_installation(pure: false) | ||
| py_dep = py.dependency() | ||
| numpy_dep = dependency('numpy', required: false) | ||
|
|
||
| if not numpy_dep.found() | ||
| # Get numpy include directory and library using Python | ||
| _incdic_numpy_abs = run_command( | ||
| py, | ||
| '-c', 'import numpy; print(numpy.get_include())', | ||
| check: true, | ||
| ).stdout().strip() | ||
|
|
||
| # Create numpy dependency using include directory | ||
| numpy_dep = declare_dependency( | ||
| include_directories: include_directories(_incdic_numpy_abs), | ||
| ) | ||
| endif | ||
|
|
||
| cython_args = ['--annotate'] | ||
|
|
||
| # ============================================================================= | ||
| # Source files | ||
| # ============================================================================= | ||
| py_files = files( | ||
| 'imas_core/__init__.py', | ||
| 'imas_core/exception.py', | ||
| 'imas_core/imasdef.py', | ||
| ) | ||
| pyx_files = files( | ||
| 'imas_core/_al_lowlevel.pyx', | ||
| 'imas_core/al_defs.pyx', | ||
| ) | ||
| pxd_files = files( | ||
| 'imas_core/al_defs.pxd', | ||
| 'imas_core/al_lowlevel_interface.pxd', | ||
| ) | ||
|
|
||
| # ============================================================================= | ||
| # Build Python Extension Module | ||
| # ============================================================================= | ||
| # compile cython | ||
| foreach pyx_file : pyx_files | ||
| py.extension_module( | ||
| fs.stem(pyx_file), | ||
| pyx_file, | ||
| cython_args: cython_args, | ||
| dependencies: [al_core_dep, py_dep, numpy_dep], | ||
| install: true, | ||
| subdir: 'imas_core', | ||
| override_options: ['cython_language=cpp'], | ||
| ) | ||
| endforeach | ||
|
|
||
| # Install pure python files | ||
| py.install_sources( | ||
| py_files + pxd_files + version_file, | ||
| subdir: 'imas_core', | ||
| ) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to add small list of steps in the sphinx documentation? https://github.com/iterorganization/IMAS-Core/blob/develop/docs/source/user_guide/installation.rst somewhere here?