Skip to content

Commit

Permalink
Remove OGLCompiler and HLSL stub libraries from build
Browse files Browse the repository at this point in the history
Fixes ranlib warnings complaining about empty archive libraries.

Simplifie build/code.
  • Loading branch information
juan-lunarg authored and arcady-lunarg committed Nov 29, 2023
1 parent c59b876 commit 6be56e4
Show file tree
Hide file tree
Showing 16 changed files with 17 additions and 392 deletions.
8 changes: 0 additions & 8 deletions .github/workflows/continuous_deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ jobs:
lib/libGenericCodeGen.a \
lib/libglslang.a \
lib/libglslang-default-resource-limits.a \
lib/libHLSL.a \
lib/libMachineIndependent.a \
lib/libOGLCompiler.a \
lib/libOSDependent.a \
lib/libSPIRV.a \
lib/libSPVRemapper.a \
Expand Down Expand Up @@ -145,9 +143,7 @@ jobs:
lib/libGenericCodeGen.a \
lib/libglslang.a \
lib/libglslang-default-resource-limits.a \
lib/libHLSL.a \
lib/libMachineIndependent.a \
lib/libOGLCompiler.a \
lib/libOSDependent.a \
lib/libSPIRV.a \
lib/libSPVRemapper.a \
Expand Down Expand Up @@ -201,9 +197,7 @@ jobs:
lib/GenericCodeGend.lib `
lib/glslangd.lib `
lib/glslang-default-resource-limitsd.lib `
lib/HLSLd.lib `
lib/MachineIndependentd.lib `
lib/OGLCompilerd.lib `
lib/OSDependentd.lib `
lib/SPIRVd.lib `
lib/SPVRemapperd.lib `
Expand All @@ -223,9 +217,7 @@ jobs:
lib/GenericCodeGen.lib `
lib/glslang.lib `
lib/glslang-default-resource-limits.lib `
lib/HLSL.lib `
lib/MachineIndependent.lib `
lib/OGLCompiler.lib `
lib/OSDependent.lib `
lib/SPIRV.lib `
lib/SPVRemapper.lib `
Expand Down
23 changes: 1 addition & 22 deletions Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -64,27 +64,6 @@ LOCAL_C_INCLUDES:=$(LOCAL_PATH) $(LOCAL_PATH)/glslang/OSDependent/Unix/
LOCAL_EXPORT_C_INCLUDES:=$(LOCAL_PATH)/glslang/OSDependent/Unix/
include $(BUILD_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE:=OGLCompiler
LOCAL_CXXFLAGS:=-std=c++17 -fno-exceptions -fno-rtti $(GLSLANG_DEFINES)
LOCAL_EXPORT_C_INCLUDES:=$(LOCAL_PATH)
LOCAL_SRC_FILES:=OGLCompilersDLL/InitializeDll.cpp
LOCAL_C_INCLUDES:=$(LOCAL_PATH)/OGLCompiler
LOCAL_STATIC_LIBRARIES:=OSDependent
include $(BUILD_STATIC_LIBRARY)

# Build the stubbed HLSL library.
# The HLSL source is now directly referenced by the glslang static library
# instead.
include $(CLEAR_VARS)
LOCAL_MODULE:=HLSL
LOCAL_CXXFLAGS:=-std=c++17 -fno-exceptions -fno-rtti $(GLSLANG_DEFINES)
LOCAL_SRC_FILES:= \
hlsl/stub.cpp
LOCAL_C_INCLUDES:=$(LOCAL_PATH) \
$(LOCAL_PATH)/glslang/HLSL
include $(BUILD_STATIC_LIBRARY)

include $(CLEAR_VARS)
GLSLANG_OUT_PATH=$(if $(call host-path-is-absolute,$(TARGET_OUT)),$(TARGET_OUT),$(abspath $(TARGET_OUT)))

Expand Down Expand Up @@ -138,7 +117,7 @@ LOCAL_C_INCLUDES:=$(LOCAL_PATH) \
$(LOCAL_PATH)/glslang/MachineIndependent \
$(GLSLANG_GENERATED_INCLUDEDIR) \
$(GLSLANG_OUT_PATH)
LOCAL_STATIC_LIBRARIES:=OSDependent OGLCompiler HLSL
LOCAL_STATIC_LIBRARIES:=OSDependent
include $(BUILD_STATIC_LIBRARY)

include $(CLEAR_VARS)
Expand Down
2 changes: 0 additions & 2 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ template("glslang_sources_common") {
}

sources = [
"OGLCompilersDLL/InitializeDll.cpp",
"OGLCompilersDLL/InitializeDll.h",
"SPIRV/GLSL.ext.AMD.h",
"SPIRV/GLSL.ext.EXT.h",
"SPIRV/GLSL.ext.KHR.h",
Expand Down
6 changes: 1 addition & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ if(ENABLE_CTEST)
endif()

if(ENABLE_HLSL)
add_definitions(-DENABLE_HLSL)
add_compile_definitions(ENABLE_HLSL)
endif()

if(WIN32)
Expand Down Expand Up @@ -292,14 +292,10 @@ else()
endif()

add_subdirectory(glslang)
add_subdirectory(OGLCompilersDLL)
if(ENABLE_GLSLANG_BINARIES)
add_subdirectory(StandAlone)
endif()
add_subdirectory(SPIRV)
if(ENABLE_HLSL)
add_subdirectory(hlsl)
endif()
if(ENABLE_CTEST)
add_subdirectory(gtests)
endif()
Expand Down
59 changes: 0 additions & 59 deletions OGLCompilersDLL/CMakeLists.txt

This file was deleted.

37 changes: 0 additions & 37 deletions OGLCompilersDLL/InitializeDll.cpp

This file was deleted.

49 changes: 0 additions & 49 deletions OGLCompilersDLL/InitializeDll.h

This file was deleted.

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# News

1. C++17 (all platforms) and Visual Studio 2019 (Windows) are now required. This change was driven by the external dependency on SPIRV-Tools.

![Continuous Integration](https://github.com/KhronosGroup/glslang/actions/workflows/continuous_integration.yml/badge.svg)
![Continuous Deployment](https://github.com/KhronosGroup/glslang/actions/workflows/continuous_deployment.yml/badge.svg)
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/KhronosGroup/glslang/badge)](https://securityscorecards.dev/viewer/?uri=github.com/KhronosGroup/glslang)

# News

1. `OGLCompiler` and `HLSL` stub libraries have been fully removed from the build.

2. `OVERRIDE_MSVCCRT` has been removed in favor of `CMAKE_MSVC_RUNTIME_LIBRARY`

Users are encouraged to utilize the standard approach via [CMAKE_MSVC_RUNTIME_LIBRARY](https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html).
Expand Down
4 changes: 2 additions & 2 deletions glslang/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ glslang_add_build_info_dependency(MachineIndependent)

glslang_pch(MachineIndependent MachineIndependent/pch.h)

target_link_libraries(MachineIndependent PRIVATE OGLCompiler OSDependent GenericCodeGen)
target_link_libraries(MachineIndependent PRIVATE OSDependent GenericCodeGen)

################################################################################
# glslang
Expand Down Expand Up @@ -174,7 +174,7 @@ set_target_properties(glslang PROPERTIES
POSITION_INDEPENDENT_CODE ON
VERSION "${GLSLANG_VERSION}"
SOVERSION "${GLSLANG_VERSION_MAJOR}")
target_link_libraries(glslang PRIVATE OGLCompiler OSDependent MachineIndependent)
target_link_libraries(glslang PRIVATE OSDependent MachineIndependent)
target_include_directories(glslang PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
Expand Down
17 changes: 0 additions & 17 deletions glslang/MachineIndependent/ShaderLang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
#endif

#include "../Include/ShHandle.h"
#include "../../OGLCompilersDLL/InitializeDll.h"

#include "preprocessor/PpContext.h"

Expand Down Expand Up @@ -1311,9 +1310,6 @@ bool CompileDeferred(
//
int ShInitialize()
{
if (! InitProcess())
return 0;

const std::lock_guard<std::mutex> lock(init_lock);
++NumberOfClients;

Expand All @@ -1335,29 +1331,20 @@ int ShInitialize()

ShHandle ShConstructCompiler(const EShLanguage language, int /*debugOptions unused*/)
{
if (!InitThread())
return nullptr;

TShHandleBase* base = static_cast<TShHandleBase*>(ConstructCompiler(language, 0));

return reinterpret_cast<void*>(base);
}

ShHandle ShConstructLinker(const EShExecutable executable, int /*debugOptions unused*/)
{
if (!InitThread())
return nullptr;

TShHandleBase* base = static_cast<TShHandleBase*>(ConstructLinker(executable, 0));

return reinterpret_cast<void*>(base);
}

ShHandle ShConstructUniformMap()
{
if (!InitThread())
return nullptr;

TShHandleBase* base = static_cast<TShHandleBase*>(ConstructUniformMap());

return reinterpret_cast<void*>(base);
Expand Down Expand Up @@ -1871,8 +1858,6 @@ void TShader::setFlattenUniformArrays(bool flatten) { intermediate->setFlatt
bool TShader::parse(const TBuiltInResource* builtInResources, int defaultVersion, EProfile defaultProfile, bool forceDefaultVersionAndProfile,
bool forwardCompatible, EShMessages messages, Includer& includer)
{
if (! InitThread())
return false;
SetThreadPoolAllocator(pool);

if (! preamble)
Expand All @@ -1897,8 +1882,6 @@ bool TShader::preprocess(const TBuiltInResource* builtInResources,
std::string* output_string,
Includer& includer)
{
if (! InitThread())
return false;
SetThreadPoolAllocator(pool);

if (! preamble)
Expand Down
10 changes: 7 additions & 3 deletions glslang/OSDependent/Windows/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,19 @@
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

set(SOURCES ossource.cpp ../osinclude.h)
add_library(OSDependent STATIC)

target_sources(OSDependent PRIVATE
../osinclude.h
ossource.cpp
)

add_library(OSDependent STATIC ${SOURCES})
set_property(TARGET OSDependent PROPERTY FOLDER glslang)
set_property(TARGET OSDependent PROPERTY POSITION_INDEPENDENT_CODE ON)

# MinGW GCC complains about function pointer casts to void*.
# Turn that off with -fpermissive.
if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
if(MINGW AND ${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
target_compile_options(OSDependent PRIVATE -fpermissive)
endif()

Expand Down

0 comments on commit 6be56e4

Please sign in to comment.