Skip to content

Commit c3c0938

Browse files
Add Go to SCons (#947)
1 parent 18eebd6 commit c3c0938

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

SConstruct

+6-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@ rust_cargo_builder = Builder(action=['cargo build --bins --manifest-path $MANIFE
1515

1616
rust_rustc_builder = Builder(action='rustc $SOURCE -o $TARGET$PROGSUFFIX')
1717

18+
go_builder = Builder(action='go build -o $TARGET$PROGSUFFIX $SOURCE')
19+
1820
env = Environment(ENV=os.environ,
19-
BUILDERS={'rustc': rust_rustc_builder, 'cargo': rust_cargo_builder},
21+
BUILDERS={'rustc': rust_rustc_builder,
22+
'cargo': rust_cargo_builder,
23+
'Go': go_builder},
2024
tools=['gcc', 'gnulink', 'g++', 'gas'])
2125

2226
env['CCFLAGS'] = ''
@@ -25,7 +29,7 @@ env['ASFLAGS'] = '--64'
2529

2630
# Add other languages here when you want to add language targets
2731
# Put 'name_of_language_directory' : 'file_extension'
28-
languages = {'c': 'c', 'cpp': 'cpp', 'asm-x64': 's', 'rust': 'rs'}
32+
languages = {'c': 'c', 'cpp': 'cpp', 'asm-x64': 's', 'rust': 'rs', 'go': 'go'}
2933

3034
env.C = env.Program
3135
env.CPlusPlus = env.Program

sconscripts/go_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.Go(f'#/build/go/{chapter_name}', str(file))

0 commit comments

Comments
 (0)