Skip to content

Commit ca96786

Browse files
committed
Added Coconut compilation
1 parent 0aa5333 commit ca96786

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

SConstruct

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,19 @@ rust_rustc_builder = Builder(action='rustc $SOURCE -o $TARGET$PROGSUFFIX')
1717

1818
go_builder = Builder(action='go build -o $TARGET$PROGSUFFIX $SOURCE')
1919

20+
coconut_builder = Builder(action='coconut $COCONUTFLAGS $SOURCE $TARGET', src_suffix='.coco', target_suffix='.py')
21+
2022
env = Environment(ENV=os.environ,
2123
BUILDERS={'rustc': rust_rustc_builder,
2224
'cargo': rust_cargo_builder,
23-
'Go': go_builder},
25+
'Go': go_builder,
26+
'Coconut': coconut_builder},
2427
tools=['gcc', 'gnulink', 'g++', 'gas', 'gfortran'])
2528

2629
env['CCFLAGS'] = ''
2730
env['CXXFLAGS'] = '-std=c++17'
2831
env['ASFLAGS'] = '--64'
32+
env['COCONUTFLAGS'] = '--target 3.8'
2933

3034
# Add other languages here when you want to add language targets
3135
# Put 'name_of_language_directory' : 'file_extension'
@@ -36,6 +40,7 @@ languages = {
3640
'rust': 'rs',
3741
'go': 'go',
3842
'fortran': 'f90',
43+
'coconut': 'coco',
3944
}
4045

4146
env.C = env.Program

sconscripts/coconut_SConscript

Lines changed: 6 additions & 0 deletions
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.Coconut(f'#/build/coconut/{chapter_name}.py', str(file))

0 commit comments

Comments
 (0)