Skip to content

Commit

Permalink
[llgi] create a new port (#34147)
Browse files Browse the repository at this point in the history
* [llgi] create a new port

* [llgi] update to latest

* [llgi] update baseline

* [llgi] create patch for cmake

* [llgi] split patch to pull request

* [llgi] update baseline

* [llgi] fix some details

* [llgi] fix vcpkg functions

* [llgi] update patch file

* [llgi] fix linux build

* Update ports/llgi/portfile.cmake

Co-authored-by: Lily Wang <94091114+LilyWangLL@users.noreply.github.com>

* Update ports/llgi/portfile.cmake

Co-authored-by: Lily Wang <94091114+LilyWangLL@users.noreply.github.com>

* Update ports/llgi/vcpkg.json

Co-authored-by: Lily Wang <94091114+LilyWangLL@users.noreply.github.com>

* [llgi] update baseline

* [llgi] apply upstream change

* [llgi] remove working version

---------

Co-authored-by: Lily Wang <94091114+LilyWangLL@users.noreply.github.com>
  • Loading branch information
luncliff and LilyWangLL committed Nov 17, 2023
1 parent 1fd0a71 commit 98f2259
Show file tree
Hide file tree
Showing 6 changed files with 163 additions and 0 deletions.
49 changes: 49 additions & 0 deletions ports/llgi/fix-cmake-use-vcpkg.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 30cb2da..dbc051b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -232,8 +232,13 @@ if(BUILD_VULKAN_COMPILER OR BUILD_TOOL)
spirv-cross-util)

else()
- list(APPEND LLGI_THIRDPARTY_INCLUDES ${GLSLANG_INCLUDE_DIR}
- ${SPIRVCROSS_INCLUDE_DIR})
+ # from vcpkg
+ find_package(glslang CONFIG REQUIRED)
+ find_package(spirv_cross_core CONFIG REQUIRED)
+ find_package(spirv_cross_glsl CONFIG REQUIRED)
+ find_package(spirv_cross_hlsl CONFIG REQUIRED)
+ find_package(spirv_cross_msl CONFIG REQUIRED)
+ find_package(spirv_cross_cpp CONFIG REQUIRED)

endif()

diff --git a/tools/ShaderTranspilerCore/CMakeLists.txt b/tools/ShaderTranspilerCore/CMakeLists.txt
index 4ce40d4..d4950ce 100644
--- a/tools/ShaderTranspilerCore/CMakeLists.txt
+++ b/tools/ShaderTranspilerCore/CMakeLists.txt
@@ -24,6 +24,10 @@ else()

endif()

+target_link_libraries(ShaderTranspilerCore PUBLIC
+ glslang::glslang glslang::SPIRV glslang::OSDependent glslang::MachineIndependent glslang::GenericCodeGen glslang::glslang-default-resource-limits glslang::OGLCompiler glslang::SPVRemapper glslang::HLSL
+ spirv-cross-cpp spirv-cross-glsl spirv-cross-msl spirv-cross-hlsl
+)
if(USE_THIRDPARTY_DIRECTORY)
add_dependencies(ShaderTranspilerCore EP_glslang EP_SPIRV-Cross)
endif()
diff --git a/CMakeLists.txt b/CMakeLists.txt
index dbc051b..b898b4c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -27,9 +27,6 @@ option(SPIRVCROSS_WITHOUT_INSTALL "Compile with spirv-cross without install"
OFF)
option(USE_CREATE_COMPILER_FUNCTION "Whether LLGI::CreateCompiler is used." ON)

-if(LINUX)
- set(BUILD_VULKAN TRUE)
-endif()

option(USE_MSVC_RUNTIME_LIBRARY_DLL "compile as multithreaded DLL" ON)

14 changes: 14 additions & 0 deletions ports/llgi/fix-sources.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/tools/ShaderTranspilerCore/ShaderTranspilerCore.h b/tools/ShaderTranspilerCore/ShaderTranspilerCore.h
index 269afa6..1d1015f 100644
--- a/tools/ShaderTranspilerCore/ShaderTranspilerCore.h
+++ b/tools/ShaderTranspilerCore/ShaderTranspilerCore.h
@@ -1,7 +1,7 @@

#pragma once
-
-#include <stdint.h>
+#include <cstddef>
+#include <cstdint>

#include "../../src/LLGI.Base.h"
#include <memory>
52 changes: 52 additions & 0 deletions ports/llgi/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO altseed/LLGI
REF 1b6b59b9f5bc9f81b4c2af2333d69f6e23670b3e
SHA512 c9011dee560897caf5ae53d8fa58869b774bd3bc7ce2e0cc4696ac034fc89a36adf3f5285e82cffe6430ca61f6509fd7fbadf5c77aef896c74e8d70e70ff4312
HEAD_REF master
PATCHES
fix-cmake-use-vcpkg.patch
fix-sources.patch
)

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
vulkan BUILD_VULKAN
vulkan BUILD_VULKAN_COMPILER
tool BUILD_TOOL
)

string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "dynamic" USE_DYNAMIC_RUNTIME)

# linux build requires x11-xcb
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
${FEATURE_OPTIONS}
-DBUILD_TEST=OFF
-DBUILD_EXAMPLE=OFF
-DUSE_CREATE_COMPILER_FUNCTION=ON
-DUSE_THIRDPARTY_DIRECTORY=OFF # prevent ExternalProject_Add
-DUSE_MSVC_RUNTIME_LIBRARY_DLL:BOOL=${USE_DYNAMIC_RUNTIME}
-DGLSLANG_WITHOUT_INSTALL=OFF
-DSPIRVCROSS_WITHOUT_INSTALL=OFF
MAYBE_UNUSED_VARIABLES
USE_MSVC_RUNTIME_LIBRARY_DLL
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake")

if("tool" IN_LIST FEATURES)
vcpkg_copy_tools(TOOL_NAMES ShaderTranspiler AUTO_CLEAN)
endif()

file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
"${CURRENT_PACKAGES_DIR}/debug/bin"
"${CURRENT_PACKAGES_DIR}/bin"
)

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
35 changes: 35 additions & 0 deletions ports/llgi/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "llgi",
"version-date": "2023-11-04",
"homepage": "https://github.com/altseed/LLGI",
"license": null,
"supports": "!(uwp | android)",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"features": {
"tool": {
"description": "Build ShaderTranspiler",
"dependencies": [
"glslang",
"spirv-cross"
]
},
"vulkan": {
"description": "Build vulkan modules",
"supports": "windows | linux",
"dependencies": [
"glslang",
"spirv-cross",
"vulkan"
]
}
}
}
4 changes: 4 additions & 0 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -5196,6 +5196,10 @@
"baseline": "2023-11-06",
"port-version": 0
},
"llgi": {
"baseline": "2023-11-04",
"port-version": 0
},
"llgl": {
"baseline": "2023-03-05",
"port-version": 0
Expand Down
9 changes: 9 additions & 0 deletions versions/l-/llgi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "a0f885d3531458ac1a7748ce8af641b30a80a166",
"version-date": "2023-11-04",
"port-version": 0
}
]
}

0 comments on commit 98f2259

Please sign in to comment.