Skip to content

Commit cfcfccc

Browse files
Amarasleios
andauthored
Added SCons compilation instructions (algorithm-archivists#885)
* Added C compilation to SCons (not all work, though) * First fully functional version of the build system for C code * Simplified SConstruct file * Simplified SConscript files SConscript files are now mostly universal for C programs. Additionally, the build hierarchy is now flattened (executables under the language folder) * fixing chapter to use split-op code (algorithm-archivists#888) Removed the quantum_systems SConscript * modified Dockerfile for ntindle * Changed my name in CONTRIBUTORS.md * apparently forgot an algorithm Co-authored-by: James Schloss <[email protected]>
1 parent 83df0b9 commit cfcfccc

File tree

23 files changed

+149
-3
lines changed

23 files changed

+149
-3
lines changed

.devcontainer/Dockerfile

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT}
66

77
# [Optional] Uncomment this section to install additional OS packages.
88
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
9-
&& apt-get -y install --no-install-recommends build-essential software-properties-common xz-utils g++ sbcl julia python3 python3-pip python3-dev ghc openjdk-11-jdk rustc libssl-dev gfortran libxml2-dev libyaml-dev libgmp-dev libz-dev libncurses5 gnuplot nodejs npm lua5.3 ocaml php ruby-full gnu-smalltalk scratch
9+
&& apt-get -y install --no-install-recommends build-essential software-properties-common xz-utils g++ sbcl julia python3 python3-pip python3-dev ghc openjdk-11-jdk rustc libssl-dev gfortran libxml2-dev libyaml-dev libgmp-dev libz-dev libncurses5 gnuplot nodejs npm lua5.3 ocaml php ruby-full gnu-smalltalk scratch libfftw3-dev
1010

1111
# Setup Crystal
1212
RUN echo 'deb http://download.opensuse.org/repositories/devel:/languages:/crystal/xUbuntu_20.04/ /' | sudo tee /etc/apt/sources.list.d/devel:languages:crystal.list
@@ -98,6 +98,7 @@ ENV PATH=$PATH:~/swift/usr/bin
9898
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
9999
&& apt-get -y install --no-install-recommends crystal dart nim powershell scala dotnet-sdk-5.0 r-base racket
100100

101-
RUN pip install wheel matplotlib numpy coconut
101+
RUN pip install wheel matplotlib numpy coconut scons
102102

103103
RUN sudo sh -c 'npm install -g typescript'
104+

.gitignore

+7
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/

CONTRIBUTORS.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ This file lists everyone, who contributed to this repo and wanted to show up her
5151
- Vincent Zalzal
5252
- Jonathan D B Van Schenck
5353
- James Goytia
54-
- Amaras
54+
- Sammy Plat
5555
- Jonathan Dönszelmann
5656
- Ishaan Verma
5757
- Delphi1024

SConscript

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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',
10+
must_exist=0)

SConstruct

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
env = Environment()
13+
14+
# Add other languages here when you want to add language targets
15+
languages = ['c']
16+
17+
env.C = env.Program
18+
19+
SConscript('SConscript', exports='env languages')
20+

contents/IFS/code/c/SConscript

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Import('*')
2+
from pathlib import Path
3+
4+
dirname = Path.cwd().parents[1].stem
5+
6+
env.C(f'#/build/c/{dirname}', Glob('*.c'))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Import('*')
2+
from pathlib import Path
3+
4+
dirname = Path.cwd().parents[1].stem
5+
6+
env.C(f'#/build/c/{dirname}', Glob('*.c'), LIBS='m')

contents/barnsley/code/c/SConscript

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Import('*')
2+
from pathlib import Path
3+
4+
dirname = Path.cwd().parents[1].stem
5+
6+
env.C(f'#/build/c/{dirname}', Glob('*.c'))

contents/computus/code/c/SConscript

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Import('*')
2+
from pathlib import Path
3+
4+
dirname = Path.cwd().parents[1].stem
5+
6+
env.C(f'#/build/c/{dirname}', Glob('*.c'))
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Import('*')
2+
from pathlib import Path
3+
4+
dirname = Path.cwd().parents[1].stem
5+
6+
env.C(f'#/build/c/{dirname}', Glob('*.c'), LIBS=['m', 'fftw3'])
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Import('*')
2+
from pathlib import Path
3+
4+
dirname = Path.cwd().parents[1].stem
5+
6+
env.C(f'#/build/c/{dirname}', Glob('*.c'))

contents/flood_fill/code/c/SConscript

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Import('*')
2+
from pathlib import Path
3+
4+
dirname = Path.cwd().parents[1].stem
5+
6+
env.C(f'#/build/c/{dirname}', Glob('*.c'))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Import('*')
2+
from pathlib import Path
3+
4+
dirname = Path.cwd().parents[1].stem
5+
6+
env.C(f'#/build/c/{dirname}', Glob('*.c'), LIBS='m')
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Import('*')
2+
from pathlib import Path
3+
4+
dirname = Path.cwd().parents[1].stem
5+
6+
env.C(f'#/build/c/{dirname}', Glob('*.c'))
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Import('*')
2+
from pathlib import Path
3+
4+
dirname = Path.cwd().parents[1].stem
5+
6+
env.C(f'#/build/c/{dirname}', Glob('*.c'), LIBS='m')
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Import('*')
2+
from pathlib import Path
3+
4+
dirname = Path.cwd().parents[1].stem
5+
6+
env.C(f'#/build/c/{dirname}', Glob('*.c'))
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Import('*')
2+
from pathlib import Path
3+
4+
dirname = Path.cwd().parents[1].stem
5+
6+
env.C(f'#/build/c/{dirname}', Glob('*.c'))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Import('*')
2+
from pathlib import Path
3+
4+
dirname = Path.cwd().parents[1].stem
5+
6+
env.C(f'#/build/c/{dirname}', Glob('*.c'))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Import('*')
2+
from pathlib import Path
3+
4+
dirname = Path.cwd().parents[1].stem
5+
6+
env.C(f'#/build/c/{dirname}', Glob('*.c'), LIBS=['m', 'fftw3'])
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Import('*')
2+
from pathlib import Path
3+
4+
dirname = Path.cwd().parents[1].stem
5+
6+
env.C(f'#/build/c/{dirname}', Glob('*.c'))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Import('*')
2+
from pathlib import Path
3+
4+
dirname = Path.cwd().parents[1].stem
5+
6+
env.C(f'#/build/c/{dirname}', Glob('*.c'))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Import('*')
2+
from pathlib import Path
3+
4+
dirname = Path.cwd().parents[1].stem
5+
6+
env.C(f'#/build/c/{dirname}', Glob('*.c'))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Import('*')
2+
from pathlib import Path
3+
4+
dirname = Path.cwd().parents[1].stem
5+
6+
env.C(f'#/build/c/{dirname}', Glob('*.c'))

0 commit comments

Comments
 (0)