Skip to content

Added SCons compilation instructions #885

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

Merged
merged 10 commits into from
Oct 26, 2021
Merged
Show file tree
Hide file tree
Changes from 3 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
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -517,3 +517,10 @@ vscode/

# aspell
*.bak

# SCons intermidiate files
.sconsign.dblite
*.o

# SCons build directory
build/
10 changes: 10 additions & 0 deletions SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from pathlib import Path

Import('*')

for p in Path('contents').iterdir():
if (q := (p / 'code')).exists():
for path in q.iterdir():
if path.stem in languages:
env.SConscript(path / 'SConscript', exports='env',
must_exist=0)
20 changes: 20 additions & 0 deletions SConstruct
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"""
SCons top-level build description (SConstruct) for the Arcane Algorithm Achive

This provides Builder objects for each of the language implementations in the AAA; however, this work cannot be considered exhaustive until every language has been covered.

Currently, the aim is to provide a way to compile or copy the implementation files to the build directory, as well as to provide ways to run them and capture their output.

To run the compilation for all implmeentations in one language, e.g. Rust, run the command `scons build/c`, and the resulting executables will be available in the `cuild/c` directory, each in their respective algorithm directory, containing the executable."""

from pathlib import Path

env = Environment()

# Add other languages here when you want to add language targets
languages = ['c']

env.C = env.Program

SConscript('SConscript', exports='env languages')

2 changes: 2 additions & 0 deletions contents/IFS/code/c/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Import('*')
env.C('#/build/c/IFS/IFS', 'IFS.c')
2 changes: 2 additions & 0 deletions contents/barnsley/code/c/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Import('*')
env.C('#/build/c/bransley/barnsley', 'barnsley.c')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in folder name

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this, it should not happen any more

2 changes: 2 additions & 0 deletions contents/computus/code/c/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Import('*')
env.C('#/build/c/computus/gauss_easter', 'gauss_easter.c')
3 changes: 3 additions & 0 deletions contents/cooley_tukey/code/c/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Import('*')
env.C('#/build/c/cooley_tukey/cooley_tukey', 'fft.c',
LIBS=['-lm', '-lfftw3'])
3 changes: 3 additions & 0 deletions contents/euclidean_algorithm/code/c/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Import('*')
env.C('#/build/c/euclidean_algorithm/euclidean_algorithm',
'euclidean_example.c', LIBS='-lm')
2 changes: 2 additions & 0 deletions contents/flood_fill/code/c/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Import('*')
env.C('#/build/c/flood_fill/flood_fill', 'flood_fill.c')
2 changes: 2 additions & 0 deletions contents/forward_euler_method/code/c/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Import('*')
env.C('#/build/c/forward_euler_method/forward_euler', 'euler.c', LIBS='-lm')
4 changes: 4 additions & 0 deletions contents/gaussian_elimination/code/c/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Import('*')
env.C('#/build/c/gaussian_elimination/gaussian_elimination',
'gaussian_elimination.c')

2 changes: 2 additions & 0 deletions contents/graham_scan/code/c/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Import('*')
env.C('#/build/c/graham_scan/graham_scan', 'graham.c', LIBS='-lm')
2 changes: 2 additions & 0 deletions contents/huffman_encoding/code/c/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Import('*')
env.C('#/build/c/huffman_encoding/huffman', 'huffman.c')
2 changes: 2 additions & 0 deletions contents/jarvis_march/code/c/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Import('*')
env.C('#/build/c/jarvis_march/jarvis_march', 'jarvis_march.c')
2 changes: 2 additions & 0 deletions contents/monte_carlo_integration/code/c/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Import('*')
env.C('#/build/c/monte_carlo_integration/monte_carlo', 'monte_carlo.c')
2 changes: 2 additions & 0 deletions contents/quantum_systems/code/c/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Import('*')
env.C('#/build/c/quantum_systems/energy', 'energy.c', LIBS=['-lm', '-lfftw3'])
3 changes: 3 additions & 0 deletions contents/split-operator_method/code/c/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Import('*')
env.C('#/build/c/split-op_method/split_op', 'split_op.c',
LIBS=['-lm', '-lfftw3'])
2 changes: 2 additions & 0 deletions contents/stable_marriage_problem/code/c/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Import('*')
env.C('#/build/c/stable_marriage/stable_marriage', 'stable_marriage.c')
2 changes: 2 additions & 0 deletions contents/thomas_algorithm/code/c/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Import('*')
env.C('#/build/c/thomas_algorithm/thomas', 'thomas.c')
2 changes: 2 additions & 0 deletions contents/tree_traversal/code/c/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Import('*')
env.C('#/build/c/tree_traversal/tree_traversal', 'tree_traversal.c')
2 changes: 2 additions & 0 deletions contents/verlet_integration/code/c/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Import('*')
env.C('#/build/c/verlet_integration/verlet', 'verlet.c')