Skip to content

Commit

Permalink
Added Coconut compilation (algorithm-archivists#949)
Browse files Browse the repository at this point in the history
  • Loading branch information
Amaras authored Dec 5, 2021
1 parent 2d7ce74 commit b7568f5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
7 changes: 6 additions & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,21 @@ rust_rustc_builder = Builder(action='rustc $SOURCE -o $TARGET$PROGSUFFIX')

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

coconut_builder = Builder(action='coconut $COCONUTFLAGS $SOURCE $TARGET', src_suffix='.coco', target_suffix='.py')

env = Environment(ENV=os.environ,
BUILDERS={'rustc': rust_rustc_builder,
'cargo': rust_cargo_builder,
'Go': go_builder},
'Go': go_builder,
'Coconut': coconut_builder},
tools=['gcc', 'gnulink', 'g++', 'gas', 'gfortran'])

Export('env')

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

# Add other languages here when you want to add language targets
# Put 'name_of_language_directory' : 'file_extension'
Expand All @@ -40,6 +44,7 @@ languages = {
'rust': 'rs',
'go': 'go',
'fortran': 'f90',
'coconut': 'coco',
}

# Do not add new Builders here, add them to the BUILDERS argument in the call to Environment above
Expand Down
6 changes: 6 additions & 0 deletions sconscripts/coconut_SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Import('files_to_compile env')

for file_info in files_to_compile:
build_target = f'#/build/{file_info.language}/{file_info.chapter}/{file_info.path.stem}'
build_result = env.Coconut(build_target, str(file_info.path))
env.Alias(str(file_info.chapter), build_result)

0 comments on commit b7568f5

Please sign in to comment.