Skip to content

Commit

Permalink
upgraded to glslang 7.12.3352 and made ENABLE_OPT work (KhronosGroup#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
mean-ui-thread authored and rbsheth committed Oct 2, 2019
1 parent 7578939 commit 2ac2c84
Show file tree
Hide file tree
Showing 6 changed files with 550 additions and 12 deletions.
25 changes: 17 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# increase to 3.1 once all major distributions
# include a version of CMake >= 3.1
cmake_minimum_required(VERSION 2.8.12)
cmake_minimum_required(VERSION 3.2)
if (POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
endif()
Expand Down Expand Up @@ -62,7 +62,17 @@ macro(glslang_pch SRCS PCHCPP)
endif()
endmacro(glslang_pch)

project(glslang)
include(cmake/HunterGate.cmake)
HunterGate(
URL "https://github.com/cpp-pm/hunter/archive/v0.23.218.tar.gz"
SHA1 "9a3594a61227967fb92159339ba326701b287b19"
)

project(glslang VERSION 7.12.3352)

hunter_add_package(SPIRV-Tools)
find_package(SPIRV-Tools CONFIG REQUIRED)

# make testing optional
include(CTest)

Expand Down Expand Up @@ -159,7 +169,7 @@ endif()
# We depend on these for later projects, so they should come first.
add_subdirectory(External)

if(NOT TARGET SPIRV-Tools-opt)
if(NOT TARGET SPIRV-Tools::SPIRV-Tools-opt)
set(ENABLE_OPT OFF)
endif()

Expand All @@ -173,7 +183,7 @@ else()
add_definitions(-DENABLE_OPT=0)
endif()

set(targets_export_name "${PROJECT_NAME}-targets")
set(targets_export_name "${PROJECT_NAME}Targets")

add_subdirectory(glslang)
add_subdirectory(OGLCompilersDLL)
Expand All @@ -188,13 +198,12 @@ add_subdirectory(gtests)

set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")
set(config_install_dir "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
set(version_config "${generated_dir}/${PROJECT_NAME}-config-version.cmake")
set(project_config "${generated_dir}/${PROJECT_NAME}-config.cmake")
set(version_config "${generated_dir}/${PROJECT_NAME}ConfigVersion.cmake")
set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake")
set(namespace "${PROJECT_NAME}::")
set(project_version "7.7.2767")

include(CMakePackageConfigHelpers)
write_basic_package_version_file("${version_config}" VERSION "${project_version}" COMPATIBILITY SameMajorVersion)
write_basic_package_version_file("${version_config}" VERSION "${PACKAGE_VERSION}" COMPATIBILITY AnyNewerVersion)
configure_package_config_file("cmake/config.cmake.in" "${project_config}" INSTALL_DESTINATION "${config_install_dir}")
install(FILES "${project_config}" "${version_config}" DESTINATION "${config_install_dir}")
install(EXPORT "${targets_export_name}" NAMESPACE "${namespace}" DESTINATION "${config_install_dir}")
2 changes: 1 addition & 1 deletion External/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ if(BUILD_TESTING)
endif()
endif()

if(ENABLE_OPT AND NOT TARGET SPIRV-Tools-opt)
if(ENABLE_OPT AND NOT TARGET SPIRV-Tools::SPIRV-Tools-opt)
if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/spirv-tools)
set(SPIRV_SKIP_TESTS ON CACHE BOOL "Skip building SPIRV-Tools tests")
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/spirv-tools spirv-tools)
Expand Down
3 changes: 1 addition & 2 deletions SPIRV/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ if(ENABLE_OPT)
PRIVATE ${spirv-tools_SOURCE_DIR}/include
PRIVATE ${spirv-tools_SOURCE_DIR}/source
)
target_link_libraries(SPIRV glslang SPIRV-Tools-opt)
target_include_directories(SPIRV PUBLIC ../External)
target_link_libraries(SPIRV glslang SPIRV-Tools::SPIRV-Tools-opt)
else()
target_link_libraries(SPIRV glslang)
endif(ENABLE_OPT)
Expand Down
2 changes: 1 addition & 1 deletion StandAlone/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ endif(WIN32)

target_link_libraries(glslangValidator ${LIBRARIES})
target_link_libraries(spirv-remap ${LIBRARIES})
target_include_directories(glslangValidator PUBLIC ../External)
target_include_directories(glslangValidator PUBLIC $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/External>)

if(WIN32)
source_group("Source" FILES ${SOURCES})
Expand Down
Loading

0 comments on commit 2ac2c84

Please sign in to comment.