|
@@ -234,55 +234,33 @@ if(NOT COMMAND find_host_package)
|
|
|
endmacro()
|
|
|
endif()
|
|
|
|
|
|
-# CMake needs to find the right version of python, right from the beginning,
|
|
|
-# otherwise, it will find the wrong version and fail later
|
|
|
-find_host_package(PythonInterp 3 REQUIRED)
|
|
|
-
|
|
|
# Root directory for build-time generated include files
|
|
|
set(GLSLANG_GENERATED_INCLUDEDIR "${CMAKE_BINARY_DIR}/include")
|
|
|
|
|
|
################################################################################
|
|
|
# Build version information generation
|
|
|
################################################################################
|
|
|
+include(parse_version.cmake)
|
|
|
set(GLSLANG_CHANGES_FILE "${CMAKE_CURRENT_SOURCE_DIR}/CHANGES.md")
|
|
|
-set(GLSLANG_BUILD_INFO_PY "${CMAKE_CURRENT_SOURCE_DIR}/build_info.py")
|
|
|
set(GLSLANG_BUILD_INFO_H_TMPL "${CMAKE_CURRENT_SOURCE_DIR}/build_info.h.tmpl")
|
|
|
set(GLSLANG_BUILD_INFO_H "${GLSLANG_GENERATED_INCLUDEDIR}/glslang/build_info.h")
|
|
|
|
|
|
-# Command to build the build_info.h file
|
|
|
-add_custom_command(
|
|
|
- OUTPUT ${GLSLANG_BUILD_INFO_H}
|
|
|
- COMMAND ${PYTHON_EXECUTABLE} "${GLSLANG_BUILD_INFO_PY}"
|
|
|
- ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
- "-i" ${GLSLANG_BUILD_INFO_H_TMPL}
|
|
|
- "-o" ${GLSLANG_BUILD_INFO_H}
|
|
|
- DEPENDS ${GLSLANG_BUILD_INFO_PY}
|
|
|
- ${GLSLANG_CHANGES_FILE}
|
|
|
- ${GLSLANG_BUILD_INFO_H_TMPL}
|
|
|
- COMMENT "Generating ${GLSLANG_BUILD_INFO_H}")
|
|
|
-
|
|
|
-# Target to build the build_info.h file
|
|
|
-add_custom_target(glslang-build-info DEPENDS ${GLSLANG_BUILD_INFO_H})
|
|
|
-
|
|
|
-# Populate the CMake GLSLANG_VERSION* variables with the build version
|
|
|
-# information.
|
|
|
-execute_process(
|
|
|
- COMMAND ${PYTHON_EXECUTABLE} "${GLSLANG_BUILD_INFO_PY}"
|
|
|
- ${CMAKE_CURRENT_SOURCE_DIR} "<major>.<minor>.<patch><-flavor>;<major>;<minor>;<patch>;<flavor>"
|
|
|
- OUTPUT_VARIABLE "GLSLANG_VERSIONS"
|
|
|
- OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
-list(GET "GLSLANG_VERSIONS" 0 "GLSLANG_VERSION")
|
|
|
-list(GET "GLSLANG_VERSIONS" 1 "GLSLANG_VERSION_MAJOR")
|
|
|
-list(GET "GLSLANG_VERSIONS" 2 "GLSLANG_VERSION_MINOR")
|
|
|
-list(GET "GLSLANG_VERSIONS" 3 "GLSLANG_VERSION_PATCH")
|
|
|
-list(GET "GLSLANG_VERSIONS" 4 "GLSLANG_VERSION_FLAVOR")
|
|
|
-configure_file(${GLSLANG_CHANGES_FILE} "${CMAKE_CURRENT_BINARY_DIR}/CHANGES.md") # Required to re-run cmake on version change
|
|
|
+parse_version(${GLSLANG_CHANGES_FILE} GLSLANG)
|
|
|
+
|
|
|
+function(configurate_version)
|
|
|
+ set(major ${GLSLANG_VERSION_MAJOR})
|
|
|
+ set(minor ${GLSLANG_VERSION_MINOR})
|
|
|
+ set(patch ${GLSLANG_VERSION_PATCH})
|
|
|
+ set(flavor ${GLSLANG_VERSION_FLAVOR})
|
|
|
+ configure_file(${GLSLANG_BUILD_INFO_H_TMPL} ${GLSLANG_BUILD_INFO_H} @ONLY)
|
|
|
+endfunction()
|
|
|
+
|
|
|
+configurate_version()
|
|
|
|
|
|
# glslang_add_build_info_dependency() adds the glslang-build-info dependency and
|
|
|
# generated include directories to target.
|
|
|
function(glslang_add_build_info_dependency target)
|
|
|
target_include_directories(${target} PUBLIC $<BUILD_INTERFACE:${GLSLANG_GENERATED_INCLUDEDIR}>)
|
|
|
- add_dependencies(${target} glslang-build-info)
|
|
|
endfunction()
|
|
|
|
|
|
# glslang_only_export_explicit_symbols() makes the symbol visibility hidden by
|
|
@@ -316,6 +294,8 @@ else()
|
|
|
endif()
|
|
|
|
|
|
if(BUILD_EXTERNAL AND IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/External)
|
|
|
+ find_package(PythonInterp 3 REQUIRED)
|
|
|
+
|
|
|
# We depend on these for later projects, so they should come first.
|
|
|
add_subdirectory(External)
|
|
|
endif()
|