diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 18af4df12..aec4ab153 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -6,7 +6,7 @@ FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT} # [Optional] Uncomment this section to install additional OS packages. RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ - && 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 + && 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 # Setup Crystal 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 RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ && apt-get -y install --no-install-recommends crystal dart nim powershell scala dotnet-sdk-5.0 r-base racket -RUN pip install wheel matplotlib numpy coconut +RUN pip install wheel matplotlib numpy coconut scons RUN sudo sh -c 'npm install -g typescript' + diff --git a/.gitignore b/.gitignore index db26e0ad0..231da8ea1 100644 --- a/.gitignore +++ b/.gitignore @@ -517,3 +517,10 @@ vscode/ # aspell *.bak + +# SCons intermidiate files +.sconsign.dblite +*.o + +# SCons build directory +build/ diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 9b2c1b460..82f3c173a 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -51,7 +51,7 @@ This file lists everyone, who contributed to this repo and wanted to show up her - Vincent Zalzal - Jonathan D B Van Schenck - James Goytia -- Amaras +- Sammy Plat - Jonathan Dönszelmann - Ishaan Verma - Delphi1024 diff --git a/SConscript b/SConscript new file mode 100644 index 000000000..be18b33d3 --- /dev/null +++ b/SConscript @@ -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) diff --git a/SConstruct b/SConstruct new file mode 100644 index 000000000..df000f732 --- /dev/null +++ b/SConstruct @@ -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') + diff --git a/contents/IFS/code/c/SConscript b/contents/IFS/code/c/SConscript new file mode 100644 index 000000000..fd696f9ce --- /dev/null +++ b/contents/IFS/code/c/SConscript @@ -0,0 +1,6 @@ +Import('*') +from pathlib import Path + +dirname = Path.cwd().parents[1].stem + +env.C(f'#/build/c/{dirname}', Glob('*.c')) diff --git a/contents/approximate_counting/code/c/SConscript b/contents/approximate_counting/code/c/SConscript new file mode 100644 index 000000000..34a951e7f --- /dev/null +++ b/contents/approximate_counting/code/c/SConscript @@ -0,0 +1,6 @@ +Import('*') +from pathlib import Path + +dirname = Path.cwd().parents[1].stem + +env.C(f'#/build/c/{dirname}', Glob('*.c'), LIBS='m') diff --git a/contents/barnsley/code/c/SConscript b/contents/barnsley/code/c/SConscript new file mode 100644 index 000000000..fd696f9ce --- /dev/null +++ b/contents/barnsley/code/c/SConscript @@ -0,0 +1,6 @@ +Import('*') +from pathlib import Path + +dirname = Path.cwd().parents[1].stem + +env.C(f'#/build/c/{dirname}', Glob('*.c')) diff --git a/contents/computus/code/c/SConscript b/contents/computus/code/c/SConscript new file mode 100644 index 000000000..fd696f9ce --- /dev/null +++ b/contents/computus/code/c/SConscript @@ -0,0 +1,6 @@ +Import('*') +from pathlib import Path + +dirname = Path.cwd().parents[1].stem + +env.C(f'#/build/c/{dirname}', Glob('*.c')) diff --git a/contents/cooley_tukey/code/c/SConscript b/contents/cooley_tukey/code/c/SConscript new file mode 100644 index 000000000..2cd13de37 --- /dev/null +++ b/contents/cooley_tukey/code/c/SConscript @@ -0,0 +1,6 @@ +Import('*') +from pathlib import Path + +dirname = Path.cwd().parents[1].stem + +env.C(f'#/build/c/{dirname}', Glob('*.c'), LIBS=['m', 'fftw3']) diff --git a/contents/euclidean_algorithm/code/c/SConscript b/contents/euclidean_algorithm/code/c/SConscript new file mode 100644 index 000000000..fd696f9ce --- /dev/null +++ b/contents/euclidean_algorithm/code/c/SConscript @@ -0,0 +1,6 @@ +Import('*') +from pathlib import Path + +dirname = Path.cwd().parents[1].stem + +env.C(f'#/build/c/{dirname}', Glob('*.c')) diff --git a/contents/flood_fill/code/c/SConscript b/contents/flood_fill/code/c/SConscript new file mode 100644 index 000000000..fd696f9ce --- /dev/null +++ b/contents/flood_fill/code/c/SConscript @@ -0,0 +1,6 @@ +Import('*') +from pathlib import Path + +dirname = Path.cwd().parents[1].stem + +env.C(f'#/build/c/{dirname}', Glob('*.c')) diff --git a/contents/forward_euler_method/code/c/SConscript b/contents/forward_euler_method/code/c/SConscript new file mode 100644 index 000000000..34a951e7f --- /dev/null +++ b/contents/forward_euler_method/code/c/SConscript @@ -0,0 +1,6 @@ +Import('*') +from pathlib import Path + +dirname = Path.cwd().parents[1].stem + +env.C(f'#/build/c/{dirname}', Glob('*.c'), LIBS='m') diff --git a/contents/gaussian_elimination/code/c/SConscript b/contents/gaussian_elimination/code/c/SConscript new file mode 100644 index 000000000..fd696f9ce --- /dev/null +++ b/contents/gaussian_elimination/code/c/SConscript @@ -0,0 +1,6 @@ +Import('*') +from pathlib import Path + +dirname = Path.cwd().parents[1].stem + +env.C(f'#/build/c/{dirname}', Glob('*.c')) diff --git a/contents/graham_scan/code/c/SConscript b/contents/graham_scan/code/c/SConscript new file mode 100644 index 000000000..34a951e7f --- /dev/null +++ b/contents/graham_scan/code/c/SConscript @@ -0,0 +1,6 @@ +Import('*') +from pathlib import Path + +dirname = Path.cwd().parents[1].stem + +env.C(f'#/build/c/{dirname}', Glob('*.c'), LIBS='m') diff --git a/contents/huffman_encoding/code/c/SConscript b/contents/huffman_encoding/code/c/SConscript new file mode 100644 index 000000000..fd696f9ce --- /dev/null +++ b/contents/huffman_encoding/code/c/SConscript @@ -0,0 +1,6 @@ +Import('*') +from pathlib import Path + +dirname = Path.cwd().parents[1].stem + +env.C(f'#/build/c/{dirname}', Glob('*.c')) diff --git a/contents/jarvis_march/code/c/SConscript b/contents/jarvis_march/code/c/SConscript new file mode 100644 index 000000000..fd696f9ce --- /dev/null +++ b/contents/jarvis_march/code/c/SConscript @@ -0,0 +1,6 @@ +Import('*') +from pathlib import Path + +dirname = Path.cwd().parents[1].stem + +env.C(f'#/build/c/{dirname}', Glob('*.c')) diff --git a/contents/monte_carlo_integration/code/c/SConscript b/contents/monte_carlo_integration/code/c/SConscript new file mode 100644 index 000000000..fd696f9ce --- /dev/null +++ b/contents/monte_carlo_integration/code/c/SConscript @@ -0,0 +1,6 @@ +Import('*') +from pathlib import Path + +dirname = Path.cwd().parents[1].stem + +env.C(f'#/build/c/{dirname}', Glob('*.c')) diff --git a/contents/split-operator_method/code/c/SConscript b/contents/split-operator_method/code/c/SConscript new file mode 100644 index 000000000..2cd13de37 --- /dev/null +++ b/contents/split-operator_method/code/c/SConscript @@ -0,0 +1,6 @@ +Import('*') +from pathlib import Path + +dirname = Path.cwd().parents[1].stem + +env.C(f'#/build/c/{dirname}', Glob('*.c'), LIBS=['m', 'fftw3']) diff --git a/contents/stable_marriage_problem/code/c/SConscript b/contents/stable_marriage_problem/code/c/SConscript new file mode 100644 index 000000000..fd696f9ce --- /dev/null +++ b/contents/stable_marriage_problem/code/c/SConscript @@ -0,0 +1,6 @@ +Import('*') +from pathlib import Path + +dirname = Path.cwd().parents[1].stem + +env.C(f'#/build/c/{dirname}', Glob('*.c')) diff --git a/contents/thomas_algorithm/code/c/SConscript b/contents/thomas_algorithm/code/c/SConscript new file mode 100644 index 000000000..fd696f9ce --- /dev/null +++ b/contents/thomas_algorithm/code/c/SConscript @@ -0,0 +1,6 @@ +Import('*') +from pathlib import Path + +dirname = Path.cwd().parents[1].stem + +env.C(f'#/build/c/{dirname}', Glob('*.c')) diff --git a/contents/tree_traversal/code/c/SConscript b/contents/tree_traversal/code/c/SConscript new file mode 100644 index 000000000..fd696f9ce --- /dev/null +++ b/contents/tree_traversal/code/c/SConscript @@ -0,0 +1,6 @@ +Import('*') +from pathlib import Path + +dirname = Path.cwd().parents[1].stem + +env.C(f'#/build/c/{dirname}', Glob('*.c')) diff --git a/contents/verlet_integration/code/c/SConscript b/contents/verlet_integration/code/c/SConscript new file mode 100644 index 000000000..fd696f9ce --- /dev/null +++ b/contents/verlet_integration/code/c/SConscript @@ -0,0 +1,6 @@ +Import('*') +from pathlib import Path + +dirname = Path.cwd().parents[1].stem + +env.C(f'#/build/c/{dirname}', Glob('*.c'))