From 9f53f6b88b9af27da5cbbe50ccf9f52c7821c874 Mon Sep 17 00:00:00 2001 From: PeanutbutterWarrior <50717143+PeanutbutterWarrior@users.noreply.github.com> Date: Sun, 28 Nov 2021 21:36:40 +0000 Subject: [PATCH] Add Go to SCons --- SConstruct | 8 ++++++-- sconscripts/go_SConscript | 6 ++++++ 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 sconscripts/go_SConscript diff --git a/SConstruct b/SConstruct index 1a20bf633..8f01fe4fe 100644 --- a/SConstruct +++ b/SConstruct @@ -15,8 +15,12 @@ rust_cargo_builder = Builder(action=['cargo build --bins --manifest-path $MANIFE rust_rustc_builder = Builder(action='rustc $SOURCE -o $TARGET$PROGSUFFIX') +go_builder = Builder(action='go build -o $TARGET$PROGSUFFIX $SOURCE') + env = Environment(ENV=os.environ, - BUILDERS={'rustc': rust_rustc_builder, 'cargo': rust_cargo_builder}, + BUILDERS={'rustc': rust_rustc_builder, + 'cargo': rust_cargo_builder, + 'Go': go_builder}, tools=['gcc', 'gnulink', 'g++', 'gas']) env['CCFLAGS'] = '' @@ -25,7 +29,7 @@ env['ASFLAGS'] = '--64' # Add other languages here when you want to add language targets # Put 'name_of_language_directory' : 'file_extension' -languages = {'c': 'c', 'cpp': 'cpp', 'asm-x64': 's', 'rust': 'rs'} +languages = {'c': 'c', 'cpp': 'cpp', 'asm-x64': 's', 'rust': 'rs', 'go': 'go'} env.C = env.Program env.CPlusPlus = env.Program diff --git a/sconscripts/go_SConscript b/sconscripts/go_SConscript new file mode 100644 index 000000000..795be1d53 --- /dev/null +++ b/sconscripts/go_SConscript @@ -0,0 +1,6 @@ +Import('files_to_compile env') +from pathlib import Path + +for file in files_to_compile: + chapter_name = file.parent.parent.parent.stem + env.Go(f'#/build/go/{chapter_name}', str(file))