File tree Expand file tree Collapse file tree 7 files changed +15
-121
lines changed Expand file tree Collapse file tree 7 files changed +15
-121
lines changed Original file line number Diff line number Diff line change @@ -72,9 +72,7 @@ cc_library(
72
72
"glslang/MachineIndependent/preprocessor/*.cpp" ,
73
73
],
74
74
exclude = [
75
- "glslang/HLSL/pch.cpp" ,
76
75
"glslang/HLSL/pch.h" ,
77
- "glslang/MachineIndependent/pch.cpp" ,
78
76
"glslang/MachineIndependent/pch.h" ,
79
77
],
80
78
) + [
Original file line number Diff line number Diff line change @@ -107,18 +107,6 @@ if(USE_CCACHE)
107
107
endif (CCACHE_FOUND )
108
108
endif ()
109
109
110
- # Precompiled header macro. Parameters are source file list and filename for pch cpp file.
111
- macro (glslang_pch SRCS PCHCPP )
112
- if (MSVC AND CMAKE_GENERATOR MATCHES "^Visual Studio" AND NOT ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" AND ENABLE_PCH )
113
- set (PCH_NAME "$(IntDir)\\ pch.pch" )
114
- # make source files use/depend on PCH_NAME
115
- set_source_files_properties (${${SRCS}} PROPERTIES COMPILE_FLAGS "/Yupch.h /FIpch.h /Fp${PCH_NAME} /Zm300" OBJECT_DEPENDS "${PCH_NAME} " )
116
- # make PCHCPP file compile and generate PCH_NAME
117
- set_source_files_properties (${PCHCPP} PROPERTIES COMPILE_FLAGS "/Ycpch.h /Fp${PCH_NAME} /Zm300" OBJECT_OUTPUTS "${PCH_NAME} " )
118
- list (APPEND ${SRCS} "${PCHCPP} " )
119
- endif ()
120
- endmacro (glslang_pch )
121
-
122
110
project (glslang )
123
111
124
112
if (ENABLE_CTEST )
@@ -255,6 +243,19 @@ function(glslang_only_export_explicit_symbols target)
255
243
endif ()
256
244
endfunction ()
257
245
246
+ # glslang_pch() adds precompiled header rules to <target> for the pre-compiled
247
+ # header file <pch>. As target_precompile_headers() was added in CMake 3.16,
248
+ # this is a no-op if called on earlier versions of CMake.
249
+ if (NOT CMAKE_VERSION VERSION_LESS "3.16" )
250
+ function (glslang_pch target pch )
251
+ target_precompile_headers (${target} PRIVATE ${pch} )
252
+ endfunction ()
253
+ else ()
254
+ function (glslang_pch target pch )
255
+ endfunction ()
256
+ message (NOTICE "Your CMake version is ${CMAKE_VERSION} . Update to at least 3.16 to enable precompiled headers to speed up incremental builds" )
257
+ endif ()
258
+
258
259
if (NOT TARGET SPIRV-Tools-opt )
259
260
set (ENABLE_OPT OFF )
260
261
endif ()
Original file line number Diff line number Diff line change @@ -133,7 +133,7 @@ endif(ENABLE_HLSL)
133
133
add_library (MachineIndependent STATIC ${MACHINEINDEPENDENT_SOURCES} ${MACHINEINDEPENDENT_HEADERS} )
134
134
set_property (TARGET MachineIndependent PROPERTY POSITION_INDEPENDENT_CODE ON )
135
135
set_property (TARGET MachineIndependent PROPERTY FOLDER glslang )
136
- glslang_pch (SOURCES MachineIndependent/pch.cpp )
136
+ glslang_pch (MachineIndependent MachineIndependent/pch.h )
137
137
138
138
target_link_libraries (MachineIndependent PRIVATE OGLCompiler OSDependent GenericCodeGen )
139
139
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -60,9 +60,9 @@ if(BUILD_TESTING)
60
60
${CMAKE_CURRENT_SOURCE_DIR} /Remap.FromFile.cpp )
61
61
endif ()
62
62
63
- glslang_pch (TEST_SOURCES ${CMAKE_CURRENT_SOURCE_DIR} /pch.cpp )
64
63
65
64
add_executable (glslangtests ${TEST_SOURCES} )
65
+ glslang_pch (glslangtests ${CMAKE_CURRENT_SOURCE_DIR} /pch.h )
66
66
set_property (TARGET glslangtests PROPERTY FOLDER tests )
67
67
glslang_set_link_args (glslangtests )
68
68
if (ENABLE_GLSLANG_INSTALL )
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments