From 98643b207a97553a8d287804880d191ba98e3b35 Mon Sep 17 00:00:00 2001 From: K1ngst0m Date: Sun, 15 Oct 2023 01:25:52 +0800 Subject: [PATCH] fix ci --- .github/workflows/cmake.yml | 5 ++++- cmake/AphExternal.cmake | 26 +++++++++++++++++--------- engine/CMakeLists.txt | 6 ++++-- external/fetch_external_sources.py | 11 ++++++----- 4 files changed, 31 insertions(+), 17 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 31491fc3..217e599e 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -21,7 +21,10 @@ jobs: - uses: actions/checkout@v3 - name: install dependencies - run: sudo apt-get install libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libvulkan-dev mesa-common-dev glslang-dev libshaderc1 + run: sudo apt-get install libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libvulkan-dev mesa-common-dev + + - name: Run fetch_external.py + run: python3 external/fetch_external_sources.py - name: Configure CMake # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. diff --git a/cmake/AphExternal.cmake b/cmake/AphExternal.cmake index 0417a99f..bc6c0ec5 100644 --- a/cmake/AphExternal.cmake +++ b/cmake/AphExternal.cmake @@ -9,23 +9,31 @@ set(ENABLE_OPT OFF CACHE BOOL "" FORCE) set(ENABLE_GLSLANG_INSTALL OFF CACHE BOOL "" FORCE) set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) set(SPIRV_CHECK_CONTEXT OFF CACHE BOOL "Disable SPIR-V IR context checking." FORCE) -set(SPIRV-Headers_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/spirv-headers" CACHE STRING "SPIRV-Headers path") -set(SHADERC_SKIP_INSTALL ON CACHE BOOL "" FORCE) -set(SHADERC_SKIP_TESTS ON CACHE BOOL "" FORCE) -set(SHADERC_SKIP_EXAMPLES ON CACHE BOOL "" FORCE) +set(SPIRV-Headers_SOURCE_DIR "${CMAKE_SOURCE_DIR}/external/spirv-headers" CACHE STRING "SPIRV-Headers path") set(SKIP_SPIRV_TOOLS_INSTALL ON CACHE BOOL "" FORCE) set(SPIRV_SKIP_EXECUTABLES ON CACHE BOOL "" FORCE) set(SPIRV_SKIP_TESTS ON CACHE BOOL "" FORCE) +set(SPIRV_CROSS_CLI OFF CACHE BOOL "" FORCE) set(SPIRV_CROSS_ENABLE_TESTS OFF CACHE BOOL "" FORCE) set(ENABLE_GLSLANG_BINARIES OFF CACHE BOOL "" FORCE) +# shaderc +set(SHADERC_SKIP_INSTALL ON CACHE BOOL "" FORCE) +set(SHADERC_SKIP_TESTS ON CACHE BOOL "" FORCE) +set(SHADERC_SKIP_EXAMPLES ON CACHE BOOL "" FORCE) +set(SHADERC_SKIP_COPYRIGHT_CHECK ON CACHE BOOL "" FORCE) +set(SHADERC_THIRD_PARTY_ROOT_DIR "${CMAKE_SOURCE_DIR}/external" CACHE STRING "Third party path." FORCE) + + add_compile_options(-w) -add_subdirectory(external/glfw) -add_subdirectory(external/reckless) -add_subdirectory(external/imgui) -add_subdirectory(external/volk) -add_subdirectory(external/SPIRV-cross) +add_subdirectory(external/glfw EXCLUDE_FROM_ALL) +add_subdirectory(external/reckless EXCLUDE_FROM_ALL) +add_subdirectory(external/imgui EXCLUDE_FROM_ALL) +add_subdirectory(external/volk EXCLUDE_FROM_ALL) +add_subdirectory(external/spirv-cross EXCLUDE_FROM_ALL) +add_subdirectory(external/shaderc EXCLUDE_FROM_ALL) +add_subdirectory(external/mmgr EXCLUDE_FROM_ALL) find_library(vulkan_lib NAMES vulkan HINTS "$ENV{VULKAN_SDK}/lib" "${CMAKE_SOURCE_DIR}/libs/vulkan" REQUIRED) if (vulkan_lib) diff --git a/engine/CMakeLists.txt b/engine/CMakeLists.txt index 2905ab57..269f3c67 100644 --- a/engine/CMakeLists.txt +++ b/engine/CMakeLists.txt @@ -25,16 +25,17 @@ target_include_directories(engine PUBLIC ../external/tinyimageformat ../external/tinyktx ../external/tinydds + ../external/mmgr PRIVATE ./ - ../external/libshaderc/include + ../external/shaderc/libshaderc/include ../external/glfw/include ../external/imgui/include ../external/vulkan ../external/stb/include ../external/tinygltf/include - ../external/SPIRV-Cross + ../external/spirv-cross ) target_link_libraries(engine PRIVATE @@ -48,5 +49,6 @@ target_link_libraries(engine PRIVATE spirv-cross-core dl dw + # mmgr # spirv-cross-reflect ) diff --git a/external/fetch_external_sources.py b/external/fetch_external_sources.py index 40015be1..eda3aa3e 100644 --- a/external/fetch_external_sources.py +++ b/external/fetch_external_sources.py @@ -46,17 +46,18 @@ def GetRevision(self): def CheckOut(self): fullDstPath = os.path.join(TargetDir, self.extractDir) if not os.path.exists(fullDstPath): - os.system("git clone " + self.httpsUrl + " " + fullDstPath); + os.system("git clone " + self.httpsUrl + " " + fullDstPath + " --depth 1"); os.chdir(fullDstPath); os.system("git fetch"); os.system("git checkout " + self.revision); PACKAGES = [ - # GitRepo("https://github.com/KhronosGroup/glslang.git", "glslang", "glslang"), - # GitRepo("https://github.com/KhronosGroup/SPIRV-Tools.git", "spirv-tools", "SPIRV-tools"), - # GitRepo("https://github.com/KhronosGroup/SPIRV-Headers.git", "spirv-headers", "SPIRV-tools/external/SPIRV-Headers"), - GitRepo("https://github.com/KhronosGroup/SPIRV-Cross.git", "spirv-cross", "SPIRV-cross"), + GitRepo("https://github.com/KhronosGroup/glslang.git", "glslang", "glslang"), + GitRepo("https://github.com/KhronosGroup/SPIRV-Tools.git", "spirv-tools", "spirv-tools"), + GitRepo("https://github.com/KhronosGroup/SPIRV-Headers.git", "spirv-headers", "spirv-headers"), + GitRepo("https://github.com/KhronosGroup/SPIRV-Cross.git", "spirv-cross", "spirv-cross"), + GitRepo("https://github.com/google/shaderc", "shaderc", "shaderc"), ] def GetOpt():