Skip to content

Commit e8c9fd6

Browse files
authored
Merge pull request KhronosGroup#2326 from ben-clayton/always_pic
Remove GLSLANG_BUILD_PIC flag
2 parents ba17d8b + 3604be1 commit e8c9fd6

File tree

2 files changed

+4
-15
lines changed

2 files changed

+4
-15
lines changed

CMakeLists.txt

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,6 @@ if(USE_CCACHE)
107107
endif(CCACHE_FOUND)
108108
endif()
109109

110-
# If projects are statically importing glslang targets into a shared library
111-
# then they'll likely need to build with -fPIC. This can be enabled by setting
112-
# GLSLANG_BUILD_PIC to 1 before calling add_subdirectory() to import glslang.
113-
# Note: -fPIC is automatically used when BUILD_SHARED_LIBS is enabled.
114-
if(NOT DEFINED GLSLANG_BUILD_PIC)
115-
option(GLSLANG_BUILD_PIC "Compile glslang with -fPIC" OFF)
116-
endif()
117-
118110
# Precompiled header macro. Parameters are source file list and filename for pch cpp file.
119111
macro(glslang_pch SRCS PCHCPP)
120112
if(MSVC AND CMAKE_GENERATOR MATCHES "^Visual Studio" AND NOT ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" AND ENABLE_PCH)
@@ -160,9 +152,6 @@ if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
160152
add_compile_options(-Wall -Wmaybe-uninitialized -Wuninitialized -Wunused -Wunused-local-typedefs
161153
-Wunused-parameter -Wunused-value -Wunused-variable -Wunused-but-set-parameter -Wunused-but-set-variable -fno-exceptions)
162154
add_compile_options(-Wno-reorder) # disable this from -Wall, since it happens all over.
163-
if(BUILD_SHARED_LIBS OR GLSLANG_BUILD_PIC)
164-
add_compile_options(-fPIC)
165-
endif()
166155
if(NOT ENABLE_RTTI)
167156
add_compile_options(-fno-rtti)
168157
endif()
@@ -183,9 +172,6 @@ elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" AND NOT MSVC)
183172
add_compile_options(-Wall -Wuninitialized -Wunused -Wunused-local-typedefs
184173
-Wunused-parameter -Wunused-value -Wunused-variable)
185174
add_compile_options(-Wno-reorder) # disable this from -Wall, since it happens all over.
186-
if(BUILD_SHARED_LIBS OR GLSLANG_BUILD_PIC)
187-
add_compile_options(-fPIC)
188-
endif()
189175
if(NOT ENABLE_RTTI)
190176
add_compile_options(-fno-rtti)
191177
endif()

glslang/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ endif(EMSCRIPTEN OR ENABLE_GLSLANG_JS)
5050
add_library(GenericCodeGen STATIC
5151
GenericCodeGen/CodeGen.cpp
5252
GenericCodeGen/Link.cpp)
53+
set_property(TARGET GenericCodeGen PROPERTY POSITION_INDEPENDENT_CODE ON)
54+
set_property(TARGET GenericCodeGen PROPERTY FOLDER glslang)
5355

5456
################################################################################
5557
# MachineIndependent
@@ -129,7 +131,8 @@ if(ENABLE_HLSL)
129131
endif(ENABLE_HLSL)
130132

131133
add_library(MachineIndependent STATIC ${MACHINEINDEPENDENT_SOURCES} ${MACHINEINDEPENDENT_HEADERS})
132-
134+
set_property(TARGET MachineIndependent PROPERTY POSITION_INDEPENDENT_CODE ON)
135+
set_property(TARGET MachineIndependent PROPERTY FOLDER glslang)
133136
glslang_pch(SOURCES MachineIndependent/pch.cpp)
134137

135138
target_link_libraries(MachineIndependent PRIVATE OGLCompiler OSDependent GenericCodeGen)

0 commit comments

Comments
 (0)