diff --git a/ports/civetweb/usage b/ports/civetweb/usage index 287a2ff668b201..15e68942a8633a 100644 --- a/ports/civetweb/usage +++ b/ports/civetweb/usage @@ -1,4 +1,4 @@ civetweb provides CMake targets: find_package(civetweb CONFIG REQUIRED) - target_link_libraries(main PRIVATE civetweb::civetweb) + target_link_libraries(main PRIVATE civetweb::civetweb civetweb::civetweb-cpp) diff --git a/ports/civetweb/vcpkg.json b/ports/civetweb/vcpkg.json index bb2dd92aa34776..0ae97c0c43a7a3 100644 --- a/ports/civetweb/vcpkg.json +++ b/ports/civetweb/vcpkg.json @@ -1,7 +1,7 @@ { "name": "civetweb", "version": "1.16", - "port-version": 2, + "port-version": 3, "description": "Easy to use, powerful, C/C++ embeddable web server.", "homepage": "https://github.com/civetweb/civetweb", "supports": "!uwp", diff --git a/ports/glslang/0001-private-headers.patch b/ports/glslang/0001-private-headers.patch new file mode 100644 index 00000000000000..4cdac80b68078d --- /dev/null +++ b/ports/glslang/0001-private-headers.patch @@ -0,0 +1,23 @@ +diff --git a/glslang/CMakeLists.txt b/glslang/CMakeLists.txt +index 47925d8d..47a14adf 100644 +--- a/glslang/CMakeLists.txt ++++ b/glslang/CMakeLists.txt +@@ -266,6 +266,15 @@ if(GLSLANG_ENABLE_INSTALL) + Include/visibility.h + MachineIndependent/Versions.h) + ++ option(INSTALL_PRIVATE_HEADERS "Install private headers" OFF) ++ if(INSTALL_PRIVATE_HEADERS) ++ foreach(PUBLIC_HEADER IN LISTS GLSLANG_HEADERS GENERICCODEGEN_HEADERS OSDEPENDENT_HEADERS MACHINEINDEPENDENT_HEADERS SPIRV_HEADERS) ++ get_filename_component(PUBLIC_HEADER "${PUBLIC_HEADER}" ABSOLUTE) ++ file(RELATIVE_PATH PUBLIC_HEADER "${CMAKE_CURRENT_LIST_DIR}" "${PUBLIC_HEADER}") ++ list(APPEND PUBLIC_HEADERS "${PUBLIC_HEADER}") ++ endforeach() ++ endif() ++ + foreach(file ${PUBLIC_HEADERS}) + get_filename_component(dir ${file} DIRECTORY) + install(FILES ${file} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/glslang/${dir}) +-- +2.45.2 + diff --git a/ports/glslang/portfile.cmake b/ports/glslang/portfile.cmake index 9f1727ba7c885c..e865dc353e6e20 100644 --- a/ports/glslang/portfile.cmake +++ b/ports/glslang/portfile.cmake @@ -6,6 +6,8 @@ vcpkg_from_github( REF "${VERSION}" SHA512 8ba7e5f73746b221ff39387282e2d929d1142c60d1c79019f4c21c84b105fb59253e88f2f649a25e9bb7ab01094e455f002c7412aeea882548fac4a426eee809 HEAD_REF master + PATCHES + 0001-private-headers.patch ) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS @@ -14,8 +16,13 @@ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS opt ALLOW_EXTERNAL_SPIRV_TOOLS tools ENABLE_GLSLANG_BINARIES rtti ENABLE_RTTI + "private-headers" INSTALL_PRIVATE_HEADERS ) +if(INSTALL_PRIVATE_HEADERS) + message(WARNING "Avoid relying on the installed private glslang headers.") +endif() + if(ENABLE_GLSLANG_BINARIES) vcpkg_find_acquire_program(PYTHON3) get_filename_component(PYTHON_PATH ${PYTHON3} DIRECTORY) diff --git a/ports/unofficial-filament/0000-compiler.patch b/ports/unofficial-filament/0000-compiler.patch new file mode 100644 index 00000000000000..5aa8e15db207f9 --- /dev/null +++ b/ports/unofficial-filament/0000-compiler.patch @@ -0,0 +1,161 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5180bdfb6..471ce49ed 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -264,6 +264,9 @@ set(TOOLS ${CMAKE_CURRENT_SOURCE_DIR}/tools) + # ================================================================================================== + # Compiler check + # ================================================================================================== ++option(FILAMENT_ALLOW_ANY_COMPILER "Allow building with any compiler" TRUE) ++ ++if(NOT FILAMENT_ALLOW_ANY_COMPILER) + set(MIN_CLANG_VERSION "6.0") + + if (CMAKE_C_COMPILER_ID MATCHES "Clang") +@@ -288,6 +291,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + message(FATAL_ERROR "Building with Clang on Windows is no longer supported. Use MSVC 2019 instead.") + endif() + endif() ++endif() + + # ================================================================================================== + # Link time optimizations (LTO) +@@ -306,16 +310,16 @@ endif() + # ================================================================================================== + # General compiler flags + # ================================================================================================== +-set(CXX_STANDARD "-std=c++17") +-if (WIN32) +- set(CXX_STANDARD "/std:c++17") +-endif() ++set(CMAKE_CXX_STANDARD 17) + + if (MSVC) + set(CXX_STANDARD "/std:c++latest") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_STANDARD} /W0 /Zc:__cplusplus") + else() +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_STANDARD} -fstrict-aliasing -Wno-unknown-pragmas -Wno-unused-function -Wno-deprecated-declarations") ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-pragmas -Wno-unused-function -Wno-deprecated-declarations") ++ if(CMAKE_CXX_COMPILER_ID STREQUAL Clang OR CMAKE_CXX_COMPILER_ID STREQUAL AppleClang) ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstrict-aliasing") ++ endif() + endif() + + if (FILAMENT_USE_EXTERNAL_GLES3) +@@ -361,10 +365,18 @@ if (MSVC) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE") + endif() + +-# Add colors to ninja builds +-if (UNIX AND CMAKE_GENERATOR STREQUAL "Ninja") +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcolor-diagnostics") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcolor-diagnostics") ++# Enhance error reporting and compiler messages ++if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang") ++ add_compile_options( ++ $<$:-fcolor-diagnostics> $<$:-fcolor-diagnostics> ++ ) ++elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") ++ add_compile_options( ++ $<$:-fdiagnostics-color=always> ++ $<$:-fdiagnostics-color=always> ++ ) ++elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND MSVC_VERSION GREATER 1900) ++ add_compile_options(/diagnostics:column) + endif() + + # Use hidden by default and expose what we need. +diff --git a/filament/CMakeLists.txt b/filament/CMakeLists.txt +index a68d1f915..b2a398c8f 100644 +--- a/filament/CMakeLists.txt ++++ b/filament/CMakeLists.txt +@@ -604,12 +604,16 @@ if (MSVC) + else() + set(FILAMENT_WARNINGS + -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers +- -Wextra-semi -Wnewline-eof -Wdeprecated -Wundef ++ -Wextra-semi -Wdeprecated -Wundef ++ -Wnon-virtual-dtor -Wimplicit-fallthrough ++ ) ++ if(CMAKE_CXX_COMPILER_ID STREQUAL Clang OR CMAKE_CXX_COMPILER_ID STREQUAL AppleClang) ++ list(APPEND FILAMENT_WARNINGS ++ -Wnewline-eof -Wweak-vtables -Wclass-varargs -Wover-aligned + -Wgnu-conditional-omitted-operand +- -Wweak-vtables -Wnon-virtual-dtor -Wclass-varargs -Wimplicit-fallthrough +- -Wover-aligned + -Werror +- ) ++ ) ++ endif() + endif() + + target_compile_options(${TARGET} PRIVATE +diff --git a/filament/backend/CMakeLists.txt b/filament/backend/CMakeLists.txt +index 28fc07941..3a2d827ff 100644 +--- a/filament/backend/CMakeLists.txt ++++ b/filament/backend/CMakeLists.txt +@@ -377,12 +377,16 @@ if (MSVC) + else() + set(FILAMENT_WARNINGS + -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers +- -Wextra-semi -Wnewline-eof -Wdeprecated -Wundef ++ -Wextra-semi -Wdeprecated -Wundef ++ -Wnon-virtual-dtor -Wimplicit-fallthrough ++ ) ++ if(CMAKE_CXX_COMPILER_ID STREQUAL Clang OR CMAKE_CXX_COMPILER_ID STREQUAL AppleClang) ++ list(APPEND FILAMENT_WARNINGS ++ -Wnewline-eof -Wweak-vtables -Wclass-varargs -Wover-aligned + -Wgnu-conditional-omitted-operand +- -Wweak-vtables -Wnon-virtual-dtor -Wclass-varargs -Wimplicit-fallthrough +- -Wover-aligned + -Werror +- ) ++ ) ++ endif() + endif() + + if (APPLE) +diff --git a/filament/backend/src/vulkan/VulkanPipelineCache.cpp b/filament/backend/src/vulkan/VulkanPipelineCache.cpp +index 4c440a008..b8e3bf5c7 100644 +--- a/filament/backend/src/vulkan/VulkanPipelineCache.cpp ++++ b/filament/backend/src/vulkan/VulkanPipelineCache.cpp +@@ -280,8 +280,8 @@ void VulkanPipelineCache::bindVertexArray(VkVertexInputAttributeDescription cons + mPipelineRequirements.vertexAttributes[i] = attribDesc[i]; + mPipelineRequirements.vertexBuffers[i] = bufferDesc[i]; + } else { +- mPipelineRequirements.vertexAttributes[i] = {}; +- mPipelineRequirements.vertexBuffers[i] = {}; ++ mPipelineRequirements.vertexAttributes[i] = VertexInputAttributeDescription{}; ++ mPipelineRequirements.vertexBuffers[i] = VertexInputBindingDescription{}; + } + } + } +diff --git a/filament/backend/src/vulkan/VulkanStagePool.cpp b/filament/backend/src/vulkan/VulkanStagePool.cpp +index 067b16afd..f74ea2cb3 100644 +--- a/filament/backend/src/vulkan/VulkanStagePool.cpp ++++ b/filament/backend/src/vulkan/VulkanStagePool.cpp +@@ -105,7 +105,7 @@ VulkanStageImage const* VulkanStagePool::acquireImage(PixelDataFormat format, Pi + .usage = VMA_MEMORY_USAGE_CPU_TO_GPU + }; + +- const UTILS_UNUSED VkResult result = vmaCreateImage(mAllocator, &imageInfo, &allocInfo, ++ UTILS_UNUSED const VkResult result = vmaCreateImage(mAllocator, &imageInfo, &allocInfo, + &image->image, &image->memory, nullptr); + + assert_invariant(result == VK_SUCCESS); +diff --git a/tools/cso-lut/src/main.cpp b/tools/cso-lut/src/main.cpp +index b45a60702..e8a7c2bb7 100644 +--- a/tools/cso-lut/src/main.cpp ++++ b/tools/cso-lut/src/main.cpp +@@ -164,7 +164,7 @@ static float sq(float x) { return x * x; } + + constexpr float PI_F = 3.141592653589793238f; + +-static UTILS_UNUSED float sphericalCapsIntersection(float cosCap1, float cosCap2, float cosDistance) { ++UTILS_UNUSED static float sphericalCapsIntersection(float cosCap1, float cosCap2, float cosDistance) { + // Oat and Sander 2007, "Ambient Aperture Lighting" + float r1 = std::acos(cosCap1); + float r2 = std::acos(cosCap2); +-- +2.45.2 + diff --git a/ports/unofficial-filament/0001-tests-benchmarks.patch b/ports/unofficial-filament/0001-tests-benchmarks.patch new file mode 100644 index 00000000000000..a455490ff1407a --- /dev/null +++ b/ports/unofficial-filament/0001-tests-benchmarks.patch @@ -0,0 +1,318 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 283778b32..614061ad4 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -19,6 +19,10 @@ project(TNT) + # ================================================================================================== + # Options + # ================================================================================================== ++option(FILAMENT_TESTS "Build tests" ON) ++ ++option(FILAMENT_BENCHMARKS "Build benchmarks" ON) ++ + option(FILAMENT_USE_EXTERNAL_GLES3 "Experimental: Compile Filament against OpenGL ES 3" OFF) + + option(FILAMENT_ENABLE_LTO "Enable link-time optimizations if supported by the compiler" OFF) +@@ -715,7 +719,9 @@ endfunction() + # ================================================================================================== + + # Common to all platforms ++if(FILAMENT_TESTS) + add_subdirectory(${EXTERNAL}/libgtest/tnt) ++endif() + add_subdirectory(${LIBRARIES}/camutils) + add_subdirectory(${LIBRARIES}/filabridge) + add_subdirectory(${LIBRARIES}/filaflat) +@@ -738,7 +744,9 @@ add_subdirectory(${EXTERNAL}/civetweb/tnt) + add_subdirectory(${EXTERNAL}/imgui/tnt) + add_subdirectory(${EXTERNAL}/robin-map/tnt) + add_subdirectory(${EXTERNAL}/smol-v/tnt) ++if(FILAMENT_BENCHMARKS) + add_subdirectory(${EXTERNAL}/benchmark/tnt) ++endif() + add_subdirectory(${EXTERNAL}/meshoptimizer/tnt) + add_subdirectory(${EXTERNAL}/mikktspace) + add_subdirectory(${EXTERNAL}/cgltf/tnt) +diff --git a/filament/CMakeLists.txt b/filament/CMakeLists.txt +index 924ca1c52..1850de32f 100644 +--- a/filament/CMakeLists.txt ++++ b/filament/CMakeLists.txt +@@ -633,5 +633,9 @@ install(FILES "../LICENSE" DESTINATION .) + # Sub-projects + # ================================================================================================== + add_subdirectory(backend) ++if(FILAMENT_TESTS) + add_subdirectory(test) ++endif() ++if(FILAMENT_BENCHMARKS) + add_subdirectory(benchmark) ++endif() +diff --git a/libs/bluegl/CMakeLists.txt b/libs/bluegl/CMakeLists.txt +index 9ce75c177..4e258b642 100644 +--- a/libs/bluegl/CMakeLists.txt ++++ b/libs/bluegl/CMakeLists.txt +@@ -61,6 +61,7 @@ endif() + install(TARGETS ${TARGET} ARCHIVE DESTINATION lib/${DIST_DIR}) + + # Build the tests... ++if(FILAMENT_TESTS) + add_executable(test_${TARGET} + tests/OpenGLSupport.cpp + tests/OpenGLSupport.hpp +@@ -74,3 +75,4 @@ endif() + target_link_libraries(test_${TARGET} LINK_PUBLIC ${TARGET}) + target_link_libraries(test_${TARGET} LINK_PUBLIC gtest) + set_target_properties(test_${TARGET} PROPERTIES FOLDER Tests) ++endif() +diff --git a/libs/bluevk/CMakeLists.txt b/libs/bluevk/CMakeLists.txt +index 9e7ee6510..68c3296fb 100644 +--- a/libs/bluevk/CMakeLists.txt ++++ b/libs/bluevk/CMakeLists.txt +@@ -29,7 +29,7 @@ target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR}) + set_target_properties(${TARGET} PROPERTIES FOLDER Libs) + + # test_bluevk is not supported on mobile or Windows +-if (NOT ANDROID AND NOT IOS AND NOT WIN32 AND NOT FILAMENT_SKIP_SDL2) ++if(FILAMENT_TESTS AND NOT ANDROID AND NOT IOS AND NOT WIN32 AND NOT FILAMENT_SKIP_SDL2) + add_executable(test_bluevk tests/test_bluevk_sdl.cpp) + target_link_libraries(test_bluevk PRIVATE dl bluevk sdl2) + endif() +diff --git a/libs/camutils/CMakeLists.txt b/libs/camutils/CMakeLists.txt +index 541261c1a..f236bf961 100644 +--- a/libs/camutils/CMakeLists.txt ++++ b/libs/camutils/CMakeLists.txt +@@ -50,7 +50,7 @@ install(DIRECTORY ${PUBLIC_HDR_DIR}/camutils DESTINATION include) + # ================================================================================================== + # Tests + # ================================================================================================== +-if (NOT ANDROID AND NOT WEBGL AND NOT IOS) ++if(FILAMENT_TESTS AND NOT ANDROID AND NOT WEBGL AND NOT IOS) + add_executable(test_${TARGET} tests/test_camutils.cpp) + target_link_libraries(test_${TARGET} PRIVATE camutils gtest) + set_target_properties(test_${TARGET} PROPERTIES FOLDER Tests) +diff --git a/libs/filamat/CMakeLists.txt b/libs/filamat/CMakeLists.txt +index c74ad631f..807b25312 100644 +--- a/libs/filamat/CMakeLists.txt ++++ b/libs/filamat/CMakeLists.txt +@@ -144,6 +144,7 @@ install(DIRECTORY ${PUBLIC_HDR_DIR}/filamat DESTINATION include) + # ================================================================================================== + # Tests + # ================================================================================================== ++if(FILAMENT_TESTS) + project(test_filamat) + set(TARGET test_filamat) + set(SRCS +@@ -159,4 +160,4 @@ target_include_directories(${TARGET} PRIVATE src) + target_link_libraries(${TARGET} filamat gtest) + + set_target_properties(${TARGET} PROPERTIES FOLDER Tests) +- ++endif() +diff --git a/libs/filameshio/CMakeLists.txt b/libs/filameshio/CMakeLists.txt +index eab319211..17d4db0c0 100644 +--- a/libs/filameshio/CMakeLists.txt ++++ b/libs/filameshio/CMakeLists.txt +@@ -37,7 +37,7 @@ install(FILES ${DIST_HDRS} DESTINATION include/${TARGET}) + # ================================================================================================== + # Tests + # ================================================================================================== +-if (NOT IOS AND NOT WEBGL AND NOT ANDROID) ++if(FILAMENT_TESTS AND NOT IOS AND NOT WEBGL AND NOT ANDROID) + add_executable(test_${TARGET} tests/test_filamesh.cpp ) + target_link_libraries(test_${TARGET} PRIVATE filameshio gtest) + set_target_properties(test_${TARGET} PROPERTIES FOLDER Tests) +diff --git a/libs/geometry/CMakeLists.txt b/libs/geometry/CMakeLists.txt +index a7e8f398e..142889c4d 100644 +--- a/libs/geometry/CMakeLists.txt ++++ b/libs/geometry/CMakeLists.txt +@@ -73,7 +73,7 @@ install(FILES "${GEOMETRY_COMBINED_OUTPUT}" DESTINATION lib/${DIST_DIR} RENAME $ + # ================================================================================================== + # Tests + # ================================================================================================== +-if (NOT ANDROID AND NOT WEBGL AND NOT IOS) ++if(FILAMENT_TESTS AND NOT ANDROID AND NOT WEBGL AND NOT IOS) + set(TARGET test_transcoder) + add_executable(${TARGET} tests/test_transcoder.cpp) + target_link_libraries(${TARGET} PRIVATE geometry gtest) +diff --git a/libs/gltfio/CMakeLists.txt b/libs/gltfio/CMakeLists.txt +index c7c7d6a63..4cfb6c57d 100644 +--- a/libs/gltfio/CMakeLists.txt ++++ b/libs/gltfio/CMakeLists.txt +@@ -222,6 +222,7 @@ endif() + # Tests + # ================================================================================================== + ++if(FILAMENT_TESTS) + set(GLTF_TEST_FILES) + function(add_test_gltf SOURCE TARGET) + set(source_path "${ROOT_DIR}/${SOURCE}") +@@ -254,6 +255,7 @@ if (TNT_DEV AND NOT WEBGL AND NOT ANDROID AND NOT IOS) + endif() + set_target_properties(${TEST_TARGET} PROPERTIES FOLDER Tests) + endif() ++endif() + + # ================================================================================================== + # Installation +diff --git a/libs/image/CMakeLists.txt b/libs/image/CMakeLists.txt +index 351d39548..26fadb5f9 100644 +--- a/libs/image/CMakeLists.txt ++++ b/libs/image/CMakeLists.txt +@@ -53,7 +53,7 @@ install(DIRECTORY ${PUBLIC_HDR_DIR}/image DESTINATION include) + # ================================================================================================== + # Tests + # ================================================================================================== +-if (NOT ANDROID AND NOT WEBGL AND NOT IOS AND NOT FILAMENT_SKIP_SDL2) ++if(FILAMENT_TESTS AND NOT ANDROID AND NOT WEBGL AND NOT IOS AND NOT FILAMENT_SKIP_SDL2) + add_executable(test_${TARGET} tests/test_image.cpp) + target_link_libraries(test_${TARGET} PRIVATE imageio gtest) + set_target_properties(test_${TARGET} PROPERTIES FOLDER Tests) +diff --git a/libs/ktxreader/CMakeLists.txt b/libs/ktxreader/CMakeLists.txt +index a9d5714e0..a531fe286 100644 +--- a/libs/ktxreader/CMakeLists.txt ++++ b/libs/ktxreader/CMakeLists.txt +@@ -60,7 +60,7 @@ endfunction() + add_testfile(color_grid_uastc_zstd.ktx2) + add_testfile(lightroom_ibl.ktx) + +-if (NOT ANDROID AND NOT WEBGL AND NOT IOS) ++if(FILAMENT_TESTS AND NOT ANDROID AND NOT WEBGL AND NOT IOS) + add_executable(test_ktxreader tests/test_ktxreader.cpp ${TESTFILES}) + target_link_libraries(test_ktxreader PRIVATE ${TARGET} gtest) + set_target_properties(test_ktxreader PROPERTIES FOLDER Tests) +diff --git a/libs/math/CMakeLists.txt b/libs/math/CMakeLists.txt +index 838aa2d53..ed565e93f 100644 +--- a/libs/math/CMakeLists.txt ++++ b/libs/math/CMakeLists.txt +@@ -52,6 +52,7 @@ install(DIRECTORY ${PUBLIC_HDR_DIR}/math DESTINATION include) + # ================================================================================================== + # Tests + # ================================================================================================== ++if(FILAMENT_TESTS) + add_executable(test_${TARGET} + tests/test_fast.cpp + tests/test_half.cpp +@@ -61,11 +62,12 @@ add_executable(test_${TARGET} + ) + target_link_libraries(test_${TARGET} PRIVATE math gtest) + set_target_properties(test_${TARGET} PROPERTIES FOLDER Tests) ++endif() + + # ================================================================================================== + # Benchmarks + # ================================================================================================== +- ++if(FILAMENT_BENCHMARKS) + set(BENCHMARK_SRCS + benchmarks/benchmark_fast.cpp include/math/mathfwd.h) + +@@ -76,3 +78,4 @@ target_compile_options(benchmark_${TARGET} PRIVATE ${OPTIMIZATION_FLAGS}) + target_link_libraries(benchmark_${TARGET} PRIVATE benchmark_main utils math) + + set_target_properties(benchmark_${TARGET} PROPERTIES FOLDER Benchmarks) ++endif() +diff --git a/libs/utils/CMakeLists.txt b/libs/utils/CMakeLists.txt +index 72558167b..75f56be0f 100644 +--- a/libs/utils/CMakeLists.txt ++++ b/libs/utils/CMakeLists.txt +@@ -173,6 +173,7 @@ if (WEBGL_PTHREADS) + endif() + + # The Path tests are platform-specific ++if(FILAMENT_TESTS) + if (NOT WEBGL) + if (WIN32) + list(APPEND TEST_SRCS test/test_WinPath.cpp) +@@ -185,12 +186,12 @@ add_executable(test_${TARGET} ${TEST_SRCS}) + + target_link_libraries(test_${TARGET} PRIVATE gtest utils tsl math) + set_target_properties(test_${TARGET} PROPERTIES FOLDER Tests) ++endif() + + # ================================================================================================== + # Benchmarks + # ================================================================================================== +- +-if (NOT WEBGL) ++if(FILAMENT_BENCHMARKS AND NOT WEBGL) + + add_library(benchmark_${TARGET}_callee SHARED benchmark/benchmark_callee.cpp) + set_target_properties(benchmark_${TARGET}_callee PROPERTIES FOLDER Benchmarks) +diff --git a/libs/viewer/CMakeLists.txt b/libs/viewer/CMakeLists.txt +index 58fe66c98..cfa9334f9 100644 +--- a/libs/viewer/CMakeLists.txt ++++ b/libs/viewer/CMakeLists.txt +@@ -57,7 +57,7 @@ install(DIRECTORY ${PUBLIC_HDR_DIR}/viewer DESTINATION include) + # ================================================================================================== + # Tests + # ================================================================================================== +-if (NOT ANDROID AND NOT WEBGL AND NOT IOS) ++if(FILAMENT_TESTS AND NOT ANDROID AND NOT WEBGL AND NOT IOS) + add_executable(test_settings tests/test_settings.cpp) + target_link_libraries(test_settings PRIVATE ${TARGET} gtest) + set_target_properties(test_settings PROPERTIES FOLDER Tests) +diff --git a/tools/cmgen/CMakeLists.txt b/tools/cmgen/CMakeLists.txt +index 4913b56dd..cbb7dc925 100644 +--- a/tools/cmgen/CMakeLists.txt ++++ b/tools/cmgen/CMakeLists.txt +@@ -52,7 +52,7 @@ install(TARGETS ${TARGET} RUNTIME DESTINATION bin) + # ================================================================================================== + # Tests + # ================================================================================================== +-if (NOT ANDROID) ++if(FILAMENT_TESTS AND NOT ANDROID) + add_executable(test_${TARGET} tests/test_cmgen.cpp) + target_link_libraries(test_${TARGET} PRIVATE imageio gtest) + set_target_properties(test_${TARGET} PROPERTIES FOLDER Tests) +diff --git a/tools/glslminifier/CMakeLists.txt b/tools/glslminifier/CMakeLists.txt +index c278320c3..4b74af57e 100644 +--- a/tools/glslminifier/CMakeLists.txt ++++ b/tools/glslminifier/CMakeLists.txt +@@ -31,7 +31,7 @@ install(TARGETS ${TARGET} RUNTIME DESTINATION bin) + # ================================================================================================== + # Tests + # ================================================================================================== +-if (NOT ANDROID) ++if(FILAMENT_TESTS AND NOT ANDROID) + add_executable(test_${TARGET} + src/GlslMinify.cpp + tests/test_glslminifier.cpp +diff --git a/tools/matc/CMakeLists.txt b/tools/matc/CMakeLists.txt +index 8199edc82..e93a3526f 100644 +--- a/tools/matc/CMakeLists.txt ++++ b/tools/matc/CMakeLists.txt +@@ -81,6 +81,7 @@ install(TARGETS ${TARGET} RUNTIME DESTINATION bin) + # ================================================================================================== + # Tests + # ================================================================================================== ++if(FILAMENT_TESTS) + project(test_matc) + set(TARGET test_matc) + set(SRCS +@@ -96,3 +97,4 @@ add_executable(${TARGET} ${SRCS}) + target_link_libraries(${TARGET} matlang gtest) + + set_target_properties(test_matc PROPERTIES FOLDER Tests) ++endif() +diff --git a/filament/backend/CMakeLists.txt b/filament/backend/CMakeLists.txt +index d12703c95..28fc07941 100644 +--- a/filament/backend/CMakeLists.txt ++++ b/filament/backend/CMakeLists.txt +@@ -415,6 +415,8 @@ install(DIRECTORY ${PUBLIC_HDR_DIR}/backend DESTINATION include) + # ================================================================================================== + # Test + # ================================================================================================== ++if(FILAMENT_TESTS) ++ + option(INSTALL_BACKEND_TEST "Install the backend test library so it can be consumed on iOS" OFF) + + if (APPLE OR LINUX) +@@ -543,3 +545,5 @@ target_link_libraries(metal_utils_test PRIVATE + set_target_properties(metal_utils_test PROPERTIES FOLDER Tests) + + endif() ++ ++endif(FILAMENT_TESTS) + +-- +2.45.2 diff --git a/ports/unofficial-filament/0002-external.patch b/ports/unofficial-filament/0002-external.patch new file mode 100644 index 00000000000000..04cb68290cc8ba --- /dev/null +++ b/ports/unofficial-filament/0002-external.patch @@ -0,0 +1,210 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 06f044b8f..b4fb8ce52 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -23,6 +23,8 @@ option(FILAMENT_TESTS "Build tests" ON) + + option(FILAMENT_BENCHMARKS "Build benchmarks" ON) + ++option(FILAMENT_PREFER_EXTERNAL "Prefer the dependencies found externally via CMake" OFF) ++ + option(FILAMENT_USE_EXTERNAL_GLES3 "Experimental: Compile Filament against OpenGL ES 3" OFF) + + option(FILAMENT_ENABLE_LTO "Enable link-time optimizations if supported by the compiler" OFF) +@@ -631,6 +633,10 @@ endif() + # ================================================================================================== + # Functions + # ================================================================================================== ++ ++# List of external subdirectories that are added/used ++set(external_subdirectories) ++ + ## The MSVC compiler has a limitation on literal string length which is reached when all the + ## licenses are concatenated together into a large string... so split them into multiple strings. + function(list_licenses OUTPUT MODULES) +@@ -639,6 +645,10 @@ function(list_licenses OUTPUT MODULES) + set(CONTENT) + set(_MODULES ${MODULES} ${ARGN}) + foreach(module ${_MODULES}) ++ if(NOT "${external_subdirectories}" MATCHES "${module}") ++ continue() ++ endif() ++ + set(license_path "../../third_party/${module}/LICENSE") + get_filename_component(fullname "${license_path}" ABSOLUTE) + if(EXISTS ${fullname}) +@@ -730,10 +740,73 @@ endfunction() + # Sub-projects + # ================================================================================================== + ++# Add an external library suth that ++# - prefer find_package if FILAMENT_PREFER_EXTERNAL defined ++# - otherwise add the external subdirectory ++macro(add_external_library package_name subdirectory targets target_aliases) ++ if(FILAMENT_PREFER_EXTERNAL) ++ find_package(${package_name} GLOBAL) ++ ++ # add aliases for targets ++ if(${${package_name}_FOUND}) ++ list(APPEND targets ${targets}) ++ list(APPEND target_aliases ${target_aliases}) ++ ++ foreach(target target_alias IN ZIP_LISTS targets target_aliases) ++ if(TARGET ${target} AND NOT TARGET ${target_alias}) ++ get_target_property(target_type ${target} TYPE) ++ ++ get_target_property(_aliased_target ${target} ALIASED_TARGET) ++ if(NOT ${_aliased_target} MATCHES ".*-NOTFOUND") ++ set(target ${_aliased_target}) ++ endif() ++ ++ if(${target_type} STREQUAL "EXECUTABLE") ++ add_executable(${target_alias} ALIAS ${target}) ++ else() ++ add_library(${target_alias} ALIAS ${target}) ++ endif() ++ endif() ++ endforeach() ++ endif() ++ endif() ++ ++ list(FIND external_subdirectories "${subdirectory}" has_subdirectory) ++ if(NOT ${${package_name}_FOUND} AND ${has_subdirectory} EQUAL -1 AND EXISTS "${EXTERNAL}/${subdirectory}") ++ add_subdirectory(${EXTERNAL}/${subdirectory}) ++ list(APPEND external_subdirectories ${subdirectory}) ++ endif() ++endmacro() ++ ++# Add an external header-only library suth that ++# - prefer find_path if FILAMENT_PREFER_EXTERNAL defined ++# - otherwise add the external subdirectory ++macro(add_external_header_library package_name subdirectory header target) ++ set(found FALSE) ++ if(FILAMENT_PREFER_EXTERNAL) ++ find_path(${package_name}_INCLUDE_DIRS ${header}) ++ ++ if(NOT "${${package_name}_INCLUDE_DIRS}" MATCHES ".*-NOTFOUND") ++ set(found TRUE) ++ add_library(${target} INTERFACE) ++ target_include_directories(${target} INTERFACE ${${package_name}_INCLUDE_DIRS}) ++ else() ++ message(WARNING "Could not find the external header library ${package_name}") ++ endif() ++ endif() ++ ++ list(FIND external_subdirectories "${subdirectory}" has_subdirectory) ++ if(NOT ${found} AND ${has_subdirectory} EQUAL -1 AND EXISTS "${EXTERNAL}/${subdirectory}") ++ add_subdirectory(${EXTERNAL}/${subdirectory}) ++ list(APPEND external_subdirectories ${subdirectory}) ++ endif() ++endmacro() ++ + # Common to all platforms + if(FILAMENT_TESTS) +-add_subdirectory(${EXTERNAL}/libgtest/tnt) ++ add_external_library("GTest" "libgtest/tnt" "GTest::gtest" "gtest") + endif() ++add_external_library("tsl-robin-map" "robin-map/tnt" "tsl::robin_map" "tsl") + add_subdirectory(${LIBRARIES}/camutils) + add_subdirectory(${LIBRARIES}/filabridge) + add_subdirectory(${LIBRARIES}/filaflat) +@@ -751,21 +824,25 @@ add_subdirectory(${LIBRARIES}/utils) + add_subdirectory(${LIBRARIES}/viewer) + add_subdirectory(${FILAMENT}/filament) + add_subdirectory(${FILAMENT}/shaders) +-add_subdirectory(${EXTERNAL}/basisu/tnt) +-add_subdirectory(${EXTERNAL}/civetweb/tnt) +-add_subdirectory(${EXTERNAL}/imgui/tnt) +-add_subdirectory(${EXTERNAL}/robin-map/tnt) +-add_subdirectory(${EXTERNAL}/smol-v/tnt) ++add_external_library("zstd" "zstd/tnt" "zstd::libzstd" "zstd") ++add_external_library("basisu" "basisu/tnt" "basisu::basisu;basisu::basisu_encoder;basisu::basisu_encoder" "basisu;basis_encoder;basis_transcoder") ++add_external_library("civetweb" "civetweb/tnt" "civetweb::civetweb;civetweb::civetweb-cpp" "civetweb;civetweb-cpp") ++if(TARGET civetweb::civetweb AND TARGET civetweb::civetweb-cpp) ++ target_link_libraries(civetweb::civetweb INTERFACE civetweb::civetweb-cpp) ++endif() ++ ++add_external_library("imgui" "imgui/tnt" "imgui::imgui" "imgui") ++add_external_library("smol-v" "smol-v/tnt" "smol-v::smol-v" "smol-v") + if(FILAMENT_BENCHMARKS) +-add_subdirectory(${EXTERNAL}/benchmark/tnt) ++ add_external_library("benchmark" "benchmark/tnt" "benchmark::benchmark;benchmark::benchmark_main" "benchmark;benchmark_main") + endif() +-add_subdirectory(${EXTERNAL}/meshoptimizer/tnt) +-add_subdirectory(${EXTERNAL}/mikktspace) +-add_subdirectory(${EXTERNAL}/cgltf/tnt) +-add_subdirectory(${EXTERNAL}/draco/tnt) +-add_subdirectory(${EXTERNAL}/jsmn/tnt) +-add_subdirectory(${EXTERNAL}/stb/tnt) +-add_subdirectory(${EXTERNAL}/getopt) ++add_external_library("meshoptimizer" "meshoptimizer/tnt" "meshoptimizer::meshoptimizer" "meshoptimizer") ++add_external_library("mikktspace" "mikktspace/tnt" "mikktspace::mikktspace" "mikktspace") ++add_external_header_library("cgltf" "cgltf/tnt" "cgltf.h" "cgltf") ++add_external_library("draco" "draco/tnt" "draco::draco" "draco") ++add_external_header_library("jsmn" "jsmn/tnt" "jsmn.h" "jsmn") ++add_external_library("Stb" "stb/tnt" "stb_include.h" "stb") ++add_external_header_library("getopt" "getopt" "getopt/getopt.h" "getopt") + + # Note that this has to be placed after mikktspace in order for combine_static_libs to work. + add_subdirectory(${LIBRARIES}/geometry) +@@ -773,9 +850,25 @@ add_subdirectory(${LIBRARIES}/geometry) + if (FILAMENT_BUILD_FILAMAT OR IS_HOST_PLATFORM) + # spirv-tools must come before filamat, as filamat relies on the presence of the + # spirv-tools_SOURCE_DIR variable. +- add_subdirectory(${EXTERNAL}/spirv-tools) +- add_subdirectory(${EXTERNAL}/glslang/tnt) +- add_subdirectory(${EXTERNAL}/spirv-cross/tnt) ++ if(BUILD_SHARED_LIBS) ++ add_external_library("SPIRV-Tools" "spirv-tools" "SPIRV-Tools-shared" "SPIRV-Tools") ++ else() ++ add_external_library("SPIRV-Tools" "spirv-tools" "SPIRV-Tools-static" "SPIRV-Tools") ++ endif() ++ add_external_library("SPIRV-Tools-opt" "spirv-tools" "SPIRV-Tools-opt" "SPIRV-Tools-opt") ++ add_external_library("glslang" "glslang/tnt" "glslang::glslang;glslang::SPIRV;glslang::OGLCompiler;glslang::MachineIndependent;glslang::OSDependent;glslang::SPVRemapper" "glslang;SPIRV;OGLCompiler;MachineIndependent;OSDependent;SPVRemapper") ++ if(TARGET glslang::glslang AND TARGET glslang::MachineIndependent) ++ target_link_libraries(glslang::glslang INTERFACE glslang::MachineIndependent) ++ endif() ++ if(TARGET glslang::SPIRV AND TARGET glslang::SPVRemapper) ++ target_link_libraries(glslang::SPIRV INTERFACE glslang::SPVRemapper) ++ endif() ++ add_external_library("spirv_cross_core" "spirv-cross/tnt" "spirv-cross-core" "spirv-cross-core") ++ add_external_library("spirv_cross_glsl" "spirv-cross/tnt" "spirv-cross-glsl" "spirv-cross-glsl") ++ add_external_library("spirv_cross_msl" "spirv-cross/tnt" "spirv-cross-msl" "spirv-cross-msl") ++ if(TARGET spirv-cross-glsl AND TARGET spirv-cross-core AND TARGET spirv-cross-msl) ++ target_link_libraries(spirv-cross-glsl INTERFACE spirv-cross-core spirv-cross-msl) ++ endif() + add_subdirectory(${LIBRARIES}/filamat) + + # the material debugger requires filamat +@@ -786,9 +879,9 @@ endif() + + if (FILAMENT_SUPPORTS_VULKAN) + add_subdirectory(${LIBRARIES}/bluevk) +- add_subdirectory(${EXTERNAL}/vkmemalloc/tnt) ++ add_external_library("vkmemalloc" "vkmemalloc/tnt" "vkmemalloc::vkmemalloc" "vkmemalloc") + set(SPIRV_HEADERS_SKIP_EXAMPLES ON) +- add_subdirectory(${EXTERNAL}/spirv-headers) ++ add_external_header_library("SPIRV_HEADERS" "spirv-headers" "spirv/unified1/spirv.hpp" "SPIRV-Headers") + endif() + + set(FILAMENT_SAMPLES_BINARY_DIR ${PROJECT_BINARY_DIR}/samples) +@@ -809,11 +902,11 @@ if (IS_HOST_PLATFORM) + + add_subdirectory(${FILAMENT}/samples) + +- add_subdirectory(${EXTERNAL}/libassimp/tnt) +- add_subdirectory(${EXTERNAL}/libpng/tnt) +- add_subdirectory(${EXTERNAL}/libsdl2/tnt) +- add_subdirectory(${EXTERNAL}/libz/tnt) +- add_subdirectory(${EXTERNAL}/tinyexr/tnt) ++ add_external_library("assimp" "libassimp/tnt" "assimp::assimp" "assimp") ++ add_external_library("PNG" "libpng/tnt" "PNG::PNG" "png") ++ add_external_library("SDL2" "libsdl2/tnt" "SDL2::SDL2;SDL2::SDL2main" "sdl2;sdl2main") ++ add_external_library("ZLIB" "libz/tnt" "ZLIB::ZLIB" "z") ++ add_external_library("tinyexr" "tinyexr/tnt" "tinyexr::tinyexr;unofficial::tinyexr::tinyexr" "tinyexr;tinyexr") + + add_subdirectory(${TOOLS}/cmgen) + add_subdirectory(${TOOLS}/cso-lut) +-- +2.45.2 + diff --git a/ports/unofficial-filament/0003-basisu.patch b/ports/unofficial-filament/0003-basisu.patch new file mode 100644 index 00000000000000..fa62c081f51e6f --- /dev/null +++ b/ports/unofficial-filament/0003-basisu.patch @@ -0,0 +1,120 @@ +diff --git a/libs/imageio/src/BasisEncoder.cpp b/libs/imageio/src/BasisEncoder.cpp +index 0c24e710d..2c3c4fdae 100644 +--- a/libs/imageio/src/BasisEncoder.cpp ++++ b/libs/imageio/src/BasisEncoder.cpp +@@ -22,7 +22,7 @@ + + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Warray-bounds" +-#include ++#include + #pragma clang diagnostic pop + + namespace image { +@@ -181,7 +181,7 @@ BasisEncoder* Builder::build() { + params.m_read_source_images = false; + + // We do not want basis to write the file, we want to manually dump "get_output_ktx2_file()" +- params.m_write_output_basis_files = false; ++ params.m_write_output_basis_or_ktx2_files = false; + + basisu::basis_compressor* encoder = new basisu::basis_compressor(); + +diff --git a/libs/ktxreader/src/Ktx2Reader.cpp b/libs/ktxreader/src/Ktx2Reader.cpp +index 5d5386146..f72c108ee 100644 +--- a/libs/ktxreader/src/Ktx2Reader.cpp ++++ b/libs/ktxreader/src/Ktx2Reader.cpp +@@ -26,7 +26,7 @@ + + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Warray-bounds" +-#include ++#include + #pragma clang diagnostic pop + + using namespace basist; +diff --git a/third_party/basisu/README.md b/third_party/basisu/README.md +index a96cdd894..090477b51 100644 +--- a/third_party/basisu/README.md ++++ b/third_party/basisu/README.md +@@ -265,7 +265,7 @@ bool test() + basisCompressorParams.m_perceptual = false; + basisCompressorParams.m_mip_srgb = false; + +- basisCompressorParams.m_write_output_basis_files = true; ++ basisCompressorParams.m_write_output_basis_or_ktx2_files = true; + basisCompressorParams.m_out_filename = "test.basis"; + + basisCompressorParams.m_uastc = true; +diff --git a/third_party/basisu/basisu_tool.cpp b/third_party/basisu/basisu_tool.cpp +index 13ed340ff..68d2c35f6 100644 +--- a/third_party/basisu/basisu_tool.cpp ++++ b/third_party/basisu/basisu_tool.cpp +@@ -1054,8 +1054,8 @@ static bool compress_mode(command_line_params &opts) + } + + params.m_read_source_images = true; +- params.m_write_output_basis_files = true; +- params.m_pGlobal_codebooks = pGlobal_codebook_data ? &pGlobal_codebook_data->m_transcoder.get_lowlevel_etc1s_decoder() : nullptr; ++ params.m_write_output_basis_or_ktx2_files = true; ++ params.m_pGlobal_codebooks = pGlobal_codebook_data ? &pGlobal_codebook_data->m_transcoder.get_lowlevel_etc1s_decoder() : nullptr; + FILE *pCSV_file = nullptr; + if (opts.m_csv_file.size()) + { +diff --git a/third_party/basisu/encoder/basisu_comp.cpp b/third_party/basisu/encoder/basisu_comp.cpp +index 166a1c4fe..6fb3baecd 100644 +--- a/third_party/basisu/encoder/basisu_comp.cpp ++++ b/third_party/basisu/encoder/basisu_comp.cpp +@@ -1448,7 +1448,7 @@ namespace basisu + debug_printf("basis_compressor::write_output_files_and_compute_stats\n"); + + const uint8_vec& comp_data = m_params.m_create_ktx2_file ? m_output_ktx2_file : m_basis_file.get_compressed_data(); +- if (m_params.m_write_output_basis_files) ++ if (m_params.m_write_output_basis_or_ktx2_files) + { + const std::string& output_filename = m_params.m_out_filename; + +@@ -2282,7 +2282,7 @@ namespace basisu + comp_params.m_multithreading = (flags_and_quality & cFlagThreaded) != 0; + comp_params.m_use_opencl = (flags_and_quality & cFlagUseOpenCL) != 0; + +- comp_params.m_write_output_basis_files = false; ++ comp_params.m_write_output_basis_or_ktx2_files = false; + + comp_params.m_perceptual = (flags_and_quality & cFlagSRGB) != 0; + comp_params.m_mip_srgb = comp_params.m_perceptual; +diff --git a/third_party/basisu/encoder/basisu_comp.h b/third_party/basisu/encoder/basisu_comp.h +index aa5ea6fec..233dd1296 100644 +--- a/third_party/basisu/encoder/basisu_comp.h ++++ b/third_party/basisu/encoder/basisu_comp.h +@@ -368,10 +368,10 @@ namespace basisu + // Read source images from m_source_filenames/m_source_alpha_filenames + bool_param m_read_source_images; + +- // Write the output basis file to disk using m_out_filename +- bool_param m_write_output_basis_files; +- +- // Compute and display image metrics ++ // Write the output basis/ktx2 file to disk using m_out_filename ++ bool_param m_write_output_basis_or_ktx2_files; ++ ++ // Compute and display image metrics + bool_param m_compute_stats; + + // Check to see if any input image has an alpha channel, if so then the output basis file will have alpha channels +diff --git a/third_party/meshoptimizer/gltf/basisenc.cpp b/third_party/meshoptimizer/gltf/basisenc.cpp +index 7ea0889d4..f20e55308 100644 +--- a/third_party/meshoptimizer/gltf/basisenc.cpp ++++ b/third_party/meshoptimizer/gltf/basisenc.cpp +@@ -82,7 +82,7 @@ static void fillParams(basisu::basis_compressor_params& params, const char* inpu + } + + params.m_read_source_images = true; +- params.m_write_output_basis_files = true; ++ params.m_write_output_basis_or_ktx2_files = true; + + params.m_source_filenames.resize(1); + params.m_source_filenames[0] = input; +-- +2.45.2 + diff --git a/ports/unofficial-filament/0004-glslang.patch b/ports/unofficial-filament/0004-glslang.patch new file mode 100644 index 00000000000000..119f5c5dfc8352 --- /dev/null +++ b/ports/unofficial-filament/0004-glslang.patch @@ -0,0 +1,128 @@ +diff --git a/filament/backend/test/ShaderGenerator.cpp b/filament/backend/test/ShaderGenerator.cpp +index 545a6f970..c33a58e2d 100644 +--- a/filament/backend/test/ShaderGenerator.cpp ++++ b/filament/backend/test/ShaderGenerator.cpp +@@ -16,8 +16,8 @@ + + #include "ShaderGenerator.h" + +-#include +-#include ++#include ++#include + + #include + #include +diff --git a/libs/filamat/src/GLSLPostProcessor.cpp b/libs/filamat/src/GLSLPostProcessor.cpp +index 9dc98b00d..753f4b944 100644 +--- a/libs/filamat/src/GLSLPostProcessor.cpp ++++ b/libs/filamat/src/GLSLPostProcessor.cpp +@@ -16,8 +16,8 @@ + + #include "GLSLPostProcessor.h" + +-#include +-#include ++#include ++#include + #include + + #include +diff --git a/libs/filamat/src/GLSLPostProcessor.h b/libs/filamat/src/GLSLPostProcessor.h +index 8616d0e4d..81209f6db 100644 +--- a/libs/filamat/src/GLSLPostProcessor.h ++++ b/libs/filamat/src/GLSLPostProcessor.h +@@ -26,7 +26,7 @@ + + #include + +-#include ++#include + + #include + +diff --git a/libs/filamat/src/sca/ASTHelpers.cpp b/libs/filamat/src/sca/ASTHelpers.cpp +index d82831aa1..aaed08b83 100644 +--- a/libs/filamat/src/sca/ASTHelpers.cpp ++++ b/libs/filamat/src/sca/ASTHelpers.cpp +@@ -18,8 +18,8 @@ + + #include "GLSLTools.h" + +-#include +-#include ++#include ++#include + + #include + +diff --git a/libs/filamat/src/sca/ASTHelpers.h b/libs/filamat/src/sca/ASTHelpers.h +index 19ec1ce01..680466f94 100644 +--- a/libs/filamat/src/sca/ASTHelpers.h ++++ b/libs/filamat/src/sca/ASTHelpers.h +@@ -19,7 +19,7 @@ + + #include + #include +-#include ++#include + + class TIntermNode; + +diff --git a/libs/filamat/src/sca/GLSLTools.cpp b/libs/filamat/src/sca/GLSLTools.cpp +index eeecf89ef..96ea469f6 100644 +--- a/libs/filamat/src/sca/GLSLTools.cpp ++++ b/libs/filamat/src/sca/GLSLTools.cpp +@@ -25,8 +25,8 @@ + #include "ASTHelpers.h" + + // GLSLANG headers +-#include +-#include ++#include ++#include + + #include "builtinResource.h" + +diff --git a/libs/filamat/src/sca/GLSLTools.h b/libs/filamat/src/sca/GLSLTools.h +index 1c7cf169d..fb2a61061 100644 +--- a/libs/filamat/src/sca/GLSLTools.h ++++ b/libs/filamat/src/sca/GLSLTools.h +@@ -25,7 +25,7 @@ + + #include + +-#include ++#include + + class TIntermNode; + +diff --git a/libs/matdbg/src/ShaderReplacer.cpp b/libs/matdbg/src/ShaderReplacer.cpp +index 9cd8ba4de..df93a7a99 100644 +--- a/libs/matdbg/src/ShaderReplacer.cpp ++++ b/libs/matdbg/src/ShaderReplacer.cpp +@@ -27,7 +27,7 @@ + + #include + +-#include ++#include + + #include "sca/builtinResource.h" + #include "sca/GLSLTools.h" +diff --git a/tools/matc/src/matc/MaterialCompiler.cpp b/tools/matc/src/matc/MaterialCompiler.cpp +index 93d0fedc0..523f3e4fe 100644 +--- a/tools/matc/src/matc/MaterialCompiler.cpp ++++ b/tools/matc/src/matc/MaterialCompiler.cpp +@@ -34,7 +34,7 @@ + #include "JsonishParser.h" + #include "ParametersProcessor.h" + +-#include ++#include + #include "glslang/Include/intermediate.h" + + #include "sca/builtinResource.h" +-- +2.45.2 + diff --git a/ports/unofficial-filament/0005-miktspace.patch b/ports/unofficial-filament/0005-miktspace.patch new file mode 100644 index 00000000000000..7b970b1cb79824 --- /dev/null +++ b/ports/unofficial-filament/0005-miktspace.patch @@ -0,0 +1,20 @@ +diff --git a/libs/geometry/src/MikktspaceImpl.cpp b/libs/geometry/src/MikktspaceImpl.cpp +index 5c5a1b582..6223bcf79 100644 +--- a/libs/geometry/src/MikktspaceImpl.cpp ++++ b/libs/geometry/src/MikktspaceImpl.cpp +@@ -21,7 +21,12 @@ + #include + + #include ++ ++#if __has_include() + #include ++#else ++#include ++#endif + + #include + +-- +2.45.2 + diff --git a/ports/unofficial-filament/0007-std-includes.patch b/ports/unofficial-filament/0007-std-includes.patch new file mode 100644 index 00000000000000..09ba7f5d5a9853 --- /dev/null +++ b/ports/unofficial-filament/0007-std-includes.patch @@ -0,0 +1,42 @@ +diff --git a/libs/gltfio/src/extended/TangentsJobExtended.cpp b/libs/gltfio/src/extended/TangentsJobExtended.cpp +index 83b9a6ede..c28c777df 100644 +--- a/libs/gltfio/src/extended/TangentsJobExtended.cpp ++++ b/libs/gltfio/src/extended/TangentsJobExtended.cpp +@@ -28,6 +28,7 @@ + + #include + #include ++#include + + using namespace filament; + using namespace filament::gltfio; +diff --git a/third_party/vkmemalloc/include/vk_mem_alloc.h b/third_party/vkmemalloc/include/vk_mem_alloc.h +index 60f572038..b47389d19 100644 +--- a/third_party/vkmemalloc/include/vk_mem_alloc.h ++++ b/third_party/vkmemalloc/include/vk_mem_alloc.h +@@ -294,6 +294,10 @@ extern "C" { + #define VMA_STATS_STRING_ENABLED 1 + #endif + ++#if VMA_STATS_STRING_ENABLED ++ #include "stdio.h" ++#endif ++ + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + // +diff --git a/tools/glslminifier/src/GlslMinify.h b/tools/glslminifier/src/GlslMinify.h +index c04e2fa42..51fb95170 100644 +--- a/tools/glslminifier/src/GlslMinify.h ++++ b/tools/glslminifier/src/GlslMinify.h +@@ -15,6 +15,7 @@ + */ + + #include ++#include + + #ifndef TNT_GLSLMINIFY_H + #define TNT_GLSLMINIFY_H +-- +2.45.2 + diff --git a/ports/unofficial-filament/0008-const.patch b/ports/unofficial-filament/0008-const.patch new file mode 100644 index 00000000000000..57b06977b431e5 --- /dev/null +++ b/ports/unofficial-filament/0008-const.patch @@ -0,0 +1,18 @@ +diff --git a/libs/viewer/src/RemoteServer.cpp b/libs/viewer/src/RemoteServer.cpp +index 441c730f7..fb95d1ae8 100644 +--- a/libs/viewer/src/RemoteServer.cpp ++++ b/libs/viewer/src/RemoteServer.cpp +@@ -208,8 +208,8 @@ bool MessageReceiver::handleData(CivetServer* server, struct mg_connection* conn + + void MessageSender::sendMessage(const char* label, const char* buffer, size_t bufsize) { + for (auto iter : connections) { +- mg_websocket_write(iter.first, 0x80, label, strlen(label) + 1); +- mg_websocket_write(iter.first, 0x80, buffer, bufsize); ++ mg_websocket_write(const_cast(iter.first), 0x80, label, strlen(label) + 1); ++ mg_websocket_write(const_cast(iter.first), 0x80, buffer, bufsize); + } + } + +-- +2.45.2 + diff --git a/ports/unofficial-filament/0009-public-includes.patch b/ports/unofficial-filament/0009-public-includes.patch new file mode 100644 index 00000000000000..3a4b3a4345d5a2 --- /dev/null +++ b/ports/unofficial-filament/0009-public-includes.patch @@ -0,0 +1,523 @@ +diff --git a/filament/CMakeLists.txt b/filament/CMakeLists.txt +index 1850de32f..a68d1f915 100644 +--- a/filament/CMakeLists.txt ++++ b/filament/CMakeLists.txt +@@ -540,7 +540,10 @@ include_directories(src) + add_library(${TARGET} STATIC ${PRIVATE_HDRS} ${PUBLIC_HDRS} ${SRCS} ${DATA_BINS}) + + # specify where the public headers of this library are +-target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR}) ++target_include_directories(${TARGET} PUBLIC ++ $ ++ $ ++) + + # add this subproject to the Filament folder + set_target_properties(${TARGET} PROPERTIES FOLDER Filament) +diff --git a/filament/backend/CMakeLists.txt b/filament/backend/CMakeLists.txt +index 9283f20f7..6f8bbdae1 100644 +--- a/filament/backend/CMakeLists.txt ++++ b/filament/backend/CMakeLists.txt +@@ -245,7 +245,10 @@ include_directories(${GENERATION_ROOT}) + add_library(${TARGET} STATIC ${PRIVATE_HDRS} ${PUBLIC_HDRS} ${SRCS}) + + # specify where the public headers of this library are +-target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR}) ++target_include_directories(${TARGET} PUBLIC ++ $ ++ $ ++) + + # add this subproject to the Filament folder + set_target_properties(${TARGET} PROPERTIES FOLDER Filament) +@@ -255,7 +258,10 @@ set_target_properties(${TARGET} PROPERTIES FOLDER Filament) + # ================================================================================================== + + add_library(${TARGET}_headers INTERFACE) +-target_include_directories(${TARGET}_headers INTERFACE ${PUBLIC_HDR_DIR}) ++target_include_directories(${TARGET}_headers INTERFACE ++ $ ++ $ ++) + + # ================================================================================================== + # Build SPIRV snippets used by the Vulkan backend. +diff --git a/libs/bluegl/CMakeLists.txt b/libs/bluegl/CMakeLists.txt +index 4e258b642..be66fcbbf 100644 +--- a/libs/bluegl/CMakeLists.txt ++++ b/libs/bluegl/CMakeLists.txt +@@ -51,7 +51,10 @@ include_directories(${PUBLIC_HDR_DIR}) + add_library(${TARGET} STATIC ${PUBLIC_HDRS} ${SRCS}) + + # specify where the public headers of this library are +-target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR}) ++target_include_directories(${TARGET} PUBLIC ++ $ ++ $ ++) + set_target_properties(${TARGET} PROPERTIES FOLDER Libs) + + if (WIN32) +diff --git a/libs/bluevk/CMakeLists.txt b/libs/bluevk/CMakeLists.txt +index 68c3296fb..5a5adfdcf 100644 +--- a/libs/bluevk/CMakeLists.txt ++++ b/libs/bluevk/CMakeLists.txt +@@ -25,7 +25,10 @@ add_library(${TARGET} STATIC ${PUBLIC_HDRS} ${SRCS}) + + target_link_libraries(${TARGET} utils math) + +-target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR}) ++target_include_directories(${TARGET} PUBLIC ++ $ ++ $ ++) + set_target_properties(${TARGET} PROPERTIES FOLDER Libs) + + # test_bluevk is not supported on mobile or Windows +diff --git a/libs/camutils/CMakeLists.txt b/libs/camutils/CMakeLists.txt +index f236bf961..a0bb3023a 100644 +--- a/libs/camutils/CMakeLists.txt ++++ b/libs/camutils/CMakeLists.txt +@@ -30,7 +30,10 @@ add_library(${TARGET} STATIC ${PUBLIC_HDRS} ${SRCS}) + + target_link_libraries(${TARGET} PUBLIC math) + +-target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR}) ++target_include_directories(${TARGET} PUBLIC ++ $ ++ $ ++) + set_target_properties(${TARGET} PROPERTIES FOLDER Libs) + + # ================================================================================================== +diff --git a/libs/filabridge/CMakeLists.txt b/libs/filabridge/CMakeLists.txt +index 6840ce536..e4f002e0a 100644 +--- a/libs/filabridge/CMakeLists.txt ++++ b/libs/filabridge/CMakeLists.txt +@@ -22,7 +22,10 @@ set(SRCS + include_directories(${PUBLIC_HDR_DIR}) + + add_library(${TARGET} STATIC ${PUBLIC_HDRS} ${SRCS}) +-target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR}) ++target_include_directories(${TARGET} PUBLIC ++ $ ++ $ ++) + set_target_properties(${TARGET} PROPERTIES FOLDER Libs) + + target_link_libraries(${TARGET} utils) +diff --git a/libs/filaflat/CMakeLists.txt b/libs/filaflat/CMakeLists.txt +index 0ebf53e06..fec9529e0 100644 +--- a/libs/filaflat/CMakeLists.txt ++++ b/libs/filaflat/CMakeLists.txt +@@ -21,7 +21,10 @@ set(SRCS + include_directories(${PUBLIC_HDR_DIR}) + + add_library(${TARGET} ${HDRS} ${SRCS}) +-target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR}) ++target_include_directories(${TARGET} PUBLIC ++ $ ++ $ ++) + set_target_properties(${TARGET} PROPERTIES FOLDER Libs) + + target_link_libraries(${TARGET} filabridge utils) +diff --git a/libs/filagui/CMakeLists.txt b/libs/filagui/CMakeLists.txt +index dac013ce7..dd155cd77 100644 +--- a/libs/filagui/CMakeLists.txt ++++ b/libs/filagui/CMakeLists.txt +@@ -94,7 +94,10 @@ add_library(${TARGET} STATIC ${PUBLIC_HDRS} ${SRCS} ${RESGEN_SOURCE}) + + target_link_libraries(${TARGET} PUBLIC imgui filament) + +-target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR}) ++target_include_directories(${TARGET} PUBLIC ++ $ ++ $ ++) + set_target_properties(${TARGET} PROPERTIES FOLDER Libs) + + # ================================================================================================== +diff --git a/libs/filamat/CMakeLists.txt b/libs/filamat/CMakeLists.txt +index 807b25312..bed3b2e1f 100644 +--- a/libs/filamat/CMakeLists.txt ++++ b/libs/filamat/CMakeLists.txt +@@ -81,7 +81,10 @@ include_directories(${CMAKE_BINARY_DIR}) + + # Filamat + add_library(${TARGET} STATIC ${HDRS} ${PRIVATE_HDRS} ${SRCS}) +-target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR}) ++target_include_directories(${TARGET} PUBLIC ++ $ ++ $ ++) + set_target_properties(${TARGET} PROPERTIES FOLDER Libs) + target_link_libraries(${TARGET} backend_headers shaders filabridge utils smol-v) + +diff --git a/libs/filamentapp/CMakeLists.txt b/libs/filamentapp/CMakeLists.txt +index 4a8a6c4ca..9f541708b 100644 +--- a/libs/filamentapp/CMakeLists.txt ++++ b/libs/filamentapp/CMakeLists.txt +@@ -143,7 +143,10 @@ add_library(${TARGET} STATIC ${PUBLIC_HDRS} ${SRCS}) + + target_link_libraries(${TARGET} PUBLIC ${LIBS} filamentapp-resources) + +-target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR}) ++target_include_directories(${TARGET} PUBLIC ++ $ ++ $ ++) + set_target_properties(${TARGET} PROPERTIES FOLDER Libs) + target_include_directories(${TARGET} PRIVATE ${GENERATION_ROOT}) + +diff --git a/libs/filameshio/CMakeLists.txt b/libs/filameshio/CMakeLists.txt +index 17d4db0c0..2a55bf9da 100644 +--- a/libs/filameshio/CMakeLists.txt ++++ b/libs/filameshio/CMakeLists.txt +@@ -20,7 +20,10 @@ set(SRCS src/MeshReader.cpp) + # ================================================================================================== + include_directories(${PUBLIC_HDR_DIR}) + add_library(${TARGET} STATIC ${PUBLIC_HDRS} ${SRCS}) +-target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR}) ++target_include_directories(${TARGET} PUBLIC ++ $ ++ $ ++) + set_target_properties(${TARGET} PROPERTIES FOLDER Libs) + target_link_libraries(${TARGET} + PRIVATE meshoptimizer +diff --git a/libs/geometry/CMakeLists.txt b/libs/geometry/CMakeLists.txt +index 142889c4d..c8df0da9c 100644 +--- a/libs/geometry/CMakeLists.txt ++++ b/libs/geometry/CMakeLists.txt +@@ -35,7 +35,10 @@ set(GEOMETRY_DEPS + target_link_libraries(${TARGET} PUBLIC math utils) + target_link_libraries(${TARGET} PRIVATE ${GEOMETRY_DEPS}) + +-target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR}) ++target_include_directories(${TARGET} PUBLIC ++ $ ++ $ ++) + set_target_properties(${TARGET} PROPERTIES FOLDER Libs) + + # ================================================================================================== +diff --git a/libs/gltfio/CMakeLists.txt b/libs/gltfio/CMakeLists.txt +index 4cfb6c57d..3e6e8833e 100644 +--- a/libs/gltfio/CMakeLists.txt ++++ b/libs/gltfio/CMakeLists.txt +@@ -174,7 +174,10 @@ set(DUMMY_SRC "${RESOURCE_DIR}/dummy.c") + add_custom_command(OUTPUT ${DUMMY_SRC} COMMAND echo "//" > ${DUMMY_SRC}) + + add_library(uberarchive ${DUMMY_SRC} ${RESGEN_SOURCE}) +-target_include_directories(uberarchive PUBLIC ${RESOURCE_DIR}) ++target_include_directories(uberarchive PUBLIC ++ $ ++ $ ++) + set_target_properties(uberarchive PROPERTIES FOLDER Libs) + + # ================================================================================================== +@@ -186,7 +189,10 @@ link_libraries(math utils filament cgltf stb ktxreader geometry tsl uberzlib) + + add_library(gltfio_core STATIC ${PUBLIC_HDRS} ${SRCS}) + +-target_include_directories(gltfio_core PUBLIC ${PUBLIC_HDR_DIR}) ++target_include_directories(gltfio_core PUBLIC ++ $ ++ $ ++) + set_target_properties(gltfio_core PROPERTIES FOLDER Libs) + + target_compile_definitions(gltfio_core PUBLIC -DGLTFIO_DRACO_SUPPORTED=1) +@@ -208,7 +214,10 @@ if (NOT WEBGL AND NOT ANDROID AND NOT IOS) + # ================================================================================================== + add_library(${TARGET} STATIC ${PUBLIC_HDRS} src/JitShaderProvider.cpp) + target_link_libraries(${TARGET} PUBLIC filamat gltfio_core) +- target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR}) ++ target_include_directories(${TARGET} PUBLIC ++ $ ++ $ ++ ) + set_target_properties(${TARGET} PROPERTIES FOLDER Libs) + if (NOT MSVC) + target_compile_options(${TARGET} PRIVATE -Wno-deprecated-register) +diff --git a/libs/ibl/CMakeLists.txt b/libs/ibl/CMakeLists.txt +index aae32fbaa..7265f4614 100644 +--- a/libs/ibl/CMakeLists.txt ++++ b/libs/ibl/CMakeLists.txt +@@ -34,13 +34,19 @@ set(SRCS + include_directories(${PUBLIC_HDR_DIR}) + + add_library(${TARGET} ${PUBLIC_HDRS} ${PRIVATE_HDRS} ${SRCS}) +-target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR}) ++target_include_directories(${TARGET} PUBLIC ++ $ ++ $ ++) + set_target_properties(${TARGET} PROPERTIES FOLDER Libs) + target_link_libraries(${TARGET} math utils) + + add_library(${TARGET}-lite ${PUBLIC_HDRS} ${PRIVATE_HDRS} ${SRCS}) + target_compile_definitions(${TARGET}-lite PUBLIC -DFILAMENT_IBL_LITE=1) +-target_include_directories(${TARGET}-lite PUBLIC ${PUBLIC_HDR_DIR}) ++target_include_directories(${TARGET}-lite PUBLIC ++ $ ++ $ ++) + set_target_properties(${TARGET}-lite PROPERTIES FOLDER Libs) + target_link_libraries(${TARGET}-lite math utils) + +diff --git a/libs/iblprefilter/CMakeLists.txt b/libs/iblprefilter/CMakeLists.txt +index c001de6bf..e23b9b475 100644 +--- a/libs/iblprefilter/CMakeLists.txt ++++ b/libs/iblprefilter/CMakeLists.txt +@@ -87,7 +87,10 @@ include_directories(src) + add_library(${TARGET} STATIC ${PRIVATE_HDRS} ${PUBLIC_HDRS} ${SRCS}) + + # specify where the public headers of this library are +-target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR}) ++target_include_directories(${TARGET} PUBLIC ++ $ ++ $ ++) + set_target_properties(${TARGET} PROPERTIES FOLDER Libs) + + # ================================================================================================== +diff --git a/libs/image/CMakeLists.txt b/libs/image/CMakeLists.txt +index 26fadb5f9..c13f751bb 100644 +--- a/libs/image/CMakeLists.txt ++++ b/libs/image/CMakeLists.txt +@@ -31,7 +31,10 @@ add_library(${TARGET} STATIC ${PUBLIC_HDRS} ${SRCS}) + + target_link_libraries(${TARGET} PUBLIC math utils) + +-target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR}) ++target_include_directories(${TARGET} PUBLIC ++ $ ++ $ ++) + set_target_properties(${TARGET} PROPERTIES FOLDER Libs) + + # ================================================================================================== +diff --git a/libs/imageio/CMakeLists.txt b/libs/imageio/CMakeLists.txt +index 47544655b..d6b20f9be 100644 +--- a/libs/imageio/CMakeLists.txt ++++ b/libs/imageio/CMakeLists.txt +@@ -30,7 +30,10 @@ include_directories(${PUBLIC_HDR_DIR}) + + add_library(${TARGET} STATIC ${PUBLIC_HDRS} ${SRCS}) + +-target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR}) ++target_include_directories(${TARGET} PUBLIC ++ $ ++ $ ++) + set_target_properties(${TARGET} PROPERTIES FOLDER Libs) + + target_link_libraries(${TARGET} PUBLIC image math png tinyexr utils z basis_encoder) +diff --git a/libs/ktxreader/CMakeLists.txt b/libs/ktxreader/CMakeLists.txt +index a531fe286..8fbb8b729 100644 +--- a/libs/ktxreader/CMakeLists.txt ++++ b/libs/ktxreader/CMakeLists.txt +@@ -26,7 +26,10 @@ add_library(${TARGET} STATIC ${PUBLIC_HDRS} ${SRCS}) + + target_link_libraries(${TARGET} PUBLIC utils image filament basis_transcoder) + +-target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR}) ++target_include_directories(${TARGET} PUBLIC ++ $ ++ $ ++) + set_target_properties(${TARGET} PROPERTIES FOLDER Libs) + + # ================================================================================================== +diff --git a/libs/matdbg/CMakeLists.txt b/libs/matdbg/CMakeLists.txt +index e58058548..5d4ac47a0 100644 +--- a/libs/matdbg/CMakeLists.txt ++++ b/libs/matdbg/CMakeLists.txt +@@ -88,7 +88,10 @@ target_link_libraries(${TARGET} PUBLIC + + target_include_directories(${TARGET} PRIVATE ${filamat_SOURCE_DIR}/src) + +-target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR}) ++target_include_directories(${TARGET} PUBLIC ++ $ ++ $ ++) + set_target_properties(${TARGET} PROPERTIES FOLDER Libs) + + # ================================================================================================== +diff --git a/libs/math/CMakeLists.txt b/libs/math/CMakeLists.txt +index ed565e93f..4f737900e 100644 +--- a/libs/math/CMakeLists.txt ++++ b/libs/math/CMakeLists.txt +@@ -41,7 +41,10 @@ include_directories(${PUBLIC_HDR_DIR}) + + add_library(${TARGET} STATIC ${PUBLIC_HDRS} ${SRCS}) + target_compile_options(${TARGET} PRIVATE ${OPTIMIZATION_FLAGS}) +-target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR}) ++target_include_directories(${TARGET} PUBLIC ++ $ ++ $ ++) + set_target_properties(${TARGET} PROPERTIES FOLDER Libs) + + # ================================================================================================== +diff --git a/libs/mathio/CMakeLists.txt b/libs/mathio/CMakeLists.txt +index 4ad5126fc..61b3fcee1 100644 +--- a/libs/mathio/CMakeLists.txt ++++ b/libs/mathio/CMakeLists.txt +@@ -20,7 +20,10 @@ include_directories(${PUBLIC_HDR_DIR}) + + add_library(${TARGET} STATIC ${PUBLIC_HDRS} ${SRCS}) + target_compile_options(${TARGET} PRIVATE ${OPTIMIZATION_FLAGS}) +-target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR}) ++target_include_directories(${TARGET} PUBLIC ++ $ ++ $ ++) + set_target_properties(${TARGET} PROPERTIES FOLDER Libs) + target_link_libraries(${TARGET} PRIVATE math) + +@@ -28,4 +31,3 @@ target_link_libraries(${TARGET} PRIVATE math) + # Installation + # ================================================================================================== + install(DIRECTORY ${PUBLIC_HDR_DIR}/mathio DESTINATION include) +- +diff --git a/libs/uberz/CMakeLists.txt b/libs/uberz/CMakeLists.txt +index 47744e225..4771b545d 100644 +--- a/libs/uberz/CMakeLists.txt ++++ b/libs/uberz/CMakeLists.txt +@@ -27,7 +27,10 @@ add_library(${TARGET} STATIC ${PUBLIC_HDRS} ${SRCS}) + + target_link_libraries(${TARGET} PUBLIC math utils filabridge zstd) + +-target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR}) ++target_include_directories(${TARGET} PUBLIC ++ $ ++ $ ++) + set_target_properties(${TARGET} PROPERTIES FOLDER Libs) + + # ================================================================================================== +diff --git a/libs/utils/CMakeLists.txt b/libs/utils/CMakeLists.txt +index 75f56be0f..25a94d9ff 100644 +--- a/libs/utils/CMakeLists.txt ++++ b/libs/utils/CMakeLists.txt +@@ -103,7 +103,10 @@ endif() + include_directories(${PUBLIC_HDR_DIR}) + + add_library(${TARGET} STATIC ${PUBLIC_HDRS} ${SRCS}) +-target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR}) ++target_include_directories(${TARGET} PUBLIC ++ $ ++ $ ++) + set_target_properties(${TARGET} PROPERTIES FOLDER Libs) + target_link_libraries(${TARGET} PUBLIC tsl) + +diff --git a/libs/viewer/CMakeLists.txt b/libs/viewer/CMakeLists.txt +index cfa9334f9..c20108176 100644 +--- a/libs/viewer/CMakeLists.txt ++++ b/libs/viewer/CMakeLists.txt +@@ -31,7 +31,10 @@ set(SRCS + # ================================================================================================== + add_library(${TARGET} STATIC ${PUBLIC_HDRS} ${SRCS}) + target_link_libraries(${TARGET} PUBLIC imgui filament gltfio_core filagui jsmn civetweb) +-target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR}) ++target_include_directories(${TARGET} PUBLIC ++ $ ++ $ ++) + set_target_properties(${TARGET} PROPERTIES FOLDER Libs) + + if (FILAMENT_SAMPLES_STEREO_TYPE STREQUAL "instanced") +diff --git a/shaders/CMakeLists.txt b/shaders/CMakeLists.txt +index dbabd77ab..b312214b3 100644 +--- a/shaders/CMakeLists.txt ++++ b/shaders/CMakeLists.txt +@@ -110,7 +110,10 @@ endif() + # Include and target definitions + # ================================================================================================== + add_library(${TARGET} STATIC ${RESGEN_SOURCE}) +-target_include_directories(${TARGET} PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) ++target_include_directories(${TARGET} PUBLIC ++ $ ++ $ ++) + set_target_properties(${TARGET} PROPERTIES FOLDER Filament/Shaders) + + # ================================================================================================== +diff --git a/third_party/getopt/CMakeLists.txt b/third_party/getopt/CMakeLists.txt +index 49ab1e1ac..5118f851e 100755 +--- a/third_party/getopt/CMakeLists.txt ++++ b/third_party/getopt/CMakeLists.txt +@@ -20,5 +20,8 @@ set(SRCS + include_directories(${PUBLIC_HDR_DIR}) + + add_library(${TARGET} STATIC ${PRIVATE_HDRS} ${PUBLIC_HDRS} ${SRCS}) +-target_include_directories (${TARGET} PUBLIC ${PUBLIC_HDR_DIR}) +-set_target_properties(${TARGET} PROPERTIES FOLDER ThirdParty) +\ No newline at end of file ++target_include_directories(${TARGET} PUBLIC ++ $ ++ $ ++) ++set_target_properties(${TARGET} PROPERTIES FOLDER ThirdParty) +diff --git a/third_party/smol-v/tnt/CMakeLists.txt b/third_party/smol-v/tnt/CMakeLists.txt +index 4b245d450..de1982c83 100644 +--- a/third_party/smol-v/tnt/CMakeLists.txt ++++ b/third_party/smol-v/tnt/CMakeLists.txt +@@ -20,7 +20,10 @@ if (NOT MSVC) + target_compile_options(${TARGET} PRIVATE -Wno-tautological-unsigned-enum-zero-compare) + endif() + +-target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR}) ++target_include_directories(${TARGET} PUBLIC ++ $ ++ $ ++) + set_target_properties(${TARGET} PROPERTIES FOLDER ThirdParty) + + install(TARGETS ${TARGET} ARCHIVE DESTINATION lib/${DIST_DIR}) +diff --git a/third_party/vkmemalloc/tnt/CMakeLists.txt b/third_party/vkmemalloc/tnt/CMakeLists.txt +index 11479471e..6b686efb2 100644 +--- a/third_party/vkmemalloc/tnt/CMakeLists.txt ++++ b/third_party/vkmemalloc/tnt/CMakeLists.txt +@@ -10,6 +10,12 @@ set(PUBLIC_HDRS ${PUBLIC_HDR_DIR}/vk_mem_alloc.h) + include_directories(${PUBLIC_HDR_DIR}) + + add_library(${TARGET} INTERFACE) +-target_sources(${TARGET} INTERFACE ${PUBLIC_HDRS}) +-target_include_directories(${TARGET} INTERFACE ${PUBLIC_HDR_DIR}) +-set_target_properties(${TARGET} PROPERTIES FOLDER ThirdParty) +\ No newline at end of file ++target_sources(${TARGET} INTERFACE ++ $ ++ $ ++) ++target_include_directories(${TARGET} INTERFACE ++ $ ++ $ ++) ++set_target_properties(${TARGET} PROPERTIES FOLDER ThirdParty) +diff --git a/tools/matc/CMakeLists.txt b/tools/matc/CMakeLists.txt +index e93a3526f..70687cd4d 100644 +--- a/tools/matc/CMakeLists.txt ++++ b/tools/matc/CMakeLists.txt +@@ -41,7 +41,10 @@ set(SRCS + # ================================================================================================== + add_library(${TARGET} STATIC ${SRCS} ${HDRS}) + +-target_include_directories(${TARGET} PUBLIC src) ++target_include_directories(${TARGET} PUBLIC ++ $ ++ $ ++) + target_include_directories(${TARGET} PRIVATE ${filamat_SOURCE_DIR}/src) + + target_link_libraries(${TARGET} getopt filamat filabridge utils) +-- +2.45.2 + diff --git a/ports/unofficial-filament/0010-FindFilament.patch b/ports/unofficial-filament/0010-FindFilament.patch new file mode 100644 index 00000000000000..fa960cf32b8345 --- /dev/null +++ b/ports/unofficial-filament/0010-FindFilament.patch @@ -0,0 +1,97 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2a6978042..700192871 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -14,7 +14,7 @@ endif() + # ================================================================================================== + # Project declaration + # ================================================================================================== +-project(TNT) ++project(unofficial-filament VERSION 1.55.0) + + # ================================================================================================== + # Options +@@ -926,7 +926,51 @@ if (IS_HOST_PLATFORM) + add_subdirectory(${TOOLS}/uberz) + endif() + +-# Generate exported executables for cross-compiled builds (Android, WebGL, and iOS) +-if (NOT CMAKE_CROSSCOMPILING) +- export(TARGETS matc cmgen filamesh mipgen resgen uberz glslminifier FILE ${IMPORT_EXECUTABLES}) +-endif() ++# version file ++include(CMakePackageConfigHelpers) ++include(GNUInstallDirs) ++write_basic_package_version_file("${CMAKE_BINARY_DIR}/unofficial-filamentConfigVersion.cmake" ++ VERSION ${PROJECT_VERSION} ++ COMPATIBILITY SameMajorVersion) ++install(FILES "${CMAKE_BINARY_DIR}/unofficial-filamentConfigVersion.cmake" ++ DESTINATION ${CMAKE_INSTALL_DATADIR}/cmake/unofficial-filament ++ COMPONENT unofficial-filament) ++ ++# public header dependencies ++set(HEADER_DEPS cgltf jsmn) ++if(TARGET SPIRV-Headers) ++ list(APPEND HEADER_DEPS SPIRV-Headers) ++endif() ++foreach(_dep ${HEADER_DEPS}) ++ if(TARGET ${_dep}) ++ get_target_property(_dep_include ${_dep} INTERFACE_INCLUDE_DIRECTORIES) ++ set_target_properties(${_dep} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ++ "$$" ++ ) ++ endif() ++endforeach() ++install(TARGETS ${HEADER_DEPS} EXPORT unofficial-filament-targets COMPONENT unofficial-filament-dependencies) ++export(TARGETS ${HEADER_DEPS} ++ NAMESPACE unofficial-filament:: ++ FILE "${CMAKE_BINARY_DIR}/unofficial-filamentTargets-Dependencies.cmake") ++ ++# config file ++set(PACKAGE_VERSION ${PROJECT_VERSION}) ++configure_package_config_file("${CMAKE_CURRENT_LIST_DIR}/filamentConfig.cmake.in" ++ "${CMAKE_BINARY_DIR}/unofficial-filamentConfig.cmake" ++ INSTALL_DESTINATION ${CMAKE_INSTALL_DATADIR}/cmake/unofficial-filament) ++install(FILES "${CMAKE_BINARY_DIR}/unofficial-filamentConfig.cmake" ++ DESTINATION ${CMAKE_INSTALL_DATADIR}/cmake/unofficial-filament ++ COMPONENT unofficial-filament) ++ ++# targets file - only include targets that actually exist ++set(TARGETS) ++foreach(_target camutils filabridge filaflat filagui filameshio uberarchive gltfio_core gltfio ibl ibl-lite filament-iblprefilter ++ image ktxreader math mathio uberzlib utils viewer backend backend_headers vkshaders filament ++ shaders geometry filamat matdbg_resources matdbg bluegl imageio cmgen cso-lut filamesh glslminifier matlang ++ matc matinfo matedit mipgen normal-blending resgen rgb-to-lmsr roughness-prefilter specular-color uberz ++ getopt smol-v vkmemalloc) ++ if(TARGET ${_target}) ++ list(APPEND TARGETS ${_target}) ++ endif() ++endforeach() ++install(TARGETS ${TARGETS} EXPORT unofficial-filament-targets COMPONENT unofficial-filament) ++export(TARGETS ${TARGETS} ++ NAMESPACE unofficial-filament:: ++ FILE "${CMAKE_BINARY_DIR}/unofficial-filamentTargets.cmake") ++export(PACKAGE unofficial-filament) ++install(EXPORT unofficial-filament-targets ++ NAMESPACE unofficial-filament:: ++ DESTINATION ${CMAKE_INSTALL_DATADIR}/cmake/unofficial-filament ++ FILE "unofficial-filamentTargets.cmake" ++ COMPONENT unofficial-filament) +diff --git a/filamentConfig.cmake.in b/filamentConfig.cmake.in +new file mode 100644 +index 000000000..ee320541d +--- /dev/null ++++ b/filamentConfig.cmake.in +@@ -0,0 +1,9 @@ ++set(unofficial-filament_VERSION @PACKAGE_VERSION@) ++ ++@PACKAGE_INIT@ ++ ++@PACKAGE_DEPENDENCIES@ ++ ++include("${CMAKE_CURRENT_LIST_DIR}/unofficial-filamentTargets.cmake") ++ ++@INCLUDED_CONTENT@ +-- +2.45.2 + diff --git a/ports/unofficial-filament/portfile.cmake b/ports/unofficial-filament/portfile.cmake new file mode 100644 index 00000000000000..0e1029a7134c59 --- /dev/null +++ b/ports/unofficial-filament/portfile.cmake @@ -0,0 +1,76 @@ +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO google/filament + REF v${VERSION} + SHA512 5c1873e83706135163c7113b715de233c9b17c5028232bdc8dc9e2b83436ad2f422b77bb08d9637523ce04b205a836f511fce51c3932e49715d94ee22077c573 + HEAD_REF master + PATCHES + 0000-compiler.patch + 0001-tests-benchmarks.patch # remove once https://github.com/google/filament/pull/8245 merged + 0002-external.patch + 0003-basisu.patch + 0004-glslang.patch + 0005-miktspace.patch + 0007-std-includes.patch + 0008-const.patch + 0009-public-includes.patch + 0010-FindFilament.patch +) + +if(VCPKG_CRT_LINKAGE STREQUAL "static") + set(USE_STATIC_CRT ON) +else() + set(USE_STATIC_CRT OFF) +endif() + +if(VCPKG_TARGET_IS_WINDOWS) + vcpkg_add_to_path("${CURRENT_INSTALLED_DIR}/debug/bin") #so that tools that are self-produced during build process, which might depend on vcpkg-provided shared libraries, do not silently fail due to missing .dlls + vcpkg_add_to_path("${CURRENT_INSTALLED_DIR}/bin") +endif() + + +vcpkg_cmake_configure( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS + -DFILAMENT_ALLOW_ANY_COMPILER=ON + -DUSE_STATIC_CRT=${USE_STATIC_CRT} + -DFILAMENT_SKIP_SAMPLES=ON + -DFILAMENT_TESTS=OFF + -DFILAMENT_BENCHMARKS=OFF + -DFILAMENT_ENABLE_LTO=OFF + -DFILAMENT_USE_SWIFTSHADER=OFF + -DFILAMENT_USE_EXTERNAL_GLES3=OFF + -DFILAMENT_PREFER_EXTERNAL=ON + -DUSE_STATIC_LIBCXX=OFF + MAYBE_UNUSED_VARIABLES + USE_STATIC_CRT + USE_STATIC_LIBCXX +) + +vcpkg_cmake_install() + +vcpkg_copy_tools(TOOL_NAMES + cmgen + filamesh + glslminifier + matc + matedit + matinfo + mipgen + normal-blending + resgen + roughness-prefilter + specular-color + uberz + AUTO_CLEAN +) + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") +file(REMOVE ${CURRENT_PACKAGES_DIR}/LICENSE ${CURRENT_PACKAGES_DIR}/README.md) +file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/LICENSE ${CURRENT_PACKAGES_DIR}/debug/README.md) + +file(INSTALL ${SOURCE_PATH}/usage DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME usage) +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) diff --git a/ports/unofficial-filament/usage b/ports/unofficial-filament/usage new file mode 100644 index 00000000000000..deea79bf432e92 --- /dev/null +++ b/ports/unofficial-filament/usage @@ -0,0 +1,7 @@ +To use unofficial-filament add the following to your CMake project: + + find_package(unofficial-filament CONFIG REQUIRED) + target_link_libraries(main PRIVATE unofficial-filament::filament) + +The unofficial-filament package also provides the following targets: + unofficial-filament::camutils unofficial-filament::filabridge unofficial-filament::filaflat unofficial-filament::filagui unofficial-filament::filameshio unofficial-filament::uberarchive unofficial-filament::gltfio_core unofficial-filament::gltfio unofficial-filament::ibl unofficial-filament::ibl-lite unofficial-filament::filament-iblprefilter unofficial-filament::image unofficial-filament::ktxreader unofficial-filament::math unofficial-filament::mathio unofficial-filament::uberzlib unofficial-filament::utils unofficial-filament::viewer unofficial-filament::backend unofficial-filament::backend_headers unofficial-filament::vkshaders unofficial-filament::shaders unofficial-filament::geometry unofficial-filament::filamat unofficial-filament::matdbg_resources unofficial-filament::matdbg unofficial-filament::bluegl unofficial-filament::imageio unofficial-filament::cmgen unofficial-filament::cso-lut unofficial-filament::filamesh unofficial-filament::glslminifier unofficial-filament::matlang unofficial-filament::matc unofficial-filament::matinfo unofficial-filament::matedit unofficial-filament::mipgen unofficial-filament::normal-blending unofficial-filament::resgen unofficial-filament::rgb-to-lmsr unofficial-filament::roughness-prefilter unofficial-filament::specular-color unofficial-filament::uberz diff --git a/ports/unofficial-filament/vcpkg.json b/ports/unofficial-filament/vcpkg.json new file mode 100644 index 00000000000000..ca050c6ae55894 --- /dev/null +++ b/ports/unofficial-filament/vcpkg.json @@ -0,0 +1,46 @@ +{ + "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", + "name": "unofficial-filament", + "version-semver": "1.55.0", + "description": "Filament is a real-time physically based rendering engine for Android, iOS, Windows, Linux, macOS and WASM/WebGL", + "homepage": "https://google.github.io/filament/", + "dependencies": [ + "assimp", + "basisu", + "cgltf", + { + "name": "civetweb", + "features": [ + "ssl" + ] + }, + "draco", + "getopt", + { + "name": "glslang", + "features": [ + "opt", + "private-headers", + "rtti" + ] + }, + "imgui", + "jsmn", + "libpng", + "meshoptimizer", + "mikktspace", + "robin-map", + "sdl2", + "spirv-cross", + "spirv-headers", + "spirv-tools", + "stb", + "tinyexr", + { + "name": "vcpkg-cmake", + "host": true + }, + "zlib", + "zstd" + ] +} diff --git a/versions/baseline.json b/versions/baseline.json index b982fe02d434d7..750b64fdcef9cf 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -1706,7 +1706,7 @@ }, "civetweb": { "baseline": "1.16", - "port-version": 2 + "port-version": 3 }, "cjson": { "baseline": "1.7.18", @@ -2832,6 +2832,10 @@ "baseline": "2019-12-19", "port-version": 2 }, + "filament": { + "baseline": "1.55.0", + "port-version": 0 + }, "fineftp": { "baseline": "1.5.1", "port-version": 0 @@ -9668,6 +9672,10 @@ "baseline": "1.3.0", "port-version": 0 }, + "unofficial-filament": { + "baseline": "1.55.0", + "port-version": 0 + }, "unordered-dense": { "baseline": "4.5.0", "port-version": 0 diff --git a/versions/c-/civetweb.json b/versions/c-/civetweb.json index 1e1a69ef06c85a..42732f6cdc3d1e 100644 --- a/versions/c-/civetweb.json +++ b/versions/c-/civetweb.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "cf5df88fe7cf818f43306e2362f24a5ced0e96b9", + "version": "1.16", + "port-version": 3 + }, { "git-tree": "e4dd629e48dc2fc142165bf825c99512544b568c", "version": "1.16", diff --git a/versions/f-/filament.json b/versions/f-/filament.json new file mode 100644 index 00000000000000..d8b7cbb22bc47b --- /dev/null +++ b/versions/f-/filament.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "0e0fb8d54d9e49edda9fcb41d21ed7a2171cfa87", + "version-semver": "1.55.0", + "port-version": 0 + } + ] +} diff --git a/versions/g-/glslang.json b/versions/g-/glslang.json index dabbac770b53ed..d8b88fbbc756c0 100644 --- a/versions/g-/glslang.json +++ b/versions/g-/glslang.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "218e34707c9d9c77a6c853ac61f9df9fb91e2555", + "git-tree": "a868efef3e84a7d39a2b8a8d1d29fedc60274314", "version": "15.1.0", "port-version": 0 }, diff --git a/versions/u-/unofficial-filament.json b/versions/u-/unofficial-filament.json new file mode 100644 index 00000000000000..d9b6b77675db5f --- /dev/null +++ b/versions/u-/unofficial-filament.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "36ddb81a6783be7bcb9cd5cd7ac958c75ed057f0", + "version-semver": "1.55.0", + "port-version": 0 + } + ] +}