diff --git a/SConstruct b/SConstruct index b5f5cdd11..c93744156 100644 --- a/SConstruct +++ b/SConstruct @@ -16,12 +16,15 @@ 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'} +languages = {'c': 'c', 'cpp': 'cpp'} env.C = env.Program +env.CPlusPlus = env.Program + Export('env') diff --git a/contents/split-operator_method/code/cpp/SConscript b/contents/split-operator_method/code/cpp/SConscript new file mode 100644 index 000000000..a25ed8c91 --- /dev/null +++ b/contents/split-operator_method/code/cpp/SConscript @@ -0,0 +1,6 @@ +Import('*') +from pathlib import Path + +dirname = Path.cwd().parents[1].stem + +env.CPlusPlus(f'#/build/cpp/{dirname}', Glob('*.cpp'), LIBS=['m', 'fftw3']) diff --git a/sconscripts/cpp_SConscript b/sconscripts/cpp_SConscript new file mode 100644 index 000000000..a30e08652 --- /dev/null +++ b/sconscripts/cpp_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.CPlusPlus(f'#/build/cpp/{chapter_name}', str(file))