Skip to content

Commit b7568f5

Browse files
authored
Added Coconut compilation (#949)
1 parent 2d7ce74 commit b7568f5

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
@@ -19,17 +19,21 @@ rust_rustc_builder = Builder(action='rustc $SOURCE -o $TARGET$PROGSUFFIX')
1919

2020
go_builder = Builder(action='go build -o $TARGET$PROGSUFFIX $SOURCE')
2121

22+
coconut_builder = Builder(action='coconut $COCONUTFLAGS $SOURCE $TARGET', src_suffix='.coco', target_suffix='.py')
23+
2224
env = Environment(ENV=os.environ,
2325
BUILDERS={'rustc': rust_rustc_builder,
2426
'cargo': rust_cargo_builder,
25-
'Go': go_builder},
27+
'Go': go_builder,
28+
'Coconut': coconut_builder},
2629
tools=['gcc', 'gnulink', 'g++', 'gas', 'gfortran'])
2730

2831
Export('env')
2932

3033
env['CFLAGS'] = '-Wall -Wextra -Werror'
3134
env['CXXFLAGS'] = '-std=c++17'
3235
env['ASFLAGS'] = '--64'
36+
env['COCONUTFLAGS'] = '--target 3.8'
3337

3438
# Add other languages here when you want to add language targets
3539
# Put 'name_of_language_directory' : 'file_extension'
@@ -40,6 +44,7 @@ languages = {
4044
'rust': 'rs',
4145
'go': 'go',
4246
'fortran': 'f90',
47+
'coconut': 'coco',
4348
}
4449

4550
# Do not add new Builders here, add them to the BUILDERS argument in the call to Environment above

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+
3+
for file_info in files_to_compile:
4+
build_target = f'#/build/{file_info.language}/{file_info.chapter}/{file_info.path.stem}'
5+
build_result = env.Coconut(build_target, str(file_info.path))
6+
env.Alias(str(file_info.chapter), build_result)

0 commit comments

Comments
 (0)