Skip to content

Commit b40b4af

Browse files
committed
Add meson option to let user control use of PCH
1 parent a160c66 commit b40b4af

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

Source/meson.build

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11

2-
#pch = meson.current_source_dir()/'System/StandardIncludes.h'
3-
pch = ''
2+
if use_pch
3+
pch = meson.current_source_dir()/'System/StandardIncludes.h'
4+
else
5+
pch = ''
6+
endif
47
sources = []
58
source_libs = []
69
source_inc_dirs += [include_directories(

meson.build

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,19 @@ if get_option('debug') and get_option('b_lto')
2525
warning('Link time optimization enabled in debug mode, debug symbols may not be fully available. Disable b_lto with "meson configure -Db_lto=false".')
2626
endif
2727

28+
use_pch = get_option('use_pch').enabled()
29+
30+
if get_option('use_pch').auto()
31+
ccache = find_program('ccache', required : false)
32+
if ccache.found()
33+
message('Detected ccache, disabling precompiled headers')
34+
use_pch = false
35+
else
36+
message('Using precompiled headers')
37+
use_pch = true
38+
endif
39+
endif
40+
2841
if compiler.get_argument_syntax()== 'gcc' # used for gcc compatible compilers
2942
# Build against system libraries on linux
3043
message('gcc detected')

meson_options.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ option('tracy_enable', type: 'boolean', value: true, description: 'Enable Tracy
1111
option('tracy_callstack', type : 'integer', value : 0, description : 'Enfore callstack collection for tracy regions')
1212
option('tracy_on_demand', type : 'boolean', value : true, description : 'On-demand profiling')
1313
option('tracy_debuginfod', type : 'boolean', value : false, description : 'Enable debuginfod support')
14+
option('use_pch', type : 'feature', value : 'auto')

0 commit comments

Comments
 (0)