From 73f432c26699879cbf5b06f46eef1fa93aaacab2 Mon Sep 17 00:00:00 2001 From: Martin Felis Date: Sun, 25 Jun 2017 21:02:28 +0200 Subject: [PATCH] Added CMake stuff to compile bgfx shaderc --- 3rdparty/bgfx/CMakeLists.txt | 122 +++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) diff --git a/3rdparty/bgfx/CMakeLists.txt b/3rdparty/bgfx/CMakeLists.txt index 0498d2e..62d729d 100644 --- a/3rdparty/bgfx/CMakeLists.txt +++ b/3rdparty/bgfx/CMakeLists.txt @@ -1,6 +1,7 @@ PROJECT (BGFX CXX) FIND_PACKAGE (OpenGL) +FIND_PACKAGE (Threads) CMAKE_MINIMUM_REQUIRED(VERSION 2.6) @@ -20,6 +21,21 @@ INCLUDE_DIRECTORIES ( ${CMAKE_CURRENT_SOURCE_DIR}/examples/common ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty ${OPENGL_INCLUDE_DIR} + + ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/fcpp/ + + ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/glsl-optimizer/include/ + ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/glsl-optimizer/src/ + ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/glsl-optimizer/src/glsl/ + ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/glsl-optimizer/src/mesa/ + + ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/glslang/glslang/Public/ + ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/glslang/glslang/Include/ + ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/glslang/ + + ${CMAKE_CURRENT_BINARY_DIR}/src + + ) SET (BGFX_SOURCES @@ -48,3 +64,109 @@ ADD_LIBRARY ( bgfx_aux SHARED ${BGFX_AUX_SOURCES} ) TARGET_LINK_LIBRARIES (bgfx ${OPENGL_LIBRARIES} ) + +# +# shaderc compilation +# + +file(GLOB glcpp-library_sources + 3rdparty/glsl-optimizer/src/mesa/main/*.c + 3rdparty/glsl-optimizer/src/mesa/program/*.c + 3rdparty/glsl-optimizer/src/glsl/glcpp/*.c + 3rdparty/glsl-optimizer/src/glsl/*.cpp + 3rdparty/glsl-optimizer/src/glsl/*.c + 3rdparty/glsl-optimizer/src/util/*.c + ) + +list(REMOVE_ITEM glcpp-library_sources + ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/glsl-optimizer/src/glsl/main.cpp) + +SET ( glslang_SRCS + 3rdparty/glslang/OGLCompilersDLL/InitializeDll.cpp + 3rdparty/glslang/SPIRV/SPVRemapper.cpp + 3rdparty/glslang/SPIRV/InReadableOrder.cpp + 3rdparty/glslang/SPIRV/SpvBuilder.cpp + 3rdparty/glslang/SPIRV/doc.cpp + 3rdparty/glslang/SPIRV/disassemble.cpp + 3rdparty/glslang/SPIRV/GlslangToSpv.cpp + 3rdparty/glslang/SPIRV/Logger.cpp + # 3rdparty/glslang/StandAlone/StandAlone.cpp + # 3rdparty/glslang/StandAlone/ResourceLimits.cpp + # 3rdparty/glslang/StandAlone/spirv-remap.cpp + 3rdparty/glslang/hlsl/hlslGrammar.cpp + 3rdparty/glslang/hlsl/hlslParseHelper.cpp + 3rdparty/glslang/hlsl/hlslParseables.cpp + 3rdparty/glslang/hlsl/hlslTokenStream.cpp + 3rdparty/glslang/hlsl/hlslAttributes.cpp + 3rdparty/glslang/hlsl/hlslOpMap.cpp + 3rdparty/glslang/hlsl/hlslScanContext.cpp + 3rdparty/glslang/glslang/OSDependent/Unix/ossource.cpp + # 3rdparty/glslang/glslang/OSDependent/Windows/ossource.cpp + # 3rdparty/glslang/glslang/OSDependent/Windows/main.cpp + 3rdparty/glslang/glslang/GenericCodeGen/CodeGen.cpp + 3rdparty/glslang/glslang/GenericCodeGen/Link.cpp + 3rdparty/glslang/glslang/MachineIndependent/parseConst.cpp + 3rdparty/glslang/glslang/MachineIndependent/iomapper.cpp + 3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp + 3rdparty/glslang/glslang/MachineIndependent/limits.cpp + 3rdparty/glslang/glslang/MachineIndependent/Scan.cpp + 3rdparty/glslang/glslang/MachineIndependent/glslang_tab.cpp + 3rdparty/glslang/glslang/MachineIndependent/SymbolTable.cpp + 3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp + 3rdparty/glslang/glslang/MachineIndependent/Constant.cpp + 3rdparty/glslang/glslang/MachineIndependent/InfoSink.cpp + 3rdparty/glslang/glslang/MachineIndependent/RemoveTree.cpp + 3rdparty/glslang/glslang/MachineIndependent/IntermTraverse.cpp + 3rdparty/glslang/glslang/MachineIndependent/Versions.cpp + 3rdparty/glslang/glslang/MachineIndependent/PoolAlloc.cpp + 3rdparty/glslang/glslang/MachineIndependent/intermOut.cpp + 3rdparty/glslang/glslang/MachineIndependent/reflection.cpp + 3rdparty/glslang/glslang/MachineIndependent/Initialize.cpp + 3rdparty/glslang/glslang/MachineIndependent/ParseContextBase.cpp + 3rdparty/glslang/glslang/MachineIndependent/linkValidate.cpp + 3rdparty/glslang/glslang/MachineIndependent/ShaderLang.cpp + 3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpMemory.cpp + 3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp + 3rdparty/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp + 3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpContext.cpp + 3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpSymbols.cpp + 3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpAtom.cpp + 3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp + 3rdparty/glslang/glslang/MachineIndependent/propagateNoContraction.cpp + ) + +ADD_EXECUTABLE (shaderc + ../bx/src/amalgamated.cpp + + src/shader.cpp + src/shader_spirv.cpp + src/shader_dxbc.cpp + src/shader_dx9bc.cpp + + tools/shaderc/shaderc.cpp + tools/shaderc/shaderc_glsl.cpp + tools/shaderc/shaderc.h + tools/shaderc/shaderc_hlsl.cpp + tools/shaderc/shaderc_pssl.cpp + tools/shaderc/shaderc_spirv.cpp + + ${glcpp-library_sources} + + 3rdparty/fcpp/cpp1.c + 3rdparty/fcpp/cpp2.c + 3rdparty/fcpp/cpp3.c + 3rdparty/fcpp/cpp4.c + 3rdparty/fcpp/cpp5.c + 3rdparty/fcpp/cpp6.c + + ${glslang_SRCS} + ) + +SET_TARGET_PROPERTIES ( shaderc PROPERTIES + COMPILE_FLAGS "-fno-strict-aliasing" +) + +TARGET_LINK_LIBRARIES ( shaderc + pthread + dl + )