diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2019-04-24 16:49:12 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2019-04-24 16:57:58 +0200 |
commit | c2a669a9f03e249fb4fca96a2adf63256eb8dfa2 (patch) | |
tree | 711bd1f6ed3b110ba56af20d6995fe615c3ccf0d /platform/windows | |
parent | e1d16e722ec9742c3f92d20dc433d540339c36e6 (diff) |
SCons: Review uses of CCFLAGS, CXXFLAGS and CPPFLAGS
Many contributors (me included) did not fully understand what CCFLAGS,
CXXFLAGS and CPPFLAGS refer to exactly, and were thus not using them
in the way they are intended to be.
As per the SCons manual: https://www.scons.org/doc/HTML/scons-user/apa.html
- CCFLAGS: General options that are passed to the C and C++ compilers.
- CFLAGS: General options that are passed to the C compiler (C only;
not C++).
- CXXFLAGS: General options that are passed to the C++ compiler. By
default, this includes the value of $CCFLAGS, so that setting
$CCFLAGS affects both C and C++ compilation.
- CPPFLAGS: User-specified C preprocessor options. These will be
included in any command that uses the C preprocessor, including not
just compilation of C and C++ source files [...], but also [...]
Fortran [...] and [...] assembly language source file[s].
TL;DR: Compiler options go to CCFLAGS, unless they must be restricted
to either C (CFLAGS) or C++ (CXXFLAGS). Preprocessor defines go to
CPPFLAGS.
Diffstat (limited to 'platform/windows')
-rw-r--r-- | platform/windows/detect.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/platform/windows/detect.py b/platform/windows/detect.py index e986c47b40..5c38eebf04 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -273,7 +273,8 @@ def configure_mingw(env): env.Prepend(CCFLAGS=['-g2']) elif (env["target"] == "release_debug"): - env.Append(CCFLAGS=['-O2', '-DDEBUG_ENABLED']) + env.Append(CCFLAGS=['-O2']) + env.Append(CPPFLAGS=['-DDEBUG_ENABLED']) if (env["debug_symbols"] == "yes"): env.Prepend(CCFLAGS=['-g1']) if (env["debug_symbols"] == "full"): @@ -284,7 +285,8 @@ def configure_mingw(env): env.Prepend(CCFLAGS=['-Os']) elif (env["target"] == "debug"): - env.Append(CCFLAGS=['-g3', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED']) + env.Append(CCFLAGS=['-g3']) + env.Append(CPPFLAGS=['-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED']) ## Compiler configuration @@ -325,11 +327,12 @@ def configure_mingw(env): ## Compile flags - env.Append(CCFLAGS=['-DWINDOWS_ENABLED', '-mwindows']) - env.Append(CCFLAGS=['-DOPENGL_ENABLED']) - env.Append(CCFLAGS=['-DWASAPI_ENABLED']) - env.Append(CCFLAGS=['-DWINMIDI_ENABLED']) - env.Append(CCFLAGS=['-DWINVER=%s' % env['target_win_version'], '-D_WIN32_WINNT=%s' % env['target_win_version']]) + env.Append(CCFLAGS=['-mwindows']) + env.Append(CPPFLAGS=['-DWINDOWS_ENABLED']) + env.Append(CPPFLAGS=['-DOPENGL_ENABLED']) + env.Append(CPPFLAGS=['-DWASAPI_ENABLED']) + env.Append(CPPFLAGS=['-DWINMIDI_ENABLED']) + env.Append(CPPFLAGS=['-DWINVER=%s' % env['target_win_version'], '-D_WIN32_WINNT=%s' % env['target_win_version']]) env.Append(LIBS=['mingw32', 'opengl32', 'dsound', 'ole32', 'd3d9', 'winmm', 'gdi32', 'iphlpapi', 'shlwapi', 'wsock32', 'ws2_32', 'kernel32', 'oleaut32', 'dinput8', 'dxguid', 'ksuser', 'imm32', 'bcrypt', 'avrt', 'uuid']) env.Append(CPPFLAGS=['-DMINGW_ENABLED']) |