Skip to content

Commit 465e1e8

Browse files
authored
Added C++ compilation (#939)
1 parent 866581e commit 465e1e8

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

Diff for: SConstruct

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,15 @@ env['CC'] = 'gcc'
1616
for tool in ['gcc','gnulink']:
1717
env.Tool(tool)
1818
env['CCFLAGS'] = ''
19+
env['CXXFLAGS'] = '-std=c++17'
1920

2021
# Add other languages here when you want to add language targets
2122
# Put 'name_of_language_directory' : 'file_extension'
22-
languages = {'c': 'c'}
23+
languages = {'c': 'c', 'cpp': 'cpp'}
2324

2425
env.C = env.Program
26+
env.CPlusPlus = env.Program
27+
2528

2629
Export('env')
2730

Diff for: contents/split-operator_method/code/cpp/SConscript

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Import('*')
2+
from pathlib import Path
3+
4+
dirname = Path.cwd().parents[1].stem
5+
6+
env.CPlusPlus(f'#/build/cpp/{dirname}', Glob('*.cpp'), LIBS=['m', 'fftw3'])

Diff for: sconscripts/cpp_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.CPlusPlus(f'#/build/cpp/{chapter_name}', str(file))

0 commit comments

Comments
 (0)