Skip to content
This repository has been archived by the owner on Jul 29, 2021. It is now read-only.

Commit

Permalink
Merge branch 'trunk'
Browse files Browse the repository at this point in the history
Change-Id: I824da323dea08c165327fb65b5dfabdfff67a6cd
  • Loading branch information
lenny-lunarg committed Feb 6, 2018
2 parents c8ca289 + 65c23ae commit ef80b50
Show file tree
Hide file tree
Showing 85 changed files with 6,925 additions and 3,159 deletions.
76 changes: 17 additions & 59 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
# build version format
version: "{build}"

# Probably not useful for free accounts, but ask anyway.
# Free accounts have a max of 1, but ask anyway.
max_jobs: 4

os:
- Visual Studio 2015
- Visual Studio 2013

environment:
PYTHON_PATH: "C:/Python35"
Expand All @@ -28,69 +28,27 @@ branches:
- master

before_build:
# These steps are a replacement for
# - update_external_sources.bat --all
# Instead of using the above script to build glslang/spirv-tools
# for all platform configs, build only the job's selected platform config.
# Since the script doesn't support building a single platform config,
# use parts of the script to build only the selected platform config.
#
# Also always build the x64 Release platform config in order to
# get the shader compiler binary which is used to build the repo.
#
# For a 4 platform config setup:
# All this results in 7 builds of glslang per commit, which isn't
# as good as building 4 when building all 4 platform configs in
# a single job, but is necessary when splitting the build into 4 jobs.
# It is still better than 16 glslang builds.
#
- "SET PATH=C:\\Python35;C:\\Python35\\Scripts;%PATH%"
- setlocal EnableDelayedExpansion
# Set up some useful vars.
- set TOP_DIR="%APPVEYOR_BUILD_FOLDER%\"
- set EXT_DIR=%TOP_DIR%external
- set REVISION_DIR=%TOP_DIR%external_revisions
- set GLSLANG_DIR=%EXT_DIR%\glslang
- set /p GLSLANG_GITURL= < %REVISION_DIR%\glslang_giturl
- set /p GLSLANG_REVISION= < %REVISION_DIR%\glslang_revision
# Clone and checkout glslang.
- echo.
- echo Creating local glslang repository %GLSLANG_DIR%
- echo GLSLANG_GITURL=%GLSLANG_GITURL%
- echo GLSLANG_REVISION=%GLSLANG_REVISION%
- if not exist %GLSLANG_DIR% (mkdir %GLSLANG_DIR%)
- cd %GLSLANG_DIR%
# If this dir is not empty, then a build cache was restored. Update it by fetching any updates.
# If the dir is empty, clone the repo.
- dir /b /a | findstr . > nul && (git fetch --all) || (git clone %GLSLANG_GITURL% . )
- git checkout %GLSLANG_REVISION%
- python.exe .\update_glslang_sources.py
# Build glslang.
- echo.
- echo Building %GLSLANG_DIR%
# We always need the x64 Release version of the shader compiler for building the repo.
- cd %GLSLANG_DIR%
- if not exist build (mkdir build)
- cd build
- cmake -G "Visual Studio 14 2015 Win64" -DCMAKE_INSTALL_PREFIX=install ..
- msbuild INSTALL.vcxproj /p:Platform=x64 /p:Configuration=Release /verbosity:quiet
# Build the x64 debug version if selected.
- if %PLATFORM% == x64 (if %CONFIGURATION% == Debug (msbuild INSTALL.vcxproj /p:Platform=x64 /p:Configuration=Debug /verbosity:quiet))
# Build 32-bit platform configs if selected.
- cd %GLSLANG_DIR%
- if not exist build32 (mkdir build32)
- cd build32
- if %PLATFORM% == Win32 (cmake -G "Visual Studio 14 2015" -DCMAKE_INSTALL_PREFIX=install ..)
- if %PLATFORM% == Win32 (msbuild INSTALL.vcxproj /p:Platform=x86 /p:Configuration=%CONFIGURATION% /verbosity:quiet)
# Generate build files using CMake for the build step.
- echo.
- echo Starting build for %APPVEYOR_REPO_NAME%
- if %PLATFORM% == Win32 (set GENERATOR="Visual Studio 14 2015")
- if %PLATFORM% == x64 (set GENERATOR="Visual Studio 14 2015 Win64")
- echo Update external sources
- if %PLATFORM% == Win32 (if %CONFIGURATION% == Debug (update_external_sources.bat --32 --debug))
- if %PLATFORM% == Win32 (if %CONFIGURATION% == Release (update_external_sources.bat --32 --release))
- if %PLATFORM% == x64 (if %CONFIGURATION% == Debug (update_external_sources.bat --64 --debug))
- if %PLATFORM% == x64 (if %CONFIGURATION% == Release (update_external_sources.bat --64 --release))
# Determine the appropriate CMake generator for the current version of Visual Studio
- echo Determining VS version
- python .\scripts\determine_vs_version.py > vsversion.tmp
- set /p VS_VERSION=< vsversion.tmp
- echo Detected Visual Studio Version as %VS_VERSION%
- del /Q /F vsversion.tmp
- if %PLATFORM% == Win32 (set GENERATOR="Visual Studio %VS_VERSION%")
- if %PLATFORM% == x64 (set GENERATOR="Visual Studio %VS_VERSION% Win64")
# Generate build files using CMake for the build step.
- echo Generating CMake files for %GENERATOR%
- cd %TOP_DIR%
- mkdir build
- cd build
- echo Generating CMake files for %GENERATOR%
- cmake -G %GENERATOR% ..
- echo Building platform=%PLATFORM% configuration=%CONFIGURATION%

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ build-android/external
.gradle
.externalNativeBuild
*.iml

.vscode/
33 changes: 27 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,25 @@ cache: ccache

before_install:
- set -e
# Install the appropriate Linux packages.
- |
if [[ "$VULKAN_BUILD_TARGET" == "LINUX" ]]; then
# Install the appropriate Linux packages.
sudo apt-get -qq update
sudo apt-get -y install libxkbcommon-dev libwayland-dev libmirclient-dev libxrandr-dev libx11-xcb-dev
fi
# Install the Android NDK.
- |
if [[ "$VULKAN_BUILD_TARGET" == "ANDROID" ]]; then
# Install the Android NDK.
export ARCH=`uname -m`
wget http://dl.google.com/android/repository/android-ndk-r15c-linux-${ARCH}.zip
unzip -u -q android-ndk-r15c-linux-${ARCH}.zip
export ANDROID_NDK_HOME=`pwd`/android-ndk-r15c
export JAVA_HOME="/usr/lib/jvm/java-8-oracle"
export PATH="$ANDROID_NDK_HOME:$PATH"
fi
# Install the clang format diff tool, but only for pull requests.
- |
if [[ "$CHECK_FORMAT" == "ON" && "$TRAVIS_PULL_REQUEST" != "false" ]]; then
# Install the clang format diff tool, but only for pull requests.
curl -L http://llvm.org/svn/llvm-project/cfe/trunk/tools/clang-format/clang-format-diff.py -o scripts/clang-format-diff.py;
fi
# Misc setup
Expand All @@ -67,12 +67,33 @@ script:
- set -e
- |
if [[ "$VULKAN_BUILD_TARGET" == "LINUX" ]]; then
# Get VulkanTools and build DevSim
mkdir -p external
cd external
git clone https://github.com/LunarG/VulkanTools.git
cd VulkanTools
# Get as little as possible from external sources
./update_external_sources.sh --glslang --no-build
# Build as few components as possible
cmake -H. -Bbuild -DBUILD_LOADER=NO -DBUILD_TESTS=NO \
-DBUILD_LAYERS=NO -DBUILD_DEMOS=NO -DBUILD_VKTRACE=NO \
-DBUILD_VKJSON=NO -DBUILD_VIA=NO -DBUILD_ICD=NO
make -C build -j $core_count
cd ${TRAVIS_BUILD_DIR}
fi
- |
if [[ "$VULKAN_BUILD_TARGET" == "LINUX" ]]; then
# Build LVL
./update_external_sources.sh
cmake -H. -Bdbuild -DCMAKE_BUILD_TYPE=Debug
make -C dbuild -j $core_count
fi
- |
if [[ "$VULKAN_BUILD_TARGET" == "LINUX" ]]; then
# Run Tests
(cd dbuild/tests; ./vkvalidatelayerdoc.sh)
export LD_LIBRARY_PATH=dbuild/loader:$LD_LIBRARY_PATH
export VK_LAYER_PATH=dbuild/layers
export VK_LAYER_PATH=external/VulkanTools/build/layersvt:dbuild/layers
export VK_ICD_FILENAMES=dbuild/icd/VkICD_mock_icd.json
dbuild/tests/vk_layer_validation_tests
VK_DEVSIM_FILENAME=tests/device_profiles/adreno_540.json dbuild/tests/vk_layer_validation_tests --devsim
Expand All @@ -91,11 +112,11 @@ script:
USE_CCACHE=1 NDK_CCACHE=ccache ndk-build APP_ABI=$ANDROID_ABI -j $core_count
popd
fi
# Run the clang format check only for pull request builds because the
# master branch is needed to do the git diff.
- |
if [[ "$CHECK_FORMAT" == "ON" ]]; then
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then
# Run the clang format check only for pull request builds because the
# master branch is needed to do the git diff.
echo "Checking clang-format between TRAVIS_BRANCH=$TRAVIS_BRANCH and TRAVIS_PULL_REQUEST_BRANCH=$TRAVIS_PULL_REQUEST_BRANCH"
./scripts/check_code_format.sh
else
Expand Down
42 changes: 39 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ if (USE_CCACHE)
endif(CCACHE_FOUND)
endif()

# Enable cmake folders
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(LVL_TARGET_FOLDER lvl_cmake_targets)

if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(FALLBACK_CONFIG_DIRS "/etc/xdg" CACHE STRING
"Search path to use when XDG_CONFIG_DIRS is unset or empty or the current process is SUID/SGID. Default is freedesktop compliant.")
Expand Down Expand Up @@ -144,7 +148,7 @@ set(SPIRV_TOOLS_BINARY_ROOT "${CMAKE_BINARY_DIR}/../SPIRV-Tools" CACHE STRING "U
set(SPIRV_TOOLS_OPT_BINARY_ROOT "${CMAKE_BINARY_DIR}/../SPIRV-Tools/opt" CACHE STRING "User defined path to the SPIRV-Tools-opt binaries for this project")

# Define a variable for a default root location to the gslang, SPIRV-Tools and other external sources and cache it to allow the user to customize it as needed
set(EXTERNAL_SOURCE_ROOT "${CMAKE_SOURCE_DIR}/external" CACHE STRING "Root path to external sources such as glslang and SPIRV-Tools")
set(EXTERNAL_SOURCE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/external" CACHE STRING "Root path to external sources such as glslang and SPIRV-Tools")


if (WIN32)
Expand Down Expand Up @@ -210,7 +214,7 @@ else()
endif()

find_program(GLSLANG_VALIDATOR NAMES glslangValidator
HINTS "${CMAKE_SOURCE_DIR}/external/glslang/${BUILDTGT_DIR}/install/bin"
HINTS "${EXTERNAL_SOURCE_ROOT}/glslang/${BUILDTGT_DIR}/install/bin"
"${GLSLANG_BINARY_ROOT}/StandAlone"
"${PROJECT_SOURCE_DIR}/external/${BINDATA_DIR}")

Expand Down Expand Up @@ -320,7 +324,10 @@ endmacro()
# Define macro used for generating header files containing commit IDs for external dependencies
macro(run_external_revision_generate source_dir symbol_name output)
add_custom_command(OUTPUT ${output}
COMMAND ${PYTHON_CMD} ${SCRIPTS_DIR}/external_revision_generator.py ${source_dir} ${symbol_name} ${output}
# NOTE: If you modify this call to use --rev_file instead of --git_dir (to read the commit ID from a file instead of
# parsing from a Git repository), you probably also want to add the revision file to the list of DEPENDS on the
# subsequent line (to ensure that the script is re-run when the revision file is modified).
COMMAND ${PYTHON_CMD} ${SCRIPTS_DIR}/external_revision_generator.py --git_dir ${source_dir} -s ${symbol_name} -o ${output}
DEPENDS ${SCRIPTS_DIR}/external_revision_generator.py ${source_dir}/.git/HEAD ${source_dir}/.git/index
)
endmacro()
Expand All @@ -339,6 +346,7 @@ add_custom_target(generate_helper_files DEPENDS
vk_typemap_helper.h
spirv_tools_commit_id.h
)
set_target_properties(generate_helper_files PROPERTIES FOLDER ${LVL_TARGET_FOLDER})

# Rules to build generated helper files
run_vk_xml_generate(loader_extension_generator.py vk_layer_dispatch_table.h)
Expand All @@ -353,6 +361,8 @@ run_vk_xml_generate(helper_file_generator.py vk_extension_helper.h)
run_vk_xml_generate(helper_file_generator.py vk_typemap_helper.h)
run_external_revision_generate(${EXTERNAL_SOURCE_ROOT}/glslang/External/spirv-tools SPIRV_TOOLS_COMMIT_ID spirv_tools_commit_id.h)



if(NOT WIN32)
include(GNUInstallDirs)

Expand Down Expand Up @@ -382,6 +392,32 @@ add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif()

# Layer Utils Library
# For Windows, we use a static lib because the Windows loader has a fairly restrictive loader search
# path that can't be easily modified to point it to the same directory that contains the layers.
set(VKLAYER_UTILS_VLF_SOURCES
layers/vk_layer_config.cpp
layers/vk_layer_extension_utils.cpp
layers/vk_layer_utils.cpp
layers/vk_format_utils.cpp
)
if (WIN32)
add_library(VkLayer_utils STATIC ${VKLAYER_UTILS_VLF_SOURCES})
target_compile_definitions(VkLayer_utils PUBLIC _CRT_SECURE_NO_WARNINGS)
else()
add_library(VkLayer_utils SHARED ${VKLAYER_UTILS_VLF_SOURCES})
if(INSTALL_LVL_FILES)
install(TARGETS VkLayer_utils DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
endif()
add_dependencies(VkLayer_utils generate_helper_files)
target_include_directories(
VkLayer_utils PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/loader
${CMAKE_CURRENT_SOURCE_DIR}/include/vulkan
${CMAKE_CURRENT_BINARY_DIR}
)

add_definitions(-DAPI_NAME="${API_NAME}")

# loader: Generic VULKAN ICD loader
Expand Down
Loading

0 comments on commit ef80b50

Please sign in to comment.