Skip to content

Commit 1ae67b0

Browse files
committed
Added C compilation to SCons (not all work, though)
1 parent 4557186 commit 1ae67b0

File tree

21 files changed

+98
-0
lines changed

21 files changed

+98
-0
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,3 +517,10 @@ vscode/
517517

518518
# aspell
519519
*.bak
520+
521+
# SCons intermidiate files
522+
.sconsign.dblite
523+
*.o
524+
525+
# SCons build directory
526+
build/

SConscript

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from pathlib import Path
2+
3+
Import('*')
4+
5+
for p in Path('contents').iterdir():
6+
if (q := (p / 'code')).exists():
7+
for path in q.iterdir():
8+
if path.stem in languages:
9+
env.SConscript(path / 'SConscript', exports='env root_dir',
10+
must_exist=0)
11+

SConstruct

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"""
2+
SCons top-level build description (SConstruct) for the Arcane Algorithm Achive
3+
4+
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.
5+
6+
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.
7+
8+
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."""
9+
10+
from pathlib import Path
11+
12+
# Add other languages here when you want to add language targets
13+
languages = ['c']
14+
15+
root_dir = Path.cwd()
16+
17+
env = Environment()
18+
env.C = env.Program
19+
20+
SConscript('SConscript', exports='env languages root_dir')
21+

contents/IFS/code/c/SConscript

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Import('*')
2+
3+
env.C(target=f'{root_dir}/build/c/IFS/IFS', source='IFS.c')

contents/barnsley/code/c/SConscript

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Import('*')
2+
3+
env.C(f'{root_dir}/build/c/barnsley/barnsley', 'barnsley.c')

contents/computus/code/c/SConscript

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Import('*')
2+
3+
env.C(f'{root_dir}/build/c/computus/gauss_easter', 'gauss_easter.c')
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Import('*')
2+
3+
env.C(f'{root_dir}/build/c/cooley_tukey/cooley_tukey', 'fft.c',
4+
LDFLAGS='-lfftw3')
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Import('*')
2+
3+
env.C(f'{root_dir}/build/c/euclidean_algorithm/euclidean_algorithm',
4+
'euclidean_example.c', LDFLAGS='-lm')

contents/flood_fill/code/c/SConscript

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Import('*')
2+
3+
env.C(f'{root_dir}/build/c/flood_fill/flood_fill', 'flood_fill.c')
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Import('*')
2+
3+
env.C(f'{root_dir}/build/c/forward_euler_method/forward_euler', 'euler.c', LDFLAGS='-lm')
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Import('*')
2+
3+
env.C(f'{root_dir}/build/c/gaussian_elimination/gaussian_elimination', 'gaussian_elimination.c')
4+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Import('*')
2+
3+
env.C(f'{root_dir}/build/c/graham_scan/graham_scan', 'graham.c',
4+
LDFLAGS='-lm')
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Import('*')
2+
3+
env.C(f'{root_dir}/build/c/huffman_encoding/huffman', 'huffman.c')
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Import('*')
2+
3+
env.C(f'{root_dir}/build/c/jarvis_march/jarvis_march', 'jarvis_march.c')
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Import('*')
2+
3+
env.C(f'{root_dir}/build/c/monte_carlo_integration/monte_carlo',
4+
'monte_carlo.c')
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Import('*')
2+
3+
env.C(f'{root_dir}/build/c/quantum_systems/energy/', 'energy.c')
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Import('*')
2+
3+
env.C(f'{root_dir}/build/c/split-op_method/split_op', 'split_op.c')
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Import('*')
2+
3+
env.C(f'{root_dir}/build/c/stable_marriage/stable_marriage', 'stable_marriage.c')
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Import('*')
2+
3+
env.C(f'{root_dir}/build/c/thomas_algorithm/thomas', 'thomas.c')
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Import('*')
2+
3+
env.C(f'{root_dir}/build/c/tree_treaversal/tree_traversal', 'tree_traversal.c')
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Import('*')
2+
3+
env.C(f'{root_dir}/build/c/verlet_integration/verlet', 'verlet.c')

0 commit comments

Comments
 (0)