Skip to content

Commit 0aa5333

Browse files
authored
Added Fortran compilation (#948)
* Added Fortran compilation * Corrected a typo
1 parent c3c0938 commit 0aa5333

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

SConstruct

+10-2
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,27 @@ env = Environment(ENV=os.environ,
2121
BUILDERS={'rustc': rust_rustc_builder,
2222
'cargo': rust_cargo_builder,
2323
'Go': go_builder},
24-
tools=['gcc', 'gnulink', 'g++', 'gas'])
24+
tools=['gcc', 'gnulink', 'g++', 'gas', 'gfortran'])
2525

2626
env['CCFLAGS'] = ''
2727
env['CXXFLAGS'] = '-std=c++17'
2828
env['ASFLAGS'] = '--64'
2929

3030
# Add other languages here when you want to add language targets
3131
# Put 'name_of_language_directory' : 'file_extension'
32-
languages = {'c': 'c', 'cpp': 'cpp', 'asm-x64': 's', 'rust': 'rs', 'go': 'go'}
32+
languages = {
33+
'c': 'c',
34+
'cpp': 'cpp',
35+
'asm-x64': 's',
36+
'rust': 'rs',
37+
'go': 'go',
38+
'fortran': 'f90',
39+
}
3340

3441
env.C = env.Program
3542
env.CPlusPlus = env.Program
3643
env.X64 = env.Program
44+
env.Fortran = env.Program
3745

3846
Export('env')
3947

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.Fortran(f'#/build/fortran/{dirname}', 'euclidean.f90')

sconscripts/fortran_SConscript

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Import('files_to_compile env')
2+
from pathlib import Path
3+
4+
for file in files_to_compile:
5+
chapter_name = file.parent.parent.parent.stem
6+
env.Fortran(f'#/build/fortran/{chapter_name}', str(file))

0 commit comments

Comments
 (0)