111 lines
3.5 KiB
Diff
111 lines
3.5 KiB
Diff
|
--- CMakeLists.txt
|
||
|
+++ CMakeLists.txt
|
||
|
@@ -9,6 +9,14 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||
|
# Adhere to GNU filesystem layout conventions
|
||
|
include(GNUInstallDirs)
|
||
|
|
||
|
+option(BUILD_SHARED_LIBS "Build Shared Libraries" OFF)
|
||
|
+
|
||
|
+set(LIB_TYPE STATIC)
|
||
|
+
|
||
|
+if(BUILD_SHARED_LIBS)
|
||
|
+ set(LIB_TYPE SHARED)
|
||
|
+endif()
|
||
|
+
|
||
|
option(SKIP_GLSLANG_INSTALL "Skip installation" ${SKIP_GLSLANG_INSTALL})
|
||
|
if(NOT ${SKIP_GLSLANG_INSTALL})
|
||
|
set(ENABLE_GLSLANG_INSTALL ON)
|
||
|
--- SPIRV/CMakeLists.txt
|
||
|
+++ SPIRV/CMakeLists.txt
|
||
|
@@ -40,11 +40,11 @@ if(ENABLE_NV_EXTENSIONS)
|
||
|
GLSL.ext.NV.h)
|
||
|
endif(ENABLE_NV_EXTENSIONS)
|
||
|
|
||
|
-add_library(SPIRV STATIC ${SOURCES} ${HEADERS})
|
||
|
+add_library(SPIRV ${LIB_TYPE} ${SOURCES} ${HEADERS})
|
||
|
set_property(TARGET SPIRV PROPERTY FOLDER glslang)
|
||
|
set_property(TARGET SPIRV PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||
|
|
||
|
-add_library(SPVRemapper STATIC ${SPVREMAP_SOURCES} ${SPVREMAP_HEADERS})
|
||
|
+add_library(SPVRemapper ${LIB_TYPE} ${SPVREMAP_SOURCES} ${SPVREMAP_HEADERS})
|
||
|
set_property(TARGET SPVRemapper PROPERTY FOLDER glslang)
|
||
|
set_property(TARGET SPVRemapper PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||
|
|
||
|
@@ -64,8 +64,13 @@ if(WIN32)
|
||
|
endif(WIN32)
|
||
|
|
||
|
if(ENABLE_GLSLANG_INSTALL)
|
||
|
- install(TARGETS SPIRV SPVRemapper
|
||
|
+ if(BUILD_SHARED_LIBS)
|
||
|
+ install(TARGETS SPIRV SPVRemapper
|
||
|
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||
|
+ else()
|
||
|
+ install(TARGETS SPIRV SPVRemapper
|
||
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||
|
+ endif()
|
||
|
|
||
|
install(FILES ${HEADERS} ${SPVREMAP_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/SPIRV/)
|
||
|
endif(ENABLE_GLSLANG_INSTALL)
|
||
|
--- StandAlone/CMakeLists.txt
|
||
|
+++ StandAlone/CMakeLists.txt
|
||
|
@@ -44,4 +44,9 @@ if(ENABLE_GLSLANG_INSTALL)
|
||
|
|
||
|
install(TARGETS spirv-remap
|
||
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||
|
+
|
||
|
+ if(BUILD_SHARED_LIBS)
|
||
|
+ install(TARGETS glslang-default-resource-limits
|
||
|
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||
|
+ endif()
|
||
|
endif(ENABLE_GLSLANG_INSTALL)
|
||
|
--- glslang/CMakeLists.txt
|
||
|
+++ glslang/CMakeLists.txt
|
||
|
@@ -80,7 +80,7 @@ set(HEADERS
|
||
|
# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||
|
# set(BISON_GLSLParser_OUTPUT_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/MachineIndependent/glslang_tab.cpp)
|
||
|
|
||
|
-add_library(glslang STATIC ${BISON_GLSLParser_OUTPUT_SOURCE} ${SOURCES} ${HEADERS})
|
||
|
+add_library(glslang ${LIB_TYPE} ${BISON_GLSLParser_OUTPUT_SOURCE} ${SOURCES} ${HEADERS})
|
||
|
set_property(TARGET glslang PROPERTY FOLDER glslang)
|
||
|
set_property(TARGET glslang PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||
|
target_link_libraries(glslang OGLCompiler OSDependent)
|
||
|
@@ -97,8 +97,13 @@ if(WIN32)
|
||
|
endif(WIN32)
|
||
|
|
||
|
if(ENABLE_GLSLANG_INSTALL)
|
||
|
- install(TARGETS glslang
|
||
|
+ if(BUILD_SHARED_LIBS)
|
||
|
+ install(TARGETS glslang
|
||
|
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||
|
+ else()
|
||
|
+ install(TARGETS glslang
|
||
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||
|
+ endif()
|
||
|
endif(ENABLE_GLSLANG_INSTALL)
|
||
|
|
||
|
if(ENABLE_GLSLANG_INSTALL)
|
||
|
--- hlsl/CMakeLists.txt
|
||
|
+++ hlsl/CMakeLists.txt
|
||
|
@@ -17,7 +17,7 @@ set(HEADERS
|
||
|
hlslGrammar.h
|
||
|
hlslParseables.h)
|
||
|
|
||
|
-add_library(HLSL STATIC ${SOURCES} ${HEADERS})
|
||
|
+add_library(HLSL ${LIB_TYPE} ${SOURCES} ${HEADERS})
|
||
|
set_property(TARGET HLSL PROPERTY FOLDER hlsl)
|
||
|
set_property(TARGET HLSL PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||
|
|
||
|
@@ -26,6 +26,11 @@ if(WIN32)
|
||
|
endif(WIN32)
|
||
|
|
||
|
if(ENABLE_GLSLANG_INSTALL)
|
||
|
- install(TARGETS HLSL
|
||
|
+ if(BUILD_SHARED_LIBS)
|
||
|
+ install(TARGETS HLSL
|
||
|
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||
|
+ else()
|
||
|
+ install(TARGETS HLSL
|
||
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||
|
+ endif()
|
||
|
endif(ENABLE_GLSLANG_INSTALL)
|