Skip to content

Add Meson build #689

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
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,15 @@ jobs:
sudo apt-get install -y lcov

- name: Build package
env:
CXXFLAGS: "-std=c++17 --coverage"
CFLAGS: "--coverage"
run: |
CXXFLAGS="-std=c++17 --coverage" CFLAGS="--coverage" python scripts/build/install.py
spin build -v
# coverage tests
- name: Run tests
run: |
python -m pytest --doctest-modules --cov=./ --cov-report=xml -s
spin test -v

- name: Capture Coverage Data with lcov
run: |
Expand Down Expand Up @@ -101,12 +104,14 @@ jobs:
python -m pip install -r docs/requirements.txt

- name: Build package
env:
CXXFLAGS: "-std=c++17"
run: |
CXXFLAGS="-std=c++17" python scripts/build/install.py
spin build -v

- name: Run tests
run: |
python -c "import pydatastructs; pydatastructs.test(only_benchmarks=True)"
spin test -v

- name: Build Documentation
run: |
Expand Down Expand Up @@ -144,11 +149,12 @@ jobs:
- name: Build package
env:
MACOSX_DEPLOYMENT_TARGET: 11.0
CXXFLAGS: "-std=c++17"
run: |
CXXFLAGS="-std=c++17" python scripts/build/install.py
spin build -v
- name: Run tests
run: |
python -c "import pydatastructs; pydatastructs.test()"
spin test -v

- name: Build Documentation
run: |
Expand Down Expand Up @@ -194,11 +200,11 @@ jobs:
env:
CL: "/std:c++17"
run: |
python scripts/build/install.py
spin build -v

- name: Run tests
run: |
python -c "import pydatastructs; pydatastructs.test()"
spin test -v

- name: Build Documentation
run: |
Expand Down
2 changes: 2 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ dependencies:
- pip:
- codecov
- pytest-cov
- spin
- meson
- sphinx==5.0
- sphinx-readable-theme==1.3.0
- myst_nb==0.17.2
Expand Down
7 changes: 7 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
project('pydatastructs', 'cpp',
version : '1.0.1-dev',
default_options : ['cpp_std=c++17'])

python = import('python').find_installation(pure: false)

subdir('pydatastructs')
1 change: 0 additions & 1 deletion pydatastructs/graphs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from . import algorithms
from . import adjacency_list
from . import adjacency_matrix
from . import _extensions

from .algorithms import (
breadth_first_search,
Expand Down
37 changes: 37 additions & 0 deletions pydatastructs/graphs/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
python = import('python').find_installation(pure: false)

python.install_sources(
[
'__init__.py',
'adjacency_list.py',
'adjacency_matrix.py',
'algorithms.py',
'graph.py'
],
subdir: 'pydatastructs/graphs'
)

python.install_sources(
['_backend/__init__.py', '_backend/cpp/__init__.py'],
subdir: 'pydatastructs/graphs/_backend'
)

py_include = include_directories('../utils/_backend/cpp')

python.extension_module(
'_graph',
'_backend/cpp/graph.cpp',
include_directories: py_include,
install: true,
subdir: 'pydatastructs/graphs/_backend/cpp'
)

python.extension_module(
'_algorithms',
'_backend/cpp/algorithms.cpp',
include_directories: py_include,
install: true,
subdir: 'pydatastructs/graphs/_backend/cpp'
)

subdir('tests')
12 changes: 12 additions & 0 deletions pydatastructs/graphs/tests/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
python = import('python').find_installation(pure: false)

python.install_sources(
[
'__init__.py',
'test_adjacency_list.py',
'test_adjacency_matrix.py',
'test_algorithms.py'
],
subdir: 'pydatastructs/graphs/tests',
install_tag: 'tests'
)
1 change: 0 additions & 1 deletion pydatastructs/linear_data_structures/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
arrays,
linked_lists,
algorithms,
_extensions
)

from .arrays import (
Expand Down
32 changes: 32 additions & 0 deletions pydatastructs/linear_data_structures/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
python = import('python').find_installation(pure: false)

python.install_sources(
[
'__init__.py',
'algorithms.py',
'arrays.py',
'linked_lists.py'
],
subdir: 'pydatastructs/linear_data_structures'
)

python.install_sources(
['_backend/__init__.py', '_backend/cpp/__init__.py'],
subdir: 'pydatastructs/linear_data_structures/_backend'
)

python.extension_module(
'_arrays',
'_backend/cpp/arrays/arrays.cpp',
install: true,
subdir: 'pydatastructs/linear_data_structures/_backend/cpp'
)

python.extension_module(
'_algorithms',
'_backend/cpp/algorithms/algorithms.cpp',
install: true,
subdir: 'pydatastructs/linear_data_structures/_backend/cpp'
)

subdir('tests')
15 changes: 15 additions & 0 deletions pydatastructs/linear_data_structures/tests/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
python = import('python').find_installation(pure: false)

python.install_sources(
[
'__init__.py',
'benchmarks/__init__.py',
'benchmarks/test_algorithms.py',
'benchmarks/test_arrays.py',
'test_algorithms.py',
'test_arrays.py',
'test_linked_lists.py'
],
subdir: 'pydatastructs/linear_data_structures/tests',
install_tag: 'tests'
)
10 changes: 10 additions & 0 deletions pydatastructs/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
python = import('python').find_installation(pure: false)

python.install_sources(['__init__.py'], subdir: 'pydatastructs')

subdir('utils')
subdir('linear_data_structures')
subdir('miscellaneous_data_structures')
subdir('trees')
subdir('graphs')
subdir('strings')
1 change: 0 additions & 1 deletion pydatastructs/miscellaneous_data_structures/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
queue,
disjoint_set,
sparse_table,
_extensions,
)

from .binomial_trees import (
Expand Down
30 changes: 30 additions & 0 deletions pydatastructs/miscellaneous_data_structures/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
python = import('python').find_installation(pure: false)

python.install_sources(
[
'__init__.py',
'algorithms.py',
'multiset.py',
'sparse_table.py',
'disjoint_set.py',
'queue.py',
'binomial_trees.py',
'segment_tree.py',
'stack.py'
],
subdir: 'pydatastructs/miscellaneous_data_structures'
)

python.install_sources(
['_backend/__init__.py', '_backend/cpp/__init__.py'],
subdir: 'pydatastructs/miscellaneous_data_structures/_backend'
)

python.extension_module(
'_stack',
'_backend/cpp/stack/stack.cpp',
install: true,
subdir: 'pydatastructs/miscellaneous_data_structures/_backend/cpp'
)

subdir('tests')
16 changes: 16 additions & 0 deletions pydatastructs/miscellaneous_data_structures/tests/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
python = import('python').find_installation(pure: false)

python.install_sources(
[
'__init__.py',
'test_binomial_trees.py',
'test_disjoint_set.py',
'test_multiset.py',
'test_queue.py',
'test_range_query_dynamic.py',
'test_range_query_static.py',
'test_stack.py'
],
subdir: 'pydatastructs/miscellaneous_data_structures/tests',
install_tag: 'tests'
)
12 changes: 12 additions & 0 deletions pydatastructs/strings/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
python = import('python').find_installation(pure: false)

python.install_sources(
[
'__init__.py',
'algorithms.py',
'trie.py'
],
subdir: 'pydatastructs/strings'
)

subdir('tests')
11 changes: 11 additions & 0 deletions pydatastructs/strings/tests/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
python = import('python').find_installation(pure: false)

python.install_sources(
[
'__init__.py',
'test_algorithms.py',
'test_trie.py'
],
subdir: 'pydatastructs/strings/tests',
install_tag: 'tests'
)
1 change: 0 additions & 1 deletion pydatastructs/trees/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
m_ary_trees,
space_partitioning_trees,
heaps,
_extensions
)

from .binary_trees import (
Expand Down
Empty file.
Empty file.
26 changes: 26 additions & 0 deletions pydatastructs/trees/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
python = import('python').find_installation(pure: false)

python.install_sources(
[
'__init__.py',
'binary_trees.py',
'heaps.py',
'm_ary_trees.py',
'space_partitioning_trees.py'
],
subdir: 'pydatastructs/trees'
)

python.install_sources(
['_backend/__init__.py', '_backend/cpp/__init__.py'],
subdir: 'pydatastructs/trees/_backend'
)

python.extension_module(
'_trees',
'_backend/cpp/trees.cpp',
install: true,
subdir: 'pydatastructs/trees/_backend/cpp'
)

subdir('tests')
14 changes: 14 additions & 0 deletions pydatastructs/trees/tests/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
python = import('python').find_installation(pure: false)

python.install_sources(
[
'__init__.py',
'benchmarks/test_binary_trees.py',
'test_binary_trees.py',
'test_heaps.py',
'test_m_ary_trees.py',
'test_space_partitioning_tree.py'
],
subdir: 'pydatastructs/trees/tests',
install_tag: 'tests'
)
1 change: 0 additions & 1 deletion pydatastructs/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from . import (
misc_util,
testing_util,
_extensions
)

from .misc_util import (
Expand Down
Empty file.
Empty file.
32 changes: 32 additions & 0 deletions pydatastructs/utils/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
python = import('python').find_installation(pure: false)

python.install_sources(
[
'__init__.py',
'misc_util.py',
'raises_util.py',
'testing_util.py'
],
subdir: 'pydatastructs/utils'
)

python.install_sources(
['_backend/__init__.py', '_backend/cpp/__init__.py'],
subdir: 'pydatastructs/utils/_backend'
)

python.extension_module(
'_nodes',
'_backend/cpp/nodes.cpp',
install: true,
subdir: 'pydatastructs/utils/_backend/cpp'
)

python.extension_module(
'_graph_utils',
'_backend/cpp/graph_utils.cpp',
install: true,
subdir: 'pydatastructs/utils/_backend/cpp'
)

subdir('tests')
11 changes: 11 additions & 0 deletions pydatastructs/utils/tests/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
python = import('python').find_installation(pure: false)

python.install_sources(
[
'__init__.py',
'test_misc_util.py',
'test_code_quality.py'
],
subdir: 'pydatastructs/utils/tests',
install_tag: 'tests'
)
Loading
Loading