浏览代码

Add support for building vulkan validation 3p package for Windows (#91)

* Add support for building vulkan validation 3p package for Windows

Signed-off-by: moudgils <[email protected]>

* Addressed feedback

Signed-off-by: moudgils <[email protected]>

* Addressed feedback

Signed-off-by: moudgils <[email protected]>
moudgils 3 年之前
父节点
当前提交
d6b975f524

+ 30 - 0
package-system/vulkan-validationlayers/Findvulkan-validationlayers.cmake

@@ -0,0 +1,30 @@
+#
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+# 
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+#
+
+set(MY_NAME "vulkan-validationlayers")
+
+set(TARGET_WITH_NAMESPACE "3rdParty::${MY_NAME}")
+if (TARGET ${TARGET_WITH_NAMESPACE})
+    return()
+endif()
+
+set(PATH_TO_DLL ${CMAKE_CURRENT_LIST_DIR}/vulkan-validationlayers/lib/release)
+
+set(_DLL_NAME ${PATH_TO_DLL}/VkLayer_khronos_validation${CMAKE_SHARED_LIBRARY_SUFFIX})
+set(${MY_NAME}_RUNTIME_JSON_DEPENDENCIES ${PATH_TO_DLL}/VkLayer_khronos_validation.json)
+
+add_library(${TARGET_WITH_NAMESPACE} INTERFACE IMPORTED GLOBAL) 
+ly_add_target_files(
+    TARGETS
+    ${TARGET_WITH_NAMESPACE}
+    FILES
+    ${${MY_NAME}_RUNTIME_JSON_DEPENDENCIES}
+    ${_DLL_NAME}
+)
+
+set(${MY_NAME}_FOUND True)

+ 26 - 0
package-system/vulkan-validationlayers/build_config.json

@@ -0,0 +1,26 @@
+{
+    "git_url":"https://github.com/KhronosGroup/Vulkan-ValidationLayers.git",
+    "git_tag":"v1.2.198",
+    "package_name":"vulkan-validationlayers",
+    "package_version":"1.2.198-rev1",
+    "package_url":"https://github.com/KhronosGroup/Vulkan-ValidationLayers",
+    "package_license":"Apache-2.0",
+    "package_license_file":"LICENSE.txt",
+    "cmake_build_args_common": [
+        "--parallel"
+    ],
+    "Platforms":{
+        "Windows":{
+            "Windows":{
+                "cmake_find_source":"Findvulkan-validationlayers.cmake",
+                "cmake_find_target":"Findvulkan-validationlayers.cmake",   
+                "custom_build_cmd" : [
+                    "build_vulkan_validation_windows.cmd"
+                ],
+                "custom_install_cmd": [
+                    "install_vulkan_validation_windows.cmd"
+                ]
+            }
+        }
+    }
+}

+ 33 - 0
package-system/vulkan-validationlayers/build_vulkan_validation_windows.cmd

@@ -0,0 +1,33 @@
+@rem #
+@rem # Copyright (c) Contributors to the Open 3D Engine Project.
+@rem # For complete copyright and license terms please see the LICENSE at the root of this distribution.
+@rem # 
+@rem # SPDX-License-Identifier: Apache-2.0 OR MIT
+@rem #
+
+@rem # note that we explicitly turn off the compilation of all features that rely on 3rd Party Libraries
+@rem # except the ones we want.  This prevents the cmake build system from automatically finding things
+@rem # if they happen to be installed locally, which we don't want.
+
+@rem # cmake expects fowardslashes:
+set "DOWNLOADED_PACKAGE_FOLDERS=%DOWNLOADED_PACKAGE_FOLDERS:\=/%"
+
+@rem cd temp/build
+
+@rem release build
+%PYTHON_BINARY% temp/src/scripts/update_deps.py --dir temp/src/external --arch x64 --config release
+cmake -C temp/src/external/helper.cmake -S temp/src -B temp/build
+cmake --build temp/build --config Release --target clean
+cmake --build temp/build --config Release --target install 
+mkdir temp\\build\\install\\lib\\release
+move temp\\build\\install\\lib\\* temp\\build\\install\\lib\\release\\
+
+@rem debug build
+%PYTHON_BINARY% temp/src/scripts/update_deps.py --dir temp/src/external --arch x64 --config debug
+cmake --build temp/build --config Debug --target clean
+cmake -C temp/src/external/helper.cmake -S temp/src -B temp/build
+cmake --build temp/build --config Debug --target install 
+mkdir temp\\build\\install\\lib\\debug
+move temp\\build\\install\\lib\\* temp\\build\\install\\lib\\debug\\
+
+exit /b 0

+ 31 - 0
package-system/vulkan-validationlayers/install_vulkan_validation_windows.cmd

@@ -0,0 +1,31 @@
+@rem
+@rem Copyright (c) Contributors to the Open 3D Engine Project.
+@rem For complete copyright and license terms please see the LICENSE at the root of this distribution.
+@rem 
+@rem SPDX-License-Identifier: Apache-2.0 OR MIT
+@rem
+@rem
+@setlocal
+
+set OUT_PATH=%TARGET_INSTALL_ROOT%
+set SRC_PATH=temp\\src
+set BLD_PATH=temp\\build
+
+mkdir %OUT_PATH%\\include
+mkdir %OUT_PATH%\\lib
+
+mkdir %OUT_PATH%\\lib\\release
+mkdir %OUT_PATH%\\lib\\debug
+
+copy %BLD_PATH%\\install\\lib\\release\\* %OUT_PATH%\\lib\\release\\
+IF %ERRORLEVEL% NEQ 0 (
+    ECHO Unable to copy to %BLD_PATH%\\install\\lib\\release\\
+    exit /b 1
+)
+copy %BLD_PATH%\\install\\lib\\debug\\* %OUT_PATH%\\lib\\debug\\
+IF %ERRORLEVEL% NEQ 0 (
+    ECHO Unable to copy to %BLD_PATH%\\install\\lib\\debug\\
+    exit /b 1
+)
+
+exit /b 0

+ 4 - 2
package_build_list_host_windows.json

@@ -49,7 +49,8 @@
         "zlib-1.2.11-rev1-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/zlib --platform-name Windows --package-root ../../package-system --clean",
         "zlib-1.2.11-rev1-android": "Scripts/extras/pull_and_build_from_git.py ../../package-system/zlib --platform-name Android --package-root ../../package-system --clean",
         "expat-2.4.2-rev1-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/expat --platform-name Windows --package-root ../../package-system/expat/temp --clean",
-        "expat-2.4.2-rev1-android": "Scripts/extras/pull_and_build_from_git.py ../../package-system/expat --platform-name Android --package-root ../../package-system/expat/temp --clean"
+        "expat-2.4.2-rev1-android": "Scripts/extras/pull_and_build_from_git.py ../../package-system/expat --platform-name Android --package-root ../../package-system/expat/temp --clean",
+        "vulkan-validationlayers-1.2.198-rev1-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/vulkan-validationlayers --platform-name Windows --package-root ../../package-system --clean"
   },
   "build_from_folder": {
     "assimp-5.1.6-rev1-windows": "package-system/assimp-windows",
@@ -119,6 +120,7 @@
     "zlib-1.2.11-rev1-android": "package-system/zlib-android",
     "zlib-1.2.11-rev1-windows": "package-system/zlib-windows",
     "expat-2.4.2-rev1-android": "package-system/expat/temp/expat-android",
-    "expat-2.4.2-rev1-windows": "package-system/expat/temp/expat-windows"
+    "expat-2.4.2-rev1-windows": "package-system/expat/temp/expat-windows",
+    "vulkan-validationlayers-1.2.198-rev1-windows": "package-system/vulkan-validationlayers-windows"
   }
 }