Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added x64 assembly compilation #940

Merged
merged 6 commits into from
Nov 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ To run the compilation for all implementations in one language, e.g. C, run the
from pathlib import Path
import os

env = Environment(ENV={'PATH': os.environ['PATH']})
env = Environment(ENV={'PATH': os.environ['PATH']},
tools=['gcc', 'gnulink', 'g++', 'gas'])

env['ASFLAGS'] = '--64'

env['CC'] = 'gcc'
for tool in ['gcc','gnulink']:
env.Tool(tool)
env['CCFLAGS'] = ''
env['CXXFLAGS'] = '-std=c++17'

# Add other languages here when you want to add language targets
# Put 'name_of_language_directory' : 'file_extension'
languages = {'c': 'c', 'cpp': 'cpp'}
languages = {'c': 'c', 'cpp': 'cpp', 'asm-x64': 's'}

env.C = env.Program
env.CPlusPlus = env.Program

env.X64 = env.Program

Export('env')

Expand All @@ -46,7 +46,8 @@ sconscript_dir_path = Path('sconscripts')
for language, files in files_to_compile.items():
if files:
if (sconscript_path := sconscript_dir_path / f"{language}_SConscript").exists():
SConscript(sconscript_path, exports = {'files_to_compile': files})
SConscript(sconscript_path, exports = {'files_to_compile': files,
'language': language})
else:
print(f'{language} file found at {files[0]}, but no sconscript file is present ')

6 changes: 6 additions & 0 deletions contents/cooley_tukey/code/asm-x64/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Import('*')
from pathlib import Path

dirname = Path.cwd().parents[1].stem

env.X64(f'#/build/asm-x64/{dirname}', Glob('*.s'), LIBS=['m'], LINKFLAGS='-no-pie')
6 changes: 6 additions & 0 deletions contents/forward_euler_method/code/asm-x64/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Import('*')
from pathlib import Path

dirname = Path.cwd().parents[1].stem

env.X64(f'#/build/asm-x64/{dirname}', Glob('*.s'), LIBS='m', LINKFLAGS='-no-pie')
6 changes: 6 additions & 0 deletions sconscripts/asm-x64_SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Import('files_to_compile language env')
from pathlib import Path

for file in files_to_compile:
chapter_name = file.parent.parent.parent.stem
env.X64(f'#/build/{language}/{chapter_name}', str(file), LINKFLAGS='-no-pie')