Import filament_1.9.25+dfsg2-4.debian.tar.xz
authorTimo Röhling <roehling@debian.org>
Sun, 13 Feb 2022 00:07:53 +0000 (00:07 +0000)
committerTimo Röhling <roehling@debian.org>
Sun, 13 Feb 2022 00:07:53 +0000 (00:07 +0000)
[dgit import tarball filament 1.9.25+dfsg2-4 filament_1.9.25+dfsg2-4.debian.tar.xz]

49 files changed:
changelog [new file with mode: 0644]
cmake/benchmark.cmake [new file with mode: 0644]
cmake/glslang.cmake [new file with mode: 0644]
cmake/imgui.cmake [new file with mode: 0644]
cmake/jsmn.cmake [new file with mode: 0644]
cmake/libassimp.cmake [new file with mode: 0644]
cmake/package-config.cmake.in [new file with mode: 0644]
cmake/spirv-cross.cmake [new file with mode: 0644]
cmake/spirv-tools.cmake [new file with mode: 0644]
cmake/stb.cmake [new file with mode: 0644]
control [new file with mode: 0644]
copyright [new file with mode: 0644]
libfilament-dev.docs [new file with mode: 0644]
libfilament-dev.install [new file with mode: 0644]
libfilament-dev.lintian-overrides [new file with mode: 0644]
libfilament-tools.install [new file with mode: 0644]
libfilament-tools.manpages [new file with mode: 0644]
libfilament1.9.install [new file with mode: 0644]
manpages/cmgen.1 [new file with mode: 0644]
manpages/filament-resgen.1 [new file with mode: 0644]
manpages/filamesh.1 [new file with mode: 0644]
manpages/glslminifier.1 [new file with mode: 0644]
manpages/matc.1 [new file with mode: 0644]
manpages/matinfo.1 [new file with mode: 0644]
manpages/mipgen.1 [new file with mode: 0644]
manpages/normal-blending.1 [new file with mode: 0644]
manpages/roughness-prefilter.1 [new file with mode: 0644]
manpages/specular-color.1 [new file with mode: 0644]
not-installed [new file with mode: 0644]
patches/0001-Build-against-system-libraries.patch [new file with mode: 0644]
patches/0002-Disable-Java.patch [new file with mode: 0644]
patches/0003-Fix-libstdc-compat.patch [new file with mode: 0644]
patches/0004-Fix-combine_static_libs-macro.patch [new file with mode: 0644]
patches/0005-Fix-list_licenses-macro.patch [new file with mode: 0644]
patches/0006-Adjust-linker-flags.patch [new file with mode: 0644]
patches/0007-Link-against-libatomic.patch [new file with mode: 0644]
patches/0008-Migrate-to-astc-encoder-API-from-Debian-package.patch [new file with mode: 0644]
patches/0009-Fix-library-export-for-Debian.patch [new file with mode: 0644]
patches/0010-Rename-resgen-executable-to-avoid-conflict-with-mono.patch [new file with mode: 0644]
patches/0011-Replace-BlueGL-with-GLEW.patch [new file with mode: 0644]
patches/0012-Use-system-spirv-cross.patch [new file with mode: 0644]
patches/0013-Define-M_PIf-only-if-it-is-not-already-defined-in-ma.patch [new file with mode: 0644]
patches/0014-Avoid-mips-as-identifier-because-it-fails-on-mips-ar.patch [new file with mode: 0644]
patches/0015-Ensure-proper-alignment-of-resgen-_OFFSET-and-_SIZE-.patch [new file with mode: 0644]
patches/series [new file with mode: 0644]
rules [new file with mode: 0755]
source/format [new file with mode: 0644]
tests/build [new file with mode: 0755]
tests/control [new file with mode: 0644]

diff --git a/changelog b/changelog
new file mode 100644 (file)
index 0000000..7b6d122
--- /dev/null
+++ b/changelog
@@ -0,0 +1,83 @@
+filament (1.9.25+dfsg2-4) unstable; urgency=medium
+
+  * Ensure proper alignment of resgen _OFFSET and _SIZE variables
+
+ -- Timo Röhling <roehling@debian.org>  Sun, 13 Feb 2022 01:07:53 +0100
+
+filament (1.9.25+dfsg2-3) unstable; urgency=medium
+
+  * Disable LTO.
+    There seems to be an issue with link time optimization on Ubuntu
+
+ -- Timo Röhling <roehling@debian.org>  Fri, 11 Feb 2022 00:48:35 +0100
+
+filament (1.9.25+dfsg2-2) unstable; urgency=medium
+
+  * Fix GLEW initialization
+
+ -- Timo Röhling <roehling@debian.org>  Thu, 10 Feb 2022 12:48:59 +0100
+
+filament (1.9.25+dfsg2-1) unstable; urgency=medium
+
+  [ Adrian Bunk ]
+  * Link with libatomic on architectures where it is needed
+
+  [ Timo Röhling ]
+  * New upstream version 1.9.25+dfsg2
+    - Remove spirv-cross from source tarball, it is no longer needed
+
+ -- Timo Röhling <roehling@debian.org>  Wed, 09 Feb 2022 10:57:06 +0100
+
+filament (1.9.25+dfsg-8) unstable; urgency=medium
+
+  * Avoid mips as identifier because it fails on mips* arch
+
+ -- Timo Röhling <roehling@debian.org>  Mon, 07 Feb 2022 10:31:42 +0100
+
+filament (1.9.25+dfsg-7) unstable; urgency=medium
+
+  * Work around M_PIf name collision with glibc 2.34
+
+ -- Timo Röhling <roehling@debian.org>  Mon, 07 Feb 2022 10:12:42 +0100
+
+filament (1.9.25+dfsg-6) unstable; urgency=medium
+
+  * Use system spirv-cross
+
+ -- Timo Röhling <roehling@debian.org>  Sun, 06 Feb 2022 22:59:40 +0100
+
+filament (1.9.25+dfsg-5) unstable; urgency=medium
+
+  * Enable Vulkan on 64 bit architectures only.
+    Filament assumes that VkSurfaceKHR is a pointer type, which is
+    only true on 64 bit architectures.
+
+ -- Timo Röhling <roehling@debian.org>  Thu, 27 Jan 2022 12:39:04 +0100
+
+filament (1.9.25+dfsg-4) unstable; urgency=medium
+
+  * Switch to clang default version
+
+ -- Timo Röhling <roehling@debian.org>  Wed, 26 Jan 2022 23:15:57 +0100
+
+filament (1.9.25+dfsg-3) unstable; urgency=medium
+
+  * Rename resgen executable to avoid conflict with mono-devel
+    (Closes: #1004380)
+  * Replace BlueGL with GLEW
+
+ -- Timo Röhling <roehling@debian.org>  Wed, 26 Jan 2022 18:23:13 +0100
+
+filament (1.9.25+dfsg-2) unstable; urgency=medium
+
+  * Fix draco linkage
+  * Make ibl_lite a shared library
+  * Fix libstdc++ compat
+
+ -- Timo Röhling <roehling@debian.org>  Tue, 25 Jan 2022 22:12:20 +0100
+
+filament (1.9.25+dfsg-1) unstable; urgency=medium
+
+  * Initial release (Closes: #974734)
+
+ -- Timo Röhling <roehling@debian.org>  Sun, 24 Oct 2021 10:33:22 +0200
diff --git a/cmake/benchmark.cmake b/cmake/benchmark.cmake
new file mode 100644 (file)
index 0000000..1d00c46
--- /dev/null
@@ -0,0 +1,9 @@
+find_package(benchmark REQUIRED)
+if(NOT TARGET benchmark)
+    add_library(benchmark INTERFACE)
+    target_link_libraries(benchmark INTERFACE benchmark::benchmark)
+endif()
+if(NOT TARGET benchmark_main)
+    add_library(benchmark_main INTERFACE)
+    target_link_libraries(benchmark_main INTERFACE benchmark::benchmark_main)
+endif()
diff --git a/cmake/glslang.cmake b/cmake/glslang.cmake
new file mode 100644 (file)
index 0000000..fe07c7a
--- /dev/null
@@ -0,0 +1,14 @@
+# Empty
+find_package(PkgConfig REQUIRED)
+if(NOT TARGET glslang)
+    pkg_check_modules(glslang REQUIRED IMPORTED_TARGET spirv glslang)
+    add_library(glslang INTERFACE)
+    target_include_directories(glslang INTERFACE
+            /usr/include/glslang/Public
+            /usr/include/glslang/Include
+            /usr/include/glslang/MachineIndependent
+            /usr/include/glslang/SPIRV
+            )
+    set_property(TARGET PkgConfig::glslang APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${STDCXX_LIBRARY})
+    target_link_libraries(glslang INTERFACE PkgConfig::glslang)
+endif()
diff --git a/cmake/imgui.cmake b/cmake/imgui.cmake
new file mode 100644 (file)
index 0000000..032665d
--- /dev/null
@@ -0,0 +1,11 @@
+if(NOT TARGET filament::imgui)
+    find_path(imgui_INCLUDE_DIR NAMES imgui.h PATH_SUFFIXES imgui)
+    find_library(imgui_LIBRARY NAMES imgui)
+    if(imgui_INCLUDE_DIR AND imgui_LIBRARY)
+        add_library(filament::imgui INTERFACE IMPORTED)
+        set_target_properties(filament::imgui PROPERTIES
+            INTERFACE_INCLUDE_DIRECTORIES "${imgui_INCLUDE_DIR}"
+            INTERFACE_LINK_LIBRARIES "${imgui_LIBRARY}"
+        )
+    endif()
+endif()
diff --git a/cmake/jsmn.cmake b/cmake/jsmn.cmake
new file mode 100644 (file)
index 0000000..039883d
--- /dev/null
@@ -0,0 +1,6 @@
+if(NOT TARGET jsm)
+    find_path(jsmn_INCLUDE_DIR NAMES jsmn.h)
+    add_library(jsmn INTERFACE)
+    target_include_directories(jsmn INTERFACE ${jsmn_INCLUDE_DIR})
+endif()
+
diff --git a/cmake/libassimp.cmake b/cmake/libassimp.cmake
new file mode 100644 (file)
index 0000000..d8e2cb8
--- /dev/null
@@ -0,0 +1,9 @@
+# find_package(assimp) and target assimp::assimp is broken, so we do this manually
+if(NOT TARGET assimp)
+    find_path(assimp_INCLUDE_DIR NAMES assimp/version.h)
+    find_library(assimp_LIBRARY NAMES assimp)
+    add_library(assimp INTERFACE)
+    target_include_directories(assimp INTERFACE ${assimp_INCLUDE_DIR})
+    target_link_libraries(assimp INTERFACE ${assimp_LIBRARY})
+endif()
+
diff --git a/cmake/package-config.cmake.in b/cmake/package-config.cmake.in
new file mode 100644 (file)
index 0000000..1002f29
--- /dev/null
@@ -0,0 +1,15 @@
+@PACKAGE_INIT@
+include(CMakeFindDependencyMacro)
+find_dependency(Threads)
+find_dependency(tsl-robin-map)
+foreach(dep IN ITEMS imgui stb)
+    include(${CMAKE_CURRENT_LIST_DIR}/${dep}.cmake)
+    if(NOT TARGET filament::${dep})
+        set(filament_FOUND FALSE)
+        set(filament_NOT_FOUND_MESSAGE "filament could not be found because dependency ${dep} could not be found.")
+        return()
+    endif()
+endforeach()
+include(${CMAKE_CURRENT_LIST_DIR}/filamentTargets.cmake)
+message(STATUS "Found filament: ${PACKAGE_PREFIX_DIR} (found version \"@FILAMENT_VERSION@\")")
+
diff --git a/cmake/spirv-cross.cmake b/cmake/spirv-cross.cmake
new file mode 100644 (file)
index 0000000..d95075c
--- /dev/null
@@ -0,0 +1,10 @@
+find_package(spirv_cross_c_shared REQUIRED)
+find_package(spirv_cross_core REQUIRED)
+find_package(spirv_cross_glsl REQUIRED)
+find_package(spirv_cross_msl REQUIRED)
+find_package(spirv_cross_cpp REQUIRED)
+if(NOT TARGET spirv-cross)
+    add_library(spirv-cross INTERFACE)
+    target_link_libraries(spirv-cross INTERFACE spirv-cross-cpp spirv-cross-msl spirv-cross-glsl spirv-cross-c-shared)
+endif()
+
diff --git a/cmake/spirv-tools.cmake b/cmake/spirv-tools.cmake
new file mode 100644 (file)
index 0000000..9745c09
--- /dev/null
@@ -0,0 +1,7 @@
+if(NOT TARGET SPIRV-Tools-opt)
+    find_package(PkgConfig REQUIRED)
+    pkg_check_modules(SPIRV-Tools REQUIRED IMPORTED_TARGET SPIRV-Tools)
+    add_library(SPIRV-Tools-opt INTERFACE)
+    target_link_libraries(SPIRV-Tools-opt INTERFACE PkgConfig::SPIRV-Tools)
+endif()
+
diff --git a/cmake/stb.cmake b/cmake/stb.cmake
new file mode 100644 (file)
index 0000000..f4a2d01
--- /dev/null
@@ -0,0 +1,11 @@
+if(NOT TARGET filament::stb)
+    find_path(stb_INCLUDE_DIR NAMES stb.h PATH_SUFFIXES stb)
+    find_library(stb_LIBRARY NAMES stb)
+    if(stb_INCLUDE_DIR AND stb_LIBRARY)
+        add_library(filament::stb INTERFACE IMPORTED)
+        set_target_properties(filament::stb PROPERTIES
+            INTERFACE_INCLUDE_DIRECTORIES "${stb_INCLUDE_DIR}"
+            INTERFACE_LINK_LIBRARIES "${stb_LIBRARY}"
+        )
+    endif()
+endif()
diff --git a/control b/control
new file mode 100644 (file)
index 0000000..15d097f
--- /dev/null
+++ b/control
@@ -0,0 +1,71 @@
+Source: filament
+Section: libs
+Priority: optional
+Maintainer: Timo Röhling <roehling@debian.org>
+Build-Depends: debhelper-compat (= 13),
+    clang,
+    cmake,
+    glslang-dev,
+    libassimp-dev,
+    libastcenc-dev,
+    libbenchmark-dev,
+    libdraco-dev,
+    libgl-dev,
+    libglew-dev,
+    libgtest-dev,
+    libimgui-dev,
+    libjsmn-dev,
+    libmeshoptimizer-dev,
+    libpng-dev,
+    libsdl2-dev,
+    libstb-dev,
+    libtinyexr-dev,
+    libspirv-cross-c-shared-dev (>= 2021.01.15-5~),
+    robin-map-dev,
+    spirv-tools,
+    zlib1g-dev,
+Homepage: https://github.com/google/filament
+Standards-Version: 4.6.0
+Rules-Requires-Root: no
+Vcs-Git: https://salsa.debian.org/roehling/filament.git
+Vcs-Browser: https://salsa.debian.org/roehling/filament
+
+Package: libfilament1.9
+Architecture: any
+Multi-Arch: same
+Depends: ${misc:Depends},
+         ${shlibs:Depends},
+Description: Real-time physically based rendering engine
+ Physically based rendering is a rendering method that provides a more
+ accurate representation of materials and how they interact with light
+ when compared to traditional real-time models.
+
+Package: libfilament-dev
+Section: libdevel
+Architecture: any
+Multi-Arch: same
+Depends: ${misc:Depends},
+         libfilament1.9 (= ${binary:Version}),
+         libimgui-dev,
+         libstb-dev,
+         robin-map-dev,
+Recommends: libfilament-tools (= ${binary:Version})
+Description: Real-time physically based rendering engine - development headers
+ Physically based rendering is a rendering method that provides a more
+ accurate representation of materials and how they interact with light
+ when compared to traditional real-time models.
+ .
+ This package installs the development headers.
+
+Package: libfilament-tools
+Section: devel
+Architecture: any
+Multi-Arch: foreign
+Depends: ${misc:Depends},
+         ${shlibs:Depends},
+Description: Real-time physically based rendering engine - command-line tools
+ Physically based rendering is a rendering method that provides a more
+ accurate representation of materials and how they interact with light
+ when compared to traditional real-time models.
+ .
+ This package installs the command-line tools for material preprocessing.
diff --git a/copyright b/copyright
new file mode 100644 (file)
index 0000000..eb2b1b5
--- /dev/null
+++ b/copyright
@@ -0,0 +1,167 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Source: https://github.com/google/filament
+Files-Excluded:
+    android
+    assets
+    docs
+    ide
+    ios
+    java
+    third_party/astcenc
+    third_party/benchmark
+    third_party/clang
+    third_party/civetweb/docs
+    third_party/civetweb/examples
+    third_party/civetweb/resources
+    third_party/civetweb/unittest
+    third_party/draco
+    third_party/environments
+    third_party/gl-matrix
+    third_party/glslang
+    third_party/imgui
+    third_party/jsmn
+    third_party/libassimp
+    third_party/libgtest
+    third_party/libpng
+    third_party/libsdl2
+    third_party/libz
+    third_party/markdeep
+    third_party/meshoptimizer
+    third_party/models
+    third_party/moltenvk
+    third_party/robin-map
+    third_party/spirv-tools
+    third_party/spirv-cross
+    third_party/stb
+    third_party/textures
+    third_party/tinyexr
+Comment: removed superfluous copies of debianized third-party libraries;
+         moltenvk is MacOS only and prebuilt;
+         ide and iOS files are useless for Debian;
+         documentation is prebuilt and pretty big;
+         the vendored astcenc version is very old and not free software;
+         the example assets are huge and not needed;
+
+Files: *
+Copyright: 2012-2021, The Android Open Source Project
+           2015-2021, Google LLC
+           2017, Romain Guy
+License: Apache-2.0
+
+Files: debian/*
+Copyright: 2021-2022, Timo Röhling <roehling@debian.org>
+License: Apache-2.0
+
+Files: third_party/civetweb/*
+Copyright: 2013-2018, CivetWeb Developers
+           2004-2013, Sergey Lyubka
+           2013, No Face Press LLC
+           2014, Jordan Shelley
+           2007-2013, Gerald Franz
+           1995-2017, Jean-Loup Gailly and Mark Adler
+           1994-2015, Lua.org
+           2002-2016, Tiago Dianizio and Doug Currie
+License: Expat
+
+Files: third_party/cgltf/*
+Copyright: 2018, Johannes Kuhlmann
+License: Expat
+
+Files: third_party/etc2comp/*
+Copyright: 2015, Etc2Comp Authors
+License: Apache-2.0
+
+Files: third_party/getopt/*
+Copyright: The Regents of the University of California
+License: BSD-3-clause
+
+Files: third_party/hat-trie/*
+Copyright: 2017, Thibaut Goetghebuer-Planchon <tessil@gmx.com>
+License: Expat
+
+Files: third_party/smol-v/*
+Copyright: 2016-2018, Aras Pranckevicius
+License: Expat or public-domain
+
+Files: third_party/vkmemalloc/*
+Copyright: 2017-2021, Advanced Micro Devices, Inc
+License: Expat
+
+License: Apache-2.0
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ .
+     http://www.apache.org/licenses/LICENSE-2.0
+ .
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ .
+ On Debian systems, you can find the full license text in
+ /usr/share/common-licenses/Apache-2.0
+
+License: BSD-3-clause
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+ 3. Neither the names of the copyright holders nor the names of its
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.
+ .
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
+ IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+
+License: Expat
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+ .
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+ .
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+
+License: public-domain
+ This is free and unencumbered software released into the public domain.
+ Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
+ software, either in source code form or as a compiled binary, for any purpose,
+ commercial or non-commercial, and by any means.
+ In jurisdictions that recognize copyright laws, the author or authors of this
+ software dedicate any and all copyright interest in the software to the public
+ domain. We make this dedication for the benefit of the public at large and to
+ the detriment of our heirs and successors. We intend this dedication to be an
+ overt act of relinquishment in perpetuity of all present and future rights to
+ this software under copyright law.
+ .
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/libfilament-dev.docs b/libfilament-dev.docs
new file mode 100644 (file)
index 0000000..72f7519
--- /dev/null
@@ -0,0 +1,2 @@
+usr/README.md
+usr/docs/*.md
diff --git a/libfilament-dev.install b/libfilament-dev.install
new file mode 100644 (file)
index 0000000..42012e1
--- /dev/null
@@ -0,0 +1,4 @@
+usr/include/filament-*
+usr/lib/*/libfilament*.so
+usr/lib/*/libfilament*.a
+usr/lib/*/cmake/filament-*
diff --git a/libfilament-dev.lintian-overrides b/libfilament-dev.lintian-overrides
new file mode 100644 (file)
index 0000000..26b8d7b
--- /dev/null
@@ -0,0 +1,2 @@
+# Lintian complains about missing code in resource and shader libraries
+libfilament-dev: no-code-sections [usr/lib/*/libfilament_*.a]
diff --git a/libfilament-tools.install b/libfilament-tools.install
new file mode 100644 (file)
index 0000000..e772481
--- /dev/null
@@ -0,0 +1 @@
+usr/bin
diff --git a/libfilament-tools.manpages b/libfilament-tools.manpages
new file mode 100644 (file)
index 0000000..019dd8c
--- /dev/null
@@ -0,0 +1,10 @@
+debian/manpages/cmgen.1
+debian/manpages/filamesh.1
+debian/manpages/glslminifier.1
+debian/manpages/matc.1
+debian/manpages/matinfo.1
+debian/manpages/mipgen.1
+debian/manpages/normal-blending.1
+debian/manpages/filament-resgen.1
+debian/manpages/roughness-prefilter.1
+debian/manpages/specular-color.1
diff --git a/libfilament1.9.install b/libfilament1.9.install
new file mode 100644 (file)
index 0000000..b643a98
--- /dev/null
@@ -0,0 +1 @@
+usr/lib/*/libfilament*.so.*
diff --git a/manpages/cmgen.1 b/manpages/cmgen.1
new file mode 100644 (file)
index 0000000..318adc1
--- /dev/null
@@ -0,0 +1,288 @@
+.\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.48.5.
+.TH CMGEN "1" "October 2021" "cmgen is a command-line tool for generating SH and mipmap levels from an env map." "User Commands"
+.SH NAME
+cmgen \- filament material tools
+.SH DESCRIPTION
+cmgen is a command\-line tool for generating SH and mipmap levels from an env map.
+Cubemaps and equirectangular formats are both supported, automatically detected
+according to the aspect ratio of the source image.
+.SS "Usages:"
+.IP
+cmgen [options] <input\-file>
+cmgen [options] <uv[N]>
+.SS "Supported input formats:"
+.IP
+PNG, 8 and 16 bits
+Radiance (.hdr)
+Photoshop (.psd), 16 and 32 bits
+OpenEXR (.exr)
+.SH OPTIONS
+.HP
+\fB\-\-help\fR, \fB\-h\fR
+.IP
+Print this message
+.HP
+\fB\-\-license\fR
+.IP
+Print copyright and license information
+.HP
+\fB\-\-quiet\fR, \fB\-q\fR
+.IP
+Quiet mode. Suppress all non\-error output
+.HP
+\fB\-\-type\fR=\fI\,[cubemap\/\fR|equirect|octahedron|ktx], \fB\-t\fR [cubemap|equirect|octahedron|ktx]
+.IP
+Specify output type (default: cubemap)
+.HP
+\fB\-\-format\fR=\fI\,[exr\/\fR|hdr|psd|rgbm|rgb32f|png|dds|ktx], \fB\-f\fR [exr|hdr|psd|rgbm|rgb32f|png|dds|ktx]
+.IP
+Specify output file format. ktx implies \fB\-type\fR=\fI\,ktx\/\fR.
+KTX files are always encoded with 3\-channel RGB_10_11_11_REV data
+.HP
+\fB\-\-compression\fR=\fI\,COMPRESSION\/\fR, \fB\-c\fR COMPRESSION
+.IP
+Format specific compression:
+.IP
+KTX:
+.IP
+astc_[fast|thorough]_[ldr|hdr]_WxH, where WxH is a valid block size
+s3tc_rgba_dxt5
+etc_FORMAT_METRIC_EFFORT
+.IP
+FORMAT is rgb8_alpha, srgb8_alpha, rgba8, or srgb8_alpha8
+METRIC is rgba, rgbx, rec709, numeric, or normalxyz
+EFFORT is an integer between 0 and 100
+.IP
+PNG: Ignored
+PNG RGBM: Ignored
+Radiance: Ignored
+Photoshop: 16 (default), 32
+OpenEXR: RAW, RLE, ZIPS, ZIP, PIZ (default)
+DDS: 8, 16 (default), 32
+.HP
+\fB\-\-size\fR=\fI\,power\-of\-two\/\fR, \fB\-s\fR power\-of\-two
+.IP
+Size of the output cubemaps (base level), 256 by default
+Also applies to DFG LUT
+.HP
+\fB\-\-deploy\fR=\fI\,dir\/\fR, \fB\-x\fR dir
+.IP
+Generate everything needed for deployment into <dir>
+.HP
+\fB\-\-extract\fR=\fI\,dir\/\fR
+.IP
+Extract faces of the cubemap into <dir>
+.HP
+\fB\-\-extract\-blur\fR=\fI\,roughness\/\fR
+.IP
+Blurs the cubemap before saving the faces using the roughness blur
+.HP
+\fB\-\-clamp\fR
+.IP
+Clamp environment before processing
+.HP
+\fB\-\-no\-mirror\fR
+.IP
+Skip mirroring of generated cubemaps (for assets with mirroring already backed in)
+.HP
+\fB\-\-ibl\-samples\fR=\fI\,numSamples\/\fR
+.IP
+Number of samples to use for IBL integrations (default 1024)
+.HP
+\fB\-\-ibl\-ld\fR=\fI\,dir\/\fR
+.IP
+Roughness pre\-filter into <dir>
+.HP
+\fB\-\-sh\-shader\fR
+.IP
+Generate irradiance SH for shader code
+.SS "Private use only:"
+.HP
+\fB\-\-ibl\-dfg\fR=\fI\,filename\/\fR.[exr|hdr|psd|png|rgbm|rgb32f|dds|h|hpp|c|cpp|inc|txt]
+.IP
+Compute the IBL DFG LUT
+.HP
+\fB\-\-ibl\-dfg\-multiscatter\fR
+.IP
+If \fB\-\-ibl\-dfg\fR is set, computes the DFG for multi\-scattering GGX
+.HP
+\fB\-\-ibl\-dfg\-cloth\fR
+.IP
+If \fB\-\-ibl\-dfg\fR is set, adds a 3rd channel to the DFG for cloth shading
+.HP
+\fB\-\-ibl\-is\-mipmap\fR=\fI\,dir\/\fR
+.IP
+Generate mipmap for pre\-filtered importance sampling
+.HP
+\fB\-\-ibl\-irradiance\fR=\fI\,dir\/\fR
+.IP
+Diffuse irradiance into <dir>
+.HP
+\fB\-\-ibl\-no\-prefilter\fR
+.IP
+Use importance sampling instead of prefiltered importance sampling
+.HP
+\fB\-\-ibl\-min\-lod\-size\fR
+.IP
+Minimum LOD size [default: 16]
+.HP
+\fB\-\-sh\fR=\fI\,bands\/\fR
+.IP
+SH decomposition of input cubemap
+.HP
+\fB\-\-sh\-output\fR=\fI\,filename\/\fR.[exr|hdr|psd|rgbm|rgb32f|png|dds|txt]
+.IP
+SH output format. The filename extension determines the output format
+.HP
+\fB\-\-sh\-irradiance\fR, \fB\-i\fR
+.IP
+Irradiance SH coefficients
+.HP
+\fB\-\-sh\-window\fR=\fI\,cutoff\/\fR|no|auto (default), \fB\-w\fR cutoff|no|auto (default)
+.IP
+SH windowing to reduce ringing
+.HP
+\fB\-\-debug\fR, \fB\-d\fR
+.IP
+Generate extra data for debugging
+.PP
+Cubemaps and equirectangular formats are both supported, automatically detected
+according to the aspect ratio of the source image.
+.SS "Usages:"
+.IP
+cmgen [options] <input\-file>
+cmgen [options] <uv[N]>
+.SS "Supported input formats:"
+.IP
+PNG, 8 and 16 bits
+Radiance (.hdr)
+Photoshop (.psd), 16 and 32 bits
+OpenEXR (.exr)
+.HP
+\fB\-\-help\fR, \fB\-h\fR
+.IP
+Print this message
+.HP
+\fB\-\-license\fR
+.IP
+Print copyright and license information
+.HP
+\fB\-\-quiet\fR, \fB\-q\fR
+.IP
+Quiet mode. Suppress all non\-error output
+.HP
+\fB\-\-type\fR=\fI\,[cubemap\/\fR|equirect|octahedron|ktx], \fB\-t\fR [cubemap|equirect|octahedron|ktx]
+.IP
+Specify output type (default: cubemap)
+.HP
+\fB\-\-format\fR=\fI\,[exr\/\fR|hdr|psd|rgbm|rgb32f|png|dds|ktx], \fB\-f\fR [exr|hdr|psd|rgbm|rgb32f|png|dds|ktx]
+.IP
+Specify output file format. ktx implies \fB\-type\fR=\fI\,ktx\/\fR.
+KTX files are always encoded with 3\-channel RGB_10_11_11_REV data
+.HP
+\fB\-\-compression\fR=\fI\,COMPRESSION\/\fR, \fB\-c\fR COMPRESSION
+.IP
+Format specific compression:
+.IP
+KTX:
+.IP
+astc_[fast|thorough]_[ldr|hdr]_WxH, where WxH is a valid block size
+s3tc_rgba_dxt5
+etc_FORMAT_METRIC_EFFORT
+.IP
+FORMAT is rgb8_alpha, srgb8_alpha, rgba8, or srgb8_alpha8
+METRIC is rgba, rgbx, rec709, numeric, or normalxyz
+EFFORT is an integer between 0 and 100
+.IP
+PNG: Ignored
+PNG RGBM: Ignored
+Radiance: Ignored
+Photoshop: 16 (default), 32
+OpenEXR: RAW, RLE, ZIPS, ZIP, PIZ (default)
+DDS: 8, 16 (default), 32
+.HP
+\fB\-\-size\fR=\fI\,power\-of\-two\/\fR, \fB\-s\fR power\-of\-two
+.IP
+Size of the output cubemaps (base level), 256 by default
+Also applies to DFG LUT
+.HP
+\fB\-\-deploy\fR=\fI\,dir\/\fR, \fB\-x\fR dir
+.IP
+Generate everything needed for deployment into <dir>
+.HP
+\fB\-\-extract\fR=\fI\,dir\/\fR
+.IP
+Extract faces of the cubemap into <dir>
+.HP
+\fB\-\-extract\-blur\fR=\fI\,roughness\/\fR
+.IP
+Blurs the cubemap before saving the faces using the roughness blur
+.HP
+\fB\-\-clamp\fR
+.IP
+Clamp environment before processing
+.HP
+\fB\-\-no\-mirror\fR
+.IP
+Skip mirroring of generated cubemaps (for assets with mirroring already backed in)
+.HP
+\fB\-\-ibl\-samples\fR=\fI\,numSamples\/\fR
+.IP
+Number of samples to use for IBL integrations (default 1024)
+.HP
+\fB\-\-ibl\-ld\fR=\fI\,dir\/\fR
+.IP
+Roughness pre\-filter into <dir>
+.HP
+\fB\-\-sh\-shader\fR
+.IP
+Generate irradiance SH for shader code
+.SS "Private use only:"
+.HP
+\fB\-\-ibl\-dfg\fR=\fI\,filename\/\fR.[exr|hdr|psd|png|rgbm|rgb32f|dds|h|hpp|c|cpp|inc|txt]
+.IP
+Compute the IBL DFG LUT
+.HP
+\fB\-\-ibl\-dfg\-multiscatter\fR
+.IP
+If \fB\-\-ibl\-dfg\fR is set, computes the DFG for multi\-scattering GGX
+.HP
+\fB\-\-ibl\-dfg\-cloth\fR
+.IP
+If \fB\-\-ibl\-dfg\fR is set, adds a 3rd channel to the DFG for cloth shading
+.HP
+\fB\-\-ibl\-is\-mipmap\fR=\fI\,dir\/\fR
+.IP
+Generate mipmap for pre\-filtered importance sampling
+.HP
+\fB\-\-ibl\-irradiance\fR=\fI\,dir\/\fR
+.IP
+Diffuse irradiance into <dir>
+.HP
+\fB\-\-ibl\-no\-prefilter\fR
+.IP
+Use importance sampling instead of prefiltered importance sampling
+.HP
+\fB\-\-ibl\-min\-lod\-size\fR
+.IP
+Minimum LOD size [default: 16]
+.HP
+\fB\-\-sh\fR=\fI\,bands\/\fR
+.IP
+SH decomposition of input cubemap
+.HP
+\fB\-\-sh\-output\fR=\fI\,filename\/\fR.[exr|hdr|psd|rgbm|rgb32f|png|dds|txt]
+.IP
+SH output format. The filename extension determines the output format
+.HP
+\fB\-\-sh\-irradiance\fR, \fB\-i\fR
+.IP
+Irradiance SH coefficients
+.HP
+\fB\-\-sh\-window\fR=\fI\,cutoff\/\fR|no|auto (default), \fB\-w\fR cutoff|no|auto (default)
+.IP
+SH windowing to reduce ringing
+.HP
+\fB\-\-debug\fR, \fB\-d\fR
+.IP
+Generate extra data for debugging
diff --git a/manpages/filament-resgen.1 b/manpages/filament-resgen.1
new file mode 100644 (file)
index 0000000..a0c1b64
--- /dev/null
@@ -0,0 +1,116 @@
+.\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.48.5.
+.TH FILAMENT-RESGEN "1" "October 2021" "resgen " "User Commands"
+.SH NAME
+filament-resgen \- filament material tools
+.SH DESCRIPTION
+filament-resgen aggregates a sequence of binary blobs, each of which becomes a "resource" whose id
+is the basename of the input file. It produces the following set of files:
+.IP
+resources.h ......... declares sizes and offsets for each resource
+resources.S ......... small assembly file with incbin directive and rodata section
+resources.apple.S ... ditto but with different rodata name and underscore prefixes
+resources.bin ....... the aggregated binary blob that the incbin refers to
+.SS "Usage:"
+.IP
+filament-resgen [options] <input_file_0> <input_file_1> ...
+.SH OPTIONS
+.HP
+\fB\-\-help\fR, \fB\-h\fR
+.IP
+Print this message
+.HP
+\fB\-\-license\fR, \fB\-L\fR
+.IP
+Print copyright and license information
+.HP
+\fB\-\-package\fR=\fI\,string\/\fR, \fB\-p\fR string
+.IP
+Name of the resource package (defaults to "resources")
+This is used to generate filenames and symbol prefixes
+.HP
+\fB\-\-deploy\fR=\fI\,dir\/\fR, \fB\-x\fR dir (defaults to ".")
+.IP
+Generate everything needed for deployment into <dir>
+.HP
+\fB\-\-keep\fR, \fB\-k\fR
+.IP
+Keep file extensions when generating symbols
+.HP
+\fB\-\-text\fR, \fB\-t\fR
+.IP
+Append a null terminator to each data blob
+.HP
+\fB\-\-cfile\fR, \fB\-c\fR
+.IP
+Generate xxd\-style C file (useful for WebAssembly)
+.HP
+\fB\-\-json\fR, \fB\-j\fR
+.IP
+Embed a JSON string in the output that provides a summary
+of all resource sizes and names. Useful for size analysis.
+.HP
+\fB\-\-quiet\fR, \fB\-q\fR
+.IP
+Suppress console output
+.HP
+\fB\-\-help\fR, \fB\-h\fR
+.IP
+Print this message
+.HP
+\fB\-\-license\fR, \fB\-L\fR
+.IP
+Print copyright and license information
+.HP
+\fB\-\-package\fR=\fI\,string\/\fR, \fB\-p\fR string
+.IP
+Name of the resource package (defaults to "resources")
+This is used to generate filenames and symbol prefixes
+.HP
+\fB\-\-deploy\fR=\fI\,dir\/\fR, \fB\-x\fR dir (defaults to ".")
+.IP
+Generate everything needed for deployment into <dir>
+.HP
+\fB\-\-keep\fR, \fB\-k\fR
+.IP
+Keep file extensions when generating symbols
+.HP
+\fB\-\-text\fR, \fB\-t\fR
+.IP
+Append a null terminator to each data blob
+.HP
+\fB\-\-cfile\fR, \fB\-c\fR
+.IP
+Generate xxd\-style C file (useful for WebAssembly)
+.HP
+\fB\-\-json\fR, \fB\-j\fR
+.IP
+Embed a JSON string in the output that provides a summary
+of all resource sizes and names. Useful for size analysis.
+.HP
+\fB\-\-quiet\fR, \fB\-q\fR
+.IP
+Suppress console output
+.SH EXAMPLES
+.IP
+resgen \-cp textures jungle.png beach.png
+> Generated files: textures.h, textures.S, textures.apple.S, textures.bin, textures.c
+> Generated symbols: TEXTURES_JUNGLE_DATA, TEXTURES_JUNGLE_SIZE,
+.IP
+TEXTURES_BEACH_DATA, TEXTURES_BEACH_SIZE
+.PP
+resgen aggregates a sequence of binary blobs, each of which becomes a "resource" whose id
+is the basename of the input file. It produces the following set of files:
+.IP
+resources.h ......... declares sizes and offsets for each resource
+resources.S ......... small assembly file with incbin directive and rodata section
+resources.apple.S ... ditto but with different rodata name and underscore prefixes
+resources.bin ....... the aggregated binary blob that the incbin refers to
+.SS "Usage:"
+.IP
+resgen [options] <input_file_0> <input_file_1> ...
+.IP
+resgen \-cp textures jungle.png beach.png
+> Generated files: textures.h, textures.S, textures.apple.S, textures.bin, textures.c
+> Generated symbols: TEXTURES_JUNGLE_DATA, TEXTURES_JUNGLE_SIZE,
+.IP
+TEXTURES_BEACH_DATA, TEXTURES_BEACH_SIZE
diff --git a/manpages/filamesh.1 b/manpages/filamesh.1
new file mode 100644 (file)
index 0000000..f67cd21
--- /dev/null
@@ -0,0 +1,55 @@
+.\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.48.5.
+.TH FILAMESH "1" "October 2021" "filamesh is a tool to convert meshes into an optimized binary format" "User Commands"
+.SH NAME
+filamesh \- filament material tools
+.SH DESCRIPTION
+filamesh is a tool to convert meshes into an optimized binary format
+Usage:
+.IP
+filamesh [options] <source mesh> <destination file>
+.SS "Supported mesh formats:"
+.IP
+FBX, OBJ
+.PP
+Input meshes must have texture coordinates.
+.SH OPTIONS
+.HP
+\fB\-\-help\fR, \fB\-h\fR
+.IP
+print this message
+.HP
+\fB\-\-license\fR
+.IP
+Print copyright and license information
+.HP
+\fB\-\-interleaved\fR, \fB\-i\fR
+.IP
+interleaves mesh attributes
+.HP
+\fB\-\-compress\fR, \fB\-c\fR
+.IP
+enable compression
+.SS "Usage:"
+.IP
+filamesh [options] <source mesh> <destination file>
+.SS "Supported mesh formats:"
+.IP
+FBX, OBJ
+.PP
+Input meshes must have texture coordinates.
+.HP
+\fB\-\-help\fR, \fB\-h\fR
+.IP
+print this message
+.HP
+\fB\-\-license\fR
+.IP
+Print copyright and license information
+.HP
+\fB\-\-interleaved\fR, \fB\-i\fR
+.IP
+interleaves mesh attributes
+.HP
+\fB\-\-compress\fR, \fB\-c\fR
+.IP
+enable compression
diff --git a/manpages/glslminifier.1 b/manpages/glslminifier.1
new file mode 100644 (file)
index 0000000..de20524
--- /dev/null
@@ -0,0 +1,77 @@
+.\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.48.5.
+.TH GLSLMINIFIER "1" "October 2021" "glslminifier " "User Commands"
+.SH NAME
+glslminifier \- filament material tools
+.SH DESCRIPTION
+glslminifier minifies GLSL shader code by removing comments, blank lines and indentation.
+.SS "Usage:"
+.IP
+glslminifier [options] <input file>
+.SH OPTIONS
+.HP
+\fB\-\-help\fR, \fB\-h\fR
+.IP
+Print this message.
+.HP
+\fB\-\-license\fR, \fB\-L\fR
+.IP
+Print copyright and license information.
+.HP
+\fB\-\-output\fR, \fB\-o\fR
+.IP
+Specify path to output file. If none provided, writes to stdout.
+.HP
+\fB\-\-optimization\fR, \fB\-O\fR [none]
+.IP
+Set the level of optimization. "none" performs a simple passthrough.
+.HP
+\fB\-\-line\fR, \fB\-l\fR [name]
+.IP
+Insert a #line directive on the first line of the shader with the given name.
+For example, \fB\-\-line\fR foobar.h will insert the following:
+.IP
+#if defined(GL_GOOGLE_cpp_style_line_directive)
+#line 0 "foobar.h"
+#endif
+.IP
+This option is meant to be used with \fB\-Onone\fR optimization.
+.SS "Example:"
+.IP
+glslminifier \fB\-o\fR output.fs.min input.fs
+> Output file: output.fs.min
+.PP
+glslminifier minifies GLSL shader code by removing comments, blank lines and indentation.
+.SS "Usage:"
+.IP
+glslminifier [options] <input file>
+.HP
+\fB\-\-help\fR, \fB\-h\fR
+.IP
+Print this message.
+.HP
+\fB\-\-license\fR, \fB\-L\fR
+.IP
+Print copyright and license information.
+.HP
+\fB\-\-output\fR, \fB\-o\fR
+.IP
+Specify path to output file. If none provided, writes to stdout.
+.HP
+\fB\-\-optimization\fR, \fB\-O\fR [none]
+.IP
+Set the level of optimization. "none" performs a simple passthrough.
+.HP
+\fB\-\-line\fR, \fB\-l\fR [name]
+.IP
+Insert a #line directive on the first line of the shader with the given name.
+For example, \fB\-\-line\fR foobar.h will insert the following:
+.IP
+#if defined(GL_GOOGLE_cpp_style_line_directive)
+#line 0 "foobar.h"
+#endif
+.IP
+This option is meant to be used with \fB\-Onone\fR optimization.
+.SS "Example:"
+.IP
+glslminifier \fB\-o\fR output.fs.min input.fs
+> Output file: output.fs.min
diff --git a/manpages/matc.1 b/manpages/matc.1
new file mode 100644 (file)
index 0000000..01ee64e
--- /dev/null
@@ -0,0 +1,88 @@
+.\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.48.5.
+.TH MATC "1" "October 2021" "matc 10" "User Commands"
+.SH NAME
+matc \- filament material tools
+.SH DESCRIPTION
+matc is a command\-line tool to compile material definition.
+Usages:
+.IP
+matc [options] <input\-file>
+.SS "Supported input formats:"
+.IP
+Filament material definition (.mat)
+.SH OPTIONS
+.HP
+\fB\-\-help\fR, \fB\-h\fR
+.IP
+Print this message
+.HP
+\fB\-\-license\fR
+.IP
+Print copyright and license information
+.HP
+\fB\-\-output\fR, \fB\-o\fR
+.IP
+Specify path to output file
+.HP
+\fB\-\-platform\fR, \fB\-p\fR
+.IP
+Shader family to generate: desktop, mobile or all (default)
+.HP
+\fB\-\-optimize\-size\fR, \fB\-S\fR
+.IP
+Optimize generated shader code for size instead of just performance
+.HP
+\fB\-\-api\fR, \fB\-a\fR
+.IP
+Specify the target API: opengl (default), vulkan, metal, or all
+This flag can be repeated to individually select APIs for inclusion:
+.IP
+matc \fB\-\-api\fR opengl \fB\-\-api\fR metal ...
+.HP
+\fB\-\-define\fR, \fB\-D\fR
+.IP
+Add a preprocessor define macro via <macro>=<value>. <value> defaults to 1 if omitted.
+Can be repeated to specify multiple definitions:
+.IP
+matc \fB\-Dfoo\fR=\fI\,1\/\fR \fB\-Dbar\fR \fB\-Dbuzz\fR=\fI\,100\/\fR ...
+.HP
+\fB\-\-reflect\fR, \fB\-r\fR
+.IP
+Reflect the specified metadata as JSON: parameters
+.HP
+\fB\-\-variant\-filter=\fR<filter>, \fB\-V\fR <filter>
+.IP
+Filter out specified comma\-separated variants:
+.IP
+directionalLighting, dynamicLighting, shadowReceiver, skinning, vsm, fog
+.IP
+This variant filter is merged with the filter from the material, if any
+.HP
+\fB\-\-version\fR, \fB\-v\fR
+.IP
+Print the material version number
+.SS "Internal use and debugging only:"
+.HP
+\fB\-\-optimize\-none\fR, \fB\-g\fR
+.IP
+Disable all shader optimizations, for debugging
+.HP
+\fB\-\-preprocessor\-only\fR, \fB\-E\fR
+.IP
+Optimize shaders by running only the preprocessor
+.HP
+\fB\-\-raw\fR, \fB\-w\fR
+.IP
+Compile a raw GLSL shader into a SPIRV binary chunk
+.HP
+\fB\-\-output\-format\fR, \fB\-f\fR
+.IP
+Specify output format: blob (default) or header
+.HP
+\fB\-\-debug\fR, \fB\-d\fR
+.IP
+Generate extra data for debugging
+.HP
+\fB\-\-print\fR, \fB\-t\fR
+.IP
+Print generated shaders for debugging
diff --git a/manpages/matinfo.1 b/manpages/matinfo.1
new file mode 100644 (file)
index 0000000..29cfff0
--- /dev/null
@@ -0,0 +1,109 @@
+.\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.48.5.
+.TH MATINFO "1" "October 2021" "matinfo prints information about material files compiled with matc" "User Commands"
+.SH NAME
+matinfo \- filament material tools
+.SH DESCRIPTION
+matinfo prints information about material files compiled with matc
+Usage:
+.IP
+matinfo [options] <material file>
+.SH OPTIONS
+.HP
+\fB\-\-help\fR, \fB\-h\fR
+.IP
+Print this message
+.HP
+\fB\-\-print\-glsl\fR=\fI\,[index]\/\fR, \fB\-g\fR
+.IP
+Print GLSL for the nth shader (0 is the first OpenGL shader)
+.HP
+\fB\-\-print\-spirv\fR=\fI\,[index]\/\fR, \fB\-s\fR
+.IP
+Validate and print disasm for the nth shader (0 is the first Vulkan shader)
+.HP
+\fB\-\-print\-metal\fR=\fI\,[index]\/\fR, \fB\-m\fR
+.IP
+Print Metal Shading Language for the nth shader (0 is the first Metal shader)
+.HP
+\fB\-\-print\-vkglsl\fR=\fI\,[index]\/\fR, \fB\-v\fR
+.IP
+Print the nth Vulkan shader transpiled into GLSL
+.HP
+\fB\-\-print\-dic\-glsl\fR
+.IP
+Print the GLSL dictionary
+.HP
+\fB\-\-print\-dic\-metal\fR
+.IP
+Print the Metal dictionary
+.HP
+\fB\-\-print\-dic\-vk\fR
+.IP
+Print the Vulkan dictionary
+.HP
+\fB\-\-web\-server\fR=\fI\,[port]\/\fR, \fB\-w\fR
+.IP
+Serve a web page at the given port (e.g. 8080)
+.HP
+\fB\-\-dump\-binary\fR=\fI\,[index]\/\fR, \fB\-b\fR
+.IP
+Dump binary SPIRV for the nth Vulkan shader to 'out.spv'
+.HP
+\fB\-\-license\fR
+.IP
+Print copyright and license information
+.HP
+\fB\-\-analyze\-spirv\fR=\fI\,[index]\/\fR, \fB\-a\fR
+.IP
+Print annotated GLSL for the nth shader (0 is the first Vulkan shader)
+.SS "Usage:"
+.IP
+matinfo [options] <material file>
+.HP
+\fB\-\-help\fR, \fB\-h\fR
+.IP
+Print this message
+.HP
+\fB\-\-print\-glsl\fR=\fI\,[index]\/\fR, \fB\-g\fR
+.IP
+Print GLSL for the nth shader (0 is the first OpenGL shader)
+.HP
+\fB\-\-print\-spirv\fR=\fI\,[index]\/\fR, \fB\-s\fR
+.IP
+Validate and print disasm for the nth shader (0 is the first Vulkan shader)
+.HP
+\fB\-\-print\-metal\fR=\fI\,[index]\/\fR, \fB\-m\fR
+.IP
+Print Metal Shading Language for the nth shader (0 is the first Metal shader)
+.HP
+\fB\-\-print\-vkglsl\fR=\fI\,[index]\/\fR, \fB\-v\fR
+.IP
+Print the nth Vulkan shader transpiled into GLSL
+.HP
+\fB\-\-print\-dic\-glsl\fR
+.IP
+Print the GLSL dictionary
+.HP
+\fB\-\-print\-dic\-metal\fR
+.IP
+Print the Metal dictionary
+.HP
+\fB\-\-print\-dic\-vk\fR
+.IP
+Print the Vulkan dictionary
+.HP
+\fB\-\-web\-server\fR=\fI\,[port]\/\fR, \fB\-w\fR
+.IP
+Serve a web page at the given port (e.g. 8080)
+.HP
+\fB\-\-dump\-binary\fR=\fI\,[index]\/\fR, \fB\-b\fR
+.IP
+Dump binary SPIRV for the nth Vulkan shader to 'out.spv'
+.HP
+\fB\-\-license\fR
+.IP
+Print copyright and license information
+.HP
+\fB\-\-analyze\-spirv\fR=\fI\,[index]\/\fR, \fB\-a\fR
+.IP
+Print annotated GLSL for the nth shader (0 is the first Vulkan shader)
diff --git a/manpages/mipgen.1 b/manpages/mipgen.1
new file mode 100644 (file)
index 0000000..4c92043
--- /dev/null
@@ -0,0 +1,174 @@
+.\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.48.5.
+.TH MIPGEN "1" "October 2021" "mipgen " "User Commands"
+.SH NAME
+mipgen \- filament material tools
+.SH DESCRIPTION
+mipgen generates mipmaps for an image down to the 1x1 level.
+.PP
+The <output_pattern> argument is a printf\-style pattern.
+For example, "mip%2d.png" generates mip01.png, mip02.png, etc.
+Miplevel 0 is not generated since it is the original image.
+.PP
+If the output format is a container format like KTX, then
+<output_pattern> is simply a filename.
+.SS "Usage:"
+.IP
+mipgen [options] <input_file> <output_pattern>
+.SH OPTIONS
+.HP
+\fB\-\-help\fR, \fB\-h\fR
+.IP
+print this message
+.HP
+\fB\-\-license\fR, \fB\-L\fR
+.IP
+print copyright and license information
+.HP
+\fB\-\-linear\fR, \fB\-l\fR
+.IP
+assume that image pixels are already linearized
+.HP
+\fB\-\-page\fR, \fB\-p\fR
+.IP
+generate HTML page for review purposes (mipmap.html)
+.HP
+\fB\-\-quiet\fR, \fB\-q\fR
+.IP
+suppress console output from the mipgen tool
+.HP
+\fB\-\-grayscale\fR, \fB\-g\fR
+.IP
+create a single\-channel image and do not perform gamma correction
+.HP
+\fB\-\-format\fR=\fI\,[exr\/\fR|hdr|rgbm|psd|png|dds|ktx], \fB\-f\fR [exr|hdr|rgbm|psd|png|dds|ktx]
+.IP
+specify output file format, inferred from output pattern if omitted
+.HP
+\fB\-\-kernel\fR=\fI\,[box\/\fR|nearest|hermite|gaussian|normals|mitchell|lanczos|min], \fB\-k\fR [filter]
+.IP
+specify filter kernel type (defaults to lanczos)
+the "normals" filter may automatically change the compression scheme
+.HP
+\fB\-\-add\-alpha\fR
+.IP
+if the source image has 3 channels, this adds a fourth channel filled with 1.0
+.HP
+\fB\-\-strip\-alpha\fR
+.IP
+ignore the alpha component of the input image
+.HP
+\fB\-\-mip\-levels\fR=\fI\,N\/\fR, \fB\-m\fR N
+.IP
+specifies the number of mip levels to generate
+if 0 (default), all levels are generated
+.HP
+\fB\-\-compression\fR=\fI\,COMPRESSION\/\fR, \fB\-c\fR COMPRESSION
+.IP
+format specific compression:
+.IP
+KTX:
+.IP
+astc_[fast|thorough]_[ldr|hdr]_WxH, where WxH is a valid block size
+s3tc_rgb_dxt1, s3tc_rgba_dxt5
+etc_FORMAT_METRIC_EFFORT
+.TP
+FORMAT is r11, signed_r11, rg11, signed_rg11, rgb8, srgb8, rgb8_alpha
+srgb8_alpha, rgba8, or srgb8_alpha8
+.IP
+METRIC is rgba, rgbx, rec709, numeric, or normalxyz
+EFFORT is an integer between 0 and 100
+.IP
+PNG: Ignored
+Radiance: Ignored
+Photoshop: 16 (default), 32
+OpenEXR: RAW, RLE, ZIPS, ZIP, PIZ (default)
+DDS: 8, 16 (default), 32
+.HP
+\fB\-\-help\fR, \fB\-h\fR
+.IP
+print this message
+.HP
+\fB\-\-license\fR, \fB\-L\fR
+.IP
+print copyright and license information
+.HP
+\fB\-\-linear\fR, \fB\-l\fR
+.IP
+assume that image pixels are already linearized
+.HP
+\fB\-\-page\fR, \fB\-p\fR
+.IP
+generate HTML page for review purposes (mipmap.html)
+.HP
+\fB\-\-quiet\fR, \fB\-q\fR
+.IP
+suppress console output from the mipgen tool
+.HP
+\fB\-\-grayscale\fR, \fB\-g\fR
+.IP
+create a single\-channel image and do not perform gamma correction
+.HP
+\fB\-\-format\fR=\fI\,[exr\/\fR|hdr|rgbm|psd|png|dds|ktx], \fB\-f\fR [exr|hdr|rgbm|psd|png|dds|ktx]
+.IP
+specify output file format, inferred from output pattern if omitted
+.HP
+\fB\-\-kernel\fR=\fI\,[box\/\fR|nearest|hermite|gaussian|normals|mitchell|lanczos|min], \fB\-k\fR [filter]
+.IP
+specify filter kernel type (defaults to lanczos)
+the "normals" filter may automatically change the compression scheme
+.HP
+\fB\-\-add\-alpha\fR
+.IP
+if the source image has 3 channels, this adds a fourth channel filled with 1.0
+.HP
+\fB\-\-strip\-alpha\fR
+.IP
+ignore the alpha component of the input image
+.HP
+\fB\-\-mip\-levels\fR=\fI\,N\/\fR, \fB\-m\fR N
+.IP
+specifies the number of mip levels to generate
+if 0 (default), all levels are generated
+.HP
+\fB\-\-compression\fR=\fI\,COMPRESSION\/\fR, \fB\-c\fR COMPRESSION
+.IP
+format specific compression:
+.IP
+KTX:
+.IP
+astc_[fast|thorough]_[ldr|hdr]_WxH, where WxH is a valid block size
+s3tc_rgb_dxt1, s3tc_rgba_dxt5
+etc_FORMAT_METRIC_EFFORT
+.TP
+FORMAT is r11, signed_r11, rg11, signed_rg11, rgb8, srgb8, rgb8_alpha
+srgb8_alpha, rgba8, or srgb8_alpha8
+.IP
+METRIC is rgba, rgbx, rec709, numeric, or normalxyz
+EFFORT is an integer between 0 and 100
+.IP
+PNG: Ignored
+Radiance: Ignored
+Photoshop: 16 (default), 32
+OpenEXR: RAW, RLE, ZIPS, ZIP, PIZ (default)
+DDS: 8, 16 (default), 32
+.SH EXAMPLES
+.IP
+mipgen \-g \-\-kernel=hermite grassland.png mip_%03d.png
+mipgen \-f ktx \-\-compression=astc_fast_ldr_4x4 grassland.png mips.ktx
+mipgen \-f ktx \-\-compression=etc_rgb_rgba_40 grassland.png mips.ktx
+.PP
+mipgen generates mipmaps for an image down to the 1x1 level.
+.PP
+The <output_pattern> argument is a printf\-style pattern.
+For example, "mip%2d.png" generates mip01.png, mip02.png, etc.
+Miplevel 0 is not generated since it is the original image.
+.PP
+If the output format is a container format like KTX, then
+<output_pattern> is simply a filename.
+.SS "Usage:"
+.IP
+mipgen [options] <input_file> <output_pattern>
+.IP
+mipgen \-g \-\-kernel=hermite grassland.png mip_%03d.png
+mipgen \-f ktx \-\-compression=astc_fast_ldr_4x4 grassland.png mips.ktx
+mipgen \-f ktx \-\-compression=etc_rgb_rgba_40 grassland.png mips.ktx
diff --git a/manpages/normal-blending.1 b/manpages/normal-blending.1
new file mode 100644 (file)
index 0000000..cdb60c4
--- /dev/null
@@ -0,0 +1,69 @@
+.\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.48.5.
+.TH NORMAL-BLENDING "1" "October 2021" "normal-blending is a tool for blending normal maps using Reoriented Normal Mapping" "User Commands"
+.SH NAME
+normal-blending \- filament material tools
+.SH DESCRIPTION
+normal\-blending is a tool for blending normal maps using Reoriented Normal Mapping
+Usage:
+.IP
+normal\-blending [options] <normal\-map> <detail\-map> <output\-map>
+.SS "Supported input formats:"
+.IP
+PNG, 8 and 16 bits
+Radiance (.hdr)
+Photoshop (.psd), 16 and 32 bits
+OpenEXR (.exr)
+.SH OPTIONS
+.HP
+\fB\-\-help\fR, \fB\-h\fR
+.IP
+print this message
+.HP
+\fB\-\-license\fR
+.IP
+Print copyright and license information
+.HP
+\fB\-\-format\fR=\fI\,[exr\/\fR|hdr|psd|png|dds], \fB\-f\fR [exr|hdr|psd|png|dds]
+.IP
+specify output file format, inferred from file name if omitted
+.HP
+\fB\-\-compression\fR=\fI\,COMPRESSION\/\fR, \fB\-c\fR COMPRESSION
+.IP
+format specific compression:
+.IP
+PNG: Ignored
+Radiance: Ignored
+Photoshop: 16 (default), 32
+OpenEXR: RAW, RLE, ZIPS, ZIP, PIZ (default)
+DDS: 8, 16 (default), 32
+.SS "Usage:"
+.IP
+normal\-blending [options] <normal\-map> <detail\-map> <output\-map>
+.SS "Supported input formats:"
+.IP
+PNG, 8 and 16 bits
+Radiance (.hdr)
+Photoshop (.psd), 16 and 32 bits
+OpenEXR (.exr)
+.HP
+\fB\-\-help\fR, \fB\-h\fR
+.IP
+print this message
+.HP
+\fB\-\-license\fR
+.IP
+Print copyright and license information
+.HP
+\fB\-\-format\fR=\fI\,[exr\/\fR|hdr|psd|png|dds], \fB\-f\fR [exr|hdr|psd|png|dds]
+.IP
+specify output file format, inferred from file name if omitted
+.HP
+\fB\-\-compression\fR=\fI\,COMPRESSION\/\fR, \fB\-c\fR COMPRESSION
+.IP
+format specific compression:
+.IP
+PNG: Ignored
+Radiance: Ignored
+Photoshop: 16 (default), 32
+OpenEXR: RAW, RLE, ZIPS, ZIP, PIZ (default)
+DDS: 8, 16 (default), 32
diff --git a/manpages/roughness-prefilter.1 b/manpages/roughness-prefilter.1
new file mode 100644 (file)
index 0000000..d2e4034
--- /dev/null
@@ -0,0 +1,104 @@
+.\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.48.5.
+.TH ROUGHNESS-PREFILTER "1" "October 2021" "roughness-prefilter generates pre-filtered roughness maps from normal maps" "User Commands"
+.SH NAME
+roughness-prefilter \- filament material tools
+.SH DESCRIPTION
+roughness\-prefilter generates pre\-filtered roughness maps from normal maps
+to help mitigate specular aliasing.
+Usage:
+.IP
+roughness\-prefilter [options] <normal\-map> <output\-roughness\-map>
+.SS "Output note:"
+.IP
+One file will be generated per mip\-level. The size of the first level will be
+the greater of the input normal map and input roughness map.
+.SS "Supported input formats:"
+.IP
+PNG, 8 and 16 bits
+Radiance (.hdr)
+Photoshop (.psd), 16 and 32 bits
+OpenEXR (.exr)
+.SH OPTIONS
+.HP
+\fB\-\-help\fR, \fB\-h\fR
+.IP
+print this message
+.HP
+\fB\-\-license\fR
+.IP
+Print copyright and license information
+.HP
+\fB\-\-roughness\fR=\fI\,[0\/\fR..1], \fB\-r\fR [0..1]
+.IP
+desired constant roughness, ignored if \fB\-\-roughness\-map\fR is specified
+.HP
+\fB\-\-roughness\-map=\fR<input\-roughness\-map>, \fB\-m\fR <input\-roughness\-map>
+.IP
+input roughness map
+.HP
+\fB\-\-format\fR=\fI\,[exr\/\fR|hdr|psd|png|dds|ktx], \fB\-f\fR [exr|hdr|psd|png|dds|ktx]
+.IP
+specify output file format, inferred from file name if omitted
+.HP
+\fB\-\-compression\fR=\fI\,COMPRESSION\/\fR, \fB\-c\fR COMPRESSION
+.IP
+format specific compression:
+.IP
+PNG: Ignored
+Radiance: Ignored
+Photoshop: 16 (default), 32
+OpenEXR: RAW, RLE, ZIPS, ZIP, PIZ (default)
+DDS: 8, 16 (default), 32
+.HP
+\fB\-\-linear\fR, \fB\-l\fR
+.IP
+force linear output when the PNG format is selected
+.PP
+to help mitigate specular aliasing.
+Usage:
+.IP
+roughness\-prefilter [options] <normal\-map> <output\-roughness\-map>
+.SS "Output note:"
+.IP
+One file will be generated per mip\-level. The size of the first level will be
+the greater of the input normal map and input roughness map.
+.SS "Supported input formats:"
+.IP
+PNG, 8 and 16 bits
+Radiance (.hdr)
+Photoshop (.psd), 16 and 32 bits
+OpenEXR (.exr)
+.HP
+\fB\-\-help\fR, \fB\-h\fR
+.IP
+print this message
+.HP
+\fB\-\-license\fR
+.IP
+Print copyright and license information
+.HP
+\fB\-\-roughness\fR=\fI\,[0\/\fR..1], \fB\-r\fR [0..1]
+.IP
+desired constant roughness, ignored if \fB\-\-roughness\-map\fR is specified
+.HP
+\fB\-\-roughness\-map=\fR<input\-roughness\-map>, \fB\-m\fR <input\-roughness\-map>
+.IP
+input roughness map
+.HP
+\fB\-\-format\fR=\fI\,[exr\/\fR|hdr|psd|png|dds|ktx], \fB\-f\fR [exr|hdr|psd|png|dds|ktx]
+.IP
+specify output file format, inferred from file name if omitted
+.HP
+\fB\-\-compression\fR=\fI\,COMPRESSION\/\fR, \fB\-c\fR COMPRESSION
+.IP
+format specific compression:
+.IP
+PNG: Ignored
+Radiance: Ignored
+Photoshop: 16 (default), 32
+OpenEXR: RAW, RLE, ZIPS, ZIP, PIZ (default)
+DDS: 8, 16 (default), 32
+.HP
+\fB\-\-linear\fR, \fB\-l\fR
+.IP
+force linear output when the PNG format is selected
diff --git a/manpages/specular-color.1 b/manpages/specular-color.1
new file mode 100644 (file)
index 0000000..3eccb58
--- /dev/null
@@ -0,0 +1,29 @@
+.\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.48.5.
+.TH SPECULAR-COLOR "1" "October 2021" "specular-color computes the base color of a conductor from spectral data" "User Commands"
+.SH NAME
+specular-color \- filament material tools
+.SH DESCRIPTION
+specular\-color computes the base color of a conductor from spectral data
+Usage:
+.IP
+specular\-color [options] <spectral data file>
+.SH OPTIONS
+.HP
+\fB\-\-help\fR, \fB\-h\fR
+.IP
+Print this message
+.HP
+\fB\-\-license\fR
+.IP
+Print copyright and license information
+.SS "Usage:"
+.IP
+specular\-color [options] <spectral data file>
+.HP
+\fB\-\-help\fR, \fB\-h\fR
+.IP
+Print this message
+.HP
+\fB\-\-license\fR
+.IP
+Print copyright and license information
diff --git a/not-installed b/not-installed
new file mode 100644 (file)
index 0000000..e7c97f2
--- /dev/null
@@ -0,0 +1,6 @@
+usr/LICENSE
+usr/include/trie
+usr/lib/*/libbluegl.a
+usr/lib/*/libbluevk.a
+usr/lib/*/libcivetweb.a
+usr/lib/*/libsmol-v.a
diff --git a/patches/0001-Build-against-system-libraries.patch b/patches/0001-Build-against-system-libraries.patch
new file mode 100644 (file)
index 0000000..87db874
--- /dev/null
@@ -0,0 +1,81 @@
+From: =?utf-8?q?Timo_R=C3=B6hling?= <roehling@debian.org>
+Date: Sat, 23 Oct 2021 19:17:07 +0200
+Subject: Build against system libraries
+
+---
+ CMakeLists.txt | 38 +++++++++++++++++++++-----------------
+ 1 file changed, 21 insertions(+), 17 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index aa51851..b82a941 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -573,12 +573,25 @@ function(get_resgen_vars ARCHIVE_DIR ARCHIVE_NAME)
+     endif()
+ endfunction()
++# ==================================================================================================
++# External dependencies
++# ==================================================================================================
++find_package(GTest REQUIRED)
++find_package(tsl-robin-map REQUIRED)
++find_package(meshoptimizer REQUIRED)
++find_package(draco REQUIRED)
++if(IS_HOST_PLATFORM)
++    find_package(PNG REQUIRED)
++    find_package(SDL2 REQUIRED)
++    find_package(ZLIB REQUIRED)
++    find_package(tinyexr REQUIRED)
++endif()
++
+ # ==================================================================================================
+ # Sub-projects
+ # ==================================================================================================
+ # Common to all platforms
+-add_subdirectory(${EXTERNAL}/libgtest/tnt)
+ add_subdirectory(${LIBRARIES}/camutils)
+ add_subdirectory(${LIBRARIES}/filabridge)
+ add_subdirectory(${LIBRARIES}/filaflat)
+@@ -597,22 +610,17 @@ add_subdirectory(${FILAMENT}/filament)
+ add_subdirectory(${FILAMENT}/shaders)
+ add_subdirectory(${EXTERNAL}/civetweb/tnt)
+ add_subdirectory(${EXTERNAL}/hat-trie/tnt)
+-add_subdirectory(${EXTERNAL}/imgui/tnt)
+-add_subdirectory(${EXTERNAL}/robin-map/tnt)
++include(debian/cmake/imgui.cmake)
+ add_subdirectory(${EXTERNAL}/smol-v/tnt)
+-add_subdirectory(${EXTERNAL}/benchmark/tnt)
+-add_subdirectory(${EXTERNAL}/meshoptimizer)
++include(debian/cmake/benchmark.cmake)
+ add_subdirectory(${EXTERNAL}/cgltf/tnt)
+-add_subdirectory(${EXTERNAL}/draco/tnt)
+-add_subdirectory(${EXTERNAL}/jsmn/tnt)
+-add_subdirectory(${EXTERNAL}/stb/tnt)
++include(debian/cmake/jsmn.cmake)
++include(debian/cmake/stb.cmake)
+ add_subdirectory(${EXTERNAL}/getopt)
+ 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)
++    include(debian/cmake/spirv-tools.cmake)
++    include(debian/cmake/glslang.cmake)
+     add_subdirectory(${EXTERNAL}/spirv-cross/tnt)
+     add_subdirectory(${LIBRARIES}/filamat)
+@@ -651,11 +659,7 @@ if (IS_HOST_PLATFORM)
+     add_subdirectory(${EXTERNAL}/astcenc/tnt)
+     add_subdirectory(${EXTERNAL}/etc2comp)
+-    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)
++    include(debian/cmake/libassimp.cmake)
+     add_subdirectory(${TOOLS}/cmgen)
+     add_subdirectory(${TOOLS}/cso-lut)
diff --git a/patches/0002-Disable-Java.patch b/patches/0002-Disable-Java.patch
new file mode 100644 (file)
index 0000000..dd00219
--- /dev/null
@@ -0,0 +1,23 @@
+From: =?utf-8?q?Timo_R=C3=B6hling?= <roehling@debian.org>
+Date: Sat, 23 Oct 2021 19:48:53 +0200
+Subject: Disable Java
+
+---
+ CMakeLists.txt | 4 ----
+ 1 file changed, 4 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index b82a941..b6cd7ab 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -651,10 +651,6 @@ if (IS_HOST_PLATFORM)
+     add_subdirectory(${LIBRARIES}/filamentapp)
+     add_subdirectory(${LIBRARIES}/imageio)
+-    add_subdirectory(${FILAMENT}/java/filamat)
+-    add_subdirectory(${FILAMENT}/java/filament)
+-    add_subdirectory(${FILAMENT}/java/gltfio)
+-
+     add_subdirectory(${FILAMENT}/samples)
+     add_subdirectory(${EXTERNAL}/astcenc/tnt)
diff --git a/patches/0003-Fix-libstdc-compat.patch b/patches/0003-Fix-libstdc-compat.patch
new file mode 100644 (file)
index 0000000..d5a46a5
--- /dev/null
@@ -0,0 +1,47 @@
+From: =?utf-8?q?Timo_R=C3=B6hling?= <roehling@debian.org>
+Date: Tue, 25 Jan 2022 21:55:31 +0100
+Subject: Fix libstdc++ compat
+
+---
+ filament/backend/include/backend/Handle.h | 2 ++
+ libs/imageio/src/BlockCompression.cpp     | 1 +
+ libs/viewer/src/RemoteServer.cpp          | 1 +
+ 3 files changed, 4 insertions(+)
+
+diff --git a/filament/backend/include/backend/Handle.h b/filament/backend/include/backend/Handle.h
+index 62572c7..73c97fe 100644
+--- a/filament/backend/include/backend/Handle.h
++++ b/filament/backend/include/backend/Handle.h
+@@ -21,6 +21,8 @@
+ #include <utils/Log.h>
+ #include <utils/debug.h>
++#include <limits>
++
+ namespace filament {
+ namespace backend {
+diff --git a/libs/imageio/src/BlockCompression.cpp b/libs/imageio/src/BlockCompression.cpp
+index f4e0e17..57b607e 100644
+--- a/libs/imageio/src/BlockCompression.cpp
++++ b/libs/imageio/src/BlockCompression.cpp
+@@ -20,6 +20,7 @@
+ #include <algorithm>
+ #include <cmath>
++#include <cstring>
+ #include <thread>
+ #include <astcenc.h>
+diff --git a/libs/viewer/src/RemoteServer.cpp b/libs/viewer/src/RemoteServer.cpp
+index d083dd1..441c730 100644
+--- a/libs/viewer/src/RemoteServer.cpp
++++ b/libs/viewer/src/RemoteServer.cpp
+@@ -20,6 +20,7 @@
+ #include <utils/Log.h>
++#include <cstring>
+ #include <vector>
+ using namespace utils;
diff --git a/patches/0004-Fix-combine_static_libs-macro.patch b/patches/0004-Fix-combine_static_libs-macro.patch
new file mode 100644 (file)
index 0000000..b6bc7c2
--- /dev/null
@@ -0,0 +1,26 @@
+From: =?utf-8?q?Timo_R=C3=B6hling?= <roehling@debian.org>
+Date: Sat, 23 Oct 2021 19:19:52 +0200
+Subject: Fix combine_static_libs macro
+
+---
+ CMakeLists.txt | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index b6cd7ab..6786b22 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -495,7 +495,12 @@ function(combine_static_libs TARGET OUTPUT DEPS)
+     # Loop through the dependent libraries and query their location on disk.
+     set(DEPS_FILES )
+     foreach(DEPENDENCY ${DEPS})
+-        list(APPEND DEPS_FILES "$<TARGET_FILE:${DEPENDENCY}>")
++        if(TARGET ${DEPENDENCY})
++            get_property(dep_type TARGET ${DEPENDENCY} PROPERTY TYPE)
++            if(dep_type STREQUAL "STATIC_LIBRARY")
++                list(APPEND DEPS_FILES "$<TARGET_FILE:${DEPENDENCY}>")
++            endif()
++        endif()
+     endforeach()
+     add_custom_command(
diff --git a/patches/0005-Fix-list_licenses-macro.patch b/patches/0005-Fix-list_licenses-macro.patch
new file mode 100644 (file)
index 0000000..0c104cf
--- /dev/null
@@ -0,0 +1,31 @@
+From: =?utf-8?q?Timo_R=C3=B6hling?= <roehling@debian.org>
+Date: Sat, 23 Oct 2021 19:20:10 +0200
+Subject: Fix list_licenses macro
+
+---
+ CMakeLists.txt | 12 +++++++-----
+ 1 file changed, 7 insertions(+), 5 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 6786b22..8d674dc 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -475,11 +475,13 @@ function(list_licenses OUTPUT MODULES)
+     foreach(module ${_MODULES})
+         set(license_path "../../third_party/${module}/LICENSE")
+         get_filename_component(fullname "${license_path}" ABSOLUTE)
+-        string(APPEND CONTENT "${STR_OPENER}License and copyrights for ${module}:\n${STR_CLOSER},\n")
+-        file(READ ${license_path} license_long)
+-        string(REPLACE "\n" "${STR_CLOSER},\n${STR_OPENER}" license ${license_long})
+-        string(APPEND CONTENT ${STR_OPENER}${license}\n${STR_CLOSER},)
+-        string(APPEND CONTENT "\n\n")
++        if(EXISTS ${license_path})
++            string(APPEND CONTENT "${STR_OPENER}License and copyrights for ${module}:\n${STR_CLOSER},\n")
++            file(READ ${license_path} license_long)
++            string(REPLACE "\n" "${STR_CLOSER},\n${STR_OPENER}" license ${license_long})
++            string(APPEND CONTENT ${STR_OPENER}${license}\n${STR_CLOSER},)
++            string(APPEND CONTENT "\n\n")
++        endif()
+     endforeach()
+     configure_file(${FILAMENT}/build/licenses.inc.in ${OUTPUT})
+ endfunction(list_licenses)
diff --git a/patches/0006-Adjust-linker-flags.patch b/patches/0006-Adjust-linker-flags.patch
new file mode 100644 (file)
index 0000000..981f96e
--- /dev/null
@@ -0,0 +1,35 @@
+From: =?utf-8?q?Timo_R=C3=B6hling?= <roehling@debian.org>
+Date: Sat, 23 Oct 2021 19:22:50 +0200
+Subject: Adjust linker flags
+
+---
+ CMakeLists.txt | 9 +--------
+ 1 file changed, 1 insertion(+), 8 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 8d674dc..ce4192c 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -331,12 +331,6 @@ endif()
+ # ==================================================================================================
+ # Linker flags
+ # ==================================================================================================
+-# Strip unused sections
+-if (NOT WEBGL)
+-    set(GC_SECTIONS "-Wl,--gc-sections")
+-endif()
+-set(B_SYMBOLIC_FUNCTIONS "-Wl,-Bsymbolic-functions")
+-
+ if (APPLE)
+     set(GC_SECTIONS "-Wl,-dead_strip")
+     set(B_SYMBOLIC_FUNCTIONS "")
+@@ -349,8 +343,7 @@ if (APPLE)
+     set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> qc -S <TARGET> <LINK_FLAGS> <OBJECTS>")
+ endif()
+-set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GC_SECTIONS}")
+-set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${GC_SECTIONS} ${B_SYMBOLIC_FUNCTIONS}")
++set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,defs")
+ if (WEBGL)
+     set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s USE_WEBGL2=1")
diff --git a/patches/0007-Link-against-libatomic.patch b/patches/0007-Link-against-libatomic.patch
new file mode 100644 (file)
index 0000000..4c36356
--- /dev/null
@@ -0,0 +1,21 @@
+From: =?utf-8?q?Timo_R=C3=B6hling?= <roehling@debian.org>
+Date: Sat, 23 Oct 2021 19:54:35 +0200
+Subject: Link against libatomic
+
+---
+ libs/utils/CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libs/utils/CMakeLists.txt b/libs/utils/CMakeLists.txt
+index b80de97..2a115f0 100644
+--- a/libs/utils/CMakeLists.txt
++++ b/libs/utils/CMakeLists.txt
+@@ -101,7 +101,7 @@ if (LINUX)
+     set(THREADS_PREFER_PTHREAD_FLAG ON)
+     find_package(Threads REQUIRED)
+     target_link_libraries(${TARGET} PRIVATE Threads::Threads)
+-    target_link_libraries(${TARGET} PRIVATE dl)
++    target_link_libraries(${TARGET} PRIVATE dl atomic)
+ endif()
+ # ==================================================================================================
diff --git a/patches/0008-Migrate-to-astc-encoder-API-from-Debian-package.patch b/patches/0008-Migrate-to-astc-encoder-API-from-Debian-package.patch
new file mode 100644 (file)
index 0000000..2198cfe
--- /dev/null
@@ -0,0 +1,349 @@
+From: =?utf-8?q?Timo_R=C3=B6hling?= <roehling@debian.org>
+Date: Sat, 23 Oct 2021 19:17:50 +0200
+Subject: Migrate to astc-encoder API from Debian package
+
+---
+ libs/imageio/src/BlockCompression.cpp | 291 +++++++++-------------------------
+ 1 file changed, 75 insertions(+), 216 deletions(-)
+
+diff --git a/libs/imageio/src/BlockCompression.cpp b/libs/imageio/src/BlockCompression.cpp
+index 57b607e..16cc0d0 100644
+--- a/libs/imageio/src/BlockCompression.cpp
++++ b/libs/imageio/src/BlockCompression.cpp
+@@ -21,6 +21,7 @@
+ #include <algorithm>
+ #include <cmath>
+ #include <cstring>
++#include <iostream>
+ #include <thread>
+ #include <astcenc.h>
+@@ -29,22 +30,17 @@
+ #define STB_DXT_IMPLEMENTATION
+ #include <stb_dxt.h>
++extern "C"
++{
++    uint16_t float_to_sf16(float val);
++}
++
+ namespace image {
+ static LinearImage extendToFourChannels(LinearImage source);
+ CompressedTexture astcCompress(const LinearImage& original, AstcConfig config) {
+-    // If this is the first time, initialize the ARM encoder tables.
+-
+-    static bool first = true;
+-    if (first) {
+-        test_inappropriate_extended_precision();
+-        prepare_angular_tables();
+-        build_quantization_mode_table();
+-        first = false;
+-    }
+-
+     // Check the validity of the given block size.
+     using Format = CompressedFormat;
+@@ -81,231 +77,94 @@ CompressedTexture astcCompress(const LinearImage& original, AstcConfig config) {
+         return {};
+     }
+-    // Create an input image for the ARM encoder in a format that it can consume.
+-    // It expects four-channel data, so we extend or curtail the channel count in a reasonable way.
+-    // The encoder can take half-floats or bytes, but we always give it half-floats.
+-
+-    LinearImage source = extendToFourChannels(original);
+-    const uint32_t width = source.getWidth();
+-    const uint32_t height = source.getHeight();
+-    astc_codec_image* input_image = allocate_image(16, width, height, 1, 0);
+-    for (int y = 0; y < height; y++) {
+-        auto imagedata16 = input_image->imagedata16[0][y];
+-        float const* src = source.getPixelRef(0, y);
+-        for (int x = 0; x < width; x++) {
+-            imagedata16[4 * x] = float_to_sf16(src[4 * x], SF_NEARESTEVEN);
+-            imagedata16[4 * x + 1] = float_to_sf16(src[4 * x + 1], SF_NEARESTEVEN);
+-            imagedata16[4 * x + 2] = float_to_sf16(src[4 * x + 2], SF_NEARESTEVEN);
+-            imagedata16[4 * x + 3] = float_to_sf16(src[4 * x + 3], SF_NEARESTEVEN);
+-        }
+-    }
+-
+-    // Determine the bitrate based on the specified block size.
+-
+-    int xdim_2d = config.blocksize.x, ydim_2d = config.blocksize.y;
+-    const float log10_texels_2d = std::log((float)(xdim_2d * ydim_2d)) / std::log(10.0f);
+-    const float bitrate = 128.0 / (xdim_2d * ydim_2d);
+-
+-    // We do not fully support 3D textures yet, but we include some of the 3D config params anyway.
+-
+-    int xdim_3d, ydim_3d, zdim_3d;
+-    find_closest_blockdim_3d(bitrate, &xdim_3d, &ydim_3d, &zdim_3d, 0);
+-    const float log10_texels_3d = std::log((float)(xdim_3d * ydim_3d * zdim_3d)) / log(10.0f);
+-
+-    // Set up presets.
+-
+-    int plimit_autoset;
+-    float oplimit_autoset;
+-    float dblimit_autoset_2d;
+-    float dblimit_autoset_3d;
+-    float bmc_autoset;
+-    float mincorrel_autoset;
+-    int maxiters_autoset;
+-    int pcdiv;
+-
++    // Configure encoder
++    astcenc_config my_config;
++    float quality;
+     switch (config.quality) {
+         case AstcPreset::VERYFAST:
+-            plimit_autoset = 2;
+-            oplimit_autoset = 1.0;
+-            dblimit_autoset_2d = fmax(70 - 35 * log10_texels_2d, 53 - 19 * log10_texels_2d);
+-            dblimit_autoset_3d = fmax(70 - 35 * log10_texels_3d, 53 - 19 * log10_texels_3d);
+-            bmc_autoset = 25;
+-            mincorrel_autoset = 0.5;
+-            maxiters_autoset = 1;
+-            switch (ydim_2d) {
+-                case 4: pcdiv = 240; break;
+-                case 5: pcdiv = 56; break;
+-                case 6: pcdiv = 64; break;
+-                case 8: pcdiv = 47; break;
+-                case 10: pcdiv = 36; break;
+-                case 12: pcdiv = 30; break;
+-                default: pcdiv = 30; break;
+-            }
++            quality = ASTCENC_PRE_FASTEST;
+             break;
+         case AstcPreset::FAST:
+-            plimit_autoset = 4;
+-            oplimit_autoset = 1.0;
+-            dblimit_autoset_2d = fmax(85 - 35 * log10_texels_2d, 63 - 19 * log10_texels_2d);
+-            dblimit_autoset_3d = fmax(85 - 35 * log10_texels_3d, 63 - 19 * log10_texels_3d);
+-            bmc_autoset = 50;
+-            mincorrel_autoset = 0.5;
+-            maxiters_autoset = 1;
+-            switch (ydim_2d) {
+-                case 4: pcdiv = 60; break;
+-                case 5: pcdiv = 27; break;
+-                case 6: pcdiv = 30; break;
+-                case 8: pcdiv = 24; break;
+-                case 10: pcdiv = 16; break;
+-                case 12: pcdiv = 20; break;
+-                default: pcdiv = 20; break;
+-            }
++            quality = ASTCENC_PRE_FAST;
+             break;
+         case AstcPreset::MEDIUM:
+-            plimit_autoset = 25;
+-            oplimit_autoset = 1.2;
+-            dblimit_autoset_2d = fmax(95 - 35 * log10_texels_2d, 70 - 19 * log10_texels_2d);
+-            dblimit_autoset_3d = fmax(95 - 35 * log10_texels_3d, 70 - 19 * log10_texels_3d);
+-            bmc_autoset = 75;
+-            mincorrel_autoset = 0.75;
+-            maxiters_autoset = 2;
+-            switch (ydim_2d) {
+-                case 4: pcdiv = 25; break;
+-                case 5: pcdiv = 15; break;
+-                case 6: pcdiv = 15; break;
+-                case 8: pcdiv = 10; break;
+-                case 10: pcdiv = 8; break;
+-                case 12: pcdiv = 6; break;
+-                default: pcdiv = 6; break;
+-            }
++            quality = ASTCENC_PRE_MEDIUM;
+             break;
+         case AstcPreset::THOROUGH:
+-            plimit_autoset = 100;
+-            oplimit_autoset = 2.5;
+-            dblimit_autoset_2d = fmax(105 - 35 * log10_texels_2d, 77 - 19 * log10_texels_2d);
+-            dblimit_autoset_3d = fmax(105 - 35 * log10_texels_3d, 77 - 19 * log10_texels_3d);
+-            bmc_autoset = 95;
+-            mincorrel_autoset = 0.95f;
+-            maxiters_autoset = 4;
+-            switch (ydim_2d) {
+-                case 4: pcdiv = 12; break;
+-                case 5: pcdiv = 7; break;
+-                case 6: pcdiv = 7; break;
+-                case 8: pcdiv = 5; break;
+-                case 10: pcdiv = 4; break;
+-                case 12: pcdiv = 3; break;
+-                default: pcdiv = 3; break;
+-            }
++            quality = ASTCENC_PRE_THOROUGH;
+             break;
+         case AstcPreset::EXHAUSTIVE:
+-            plimit_autoset = 1 << 10;
+-            oplimit_autoset = 1000.0;
+-            dblimit_autoset_2d = 999.0f;
+-            dblimit_autoset_3d = 999.0f;
+-            bmc_autoset = 100;
+-            mincorrel_autoset = 0.99;
+-            maxiters_autoset = 4;
+-            switch (ydim_2d) {
+-                case 4: pcdiv = 3; break;
+-                case 5: pcdiv = 1; break;
+-                case 6: pcdiv = 1; break;
+-                case 8: pcdiv = 1; break;
+-                case 10: pcdiv = 1; break;
+-                case 12: pcdiv = 1; break;
+-                default: pcdiv = 1; break;
+-            }
++            quality = ASTCENC_PRE_EXHAUSTIVE;
+             break;
+     }
++    astcenc_config_init(
++        config.semantic == AstcSemantic::COLORS_HDR ?
++            ASTCENC_PRF_HDR :
++            (config.srgb ? ASTCENC_PRF_LDR_SRGB : ASTCENC_PRF_LDR),
++        config.blocksize.x,
++        config.blocksize.y,
++        1,
++        quality,
++        config.semantic == AstcSemantic::NORMALS ? ASTCENC_FLG_MAP_NORMAL : 0,
++        &my_config
++    );
++
++    // Create encoding context
++    const int threadcount = 1; // std::thread::hardware_concurrency();
++    astcenc_context *context;
++    astcenc_context_alloc(&my_config, threadcount, &context);
+-    if (plimit_autoset < 1) {
+-        plimit_autoset = 1;
+-    } else if (plimit_autoset > PARTITION_COUNT) {
+-        plimit_autoset = PARTITION_COUNT;
+-    }
++    // Create an input image for the ARM encoder in a format that it can consume.
++    // It expects four-channel data, so we extend or curtail the channel count in a reasonable way.
++    // The encoder can take half-floats or bytes, but we always give it half-floats.
+-    error_weighting_params ewp;
+-    ewp.rgb_power = 1.0f;
+-    ewp.alpha_power = 1.0f;
+-    ewp.rgb_base_weight = 1.0f;
+-    ewp.alpha_base_weight = 1.0f;
+-    ewp.rgb_mean_weight = 0.0f;
+-    ewp.rgb_stdev_weight = 0.0f;
+-    ewp.alpha_mean_weight = 0.0f;
+-    ewp.alpha_stdev_weight = 0.0f;
+-    ewp.rgb_mean_and_stdev_mixing = 0.0f;
+-    ewp.mean_stdev_radius = 0;
+-    ewp.enable_rgb_scale_with_alpha = 0;
+-    ewp.alpha_radius = 0;
+-    ewp.block_artifact_suppression = 0.0f;
+-    ewp.rgba_weights[0] = 1.0f;
+-    ewp.rgba_weights[1] = 1.0f;
+-    ewp.rgba_weights[2] = 1.0f;
+-    ewp.rgba_weights[3] = 1.0f;
+-    ewp.ra_normal_angular_scale = 0;
+-    ewp.max_refinement_iters = maxiters_autoset;
+-    ewp.block_mode_cutoff = bmc_autoset / 100.0f;
+-    ewp.texel_avg_error_limit = pow(0.1f, dblimit_autoset_2d * 0.1f) * 65535.0f * 65535.0f;
+-    ewp.partition_1_to_2_limit = oplimit_autoset;
+-    ewp.lowest_correlation_cutoff = mincorrel_autoset;
+-    ewp.partition_search_limit = plimit_autoset;
+-
+-    // For now we do not support 3D textures but we keep the variable names consistent
+-    // with what's found in the ARM standalone tool.
+-    int xdim = xdim_2d, ydim = ydim_2d, zdim = 1;
+-    expand_block_artifact_suppression(xdim, ydim, zdim, &ewp);
+-
+-    // Perform compression.
+-
+-    swizzlepattern swz_encode = { 0, 1, 2, 3 };
+-    swizzlepattern swz_decode = { 0, 1, 2, 3 };
+-    astc_decode_mode decode_mode;
+-    switch (config.semantic) {
+-        case AstcSemantic::COLORS_LDR:
+-            decode_mode = config.srgb ? DECODE_LDR_SRGB : DECODE_LDR;
+-            break;
+-        case AstcSemantic::COLORS_HDR:
+-            decode_mode = DECODE_HDR;
+-            break;
+-        case AstcSemantic::NORMALS:
+-            decode_mode = config.srgb ? DECODE_LDR_SRGB : DECODE_LDR;
+-            ewp.rgba_weights[0] = 1.0f;
+-            ewp.rgba_weights[1] = 0.0f;
+-            ewp.rgba_weights[2] = 0.0f;
+-            ewp.rgba_weights[3] = 1.0f;
+-            ewp.ra_normal_angular_scale = 1;
+-            swz_encode.r = 0;
+-            swz_encode.g = 0;
+-            swz_encode.b = 0;
+-            swz_encode.a = 1;
+-            swz_decode.r = 0;
+-            swz_decode.g = 3;
+-            swz_decode.b = 6;
+-            swz_decode.a = 5;
+-            ewp.block_artifact_suppression = 1.8f;
+-            ewp.mean_stdev_radius = 3;
+-            ewp.rgb_mean_weight = 0;
+-            ewp.rgb_stdev_weight = 50;
+-            ewp.rgb_mean_and_stdev_mixing = 0.0;
+-            ewp.alpha_mean_weight = 0;
+-            ewp.alpha_stdev_weight = 50;
+-            break;
++    LinearImage source = extendToFourChannels(original);
++    const uint32_t width = source.getWidth();
++    const uint32_t height = source.getHeight();
++    astcenc_image input_image;
++    uint16_t *imagedata = new uint16_t[4 * width * height];
++    input_image.dim_x = width;
++    input_image.dim_y = height;
++    input_image.dim_z = 1;
++    input_image.data_type = ASTCENC_TYPE_F16;
++    input_image.data = reinterpret_cast<void**>(&imagedata);
++    for (int y = 0; y < height; y++) {
++        auto imagedata16 = &imagedata[4 * width * y];
++        float const* src = source.getPixelRef(0, y);
++        for (int x = 0; x < width; x++) {
++            imagedata16[4 * x] = float_to_sf16(src[4 * x]);
++            imagedata16[4 * x + 1] = float_to_sf16(src[4 * x + 1]);
++            imagedata16[4 * x + 2] = float_to_sf16(src[4 * x + 2]);
++            imagedata16[4 * x + 3] = float_to_sf16(src[4 * x + 3]);
++        }
+     }
+-    const int threadcount = std::thread::hardware_concurrency();
+-
+-    const int xsize = input_image->xsize;
+-    const int ysize = input_image->ysize;
+-    const int zsize = input_image->zsize;
+-    const int xblocks = (xsize + xdim - 1) / xdim;
+-    const int yblocks = (ysize + ydim - 1) / ydim;
+-    const int zblocks = (zsize + zdim - 1) / zdim;
++    const int xblocks = (width + my_config.block_x - 1) / my_config.block_x;
++    const int yblocks = (height + my_config.block_y - 1) / my_config.block_y;
++    const astcenc_swizzle swz = { ASTCENC_SWZ_R, ASTCENC_SWZ_G, ASTCENC_SWZ_B, ASTCENC_SWZ_A };
+-    uint32_t size = xblocks * yblocks * zblocks * 16;
++    uint32_t size = xblocks * yblocks * 16;
+     uint8_t* buffer = new uint8_t[size];
+-    encode_astc_image(input_image, nullptr, xdim, ydim, zdim, &ewp, decode_mode,
+-            swz_encode, swz_decode, buffer, 0, threadcount);
+-
+-    destroy_image(input_image);
++    // TODO Run this threadcount times in parallel
++    astcenc_error err = astcenc_compress_image(
++            context,
++            &input_image,
++            &swz,
++            buffer,
++            size,
++            0
++    );
++
++    delete[] imagedata;
++    astcenc_context_free(context);
++
++    if (err != 0)
++    {
++        std::cerr << "astcCompress: error: " << astcenc_get_error_string(err) << "\n";
++        free(buffer);
++        return {};
++    }
+     return {
+         .format = format,
diff --git a/patches/0009-Fix-library-export-for-Debian.patch b/patches/0009-Fix-library-export-for-Debian.patch
new file mode 100644 (file)
index 0000000..bff21de
--- /dev/null
@@ -0,0 +1,1499 @@
+From: =?utf-8?q?Timo_R=C3=B6hling?= <roehling@debian.org>
+Date: Tue, 25 Jan 2022 22:04:07 +0100
+Subject: Fix library export for Debian
+
+---
+ CMakeLists.txt                           | 24 ++++++++++--
+ filament/CMakeLists.txt                  | 54 +++++++++++++++++++--------
+ filament/backend/CMakeLists.txt          | 47 ++++++++++++++++--------
+ filament/benchmark/CMakeLists.txt        |  3 +-
+ filament/test/CMakeLists.txt             |  4 +-
+ libs/bluegl/CMakeLists.txt               |  2 +-
+ libs/bluevk/CMakeLists.txt               |  4 +-
+ libs/camutils/CMakeLists.txt             | 24 ++++++++----
+ libs/filabridge/CMakeLists.txt           | 34 +++++++++++++----
+ libs/filaflat/CMakeLists.txt             | 35 +++++++++---------
+ libs/filagui/CMakeLists.txt              | 27 +++++++++++---
+ libs/filamat/CMakeLists.txt              | 61 +++++++++++++++++++++----------
+ libs/filameshio/CMakeLists.txt           | 30 +++++++++++----
+ libs/geometry/CMakeLists.txt             | 24 ++++++++----
+ libs/gltfio/CMakeLists.txt               | 54 ++++++++++++++++++++-------
+ libs/ibl/CMakeLists.txt                  | 45 ++++++++++++++++-------
+ libs/iblprefilter/CMakeLists.txt         | 31 ++++++++++------
+ libs/image/CMakeLists.txt                | 34 +++++++++++------
+ libs/imageio/CMakeLists.txt              | 26 ++++++++++---
+ libs/matdbg/CMakeLists.txt               | 63 ++++++++++++++++----------------
+ libs/math/CMakeLists.txt                 | 19 ++++++----
+ libs/mathio/CMakeLists.txt               | 23 ++++++++----
+ libs/utils/CMakeLists.txt                | 31 +++++++++-------
+ libs/viewer/CMakeLists.txt               | 24 +++++++++---
+ shaders/CMakeLists.txt                   | 10 ++++-
+ tools/cmgen/CMakeLists.txt               |  4 +-
+ tools/cso-lut/CMakeLists.txt             |  2 +-
+ tools/filamesh/CMakeLists.txt            |  2 +-
+ tools/glslminifier/CMakeLists.txt        |  2 +-
+ tools/matc/CMakeLists.txt                |  4 +-
+ tools/matinfo/CMakeLists.txt             |  4 +-
+ tools/mipgen/CMakeLists.txt              |  2 +-
+ tools/normal-blending/CMakeLists.txt     |  2 +-
+ tools/roughness-prefilter/CMakeLists.txt |  2 +-
+ 34 files changed, 508 insertions(+), 249 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index ce4192c..a95c557 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -577,15 +577,20 @@ endfunction()
+ # External dependencies
+ # ==================================================================================================
+ find_package(GTest REQUIRED)
++find_package(astcenc REQUIRED)
+ find_package(tsl-robin-map REQUIRED)
+ find_package(meshoptimizer REQUIRED)
+ find_package(draco REQUIRED)
++set(THREADS_PREFER_PTHREAD_FLAG ON)
++find_package(Threads REQUIRED)
+ if(IS_HOST_PLATFORM)
+     find_package(PNG REQUIRED)
+     find_package(SDL2 REQUIRED)
+     find_package(ZLIB REQUIRED)
+     find_package(tinyexr REQUIRED)
+ endif()
++include(debian/cmake/imgui.cmake)
++include(debian/cmake/stb.cmake)
+ # ==================================================================================================
+ # Sub-projects
+@@ -610,12 +615,10 @@ add_subdirectory(${FILAMENT}/filament)
+ add_subdirectory(${FILAMENT}/shaders)
+ add_subdirectory(${EXTERNAL}/civetweb/tnt)
+ add_subdirectory(${EXTERNAL}/hat-trie/tnt)
+-include(debian/cmake/imgui.cmake)
+ add_subdirectory(${EXTERNAL}/smol-v/tnt)
+ include(debian/cmake/benchmark.cmake)
+ add_subdirectory(${EXTERNAL}/cgltf/tnt)
+ include(debian/cmake/jsmn.cmake)
+-include(debian/cmake/stb.cmake)
+ add_subdirectory(${EXTERNAL}/getopt)
+ if (FILAMENT_BUILD_FILAMAT OR IS_HOST_PLATFORM)
+@@ -653,7 +656,6 @@ if (IS_HOST_PLATFORM)
+     add_subdirectory(${FILAMENT}/samples)
+-    add_subdirectory(${EXTERNAL}/astcenc/tnt)
+     add_subdirectory(${EXTERNAL}/etc2comp)
+     include(debian/cmake/libassimp.cmake)
+@@ -674,3 +676,19 @@ endif()
+ if (NOT CMAKE_CROSSCOMPILING)
+     export(TARGETS matc cmgen filamesh mipgen resgen glslminifier FILE ${IMPORT_EXECUTABLES})
+ endif()
++
++include(CMakePackageConfigHelpers)
++configure_package_config_file(debian/cmake/package-config.cmake.in filamentConfig.cmake
++    INSTALL_DESTINATION ${FILAMENT_CMAKEDIR}
++    NO_SET_AND_CHECK_MACRO
++    NO_CHECK_REQUIRED_COMPONENTS_MACRO
++)
++write_basic_package_version_file(filamentConfigVersion.cmake
++    VERSION ${FILAMENT_VERSION}
++    COMPATIBILITY SameMinorVersion
++)
++install(EXPORT filamentTargets NAMESPACE filament:: DESTINATION ${FILAMENT_CMAKEDIR})
++install(FILES ${CMAKE_CURRENT_BINARY_DIR}/filamentConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/filamentConfigVersion.cmake DESTINATION ${FILAMENT_CMAKEDIR})
++install(FILES debian/cmake/imgui.cmake DESTINATION ${FILAMENT_CMAKEDIR})
++install(FILES debian/cmake/stb.cmake DESTINATION ${FILAMENT_CMAKEDIR})
++
+diff --git a/filament/CMakeLists.txt b/filament/CMakeLists.txt
+index 09c77eb..514e430 100644
+--- a/filament/CMakeLists.txt
++++ b/filament/CMakeLists.txt
+@@ -345,31 +345,52 @@ list(APPEND DATA_BINS ${output_path})
+ # ==================================================================================================
+ # Includes & target definition
+ # ==================================================================================================
+-# specify where our headers are
+-include_directories(${PUBLIC_HDR_DIR})
+-include_directories(${GENERATION_ROOT})
+-include_directories(src)
+ # we're building a library
+-add_library(${TARGET} STATIC ${PRIVATE_HDRS} ${PUBLIC_HDRS} ${SRCS} ${DATA_BINS})
++add_library(${TARGET} SHARED ${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 
++    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
++    $<INSTALL_INTERFACE:${FILAMENT_INCLUDEDIR}>
++)
++target_include_directories(${TARGET} PRIVATE
++    ${CMAKE_CURRENT_SOURCE_DIR}/src
++    ${GENERATION_ROOT}
++)
++set_target_properties(${TARGET} PROPERTIES
++    VERSION ${FILAMENT_VERSION}
++    SOVERSION ${FILAMENT_SOVERSION}
++)
++target_compile_features(${TARGET} PUBLIC cxx_std_17)
++add_library(filament::${TARGET} ALIAS ${TARGET})
++
++add_library(${TARGET}_headers INTERFACE)
++target_include_directories(${TARGET}_headers INTERFACE 
++    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
++    $<INSTALL_INTERFACE:${FILAMENT_INCLUDEDIR}>
++)
++set_target_properties(${TARGET}_headers PROPERTIES
++    EXPORT_NAME "${TARGET}::headers"
++)
++target_compile_features(${TARGET}_headers INTERFACE cxx_std_17)
++add_library(filament::${TARGET}::headers ALIAS ${TARGET}_headers)
+ # ==================================================================================================
+ # Dependencies
+ # ==================================================================================================
+-target_link_libraries(${TARGET} PUBLIC backend)
+-target_link_libraries(${TARGET} PUBLIC math)
+-target_link_libraries(${TARGET} PUBLIC utils)
+-target_link_libraries(${TARGET} PUBLIC geometry) # TODO: remove this dependency after deprecating VertexBuffer::populateTangentQuaternions
+-target_link_libraries(${TARGET} PUBLIC filaflat)
+-target_link_libraries(${TARGET} PUBLIC filabridge)
+-target_link_libraries(${TARGET} PUBLIC ibl-lite)
++target_link_libraries(${TARGET} PUBLIC filament::backend)
++target_link_libraries(${TARGET} PUBLIC filament::math)
++target_link_libraries(${TARGET} PUBLIC filament::utils)
++target_link_libraries(${TARGET} PUBLIC filament::filabridge::headers)
++target_link_libraries(${TARGET} PRIVATE filament::geometry)
++target_link_libraries(${TARGET} PRIVATE filament::filaflat)
++target_link_libraries(${TARGET} PRIVATE filament::filabridge)
++target_link_libraries(${TARGET} PRIVATE filament::ibl_lite)
+ if (FILAMENT_ENABLE_MATDBG)
+-    target_link_libraries(${TARGET} PUBLIC matdbg)
++    target_link_libraries(${TARGET} PRIVATE filament::matdbg)
+     add_definitions(-DFILAMENT_ENABLE_MATDBG=1)
+ else()
+     add_definitions(-DFILAMENT_ENABLE_MATDBG=0)
+@@ -435,8 +456,8 @@ target_link_libraries(${TARGET} PRIVATE
+ # Installation
+ # ==================================================================================================
+ set(INSTALL_TYPE ARCHIVE)
+-install(TARGETS ${TARGET} ${INSTALL_TYPE} DESTINATION lib/${DIST_DIR})
+-install(DIRECTORY ${PUBLIC_HDR_DIR}/filament DESTINATION include)
++install(TARGETS ${TARGET} ${TARGET}_headers DESTINATION ${FILAMENT_LIBDIR} EXPORT filamentTargets)
++install(DIRECTORY ${PUBLIC_HDR_DIR}/filament DESTINATION ${FILAMENT_INCLUDEDIR})
+ install(FILES "README.md" DESTINATION .)
+ install(FILES "../LICENSE" DESTINATION .)
+@@ -446,3 +467,4 @@ install(FILES "../LICENSE" DESTINATION .)
+ add_subdirectory(backend)
+ add_subdirectory(test)
+ add_subdirectory(benchmark)
++
+diff --git a/filament/backend/CMakeLists.txt b/filament/backend/CMakeLists.txt
+index 19fa52d..f61faee 100644
+--- a/filament/backend/CMakeLists.txt
++++ b/filament/backend/CMakeLists.txt
+@@ -193,23 +193,38 @@ add_definitions(-DSYSTRACE_TAG=2 )
+ # ==================================================================================================
+ # Includes & target definition
+ # ==================================================================================================
+-# specify where our headers are
+-include_directories(${PUBLIC_HDR_DIR})
+-include_directories(src)
+-include_directories(${GENERATION_ROOT})
+-
+ # we're building a library
+-add_library(${TARGET} STATIC ${PRIVATE_HDRS} ${PUBLIC_HDRS} ${SRCS})
++add_library(${TARGET} SHARED ${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
++    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
++    $<INSTALL_INTERFACE:${FILAMENT_INCLUDEDIR}>
++)
++target_include_directories(${TARGET} PRIVATE
++    ${CMAKE_CURRENT_SOURCE_DIR}/src
++    ${GENERATION_ROOT}
++)
++set_target_properties(${TARGET} PROPERTIES
++    OUTPUT_NAME "filament_${TARGET}"
++    VERSION ${FILAMENT_VERSION}
++    SOVERSION ${FILAMENT_SOVERSION}
++)
++add_library(filament::${TARGET} ALIAS ${TARGET})
+ # ==================================================================================================
+ # Expose a header-only target to minimize dependencies.
+ # ==================================================================================================
+ add_library(${TARGET}_headers INTERFACE)
+-target_include_directories(${TARGET}_headers INTERFACE ${PUBLIC_HDR_DIR})
++target_include_directories(${TARGET}_headers INTERFACE
++    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
++    $<INSTALL_INTERFACE:${FILAMENT_INCLUDEDIR}>
++)
++set_target_properties(${TARGET}_headers PROPERTIES
++    EXPORT_NAME "${TARGET}::headers"
++)
++add_library(filament::${TARGET}::headers ALIAS ${TARGET}_headers)
+ # ==================================================================================================
+ # Build SPIRV snippets used by the Vulkan backend.
+@@ -249,6 +264,7 @@ set(DUMMY_SRC "${VKSHADERS_DIR}/dummy.c")
+ add_custom_command(OUTPUT ${DUMMY_SRC} COMMAND echo "//" > ${DUMMY_SRC})
+ add_library(vkshaders STATIC ${DUMMY_SRC} ${RESGEN_SOURCE})
++set_target_properties(vkshaders PROPERTIES OUTPUT_NAME "filament_vkshaders" VERSION ${FILAMENT_VERSION})
+ # ==================================================================================================
+ # Dependencies
+@@ -259,15 +275,15 @@ if (ANDROID)
+ endif()
+ if (FILAMENT_USE_SWIFTSHADER)
+-    target_link_libraries(${TARGET} PUBLIC ${SWIFTSHADER_VK})
++    target_link_libraries(${TARGET} PRIVATE ${SWIFTSHADER_VK})
+ endif()
+ if (APPLE AND NOT IOS)
+     target_link_libraries(${TARGET} PRIVATE "-framework Cocoa")
+ endif()
+-target_link_libraries(${TARGET} PUBLIC math)
+-target_link_libraries(${TARGET} PUBLIC utils)
++target_link_libraries(${TARGET} PUBLIC filament::math)
++target_link_libraries(${TARGET} PUBLIC filament::utils)
+ # Android, iOS, and WebGL do not use bluegl.
+ if(NOT IOS AND NOT ANDROID AND NOT WEBGL)
+@@ -275,7 +291,7 @@ if(NOT IOS AND NOT ANDROID AND NOT WEBGL)
+ endif()
+ if (FILAMENT_SUPPORTS_VULKAN)
+-    target_link_libraries(${TARGET} PUBLIC bluevk vkmemalloc vkshaders)
++    target_link_libraries(${TARGET} PRIVATE bluevk vkmemalloc vkshaders smol-v)
+ endif()
+ if (FILAMENT_SUPPORTS_METAL)
+@@ -283,6 +299,7 @@ if (FILAMENT_SUPPORTS_METAL)
+ endif()
+ if (LINUX)
++    target_link_libraries(${TARGET} PUBLIC Threads::Threads)
+     target_link_libraries(${TARGET} PRIVATE dl)
+ endif()
+@@ -343,9 +360,9 @@ target_link_libraries(${TARGET} PRIVATE
+ # Installation
+ # ==================================================================================================
+ set(INSTALL_TYPE ARCHIVE)
+-install(TARGETS ${TARGET} ${INSTALL_TYPE} DESTINATION lib/${DIST_DIR})
+-install(TARGETS vkshaders ${INSTALL_TYPE} DESTINATION lib/${DIST_DIR})
+-install(DIRECTORY ${PUBLIC_HDR_DIR}/backend DESTINATION include)
++install(TARGETS ${TARGET} DESTINATION ${FILAMENT_LIBDIR} EXPORT filamentTargets)
++install(TARGETS vkshaders backend_headers DESTINATION ${FILAMENT_LIBDIR} EXPORT filamentTargets)
++install(DIRECTORY ${PUBLIC_HDR_DIR}/backend DESTINATION ${FILAMENT_INCLUDEDIR})
+ # ==================================================================================================
+ # Test
+diff --git a/filament/benchmark/CMakeLists.txt b/filament/benchmark/CMakeLists.txt
+index 3a1c57f..a4ac6ef 100644
+--- a/filament/benchmark/CMakeLists.txt
++++ b/filament/benchmark/CMakeLists.txt
+@@ -10,4 +10,5 @@ set(BENCHMARK_SRCS
+ add_executable(benchmark_filament ${BENCHMARK_SRCS})
+-target_link_libraries(benchmark_filament PRIVATE benchmark_main utils math filament)
++target_include_directories(benchmark_filament PRIVATE ../src)
++target_link_libraries(benchmark_filament PRIVATE benchmark_main filament::utils filament::math filament::filament)
+diff --git a/filament/test/CMakeLists.txt b/filament/test/CMakeLists.txt
+index 6216701..5099da1 100644
+--- a/filament/test/CMakeLists.txt
++++ b/filament/test/CMakeLists.txt
+@@ -57,6 +57,6 @@ endif()
+ add_executable(test_material_parser
+         filament_test_material_parser.cpp
+         ${RESGEN_SOURCE})
+-target_link_libraries(test_material_parser PRIVATE filament gtest)
++target_link_libraries(test_material_parser PRIVATE filament::filament filament::filaflat GTest::gtest)
+ target_compile_options(test_material_parser PRIVATE ${COMPILER_FLAGS})
+-target_include_directories(test_material_parser PRIVATE ${RESOURCE_DIR})
++target_include_directories(test_material_parser PRIVATE ${RESOURCE_DIR} ../src)
+diff --git a/libs/bluegl/CMakeLists.txt b/libs/bluegl/CMakeLists.txt
+index 3f7ff83..b85c7f5 100644
+--- a/libs/bluegl/CMakeLists.txt
++++ b/libs/bluegl/CMakeLists.txt
+@@ -61,4 +61,4 @@ endif()
+ # and we're linking against the libraries below, importing their public headers
+ target_link_libraries(test_${TARGET} LINK_PUBLIC ${TARGET})
+-target_link_libraries(test_${TARGET} LINK_PUBLIC gtest)
++target_link_libraries(test_${TARGET} LINK_PUBLIC GTest::gtest)
+diff --git a/libs/bluevk/CMakeLists.txt b/libs/bluevk/CMakeLists.txt
+index eca0cd1..7b7d4e1 100644
+--- a/libs/bluevk/CMakeLists.txt
++++ b/libs/bluevk/CMakeLists.txt
+@@ -25,14 +25,14 @@ include_directories(${PUBLIC_HDR_DIR})
+ add_library(${TARGET} STATIC ${PUBLIC_HDRS} ${SRCS})
+-target_link_libraries(${TARGET} utils math)
++target_link_libraries(${TARGET} filament::utils filament::math)
+ target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR})
+ # test_bluevk is not supported on mobile or Windows
+ if (NOT ANDROID AND NOT IOS AND NOT WIN32)
+     add_executable(test_bluevk tests/test_bluevk_sdl.cpp)
+-    target_link_libraries(test_bluevk PRIVATE dl bluevk sdl2)
++    target_link_libraries(test_bluevk PRIVATE dl bluevk SDL2::SDL2)
+ endif()
+ install(TARGETS ${TARGET} ARCHIVE DESTINATION lib/${DIST_DIR})
+diff --git a/libs/camutils/CMakeLists.txt b/libs/camutils/CMakeLists.txt
+index de50254..43ef1f2 100644
+--- a/libs/camutils/CMakeLists.txt
++++ b/libs/camutils/CMakeLists.txt
+@@ -23,13 +23,21 @@ set(SRCS
+ # ==================================================================================================
+ # Include and target definitions
+ # ==================================================================================================
+-include_directories(${PUBLIC_HDR_DIR})
++add_library(${TARGET} SHARED ${PUBLIC_HDRS} ${SRCS})
+-add_library(${TARGET} STATIC ${PUBLIC_HDRS} ${SRCS})
++target_link_libraries(${TARGET} PUBLIC filament::math)
+-target_link_libraries(${TARGET} PUBLIC math)
+-
+-target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR})
++target_include_directories(${TARGET} PUBLIC
++    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
++    $<INSTALL_INTERFACE:${FILAMENT_INCLUDEDIR}>
++)
++target_compile_features(${TARGET} PUBLIC cxx_std_17)
++set_target_properties(${TARGET} PROPERTIES
++    OUTPUT_NAME "filament_${TARGET}"
++    VERSION ${FILAMENT_VERSION}
++    SOVERSION ${FILAMENT_SOVERSION}
++)
++add_library(filament::${TARGET} ALIAS ${TARGET})
+ # ==================================================================================================
+ # Compiler flags
+@@ -44,13 +52,13 @@ endif()
+ # ==================================================================================================
+ # Installation
+ # ==================================================================================================
+-install(TARGETS ${TARGET} ARCHIVE DESTINATION lib/${DIST_DIR})
+-install(DIRECTORY ${PUBLIC_HDR_DIR}/camutils DESTINATION include)
++install(TARGETS ${TARGET} DESTINATION ${FILAMENT_LIBDIR} EXPORT filamentTargets)
++install(DIRECTORY ${PUBLIC_HDR_DIR}/camutils DESTINATION ${FILAMENT_INCLUDEDIR})
+ # ==================================================================================================
+ # Tests
+ # ==================================================================================================
+ if (NOT ANDROID AND NOT WEBGL AND NOT IOS)
+     add_executable(test_${TARGET} tests/test_camutils.cpp)
+-    target_link_libraries(test_${TARGET} PRIVATE camutils gtest)
++    target_link_libraries(test_${TARGET} PRIVATE filament::camutils GTest::gtest)
+ endif()
+diff --git a/libs/filabridge/CMakeLists.txt b/libs/filabridge/CMakeLists.txt
+index 4b2691c..da2dddd 100644
+--- a/libs/filabridge/CMakeLists.txt
++++ b/libs/filabridge/CMakeLists.txt
+@@ -20,17 +20,35 @@ set(SRCS
+ # ==================================================================================================
+ # Include and target definitions
+ # ==================================================================================================
+-include_directories(${PUBLIC_HDR_DIR})
++add_library(${TARGET} SHARED ${PUBLIC_HDRS} ${SRCS})
++target_include_directories(${TARGET} PUBLIC
++    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
++    $<INSTALL_INTERFACE:${FILAMENT_INCLUDEDIR}>
++)
+-add_library(${TARGET} STATIC ${PUBLIC_HDRS} ${SRCS})
+-target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR})
++target_link_libraries(${TARGET} PRIVATE filament::utils)
++target_link_libraries(${TARGET} PUBLIC filament::math)
++target_link_libraries(${TARGET} PUBLIC filament::backend::headers)
++set_target_properties(${TARGET} PROPERTIES
++    OUTPUT_NAME "filament_${TARGET}"
++    VERSION ${FILAMENT_VERSION}
++    SOVERSION ${FILAMENT_SOVERSION}
++)
++target_compile_features(${TARGET} PUBLIC cxx_std_17)
++add_library(filament::${TARGET} ALIAS ${TARGET})
+-target_link_libraries(${TARGET} utils)
+-target_link_libraries(${TARGET} math)
+-target_link_libraries(${TARGET} backend_headers)
++add_library(${TARGET}_headers INTERFACE)
++target_include_directories(${TARGET}_headers INTERFACE
++    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
++    $<INSTALL_INTERFACE:${FILAMENT_INCLUDEDIR}>
++)
++set_target_properties(${TARGET}_headers PROPERTIES
++    EXPORT_NAME "${TARGET}::headers"
++)
++add_library(filament::${TARGET}::headers ALIAS ${TARGET}_headers)
+ # ==================================================================================================
+ # Installation
+ # ==================================================================================================
+-install(DIRECTORY ${PUBLIC_HDR_DIR}/filament DESTINATION include)
+-install(TARGETS ${TARGET} ARCHIVE DESTINATION lib/${DIST_DIR})
++install(DIRECTORY ${PUBLIC_HDR_DIR}/filament DESTINATION ${FILAMENT_INCLUDEDIR})
++install(TARGETS ${TARGET} ${TARGET}_headers DESTINATION ${FILAMENT_LIBDIR} EXPORT filamentTargets)
+diff --git a/libs/filaflat/CMakeLists.txt b/libs/filaflat/CMakeLists.txt
+index ce4927f..6a4a9e5 100644
+--- a/libs/filaflat/CMakeLists.txt
++++ b/libs/filaflat/CMakeLists.txt
+@@ -19,29 +19,28 @@ set(SRCS
+ # ==================================================================================================
+ # Include and target definitions
+ # ==================================================================================================
+-include_directories(${PUBLIC_HDR_DIR})
+-
+-add_library(${TARGET} ${HDRS} ${SRCS})
+-target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR})
+-
+-target_link_libraries(${TARGET} filabridge utils)
++add_library(${TARGET} SHARED ${HDRS} ${SRCS})
++target_include_directories(${TARGET} PUBLIC
++    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
++    $<INSTALL_INTERFACE:${FILAMENT_INCLUDEDIR}>
++)
++target_link_libraries(${TARGET} PRIVATE filament::filabridge)
++target_link_libraries(${TARGET} PUBLIC filament::utils)
++target_compile_features(${TARGET} PUBLIC cxx_std_17)
++set_target_properties(${TARGET} PROPERTIES
++    OUTPUT_NAME "filament_${TARGET}"
++    VERSION ${FILAMENT_VERSION}
++    SOVERSION ${FILAMENT_SOVERSION}
++)
++add_library(filament::${TARGET} ALIAS ${TARGET})
+ if (FILAMENT_SUPPORTS_VULKAN)
+-    target_link_libraries(${TARGET} smol-v)
+-endif()
+-
+-# ==================================================================================================
+-# Compiler flags
+-# ==================================================================================================
+-if (NOT WIN32)
+-    target_compile_options(${TARGET} PRIVATE
+-        -fvisibility=hidden
+-    )
++    target_link_libraries(${TARGET} PRIVATE smol-v)
+ endif()
+ # ==================================================================================================
+ # Installation
+ # ==================================================================================================
+ # We do not need filaflat headers in the install directory
+-# install(DIRECTORY ${PUBLIC_HDR_DIR}/filaflat DESTINATION include)
+-install(TARGETS ${TARGET} ARCHIVE DESTINATION lib/${DIST_DIR})
++install(DIRECTORY ${PUBLIC_HDR_DIR}/filaflat DESTINATION ${FILAMENT_INCLUDEDIR})
++install(TARGETS ${TARGET} DESTINATION ${FILAMENT_LIBDIR} EXPORT filamentTargets)
+diff --git a/libs/filagui/CMakeLists.txt b/libs/filagui/CMakeLists.txt
+index fe5373e..683d022 100644
+--- a/libs/filagui/CMakeLists.txt
++++ b/libs/filagui/CMakeLists.txt
+@@ -75,14 +75,31 @@ list(APPEND RESGEN_SOURCE ${DUMMY_SRC})
+ # ==================================================================================================
+ # Include and target definitions
+ # ==================================================================================================
+-include_directories(${PUBLIC_HDR_DIR})
+-include_directories(${GENERATION_ROOT})
++add_library(${TARGET} SHARED ${PUBLIC_HDRS} ${SRCS} ${RESGEN_SOURCE})
+-add_library(${TARGET} STATIC ${PUBLIC_HDRS} ${SRCS} ${RESGEN_SOURCE})
++target_link_libraries(${TARGET} PUBLIC filament::imgui filament::stb filament::filament)
+-target_link_libraries(${TARGET} PUBLIC imgui filament)
++target_include_directories(${TARGET} PUBLIC
++    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
++    $<INSTALL_INTERFACE:${FILAMENT_INCLUDEDIR}>
++)
++target_include_directories(${TARGET} PRIVATE
++    ${GENERATION_ROOT}
++)
++target_compile_features(${TARGET} PUBLIC cxx_std_17)
++set_target_properties(${TARGET} PROPERTIES
++    OUTPUT_NAME "filament_${TARGET}"
++    VERSION ${FILAMENT_VERSION}
++    SOVERSION ${FILAMENT_SOVERSION}
++)
++add_library(filament::${TARGET} ALIAS ${TARGET})
+-target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR})
++
++# ==================================================================================================
++# Installation
++# ==================================================================================================
++install(TARGETS ${TARGET} DESTINATION ${FILAMENT_LIBDIR} EXPORT filamentTargets)
++install(DIRECTORY ${PUBLIC_HDR_DIR}/filagui DESTINATION ${FILAMENT_INCLUDEDIR})
+ # ==================================================================================================
+ # Compiler flags
+diff --git a/libs/filamat/CMakeLists.txt b/libs/filamat/CMakeLists.txt
+index 9645004..a130f0c 100644
+--- a/libs/filamat/CMakeLists.txt
++++ b/libs/filamat/CMakeLists.txt
+@@ -84,18 +84,36 @@ include_directories(${PUBLIC_HDR_DIR})
+ include_directories(${CMAKE_BINARY_DIR})
+ # Filamat
+-add_library(${TARGET} STATIC ${HDRS} ${PRIVATE_HDRS} ${SRCS})
+-target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR})
+-target_link_libraries(${TARGET} shaders filabridge utils smol-v)
++add_library(${TARGET} SHARED ${HDRS} ${PRIVATE_HDRS} ${SRCS})
++target_include_directories(${TARGET} PUBLIC
++    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
++    $<INSTALL_INTERFACE:${FILAMENT_INCLUDEDIR}>
++)
++target_compile_features(${TARGET} PUBLIC cxx_std_17)
++set_target_properties(${TARGET} PROPERTIES
++    OUTPUT_NAME "filament_${TARGET}"
++    VERSION ${FILAMENT_VERSION}
++    SOVERSION ${FILAMENT_SOVERSION}
++)
++target_link_libraries(${TARGET} PRIVATE filament::shaders filament::filabridge smol-v)
++target_link_libraries(${TARGET} PUBLIC filament::utils)
++add_library(filament::${TARGET} ALIAS ${TARGET})
+ # Filamat Lite
+-add_library(filamat_lite STATIC ${HDRS} ${LITE_PRIVATE_HDRS} ${LITE_SRCS})
+-target_include_directories(filamat_lite PUBLIC ${PUBLIC_HDR_DIR})
+-target_link_libraries(filamat_lite shaders filabridge utils)
+-
+-# We are being naughty and accessing private headers here
+-# For spirv-tools, we're just following glslang's example
+-target_include_directories(${TARGET} PRIVATE ${spirv-tools_SOURCE_DIR}/include)
++add_library(filamat_lite SHARED ${HDRS} ${LITE_PRIVATE_HDRS} ${LITE_SRCS})
++target_include_directories(filamat_lite PUBLIC
++    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
++    $<INSTALL_INTERFACE:${FILAMENT_INCLUDEDIR}>
++)
++target_link_libraries(filamat_lite PRIVATE filament::shaders filament::filabridge)
++target_link_libraries(filamat_lite PUBLIC filament::utils)
++target_compile_features(filamat_lite PUBLIC cxx_std_17)
++set_target_properties(filamat_lite PROPERTIES
++    OUTPUT_NAME "filament_filamat_lite"
++    VERSION ${FILAMENT_VERSION}
++    SOVERSION ${FILAMENT_SOVERSION}
++)
++add_library(filament::filamat_lite ALIAS filamat_lite)
+ # glslang libraries have circular dependencies. To make sure the proper object are part of the link
+ # we need to force archive re-scan on new symbol dependencies via start/end-group.
+@@ -103,7 +121,7 @@ target_include_directories(${TARGET} PRIVATE ${spirv-tools_SOURCE_DIR}/include)
+ if (APPLE OR MSVC)
+     target_link_libraries(${TARGET} glslang SPIRV SPVRemapper SPIRV-Tools-opt spirv-cross-glsl)
+ else()
+-    target_link_libraries(${TARGET}
++    target_link_libraries(${TARGET} PRIVATE
+             -Wl,--start-group glslang SPIRV SPVRemapper SPIRV-Tools-opt spirv-cross-glsl -Wl,--end-group)
+ endif()
+@@ -151,14 +169,14 @@ set(FILAMAT_DEPS
+         spirv-cross-msl
+         )
+-set(FILAMAT_COMBINED_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/libfilamat_combined.a")
+-combine_static_libs(filamat "${FILAMAT_COMBINED_OUTPUT}" "${FILAMAT_DEPS}")
++#set(FILAMAT_COMBINED_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/libfilamat_combined.a")
++#combine_static_libs(filamat "${FILAMAT_COMBINED_OUTPUT}" "${FILAMAT_DEPS}")
+-set(FILAMAT_LIB_NAME ${CMAKE_STATIC_LIBRARY_PREFIX}filamat${CMAKE_STATIC_LIBRARY_SUFFIX})
+-install(FILES "${FILAMAT_COMBINED_OUTPUT}" DESTINATION lib/${DIST_DIR} RENAME ${FILAMAT_LIB_NAME})
+-install(DIRECTORY ${PUBLIC_HDR_DIR}/filamat DESTINATION include)
++#set(FILAMAT_LIB_NAME ${CMAKE_STATIC_LIBRARY_PREFIX}filamat${CMAKE_STATIC_LIBRARY_SUFFIX})
++#install(FILES "${FILAMAT_COMBINED_OUTPUT}" DESTINATION lib/${DIST_DIR} RENAME ${FILAMAT_LIB_NAME})
++install(DIRECTORY ${PUBLIC_HDR_DIR}/filamat DESTINATION ${FILAMENT_INCLUDEDIR})
+-install(TARGETS filamat_lite ARCHIVE DESTINATION lib/${DIST_DIR})
++install(TARGETS ${TARGET} filamat_lite DESTINATION ${FILAMENT_LIBDIR} EXPORT filamentTargets)
+ # ==================================================================================================
+ # Tests
+@@ -173,7 +191,9 @@ add_executable(${TARGET} ${SRCS})
+ target_include_directories(${TARGET} PRIVATE src)
+-target_link_libraries(${TARGET} filamat gtest)
++target_link_libraries(${TARGET} PRIVATE filament::backend filament::filabridge filament::filamat GTest::gtest)
++target_link_libraries(${TARGET} PRIVATE
++        -Wl,--start-group glslang SPIRV SPVRemapper SPIRV-Tools-opt spirv-cross-glsl -Wl,--end-group)
+ set(TARGET test_filamat_lite)
+ set(SRCS
+@@ -183,4 +203,7 @@ add_executable(${TARGET} ${SRCS})
+ target_include_directories(${TARGET} PRIVATE src)
+-target_link_libraries(${TARGET} filamat_lite gtest)
++target_link_libraries(${TARGET} PRIVATE filament::backend filament::filabridge filament::filamat_lite GTest::gtest)
++target_link_libraries(${TARGET} PRIVATE
++        -Wl,--start-group glslang SPIRV SPVRemapper SPIRV-Tools-opt spirv-cross-glsl -Wl,--end-group)
++
+diff --git a/libs/filameshio/CMakeLists.txt b/libs/filameshio/CMakeLists.txt
+index 7e7dc4e..2bbf51f 100644
+--- a/libs/filameshio/CMakeLists.txt
++++ b/libs/filameshio/CMakeLists.txt
+@@ -18,25 +18,39 @@ set(SRCS src/MeshReader.cpp)
+ # ==================================================================================================
+ # Includes and target definition
+ # ==================================================================================================
+-include_directories(${PUBLIC_HDR_DIR})
+-add_library(${TARGET} STATIC ${PUBLIC_HDRS} ${SRCS})
+-target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR})
++add_library(${TARGET} SHARED ${PUBLIC_HDRS} ${SRCS})
++target_include_directories(${TARGET} PUBLIC
++    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
++    $<INSTALL_INTERFACE:${FILAMENT_INCLUDEDIR}>
++)
++target_compile_features(${TARGET} PUBLIC cxx_std_17)
+ target_link_libraries(${TARGET}
+-    PRIVATE meshoptimizer
+-    PUBLIC filament # Public only because the filamesh API needs Box.h
++    PRIVATE
++        filament::filament
++        meshoptimizer::meshoptimizer
++    PUBLIC
++        filament::math
++        filament::utils
++        filament::filament::headers # Public only because the filamesh API needs Box.h
++)
++set_target_properties(${TARGET} PROPERTIES
++    OUTPUT_NAME "filament_${TARGET}"
++    VERSION ${FILAMENT_VERSION}
++    SOVERSION ${FILAMENT_SOVERSION}
+ )
++add_library(filament::${TARGET} ALIAS ${TARGET})
+ # ==================================================================================================
+ # Installation
+ # ==================================================================================================
+ set(INSTALL_TYPE ARCHIVE)
+-install(TARGETS ${TARGET} ${INSTALL_TYPE} DESTINATION lib/${DIST_DIR})
+-install(FILES ${DIST_HDRS} DESTINATION include/${TARGET})
++install(TARGETS ${TARGET} DESTINATION ${FILAMENT_LIBDIR} EXPORT filamentTargets)
++install(FILES ${DIST_HDRS} DESTINATION ${FILAMENT_INCLUDEDIR}/${TARGET})
+ # ==================================================================================================
+ # Tests
+ # ==================================================================================================
+ if (NOT IOS AND NOT WEBGL AND NOT ANDROID)
+     add_executable(test_${TARGET} tests/test_filamesh.cpp )
+-    target_link_libraries(test_${TARGET} PRIVATE filameshio gtest)
++    target_link_libraries(test_${TARGET} PRIVATE filament::filament filament::filameshio GTest::gtest)
+ endif()
+diff --git a/libs/geometry/CMakeLists.txt b/libs/geometry/CMakeLists.txt
+index 37db5a9..dd13c29 100644
+--- a/libs/geometry/CMakeLists.txt
++++ b/libs/geometry/CMakeLists.txt
+@@ -20,13 +20,21 @@ set(SRCS
+ # ==================================================================================================
+ # Include and target definitions
+ # ==================================================================================================
+-include_directories(${PUBLIC_HDR_DIR})
++add_library(${TARGET} SHARED ${PUBLIC_HDRS} ${SRCS})
+-add_library(${TARGET} STATIC ${PUBLIC_HDRS} ${SRCS})
++target_link_libraries(${TARGET} PUBLIC filament::math filament::utils)
+-target_link_libraries(${TARGET} PUBLIC math utils)
+-
+-target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR})
++target_include_directories(${TARGET} PUBLIC
++    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
++    $<INSTALL_INTERFACE:${FILAMENT_INCLUDEDIR}>
++)
++target_compile_features(${TARGET} PUBLIC cxx_std_17)
++set_target_properties(${TARGET} PROPERTIES
++    OUTPUT_NAME "filament_${TARGET}"
++    VERSION ${FILAMENT_VERSION}
++    SOVERSION ${FILAMENT_SOVERSION}
++)
++add_library(filament::${TARGET} ALIAS ${TARGET})
+ # ==================================================================================================
+ # Compiler flags
+@@ -41,13 +49,13 @@ endif()
+ # ==================================================================================================
+ # Installation
+ # ==================================================================================================
+-install(TARGETS ${TARGET} ARCHIVE DESTINATION lib/${DIST_DIR})
+-install(DIRECTORY ${PUBLIC_HDR_DIR}/geometry DESTINATION include)
++install(TARGETS ${TARGET} DESTINATION ${FILAMENT_LIBDIR} EXPORT filamentTargets)
++install(DIRECTORY ${PUBLIC_HDR_DIR}/geometry DESTINATION ${FILAMENT_INCLUDEDIR})
+ # ==================================================================================================
+ # Tests
+ # ==================================================================================================
+ if (NOT ANDROID AND NOT WEBGL AND NOT IOS)
+     add_executable(test_transcoder tests/test_transcoder.cpp)
+-    target_link_libraries(test_transcoder PRIVATE ${TARGET} gtest)
++    target_link_libraries(test_transcoder PRIVATE ${TARGET} GTest::gtest)
+ endif()
+diff --git a/libs/gltfio/CMakeLists.txt b/libs/gltfio/CMakeLists.txt
+index b759b0b..1f6ed14 100644
+--- a/libs/gltfio/CMakeLists.txt
++++ b/libs/gltfio/CMakeLists.txt
+@@ -106,6 +106,12 @@ set(DUMMY_SRC "${RESOURCE_DIR}/dummy.c")
+ add_custom_command(OUTPUT ${DUMMY_SRC} COMMAND echo "//" > ${DUMMY_SRC})
+ add_library(gltfio_resources ${DUMMY_SRC} ${RESGEN_SOURCE})
++set_target_properties(gltfio_resources PROPERTIES
++    OUTPUT_NAME "filament_gltfio_resources"
++    VERSION ${FILAMENT_VERSION}
++    SOVERSION ${FILAMENT_SOVERSION}
++)
++add_library(filament::gltfio_resources ALIAS gltfio_resources)
+ # ==================================================================================================
+ # Build "lite" resources library, which contains only a few materials
+@@ -157,29 +163,49 @@ set(DUMMY_SRC "${LITE_DIR}/dummy.c")
+ add_custom_command(OUTPUT ${DUMMY_SRC} COMMAND echo "//" > ${DUMMY_SRC})
+ add_library(gltfio_resources_lite ${DUMMY_SRC} ${RESGEN_SOURCE})
++set_target_properties(gltfio_resources_lite PROPERTIES
++    OUTPUT_NAME "filament_gltfio_resources_lite"
++    VERSION ${FILAMENT_VERSION}
++    SOVERSION ${FILAMENT_SOVERSION}
++)
++add_library(filament::gltfio_resources_lite ALIAS gltfio_resources_lite)
+ # ==================================================================================================
+ # Build the "core" library (no filamat)
+ # ==================================================================================================
+ include_directories(${PUBLIC_HDR_DIR} ${RESOURCE_DIR})
+-link_libraries(math utils filament cgltf stb geometry gltfio_resources tsl trie)
+-
+-add_library(gltfio_core STATIC ${PUBLIC_HDRS} ${SRCS})
+-target_include_directories(gltfio_core PUBLIC ${PUBLIC_HDR_DIR})
+-
+-target_compile_definitions(gltfio_core PUBLIC -DGLTFIO_DRACO_SUPPORTED=1)
+-target_link_libraries(gltfio_core PUBLIC dracodec)
++add_library(gltfio_core SHARED ${PUBLIC_HDRS} ${SRCS})
++target_include_directories(gltfio_core PUBLIC
++    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
++    $<INSTALL_INTERFACE:${FILAMENT_INCLUDEDIR}>
++)
++target_compile_features(gltfio_core PUBLIC cxx_std_17)
++target_compile_definitions(gltfio_core PRIVATE -DGLTFIO_DRACO_SUPPORTED=1)
++target_link_libraries(gltfio_core PRIVATE ${DRACO_LIBRARIES})
++target_link_libraries(gltfio_core PRIVATE filament::math filament::utils filament::filament cgltf filament::stb filament::geometry filament::gltfio_resources tsl::robin_map trie)
++set_target_properties(gltfio_core PROPERTIES
++    OUTPUT_NAME "filament_gltfio_core"
++    VERSION ${FILAMENT_VERSION}
++    SOVERSION ${FILAMENT_SOVERSION}
++)
++add_library(filament::gltfio_core ALIAS gltfio_core)
+ if (NOT WEBGL AND NOT ANDROID AND NOT IOS)
+     # ==================================================================================================
+     # Link the core library with additional dependencies to create the "full" library
+     # ==================================================================================================
+-    add_library(${TARGET} STATIC ${PUBLIC_HDRS} src/MaterialGenerator.cpp)
+-    target_link_libraries(${TARGET} PUBLIC filamat gltfio_core)
+-    target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR})
++    add_library(${TARGET} SHARED ${PUBLIC_HDRS} src/MaterialGenerator.cpp)
++    target_link_libraries(${TARGET} PUBLIC filament::filamat filament::gltfio_core)
++    target_link_libraries(${TARGET} PRIVATE filament::math filament::utils filament::filament cgltf stb filament::geometry filament::gltfio_resources tsl::robin_map trie)
++    target_compile_features(${TARGET} PUBLIC cxx_std_17)
++    set_target_properties(${TARGET} PROPERTIES
++        OUTPUT_NAME "filament_${TARGET}"
++        VERSION ${FILAMENT_VERSION}
++        SOVERSION ${FILAMENT_SOVERSION}
++    )
+     # ==================================================================================================
+     # Compiler flags
+@@ -194,9 +220,11 @@ if (NOT WEBGL AND NOT ANDROID AND NOT IOS)
+     # ==================================================================================================
+     # Installation
+     # ==================================================================================================
+-    install(TARGETS ${TARGET} gltfio_core gltfio_resources gltfio_resources_lite ARCHIVE DESTINATION lib/${DIST_DIR})
+-    install(DIRECTORY ${PUBLIC_HDR_DIR}/gltfio DESTINATION include)
+-
++    install(TARGETS ${TARGET} gltfio_core gltfio_resources gltfio_resources_lite DESTINATION ${FILAMENT_LIBDIR} EXPORT filamentTargets)
++    # The Image.h header is only needed within Filament and does not need to be distributed.
++    install(DIRECTORY ${PUBLIC_HDR_DIR}/gltfio
++        DESTINATION ${FILAMENT_INCLUDEDIR}
++        PATTERN "Image.h" EXCLUDE)
+ else()
+     install(TARGETS gltfio_core gltfio_resources gltfio_resources_lite ARCHIVE DESTINATION lib/${DIST_DIR})
+diff --git a/libs/ibl/CMakeLists.txt b/libs/ibl/CMakeLists.txt
+index 0719871..5faa579 100644
+--- a/libs/ibl/CMakeLists.txt
++++ b/libs/ibl/CMakeLists.txt
+@@ -31,32 +31,49 @@ set(SRCS
+ # ==================================================================================================
+ # Target definitions
+ # ==================================================================================================
+-include_directories(${PUBLIC_HDR_DIR})
+-
+-add_library(${TARGET} ${PUBLIC_HDRS} ${PRIVATE_HDRS} ${SRCS})
+-target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR})
+-target_link_libraries(${TARGET} math utils)
++add_library(${TARGET} SHARED ${PUBLIC_HDRS} ${PRIVATE_HDRS} ${SRCS})
++target_include_directories(${TARGET} PUBLIC
++    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
++    $<INSTALL_INTERFACE:${FILAMENT_INCLUDEDIR}>
++)
++target_link_libraries(${TARGET} PUBLIC filament::math filament::utils)
++target_compile_features(${TARGET} PUBLIC cxx_std_17)
++set_target_properties(${TARGET} PROPERTIES
++    OUTPUT_NAME "filament_${TARGET}"
++    VERSION ${FILAMENT_VERSION}
++    SOVERSION ${FILAMENT_SOVERSION}
++)
++add_library(filament::${TARGET} ALIAS ${TARGET})
+-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_link_libraries(${TARGET}-lite math utils)
++add_library(${TARGET}_lite SHARED ${PUBLIC_HDRS} ${PRIVATE_HDRS} ${SRCS})
++target_compile_definitions(${TARGET}_lite PUBLIC -DFILAMENT_IBL_LITE=1)
++target_compile_features(${TARGET}_lite PUBLIC cxx_std_17)
++target_include_directories(${TARGET}_lite PUBLIC
++    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
++    $<INSTALL_INTERFACE:${FILAMENT_INCLUDEDIR}>
++)
++target_link_libraries(${TARGET}_lite PUBLIC filament::math filament::utils)
++set_target_properties(${TARGET}_lite PROPERTIES
++    OUTPUT_NAME "filament_${TARGET}_lite"
++    VERSION ${FILAMENT_VERSION}
++    SOVERSION ${FILAMENT_SOVERSION}
++)
++add_library(filament::${TARGET}_lite ALIAS ${TARGET}_lite)
+ # ==================================================================================================
+ # Compile options and optimizations
+ # ==================================================================================================
+ if (MSVC)
+     target_compile_options(${TARGET} PRIVATE /fp:fast)
+-    target_compile_options(${TARGET}-lite PRIVATE /fp:fast)
++    target_compile_options(${TARGET}_lite PRIVATE /fp:fast)
+ else()
+     target_compile_options(${TARGET} PRIVATE -ffast-math)
+-    target_compile_options(${TARGET}-lite PRIVATE -ffast-math)
++    target_compile_options(${TARGET}_lite PRIVATE -ffast-math)
+ endif()
+ # ==================================================================================================
+ # Installation
+ # ==================================================================================================
+-install(TARGETS ${TARGET} ARCHIVE DESTINATION lib/${DIST_DIR})
+-install(TARGETS ${TARGET}-lite ARCHIVE DESTINATION lib/${DIST_DIR})
+-install(DIRECTORY ${PUBLIC_HDR_DIR}/ibl DESTINATION include)
++install(TARGETS ${TARGET} ${TARGET}_lite DESTINATION ${FILAMENT_LIBDIR} EXPORT filamentTargets)
++install(DIRECTORY ${PUBLIC_HDR_DIR}/ibl DESTINATION ${FILAMENT_INCLUDEDIR})
+diff --git a/libs/iblprefilter/CMakeLists.txt b/libs/iblprefilter/CMakeLists.txt
+index 6bf2237..b78b8c9 100644
+--- a/libs/iblprefilter/CMakeLists.txt
++++ b/libs/iblprefilter/CMakeLists.txt
+@@ -78,24 +78,33 @@ endif()
+ # ==================================================================================================
+ # Includes & target definition
+ # ==================================================================================================
+-# specify where our headers are
+-include_directories(${PUBLIC_HDR_DIR})
+-include_directories(${GENERATION_ROOT})
+-include_directories(src)
+ # we're building a library
+-add_library(${TARGET} STATIC ${PRIVATE_HDRS} ${PUBLIC_HDRS} ${SRCS})
++add_library(${TARGET} SHARED ${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
++    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
++    $<INSTALL_INTERFACE:${FILAMENT_INCLUDEDIR}>
++)
++target_include_directories(${TARGET} PRIVATE
++    ${GENERATION_ROOT}
++    ${CMAKE_CURRENT_SOURCEDIR}/src
++)
++set_target_properties(${TARGET} PROPERTIES
++    OUTPUT_NAME "filament_iblprefilter"
++    VERSION ${FILAMENT_VERSION}
++    SOVERSION ${FILAMENT_SOVERSION}
++)
++add_library(filament::${TARGET} ALIAS ${TARGET})
+ # ==================================================================================================
+ # Dependencies
+ # ==================================================================================================
+-target_link_libraries(${TARGET} PUBLIC math)
+-target_link_libraries(${TARGET} PUBLIC utils)
+-target_link_libraries(${TARGET} PUBLIC filament)
++target_link_libraries(${TARGET} PRIVATE filament::math)
++target_link_libraries(${TARGET} PUBLIC filament::utils)
++target_link_libraries(${TARGET} PUBLIC filament::filament)
+ # ==================================================================================================
+ # Compiler flags
+@@ -133,5 +142,5 @@ target_link_libraries(${TARGET} PRIVATE
+ # Installation
+ # ==================================================================================================
+ set(INSTALL_TYPE ARCHIVE)
+-install(TARGETS ${TARGET} ${INSTALL_TYPE} DESTINATION lib/${DIST_DIR})
+-install(DIRECTORY ${PUBLIC_HDR_DIR}/filament-iblprefilter DESTINATION include)
++install(TARGETS ${TARGET} DESTINATION ${FILAMENT_LIBDIR} EXPORT filamentTargets)
++install(DIRECTORY ${PUBLIC_HDR_DIR}/filament-iblprefilter DESTINATION ${FILAMENT_INCLUDEDIR})
+diff --git a/libs/image/CMakeLists.txt b/libs/image/CMakeLists.txt
+index 3f5072e..95e828d 100644
+--- a/libs/image/CMakeLists.txt
++++ b/libs/image/CMakeLists.txt
+@@ -26,13 +26,19 @@ set(SRCS
+ # ==================================================================================================
+ # Include and target definitions
+ # ==================================================================================================
+-include_directories(${PUBLIC_HDR_DIR})
+-
+-add_library(${TARGET} STATIC ${PUBLIC_HDRS} ${SRCS})
+-
+-target_link_libraries(${TARGET} PUBLIC math utils)
+-
+-target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR})
++add_library(${TARGET} SHARED ${PUBLIC_HDRS} ${SRCS})
++target_link_libraries(${TARGET} PUBLIC filament::math filament::utils)
++target_compile_features(${TARGET} PUBLIC cxx_std_17)
++target_include_directories(${TARGET} PUBLIC
++    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
++    $<INSTALL_INTERFACE:${FILAMENT_INCLUDEDIR}>
++)
++set_target_properties(${TARGET} PROPERTIES
++    OUTPUT_NAME "filament_${TARGET}"
++    VERSION ${FILAMENT_VERSION}
++    SOVERSION ${FILAMENT_SOVERSION}
++)
++add_library(filament::${TARGET} ALIAS ${TARGET})
+ # ==================================================================================================
+ # Compiler flags
+@@ -48,18 +54,24 @@ endif()
+ # Expose header-only utilities to lean-and-mean client projects.
+ # ==================================================================================================
+ add_library(image_headers INTERFACE)
+-target_include_directories(image_headers INTERFACE ${PUBLIC_HDR_DIR})
++target_include_directories(image_headers INTERFACE
++    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
++    $<INSTALL_INTERFACE:${FILAMENT_INCLUDEDIR}>
++)
++set_target_properties(image_headers PROPERTIES EXPORT_NAME "image::headers")
++target_compile_features(image_headers INTERFACE cxx_std_17)
++add_library(filament::image::headers ALIAS image_headers)
+ # ==================================================================================================
+ # Installation
+ # ==================================================================================================
+-install(TARGETS ${TARGET} ARCHIVE DESTINATION lib/${DIST_DIR})
+-install(DIRECTORY ${PUBLIC_HDR_DIR}/image DESTINATION include)
++install(TARGETS ${TARGET} image_headers DESTINATION ${FILAMENT_LIBDIR} EXPORT filamentTargets)
++install(DIRECTORY ${PUBLIC_HDR_DIR}/image DESTINATION ${FILAMENT_INCLUDEDIR})
+ # ==================================================================================================
+ # Tests
+ # ==================================================================================================
+ if (NOT ANDROID AND NOT WEBGL AND NOT IOS)
+     add_executable(test_${TARGET} tests/test_image.cpp)
+-    target_link_libraries(test_${TARGET} PRIVATE image imageio gtest)
++    target_link_libraries(test_${TARGET} PRIVATE filament::image filament::imageio GTest::gtest)
+ endif()
+diff --git a/libs/imageio/CMakeLists.txt b/libs/imageio/CMakeLists.txt
+index 0c3a6a3..a57b379 100644
+--- a/libs/imageio/CMakeLists.txt
++++ b/libs/imageio/CMakeLists.txt
+@@ -24,16 +24,30 @@ set(SRCS
+ # ==================================================================================================
+ # Include and target definitions
+ # ==================================================================================================
+-include_directories(${PUBLIC_HDR_DIR})
+-
+-add_library(${TARGET} STATIC ${PUBLIC_HDRS} ${SRCS})
+-
+-target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR})
++add_library(${TARGET} SHARED ${PUBLIC_HDRS} ${SRCS})
++target_include_directories(${TARGET} PUBLIC
++    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
++    $<INSTALL_INTERFACE:${FILAMENT_INCLUDEDIR}>
++)
+-target_link_libraries(${TARGET} PUBLIC image math png tinyexr utils z astcenc stb EtcLib)
++target_link_libraries(${TARGET} PUBLIC filament::image filament::math filament::utils)
++target_link_libraries(${TARGET} PRIVATE PNG::PNG tinyexr::tinyexr astcenc::astcenc filament::stb EtcLib Threads::Threads)
+ if (WIN32)
+     target_link_libraries(${TARGET} PRIVATE wsock32)
+ endif()
++target_compile_features(${TARGET} PUBLIC cxx_std_17)
++set_target_properties(${TARGET} PROPERTIES
++    OUTPUT_NAME "filament_${TARGET}"
++    VERSION ${FILAMENT_VERSION}
++    SOVERSION ${FILAMENT_SOVERSION}
++)
++add_library(filament::${TARGET} ALIAS ${TARGET})
++
++# ==================================================================================================
++# Installation
++# ==================================================================================================
++install(TARGETS ${TARGET} DESTINATION ${FILAMENT_LIBDIR} EXPORT filamentTargets)
++install(DIRECTORY ${PUBLIC_HDR_DIR}/imageio DESTINATION ${FILAMENT_INCLUDEDIR})
+ # ==================================================================================================
+ # Transitive macro definitions
+diff --git a/libs/matdbg/CMakeLists.txt b/libs/matdbg/CMakeLists.txt
+index c8c5976..86f23ed 100644
+--- a/libs/matdbg/CMakeLists.txt
++++ b/libs/matdbg/CMakeLists.txt
+@@ -60,29 +60,45 @@ set(DUMMY_SRC "${RESOURCE_DIR}/dummy.c")
+ add_custom_command(OUTPUT ${DUMMY_SRC} COMMAND echo "//" > ${DUMMY_SRC})
+ add_library(matdbg_resources ${DUMMY_SRC} ${RESGEN_SOURCE})
++set_target_properties(matdbg_resources PROPERTIES
++    OUTPUT_NAME "filament_matdbg_resources"
++    VERSION ${FILAMENT_VERSION}
++)
++add_library(filament::matdbg_resources ALIAS matdbg_resources)
+ # ==================================================================================================
+ # Include and target definitions
+ # ==================================================================================================
+-include_directories(${PUBLIC_HDR_DIR} ${RESOURCE_DIR})
+-
+-add_library(${TARGET} STATIC ${PUBLIC_HDRS} ${SRCS})
+-
++add_library(${TARGET} SHARED ${PUBLIC_HDRS} ${SRCS})
++target_include_directories(${TARGET} PUBLIC
++    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
++    $<INSTALL_INTERFACE:${FILAMENT_INCLUDEDIR}>
++)
+ target_link_libraries(${TARGET} PUBLIC
+-        utils
+-        filaflat
+-        filabridge
+-        backend_headers
++        filament::backend::headers
++        filament::filaflat
++        filament::filamat
++        filament::utils
++)
++target_link_libraries(${TARGET} PRIVATE
++        filament::filabridge
+         civetweb
+-        utils
++        glslang
++        filament::matdbg_resources
+         SPIRV
+-        SPIRV-Tools
+         spirv-cross-glsl
+-        matdbg_resources
++        SPIRV-Tools
++        smol-v
+ )
+-
+-target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR})
++target_include_directories(${TARGET} PRIVATE ${RESOURCE_DIR} ${filamat_SOURCE_DIR}/src)
++set_target_properties(${TARGET} PROPERTIES
++    OUTPUT_NAME "filament_${TARGET}"
++    VERSION ${FILAMENT_VERSION}
++    SOVERSION ${FILAMENT_SOVERSION}
++)
++target_compile_features(${TARGET} PUBLIC cxx_std_17)
++add_library(filament::${TARGET} ALIAS ${TARGET})
+ # ==================================================================================================
+ # Compiler flags
+@@ -98,22 +114,5 @@ endif()
+ # ==================================================================================================
+ # Installation
+ # ==================================================================================================
+-
+-# matdbg has dependencies on non-installed libraries. Here we bundle them all together into a single
+-# library that gets copied into the installation folder so users are only required to link against
+-# matdbg.
+-set(MATDBG_DEPS
+-    matdbg
+-    matdbg_resources
+-    civetweb
+-    SPIRV-Tools
+-    spirv-cross-core
+-    spirv-cross-glsl
+-    )
+-
+-set(MATDBG_COMBINED_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/libmatdbg_combined.a")
+-combine_static_libs(matdbg "${MATDBG_COMBINED_OUTPUT}" "${MATDBG_DEPS}")
+-
+-set(MATDBG_LIB_NAME ${CMAKE_STATIC_LIBRARY_PREFIX}matdbg${CMAKE_STATIC_LIBRARY_SUFFIX})
+-install(FILES "${MATDBG_COMBINED_OUTPUT}" DESTINATION lib/${DIST_DIR} RENAME ${MATDBG_LIB_NAME})
+-install(DIRECTORY ${PUBLIC_HDR_DIR}/matdbg DESTINATION include)
++install(DIRECTORY ${PUBLIC_HDR_DIR}/matdbg DESTINATION ${FILAMENT_INCLUDEDIR})
++install(TARGETS ${TARGET} matdbg_resources DESTINATION ${FILAMENT_LIBDIR} EXPORT filamentTargets)
+diff --git a/libs/math/CMakeLists.txt b/libs/math/CMakeLists.txt
+index cdfe25c..c812501 100644
+--- a/libs/math/CMakeLists.txt
++++ b/libs/math/CMakeLists.txt
+@@ -37,16 +37,19 @@ set(SRCS src/dummy.cpp)
+ # ==================================================================================================
+ # Include and target definitions
+ # ==================================================================================================
+-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})
++add_library(${TARGET} INTERFACE)
++target_include_directories(${TARGET} INTERFACE
++    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
++    $<INSTALL_INTERFACE:${FILAMENT_INCLUDEDIR}>
++)
++target_compile_features(${TARGET} INTERFACE cxx_std_17)
++add_library(filament::${TARGET} ALIAS ${TARGET})
+ # ==================================================================================================
+ # Installation
+ # ==================================================================================================
+-install(DIRECTORY ${PUBLIC_HDR_DIR}/math DESTINATION include)
++install(DIRECTORY ${PUBLIC_HDR_DIR}/math DESTINATION ${FILAMENT_INCLUDEDIR})
++install(TARGETS ${TARGET} EXPORT filamentTargets)
+ # ==================================================================================================
+ # Tests
+@@ -58,7 +61,7 @@ add_executable(test_${TARGET}
+         tests/test_vec.cpp
+         tests/test_quat.cpp
+ )
+-target_link_libraries(test_${TARGET} PRIVATE math gtest)
++target_link_libraries(test_${TARGET} PRIVATE filament::math GTest::gtest)
+ # ==================================================================================================
+ # Benchmarks
+@@ -71,4 +74,4 @@ add_executable(benchmark_${TARGET} ${BENCHMARK_SRCS})
+ target_compile_options(benchmark_${TARGET} PRIVATE ${OPTIMIZATION_FLAGS})
+-target_link_libraries(benchmark_${TARGET} PRIVATE benchmark_main utils math)
++target_link_libraries(benchmark_${TARGET} PRIVATE benchmark_main filament::utils filament::math)
+diff --git a/libs/mathio/CMakeLists.txt b/libs/mathio/CMakeLists.txt
+index fc55a4b..2d0b04d 100644
+--- a/libs/mathio/CMakeLists.txt
++++ b/libs/mathio/CMakeLists.txt
+@@ -22,15 +22,24 @@ set(SRCS src/ostream.cpp)
+ # ==================================================================================================
+ # Include and target definitions
+ # ==================================================================================================
+-include_directories(${PUBLIC_HDR_DIR})
++add_library(${TARGET} SHARED ${PUBLIC_HDRS} ${SRCS})
+-add_library(${TARGET} STATIC ${PUBLIC_HDRS} ${SRCS})
+-target_compile_options(${TARGET} PRIVATE ${OPTIMIZATION_FLAGS})
+-target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR})
+-target_link_libraries(${TARGET} PRIVATE math)
++target_link_libraries(${TARGET} PUBLIC filament::math)
++
++target_include_directories(${TARGET} PUBLIC
++    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
++    $<INSTALL_INTERFACE:${FILAMENT_INCLUDEDIR}>
++)
++target_compile_features(${TARGET} PUBLIC cxx_std_17)
++set_target_properties(${TARGET} PROPERTIES
++    OUTPUT_NAME "filament_${TARGET}"
++    VERSION ${FILAMENT_VERSION}
++    SOVERSION ${FILAMENT_SOVERSION}
++)
++add_library(filament::${TARGET} ALIAS ${TARGET})
+ # ==================================================================================================
+ # Installation
+ # ==================================================================================================
+-install(DIRECTORY ${PUBLIC_HDR_DIR}/mathio DESTINATION include)
+-
++install(DIRECTORY ${PUBLIC_HDR_DIR}/mathio DESTINATION ${FILAMENT_INCLUDEDIR})
++install(TARGETS ${TARGET} DESTINATION ${FILAMENT_LIBDIR} EXPORT filamentTargets)
+diff --git a/libs/utils/CMakeLists.txt b/libs/utils/CMakeLists.txt
+index 2a115f0..38684c5 100644
+--- a/libs/utils/CMakeLists.txt
++++ b/libs/utils/CMakeLists.txt
+@@ -81,11 +81,19 @@ endif()
+ # ==================================================================================================
+ # Includes and target definition
+ # ==================================================================================================
+-include_directories(${PUBLIC_HDR_DIR})
+-
+-add_library(${TARGET} STATIC ${PUBLIC_HDRS} ${SRCS})
+-target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR})
+-target_link_libraries(${TARGET} PUBLIC tsl)
++add_library(${TARGET} SHARED ${PUBLIC_HDRS} ${SRCS})
++target_include_directories(${TARGET} PUBLIC
++    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
++    $<INSTALL_INTERFACE:${FILAMENT_INCLUDEDIR}>
++)
++target_link_libraries(${TARGET} PUBLIC tsl::robin_map)
++target_compile_features(${TARGET} PUBLIC cxx_std_17)
++set_target_properties(${TARGET} PROPERTIES
++    OUTPUT_NAME "filament_${TARGET}"
++    VERSION ${FILAMENT_VERSION}
++    SOVERSION ${FILAMENT_SOVERSION}
++)
++add_library(filament::${TARGET} ALIAS ${TARGET})
+ if (ANDROID)
+     target_link_libraries(${TARGET} PUBLIC log)
+@@ -98,8 +106,6 @@ if (WIN32)
+ endif()
+ if (LINUX)
+-    set(THREADS_PREFER_PTHREAD_FLAG ON)
+-    find_package(Threads REQUIRED)
+     target_link_libraries(${TARGET} PRIVATE Threads::Threads)
+     target_link_libraries(${TARGET} PRIVATE dl atomic)
+ endif()
+@@ -116,13 +122,12 @@ target_compile_options(${TARGET} PRIVATE
+ # ==================================================================================================
+ # Installation
+ # ==================================================================================================
+-set(INSTALL_TYPE ARCHIVE)
+-install(TARGETS ${TARGET} ${INSTALL_TYPE} DESTINATION lib/${DIST_DIR})
+-install(FILES ${DIST_HDRS} DESTINATION include/${TARGET})
++install(TARGETS ${TARGET} DESTINATION ${FILAMENT_LIBDIR} EXPORT filamentTargets)
++install(FILES ${DIST_HDRS} DESTINATION ${FILAMENT_INCLUDEDIR}/${TARGET})
+ if (LINUX OR ANDROID)
+-    install(FILES ${DIST_LINUX_HDRS} DESTINATION include/${TARGET_LINUX})
++    install(FILES ${DIST_LINUX_HDRS} DESTINATION ${FILAMENT_INCLUDEDIR}/${TARGET_LINUX})
+ else()
+-    install(FILES ${DIST_GENERIC_HDRS} DESTINATION include/${TARGET_GENERIC})
++    install(FILES ${DIST_GENERIC_HDRS} DESTINATION ${FILAMENT_INCLUDEDIR}/${TARGET_GENERIC})
+ endif()
+ # ==================================================================================================
+@@ -156,7 +161,7 @@ endif()
+ add_executable(test_${TARGET} ${TEST_SRCS})
+-target_link_libraries(test_${TARGET} PRIVATE gtest utils tsl math)
++target_link_libraries(test_${TARGET} PRIVATE GTest::gtest filament::utils filament::math)
+ # ==================================================================================================
+ # Benchmarks
+diff --git a/libs/viewer/CMakeLists.txt b/libs/viewer/CMakeLists.txt
+index c9a3dcd..fe168d2 100644
+--- a/libs/viewer/CMakeLists.txt
++++ b/libs/viewer/CMakeLists.txt
+@@ -27,9 +27,21 @@ set(SRCS
+ # ==================================================================================================
+ # Include and target definitions
+ # ==================================================================================================
+-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})
++add_library(${TARGET} SHARED ${PUBLIC_HDRS} ${SRCS})
++
++target_link_libraries(${TARGET} PUBLIC filament::filament)
++target_link_libraries(${TARGET} PRIVATE filament::imgui filament::gltfio_core filament::filagui jsmn civetweb)
++
++target_include_directories(${TARGET} PUBLIC
++    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
++    $<INSTALL_INTERFACE:${FILAMENT_INCLUDEDIR}>
++)
++target_compile_features(${TARGET} PUBLIC cxx_std_17)
++set_target_properties(${TARGET} PROPERTIES
++    OUTPUT_NAME "filament_${TARGET}"
++    VERSION ${FILAMENT_VERSION}
++    SOVERSION ${FILAMENT_SOVERSION}
++)
+ # ==================================================================================================
+ # Compiler flags
+@@ -44,13 +56,13 @@ endif()
+ # ==================================================================================================
+ # Installation
+ # ==================================================================================================
+-install(TARGETS ${TARGET} ARCHIVE DESTINATION lib/${DIST_DIR})
+-install(DIRECTORY ${PUBLIC_HDR_DIR}/viewer DESTINATION include)
++install(TARGETS ${TARGET} DESTINATION ${FILAMENT_LIBDIR} EXPORT filamentTargets)
++install(DIRECTORY ${PUBLIC_HDR_DIR}/viewer DESTINATION ${FILAMENT_INCLUDEDIR})
+ # ==================================================================================================
+ # Tests
+ # ==================================================================================================
+ if (NOT ANDROID AND NOT WEBGL AND NOT IOS)
+     add_executable(test_settings tests/test_settings.cpp)
+-    target_link_libraries(test_settings PRIVATE ${TARGET} gtest)
++    target_link_libraries(test_settings PRIVATE ${TARGET} GTest::gtest)
+ endif()
+diff --git a/shaders/CMakeLists.txt b/shaders/CMakeLists.txt
+index fb4dda1..8b56e12 100644
+--- a/shaders/CMakeLists.txt
++++ b/shaders/CMakeLists.txt
+@@ -105,10 +105,16 @@ 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 $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
++add_library(filament::${TARGET} ALIAS ${TARGET})
+ # ==================================================================================================
+ # Installation
+ # ==================================================================================================
+-install(TARGETS ${TARGET} ARCHIVE DESTINATION lib/${DIST_DIR})
++install(TARGETS ${TARGET} DESTINATION ${FILAMENT_LIBDIR} EXPORT filamentTargets)
++set_target_properties(${TARGET} PROPERTIES
++    OUTPUT_NAME "filament_${TARGET}"
++    VERSION ${FILAMENT_VERSION}
++    SOVERSION ${FILAMENT_SOVERSION}
++)
+diff --git a/tools/cmgen/CMakeLists.txt b/tools/cmgen/CMakeLists.txt
+index c84f70f..27493d0 100644
+--- a/tools/cmgen/CMakeLists.txt
++++ b/tools/cmgen/CMakeLists.txt
+@@ -22,7 +22,7 @@ set(SRCS
+ # ==================================================================================================
+ add_executable(${TARGET} ${HDRS} ${SRCS})
+-target_link_libraries(${TARGET} PRIVATE math utils ibl z image imageio getopt)
++target_link_libraries(${TARGET} PRIVATE math utils ibl image imageio getopt Threads::Threads)
+ # ==================================================================================================
+ # Compile options and optimizations
+@@ -55,5 +55,5 @@ install(TARGETS ${TARGET} RUNTIME DESTINATION bin)
+ # ==================================================================================================
+ if (NOT ANDROID)
+     add_executable(test_${TARGET} tests/test_cmgen.cpp)
+-    target_link_libraries(test_${TARGET} PRIVATE image imageio gtest)
++    target_link_libraries(test_${TARGET} PRIVATE image imageio GTest::gtest)
+ endif()
+diff --git a/tools/cso-lut/CMakeLists.txt b/tools/cso-lut/CMakeLists.txt
+index ead06a8..9f83f67 100644
+--- a/tools/cso-lut/CMakeLists.txt
++++ b/tools/cso-lut/CMakeLists.txt
+@@ -15,7 +15,7 @@ set(SRCS src/main.cpp)
+ # ==================================================================================================
+ add_executable(${TARGET} ${HDRS} ${SRCS})
+-target_link_libraries(${TARGET} PRIVATE math utils z image imageio getopt)
++target_link_libraries(${TARGET} PRIVATE math utils ZLIB::ZLIB image imageio getopt)
+ # ==================================================================================================
+ # Compile options and optimizations
+diff --git a/tools/filamesh/CMakeLists.txt b/tools/filamesh/CMakeLists.txt
+index 3cc8bda..f7eacd1 100644
+--- a/tools/filamesh/CMakeLists.txt
++++ b/tools/filamesh/CMakeLists.txt
+@@ -19,7 +19,7 @@ add_executable(${TARGET} ${SRCS})
+ target_link_libraries(${TARGET} PUBLIC math)
+ target_link_libraries(${TARGET} PUBLIC utils)
+ target_link_libraries(${TARGET} PUBLIC assimp)
+-target_link_libraries(${TARGET} PRIVATE getopt filameshio meshoptimizer)
++target_link_libraries(${TARGET} PRIVATE getopt filameshio meshoptimizer::meshoptimizer)
+ # ==================================================================================================
+ # Compile options and optimizations
+diff --git a/tools/glslminifier/CMakeLists.txt b/tools/glslminifier/CMakeLists.txt
+index 5a6837f..0549fbf 100644
+--- a/tools/glslminifier/CMakeLists.txt
++++ b/tools/glslminifier/CMakeLists.txt
+@@ -36,5 +36,5 @@ if (NOT ANDROID)
+             tests/test_glslminifier.cpp
+     )
+     target_include_directories(test_${TARGET} PRIVATE src)
+-    target_link_libraries(test_${TARGET} PRIVATE gtest)
++    target_link_libraries(test_${TARGET} PRIVATE GTest::gtest)
+ endif()
+diff --git a/tools/matc/CMakeLists.txt b/tools/matc/CMakeLists.txt
+index cb8c934..8eef505 100644
+--- a/tools/matc/CMakeLists.txt
++++ b/tools/matc/CMakeLists.txt
+@@ -44,7 +44,7 @@ add_library(${TARGET} STATIC ${SRCS} ${HDRS})
+ target_include_directories(${TARGET} PUBLIC src)
+ target_include_directories(${TARGET} PRIVATE ${filamat_SOURCE_DIR}/src)
+-target_link_libraries(${TARGET} getopt filamat filabridge utils)
++target_link_libraries(${TARGET} getopt filamat filabridge utils glslang smol-v)
+ # =================================================================================================
+ # Licenses
+@@ -89,4 +89,4 @@ set(SRCS
+ add_executable(${TARGET} ${SRCS})
+-target_link_libraries(${TARGET} matlang gtest)
++target_link_libraries(${TARGET} matlang GTest::gtest)
+diff --git a/tools/matinfo/CMakeLists.txt b/tools/matinfo/CMakeLists.txt
+index 17d948f..37b56f5 100644
+--- a/tools/matinfo/CMakeLists.txt
++++ b/tools/matinfo/CMakeLists.txt
+@@ -13,12 +13,12 @@ set(SRCS src/main.cpp)
+ # ==================================================================================================
+ add_executable(${TARGET} ${SRCS})
+-target_link_libraries(${TARGET} matdbg filaflat backend_headers utils getopt SPIRV-Tools spirv-cross-glsl)
++target_link_libraries(${TARGET} matdbg filaflat filabridge backend_headers utils getopt SPIRV-Tools spirv-cross-glsl glslang)
+ # glslang contains a copy of the SPIRV headers, so let's just use those. The leading ".." in the
+ # following variable refers to the project name that we define in glslang/tnt, and the trailing ".."
+ # in the path allows us to do #include <SPIRV/disassemble.h>
+-target_include_directories(${TARGET} PRIVATE ${../glslang_SOURCE_DIR}/..)
++#target_include_directories(${TARGET} PRIVATE ${../glslang_SOURCE_DIR}/..)
+ # =================================================================================================
+ # Licenses
+diff --git a/tools/mipgen/CMakeLists.txt b/tools/mipgen/CMakeLists.txt
+index 2686b40..38fdc60 100644
+--- a/tools/mipgen/CMakeLists.txt
++++ b/tools/mipgen/CMakeLists.txt
+@@ -12,7 +12,7 @@ set(SRCS src/main.cpp)
+ # Target definitions
+ # ==================================================================================================
+ add_executable(${TARGET} ${SRCS})
+-target_link_libraries(${TARGET} PRIVATE math utils z image imageio getopt)
++target_link_libraries(${TARGET} PRIVATE math utils ZLIB::ZLIB image imageio getopt)
+ # =================================================================================================
+ # Licenses
+diff --git a/tools/normal-blending/CMakeLists.txt b/tools/normal-blending/CMakeLists.txt
+index 40be37f..73634ce 100644
+--- a/tools/normal-blending/CMakeLists.txt
++++ b/tools/normal-blending/CMakeLists.txt
+@@ -15,7 +15,7 @@ set(SRCS src/main.cpp)
+ # ==================================================================================================
+ add_executable(${TARGET} ${HDRS} ${SRCS})
+-target_link_libraries(${TARGET} PRIVATE math utils z image imageio getopt)
++target_link_libraries(${TARGET} PRIVATE math utils ZLIB::ZLIB image imageio getopt)
+ # ==================================================================================================
+ # Compile options and optimizations
+diff --git a/tools/roughness-prefilter/CMakeLists.txt b/tools/roughness-prefilter/CMakeLists.txt
+index 4112f81..fdbc3bb 100644
+--- a/tools/roughness-prefilter/CMakeLists.txt
++++ b/tools/roughness-prefilter/CMakeLists.txt
+@@ -15,7 +15,7 @@ set(SRCS src/main.cpp)
+ # ==================================================================================================
+ add_executable(${TARGET} ${HDRS} ${SRCS})
+-target_link_libraries(${TARGET} PRIVATE math utils z image imageio getopt)
++target_link_libraries(${TARGET} PRIVATE math utils ZLIB::ZLIB image imageio getopt)
+ # ==================================================================================================
+ # Compile options and optimizations
diff --git a/patches/0010-Rename-resgen-executable-to-avoid-conflict-with-mono.patch b/patches/0010-Rename-resgen-executable-to-avoid-conflict-with-mono.patch
new file mode 100644 (file)
index 0000000..07820dc
--- /dev/null
@@ -0,0 +1,43 @@
+From: =?utf-8?q?Timo_R=C3=B6hling?= <roehling@debian.org>
+Date: Wed, 26 Jan 2022 13:31:12 +0100
+Subject: Rename resgen executable to avoid conflict with mono-devel
+
+---
+ tools/resgen/CMakeLists.txt | 1 +
+ tools/resgen/src/main.cpp   | 4 ++--
+ 2 files changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/tools/resgen/CMakeLists.txt b/tools/resgen/CMakeLists.txt
+index 701931c..25721fd 100644
+--- a/tools/resgen/CMakeLists.txt
++++ b/tools/resgen/CMakeLists.txt
+@@ -13,6 +13,7 @@ set(SRCS src/main.cpp)
+ # ==================================================================================================
+ add_executable(${TARGET} ${SRCS})
+ target_link_libraries(${TARGET} PRIVATE utils getopt)
++set_target_properties(${TARGET} PROPERTIES OUTPUT_NAME filament-${TARGET})
+ # =================================================================================================
+ # Licenses
+diff --git a/tools/resgen/src/main.cpp b/tools/resgen/src/main.cpp
+index 8cae171..e126b34 100644
+--- a/tools/resgen/src/main.cpp
++++ b/tools/resgen/src/main.cpp
+@@ -41,7 +41,7 @@ static bool g_quietMode = false;
+ static bool g_embedJson = false;
+ static const char* USAGE = R"TXT(
+-RESGEN aggregates a sequence of binary blobs, each of which becomes a "resource" whose id
++filament-resgen aggregates a sequence of binary blobs, each of which becomes a "resource" whose id
+ is the basename of the input file. It produces the following set of files:
+     resources.h ......... declares sizes and offsets for each resource
+@@ -50,7 +50,7 @@ is the basename of the input file. It produces the following set of files:
+     resources.bin ....... the aggregated binary blob that the incbin refers to
+ Usage:
+-    RESGEN [options] <input_file_0> <input_file_1> ...
++    filament-resgen [options] <input_file_0> <input_file_1> ...
+ Options:
+    --help, -h
diff --git a/patches/0011-Replace-BlueGL-with-GLEW.patch b/patches/0011-Replace-BlueGL-with-GLEW.patch
new file mode 100644 (file)
index 0000000..c26d26b
--- /dev/null
@@ -0,0 +1,378 @@
+From: =?utf-8?q?Timo_R=C3=B6hling?= <roehling@debian.org>
+Date: Wed, 26 Jan 2022 17:40:16 +0100
+Subject: Replace BlueGL with GLEW
+
+---
+ CMakeLists.txt                               |   1 -
+ filament/backend/CMakeLists.txt              |  10 +-
+ filament/backend/src/opengl/OpenGLDriver.cpp |   4 +-
+ filament/backend/src/opengl/PlatformGLX.cpp  | 167 ++++++---------------------
+ filament/backend/src/opengl/PlatformGLX.h    |   6 +-
+ filament/backend/src/opengl/gl_headers.h     |   3 +-
+ 6 files changed, 49 insertions(+), 142 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index a95c557..5c117c3 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -650,7 +650,6 @@ if (WEBGL)
+ endif()
+ if (IS_HOST_PLATFORM)
+-    add_subdirectory(${LIBRARIES}/bluegl)
+     add_subdirectory(${LIBRARIES}/filamentapp)
+     add_subdirectory(${LIBRARIES}/imageio)
+diff --git a/filament/backend/CMakeLists.txt b/filament/backend/CMakeLists.txt
+index f61faee..7a1ba64 100644
+--- a/filament/backend/CMakeLists.txt
++++ b/filament/backend/CMakeLists.txt
+@@ -285,11 +285,6 @@ endif()
+ target_link_libraries(${TARGET} PUBLIC filament::math)
+ target_link_libraries(${TARGET} PUBLIC filament::utils)
+-# Android, iOS, and WebGL do not use bluegl.
+-if(NOT IOS AND NOT ANDROID AND NOT WEBGL)
+-    target_link_libraries(${TARGET} PRIVATE bluegl)
+-endif()
+-
+ if (FILAMENT_SUPPORTS_VULKAN)
+     target_link_libraries(${TARGET} PRIVATE bluevk vkmemalloc vkshaders smol-v)
+ endif()
+@@ -299,8 +294,13 @@ if (FILAMENT_SUPPORTS_METAL)
+ endif()
+ if (LINUX)
++    find_package(X11 REQUIRED)
++    find_package(GLEW REQUIRED)
++    find_package(OpenGL REQUIRED)
+     target_link_libraries(${TARGET} PUBLIC Threads::Threads)
+     target_link_libraries(${TARGET} PRIVATE dl)
++    target_link_libraries(${TARGET} PRIVATE ${X11_X11_LIB})
++    target_link_libraries(${TARGET} PRIVATE GLEW::GLEW OpenGL::GL)
+ endif()
+ # ==================================================================================================
+diff --git a/filament/backend/src/opengl/OpenGLDriver.cpp b/filament/backend/src/opengl/OpenGLDriver.cpp
+index 9b7135f..5ccf074 100644
+--- a/filament/backend/src/opengl/OpenGLDriver.cpp
++++ b/filament/backend/src/opengl/OpenGLDriver.cpp
+@@ -974,7 +974,7 @@ void OpenGLDriver::framebufferTexture(backend::TargetBufferInfo const& binfo,
+         // This extension only exists on OpenGL ES.
+         gl.bindFramebuffer(GL_FRAMEBUFFER, rt->gl.fbo);
+         if (any(t->usage & TextureUsage::SAMPLEABLE)) {
+-            glext::glFramebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER,
++            glFramebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER,
+                     attachment, target, t->gl.id, binfo.level, rt->gl.samples);
+         } else {
+             glFramebufferRenderbuffer(GL_FRAMEBUFFER, attachment,
+@@ -1073,7 +1073,7 @@ void OpenGLDriver::renderBufferStorage(GLuint rbo, GLenum internalformat, uint32
+         auto& gl = mContext;
+         if (gl.ext.EXT_multisampled_render_to_texture ||
+             gl.ext.EXT_multisampled_render_to_texture2) {
+-            glext::glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER, samples, internalformat, width, height);
++            glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER, samples, internalformat, width, height);
+         } else
+ #endif
+         {
+diff --git a/filament/backend/src/opengl/PlatformGLX.cpp b/filament/backend/src/opengl/PlatformGLX.cpp
+index b5cb484..4253f7c 100644
+--- a/filament/backend/src/opengl/PlatformGLX.cpp
++++ b/filament/backend/src/opengl/PlatformGLX.cpp
+@@ -20,131 +20,41 @@
+ #include <utils/Panic.h>
+ #include <X11/Xlib.h>
+-#include <GL/glx.h>
++#include <GL/glew.h>
++#include <GL/glxew.h>
+ #include <GL/glxext.h>
+ #include "OpenGLDriverFactory.h"
+-#include <dlfcn.h>
+-
+-#define LIBRARY_GLX "libGL.so.1"
+-#define LIBRARY_X11 "libX11.so.6"
+-
+-// Function pointer types for X11 functions
+-typedef Display* (* X11_OPEN_DISPLAY)(const char*);
+-typedef Display* (* X11_CLOSE_DISPLAY)(Display*);
+-
+-// Function pointer types for GLX functions
+-typedef void (* GLX_DESTROY_CONTEXT)(Display*, GLXContext);
+-typedef void (* GLX_SWAP_BUFFERS)(Display* dpy, GLXDrawable drawable);
+-// Stores GLX function pointers and a handle to the system's GLX library
+-struct GLXFunctions {
+-    PFNGLXCHOOSEFBCONFIGPROC chooseFbConfig;
+-    PFNGLXCREATECONTEXTATTRIBSARBPROC createContext;
+-    PFNGLXCREATEPBUFFERPROC createPbuffer;
+-    PFNGLXDESTROYPBUFFERPROC destroyPbuffer;
+-    PFNGLXMAKECONTEXTCURRENTPROC setCurrentContext;
+-
+-    /* 
+-       When creating a shared GL context, we query the used
+-       GLX_FBCONFIG_ID to make sure our display framebuffer
+-       attributes match; otherwise making our context current
+-       results in a BadMatch
+-       https://gist.github.com/roxlu/c282d642c353ce96ef19b6359c741bcb
+-    */
+-    PFNGLXQUERYCONTEXTPROC queryContext;
+-
+-    /* 
+-       When creating a shared GL context, we select the matching
+-       GLXFBConfig that is used by the shared GL context. `getFBConfigs`
+-       will return all the available GLXFBConfigs.
+-    */
+-    PFNGLXGETFBCONFIGSPROC getFbConfigs;
+-
+-    /*
+-      When creating a shared GL contect, we iterate over the
+-      available GLXFBConfigs that are returned by `getFBConfigs`,
+-      we use `getFbConfigAttrib` to find the matching
+-      `GLX_FBCONFIG_ID`.
+-    */
+-    PFNGLXGETFBCONFIGATTRIBPROC getFbConfigAttrib;
+-
+-    GLX_DESTROY_CONTEXT destroyContext;
+-    GLX_SWAP_BUFFERS swapBuffers;
+-    void* library;
+-} g_glx;
+-
+-// Stores X11 function pointers and a handle to the system's X11 library
+-struct X11Functions {
+-    X11_OPEN_DISPLAY openDisplay;
+-    X11_CLOSE_DISPLAY closeDisplay;
+-    void* library;
+-} g_x11;
+-
+-static PFNGLXGETPROCADDRESSPROC getProcAddress;
+-
+-static bool loadLibraries() {
+-    g_glx.library = dlopen(LIBRARY_GLX, RTLD_LOCAL | RTLD_NOW);
+-    if (!g_glx.library) {
+-        utils::slog.e << "Could not find library " << LIBRARY_GLX << utils::io::endl;
+-        return false;
+-    }
+-
+-    getProcAddress =
+-            (PFNGLXGETPROCADDRESSPROC)dlsym(g_glx.library, "glXGetProcAddressARB");
+-
+-    g_glx.chooseFbConfig = (PFNGLXCHOOSEFBCONFIGPROC)
+-            getProcAddress((const GLubyte*)"glXChooseFBConfig");
+-    g_glx.createContext = (PFNGLXCREATECONTEXTATTRIBSARBPROC)
+-            getProcAddress((const GLubyte*)"glXCreateContextAttribsARB");
+-    g_glx.createPbuffer = (PFNGLXCREATEPBUFFERPROC)
+-            getProcAddress((const GLubyte*)"glXCreatePbuffer");
+-    g_glx.destroyPbuffer = (PFNGLXDESTROYPBUFFERPROC)
+-            getProcAddress((const GLubyte*)"glXDestroyPbuffer");
+-    g_glx.setCurrentContext = (PFNGLXMAKECONTEXTCURRENTPROC)
+-            getProcAddress((const GLubyte*)"glXMakeContextCurrent");
+-    g_glx.destroyContext = (GLX_DESTROY_CONTEXT)
+-            getProcAddress((const GLubyte*)"glXDestroyContext");
+-    g_glx.swapBuffers = (GLX_SWAP_BUFFERS)
+-            getProcAddress((const GLubyte*)"glXSwapBuffers");
+-
+-    g_glx.queryContext = (PFNGLXQUERYCONTEXTPROC)
+-            getProcAddress((const GLubyte*)"glXQueryContext");
+-    g_glx.getFbConfigs = (PFNGLXGETFBCONFIGSPROC)
+-            getProcAddress((const GLubyte*)"glXGetFBConfigs");
+-    g_glx.getFbConfigAttrib = (PFNGLXGETFBCONFIGATTRIBPROC)
+-            getProcAddress((const GLubyte*)"glXGetFBConfigAttrib");
+-
+-    g_x11.library = dlopen(LIBRARY_X11, RTLD_LOCAL | RTLD_NOW);
+-    if (!g_x11.library) {
+-        utils::slog.e << "Could not find library " << LIBRARY_X11 << utils::io::endl;
+-        return false;
+-    }
+-
+-    g_x11.openDisplay = (X11_OPEN_DISPLAY)dlsym(g_x11.library, "XOpenDisplay");
+-    g_x11.closeDisplay = (X11_CLOSE_DISPLAY)dlsym(g_x11.library, "XCloseDisplay");
+-    return true;
+-}
++#define RESOLVE_GLX_ENTRYPOINT(Function, Type) \
++    Function = (Type)glXGetProcAddress((const GLubyte*)#Function);
+ namespace filament {
+ using namespace backend;
+ Driver* PlatformGLX::createDriver(void* const sharedGLContext) noexcept {
+-    loadLibraries();
+     // Get the display device
+-    mGLXDisplay = g_x11.openDisplay(NULL);
++    mGLXDisplay = XOpenDisplay(NULL);
+     if (mGLXDisplay == nullptr) {
+         utils::slog.e << "Failed to open X display. (exiting)." << utils::io::endl;
+         exit(1);
+     }
++    /* Manually resolve glX entrypoints we need to create a context */
++    RESOLVE_GLX_ENTRYPOINT(glXCreateContextAttribsARB, PFNGLXCREATECONTEXTATTRIBSARBPROC);
++    RESOLVE_GLX_ENTRYPOINT(glXCreatePbuffer, PFNGLXCREATEPBUFFERPROC);
++    RESOLVE_GLX_ENTRYPOINT(glXMakeContextCurrent, PFNGLXMAKECONTEXTCURRENTPROC);
++    RESOLVE_GLX_ENTRYPOINT(glXChooseFBConfig, PFNGLXCHOOSEFBCONFIGPROC);
++    RESOLVE_GLX_ENTRYPOINT(glXQueryContext, PFNGLXQUERYCONTEXTPROC);
++    RESOLVE_GLX_ENTRYPOINT(glXGetFBConfigs, PFNGLXGETFBCONFIGSPROC);
++    RESOLVE_GLX_ENTRYPOINT(glXGetFBConfigAttrib, PFNGLXGETFBCONFIGATTRIBPROC);
+     if (sharedGLContext != nullptr) {
+         int r = -1;
+         int usedFbId = -1;
+         GLXContext sharedCtx = (GLXContext)((void*)sharedGLContext);
+-        r = g_glx.queryContext(mGLXDisplay, sharedCtx, GLX_FBCONFIG_ID, &usedFbId);
++        r = glXQueryContext(mGLXDisplay, sharedCtx, GLX_FBCONFIG_ID, &usedFbId);
+         if (r != 0) {
+             utils::slog.e << "Failed to get GLX_FBCONFIG_ID from shared GL context."
+                           << utils::io::endl;
+@@ -152,7 +62,7 @@ Driver* PlatformGLX::createDriver(void* const sharedGLContext) noexcept {
+         }
+         int numConfigs = 0;
+-        GLXFBConfig* fbConfigs = g_glx.getFbConfigs(mGLXDisplay, 0, &numConfigs);
++        GLXFBConfig* fbConfigs = glXGetFBConfigs(mGLXDisplay, 0, &numConfigs);
+         if (fbConfigs == nullptr) {
+             utils::slog.e << "Failed to get the available GLXFBConfigs." << utils::io::endl;
+@@ -163,7 +73,7 @@ Driver* PlatformGLX::createDriver(void* const sharedGLContext) noexcept {
+         int fbIndex = -1;
+         for (int i = 0; i < numConfigs; ++i) {
+-            r = g_glx.getFbConfigAttrib(mGLXDisplay, fbConfigs[i], GLX_FBCONFIG_ID, &fbId);
++            r = glXGetFBConfigAttrib(mGLXDisplay, fbConfigs[i], GLX_FBCONFIG_ID, &fbId);
+             if (r != 0) {
+                 utils::slog.e << "Failed to get GLX_FBCONFIG_ID for entry " << i << "."
+                               << utils::io::endl;
+@@ -190,31 +100,21 @@ Driver* PlatformGLX::createDriver(void* const sharedGLContext) noexcept {
+                 GLX_DEPTH_SIZE, 24,
+                 None
+         };
+-
+         int configCount = 0;
+-        mGLXConfig = g_glx.chooseFbConfig(mGLXDisplay, DefaultScreen(mGLXDisplay),
++        mGLXConfig = glXChooseFBConfig(mGLXDisplay, DefaultScreen(mGLXDisplay),
+                 attribs, &configCount);
+         if (mGLXConfig == nullptr || configCount == 0) {
+             return nullptr;
+         }
+     }
+-    PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribs = (PFNGLXCREATECONTEXTATTRIBSARBPROC)
+-            getProcAddress((GLubyte*)"glXCreateContextAttribsARB");
+-
+-    if (glXCreateContextAttribs == nullptr) {
+-        utils::slog.i << "Unable to retrieve function pointer for `glXCreateContextAttribs()`."
+-                      << utils::io::endl;
+-        return nullptr;
+-    }
+-
+     int contextAttribs[] = {
+             GLX_CONTEXT_MAJOR_VERSION_ARB, 4,
+             GLX_CONTEXT_MINOR_VERSION_ARB, 1,
+             GL_NONE
+     };
+-    mGLXContext = g_glx.createContext(mGLXDisplay, mGLXConfig[0],
++    mGLXContext = glXCreateContextAttribsARB(mGLXDisplay, mGLXConfig[0],
+             (GLXContext)sharedGLContext, True, contextAttribs);
+     int pbufferAttribs[] = {
+@@ -223,21 +123,26 @@ Driver* PlatformGLX::createDriver(void* const sharedGLContext) noexcept {
+             GL_NONE
+     };
+-    mDummySurface = g_glx.createPbuffer(mGLXDisplay, mGLXConfig[0], pbufferAttribs);
+-    g_glx.setCurrentContext(mGLXDisplay, mDummySurface, mDummySurface, mGLXContext);
++    mDummySurface = glXCreatePbuffer(mGLXDisplay, mGLXConfig[0], pbufferAttribs);
++    glXMakeContextCurrent(mGLXDisplay, mDummySurface, mDummySurface, mGLXContext);
++
++    GLenum result;
++    /* Properly initialize the remainder of the GL entrypoints */
++    if ((result = glewInit()) != GLEW_OK)
++    {
++        utils::slog.e << "Failed to initialize GLEW. (" << result << ", exiting)." << utils::io::endl;
++        exit(1);
++    }
+-    int result = bluegl::bind();
+-    ASSERT_POSTCONDITION(!result, "Unable to load OpenGL entry points.");
+     return OpenGLDriverFactory::create(this, sharedGLContext);
+ }
+ void PlatformGLX::terminate() noexcept {
+-    g_glx.setCurrentContext(mGLXDisplay, None, None, nullptr);
+-    g_glx.destroyPbuffer(mGLXDisplay, mDummySurface);
+-    g_glx.destroyContext(mGLXDisplay, mGLXContext);
+-    g_x11.closeDisplay(mGLXDisplay);
+-    bluegl::unbind();
++    glXMakeContextCurrent(mGLXDisplay, None, None, nullptr);
++    glXDestroyPbuffer(mGLXDisplay, mDummySurface);
++    glXDestroyContext(mGLXDisplay, mGLXContext);
++    XCloseDisplay(mGLXDisplay);
+ }
+ Platform::SwapChain* PlatformGLX::createSwapChain(void* nativeWindow, uint64_t& flags) noexcept {
+@@ -255,7 +160,7 @@ Platform::SwapChain* PlatformGLX::createSwapChain(
+             GLX_PBUFFER_HEIGHT, int(height),
+             GL_NONE
+     };
+-    GLXPbuffer sur = g_glx.createPbuffer(mGLXDisplay, mGLXConfig[0], pbufferAttribs);
++    GLXPbuffer sur = glXCreatePbuffer(mGLXDisplay, mGLXConfig[0], pbufferAttribs);
+     if (sur) {
+         mPBuffers.push_back(sur);
+     }
+@@ -265,19 +170,19 @@ Platform::SwapChain* PlatformGLX::createSwapChain(
+ void PlatformGLX::destroySwapChain(Platform::SwapChain* swapChain) noexcept {
+     auto it = std::find(mPBuffers.begin(), mPBuffers.end(), (GLXPbuffer)swapChain);
+     if (it != mPBuffers.end()) {
+-        g_glx.destroyPbuffer(mGLXDisplay, (GLXPbuffer)swapChain);
++        glXDestroyPbuffer(mGLXDisplay, (GLXPbuffer)swapChain);
+         mPBuffers.erase(it);
+     }
+ }
+ void PlatformGLX::makeCurrent(
+         Platform::SwapChain* drawSwapChain, Platform::SwapChain* readSwapChain) noexcept {
+-    g_glx.setCurrentContext(mGLXDisplay,
++    glXMakeContextCurrent(mGLXDisplay,
+             (GLXDrawable)drawSwapChain, (GLXDrawable)readSwapChain, mGLXContext);
+ }
+ void PlatformGLX::commit(Platform::SwapChain* swapChain) noexcept {
+-    g_glx.swapBuffers(mGLXDisplay, (GLXDrawable)swapChain);
++    glXSwapBuffers(mGLXDisplay, (GLXDrawable)swapChain);
+ }
+ // TODO Implement GLX fences
+diff --git a/filament/backend/src/opengl/PlatformGLX.h b/filament/backend/src/opengl/PlatformGLX.h
+index 45c3abf..e867c4c 100644
+--- a/filament/backend/src/opengl/PlatformGLX.h
++++ b/filament/backend/src/opengl/PlatformGLX.h
+@@ -19,8 +19,10 @@
+ #include <stdint.h>
+-#include <bluegl/BlueGL.h>
+-#include <GL/glx.h>
++#include <GL/glew.h>
++#include <GL/glext.h>
++#include <GL/glxew.h>
++#include <GL/glxext.h>
+ #include <backend/DriverEnums.h>
+diff --git a/filament/backend/src/opengl/gl_headers.h b/filament/backend/src/opengl/gl_headers.h
+index 32ca122..cdbf6fc 100644
+--- a/filament/backend/src/opengl/gl_headers.h
++++ b/filament/backend/src/opengl/gl_headers.h
+@@ -103,7 +103,8 @@
+ #endif
+ #else
+-    #include <bluegl/BlueGL.h>
++    #include <GL/glew.h>
++    #include <GL/glext.h>
+ #endif
+ // This is just to simplify the implementation (i.e. so we don't have to have #ifdefs everywhere)
diff --git a/patches/0012-Use-system-spirv-cross.patch b/patches/0012-Use-system-spirv-cross.patch
new file mode 100644 (file)
index 0000000..d449c51
--- /dev/null
@@ -0,0 +1,35 @@
+From: =?utf-8?q?Timo_R=C3=B6hling?= <roehling@debian.org>
+Date: Thu, 27 Jan 2022 19:50:26 +0100
+Subject: Use system spirv-cross
+
+---
+ CMakeLists.txt              | 2 +-
+ libs/filamat/CMakeLists.txt | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 5c117c3..632ece6 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -624,7 +624,7 @@ add_subdirectory(${EXTERNAL}/getopt)
+ if (FILAMENT_BUILD_FILAMAT OR IS_HOST_PLATFORM)
+     include(debian/cmake/spirv-tools.cmake)
+     include(debian/cmake/glslang.cmake)
+-    add_subdirectory(${EXTERNAL}/spirv-cross/tnt)
++    include(debian/cmake/spirv-cross.cmake)
+     add_subdirectory(${LIBRARIES}/filamat)
+     # the material debugger requires filamat
+diff --git a/libs/filamat/CMakeLists.txt b/libs/filamat/CMakeLists.txt
+index a130f0c..9b38857 100644
+--- a/libs/filamat/CMakeLists.txt
++++ b/libs/filamat/CMakeLists.txt
+@@ -122,7 +122,7 @@ if (APPLE OR MSVC)
+     target_link_libraries(${TARGET} glslang SPIRV SPVRemapper SPIRV-Tools-opt spirv-cross-glsl)
+ else()
+     target_link_libraries(${TARGET} PRIVATE
+-            -Wl,--start-group glslang SPIRV SPVRemapper SPIRV-Tools-opt spirv-cross-glsl -Wl,--end-group)
++            -Wl,--start-group glslang SPIRV SPVRemapper SPIRV-Tools-opt spirv-cross -Wl,--end-group)
+ endif()
+ # ==================================================================================================
diff --git a/patches/0013-Define-M_PIf-only-if-it-is-not-already-defined-in-ma.patch b/patches/0013-Define-M_PIf-only-if-it-is-not-already-defined-in-ma.patch
new file mode 100644 (file)
index 0000000..554a285
--- /dev/null
@@ -0,0 +1,22 @@
+From: =?utf-8?q?Timo_R=C3=B6hling?= <roehling@debian.org>
+Date: Mon, 7 Feb 2022 10:12:08 +0100
+Subject: Define M_PIf only if it is not already defined in math.h
+
+---
+ libs/image/src/ImageSampler.cpp | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/libs/image/src/ImageSampler.cpp b/libs/image/src/ImageSampler.cpp
+index 00385e9..53c68e8 100644
+--- a/libs/image/src/ImageSampler.cpp
++++ b/libs/image/src/ImageSampler.cpp
+@@ -38,7 +38,9 @@ struct FilterFunction {
+     bool rejectExternalSamples = true;
+ };
++#ifndef M_PIf
+ constexpr float M_PIf = float(filament::math::F_PI);
++#endif
+ const FilterFunction Box {
+     .fn = [](float t) { return t <= 0.5f ? 1.0f : 0.0f; },
diff --git a/patches/0014-Avoid-mips-as-identifier-because-it-fails-on-mips-ar.patch b/patches/0014-Avoid-mips-as-identifier-because-it-fails-on-mips-ar.patch
new file mode 100644 (file)
index 0000000..2dcc85e
--- /dev/null
@@ -0,0 +1,62 @@
+From: =?utf-8?q?Timo_R=C3=B6hling?= <roehling@debian.org>
+Date: Mon, 7 Feb 2022 10:30:35 +0100
+Subject: Avoid mips as identifier because it fails on mips* arch
+
+---
+ libs/image/src/ImageSampler.cpp |  6 +++---
+ libs/image/tests/test_image.cpp | 12 ++++++------
+ 2 files changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/libs/image/src/ImageSampler.cpp b/libs/image/src/ImageSampler.cpp
+index 53c68e8..80ae4b7 100644
+--- a/libs/image/src/ImageSampler.cpp
++++ b/libs/image/src/ImageSampler.cpp
+@@ -339,11 +339,11 @@ void computeSingleSample(const LinearImage& source, float x, float y, SingleSamp
+ // Unlike traditional mipmap generation, our implementation generates all levels from the original
+ // image, under the premise that this produces a higher quality result.
+-void generateMipmaps(const LinearImage& source, Filter filter, LinearImage* result, uint32_t mips) {
+-    mips = std::min(mips, getMipmapCount(source));
++void generateMipmaps(const LinearImage& source, Filter filter, LinearImage* result, uint32_t mipCount) {
++    mipCount = std::min(mipCount, getMipmapCount(source));
+     uint32_t width = source.getWidth();
+     uint32_t height = source.getHeight();
+-    for (uint32_t n = 0; n < mips; ++n) {
++    for (uint32_t n = 0; n < mipCount; ++n) {
+         width = std::max(width >> 1u, 1u);
+         height = std::max(height >> 1u, 1u);
+         result[n] = resampleImage(source, width, height, filter);
+diff --git a/libs/image/tests/test_image.cpp b/libs/image/tests/test_image.cpp
+index 963515a..7ceb323 100644
+--- a/libs/image/tests/test_image.cpp
++++ b/libs/image/tests/test_image.cpp
+@@ -342,11 +342,11 @@ TEST_F(ImageTest, Mipmaps) { // NOLINT
+             "44444 41014 40704 41014 44444 44444 41014 40704 41014 44444");
+     uint32_t count = getMipmapCount(src);
+     ASSERT_EQ(count, 3);
+-    vector<LinearImage> mips(count);
+-    generateMipmaps(src, filter, mips.data(), count);
++    vector<LinearImage> mipmaps(count);
++    generateMipmaps(src, filter, mipmaps.data(), count);
+     updateOrCompare(src, "mip0_5x10.png");
+     for (uint32_t index = 0; index < count; ++index) {
+-        updateOrCompare(mips[index], "mip" + std::to_string(index + 1) + "_5x10.png");
++        updateOrCompare(mipmaps[index], "mip" + std::to_string(index + 1) + "_5x10.png");
+     }
+     // Test color space with a classic RED => GREEN color gradient.
+@@ -354,11 +354,11 @@ TEST_F(ImageTest, Mipmaps) { // NOLINT
+     src = resampleImage(src, 200, 100, Filter::NEAREST);
+     count = getMipmapCount(src);
+     ASSERT_EQ(count, 7);
+-    mips.resize(count);
+-    generateMipmaps(src, filter, mips.data(), count);
++    mipmaps.resize(count);
++    generateMipmaps(src, filter, mipmaps.data(), count);
+     updateOrCompare(src, "mip0_200x100.png");
+     for (uint32_t index = 0; index < count; ++index) {
+-        updateOrCompare(mips[index], "mip" + std::to_string(index + 1) + "_200x100.png");
++        updateOrCompare(mipmaps[index], "mip" + std::to_string(index + 1) + "_200x100.png");
+     }
+ }
diff --git a/patches/0015-Ensure-proper-alignment-of-resgen-_OFFSET-and-_SIZE-.patch b/patches/0015-Ensure-proper-alignment-of-resgen-_OFFSET-and-_SIZE-.patch
new file mode 100644 (file)
index 0000000..e968a7b
--- /dev/null
@@ -0,0 +1,20 @@
+From: =?utf-8?q?Timo_R=C3=B6hling?= <roehling@debian.org>
+Date: Sun, 13 Feb 2022 00:58:20 +0100
+Subject: Ensure proper alignment of resgen _OFFSET and _SIZE variables
+
+---
+ tools/resgen/src/main.cpp | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/tools/resgen/src/main.cpp b/tools/resgen/src/main.cpp
+index e126b34..083e7d6 100644
+--- a/tools/resgen/src/main.cpp
++++ b/tools/resgen/src/main.cpp
+@@ -312,6 +312,7 @@ int main(int argc, char* argv[]) {
+                 << "    extern int " << prname << "_SIZE;\n";
+         dataAsmStream
++                << "    .balign 8\n"
+                 << prname << "_OFFSET:\n"
+                 << "    .int " << offset << "\n"
+                 << prname << "_SIZE:\n"
diff --git a/patches/series b/patches/series
new file mode 100644 (file)
index 0000000..5dbb9f8
--- /dev/null
@@ -0,0 +1,15 @@
+0001-Build-against-system-libraries.patch
+0002-Disable-Java.patch
+0003-Fix-libstdc-compat.patch
+0004-Fix-combine_static_libs-macro.patch
+0005-Fix-list_licenses-macro.patch
+0006-Adjust-linker-flags.patch
+0007-Link-against-libatomic.patch
+0008-Migrate-to-astc-encoder-API-from-Debian-package.patch
+0009-Fix-library-export-for-Debian.patch
+0010-Rename-resgen-executable-to-avoid-conflict-with-mono.patch
+0011-Replace-BlueGL-with-GLEW.patch
+0012-Use-system-spirv-cross.patch
+0013-Define-M_PIf-only-if-it-is-not-already-defined-in-ma.patch
+0014-Avoid-mips-as-identifier-because-it-fails-on-mips-ar.patch
+0015-Ensure-proper-alignment-of-resgen-_OFFSET-and-_SIZE-.patch
diff --git a/rules b/rules
new file mode 100755 (executable)
index 0000000..56dafc1
--- /dev/null
+++ b/rules
@@ -0,0 +1,37 @@
+#!/usr/bin/make -f
+
+include /usr/share/dpkg/architecture.mk
+include /usr/share/dpkg/pkg-info.mk
+
+export DEB_BUILD_MAINT_OPTIONS = hardening=+all reproducible=+all future=+lfs
+
+FILAMENT_VERSION := $(shell echo $(DEB_VERSION_UPSTREAM) | sed 's/[+~]dfsg[0-9]*$$//')
+FILAMENT_SOVERSION := $(shell echo $(FILAMENT_VERSION) | cut -d. -f1,2)
+
+# Filament assumes that VkSurfaceKHR is a pointer type, which is only true on 64 bit
+ifeq ($(DEB_HOST_ARCH_BITS),64)
+SUPPORTS_VULKAN = ON
+else
+SUPPORTS_VULKAN = OFF
+endif
+
+ifneq (,$(filter $(DEB_HOST_ARCH), armel m68k mipsel powerpc sh4))
+  export DEB_CXXFLAGS_MAINT_APPEND += -Wl,--no-as-needed -latomic -Wl,--as-needed
+endif
+
+%:
+       dh $@
+
+override_dh_auto_configure:
+       dh_auto_configure -- \
+               -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \
+               -DFILAMENT_SKIP_SAMPLES=ON \
+               -DFILAMENT_ENABLE_JAVA=OFF \
+               -DUSE_STATIC_LIBCXX=OFF \
+               -DFILAMENT_SUPPORTS_VULKAN=$(SUPPORTS_VULKAN) \
+               -DFILAMENT_VERSION=$(FILAMENT_VERSION) \
+               -DFILAMENT_SOVERSION=$(FILAMENT_SOVERSION) \
+               -DFILAMENT_LIBDIR=lib/$(DEB_HOST_MULTIARCH) \
+               -DFILAMENT_INCLUDEDIR=include/filament-$(FILAMENT_SOVERSION) \
+               -DFILAMENT_CMAKEDIR=lib/$(DEB_HOST_MULTIARCH)/cmake/filament-$(FILAMENT_SOVERSION)
+
diff --git a/source/format b/source/format
new file mode 100644 (file)
index 0000000..163aaf8
--- /dev/null
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/tests/build b/tests/build
new file mode 100755 (executable)
index 0000000..6582cb8
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/bash
+set -e
+
+library="$1"
+shift
+
+cd "$AUTOPKGTEST_TMP"
+echo '8< -------------- CMakeLists.txt --------------------------------------'
+tee CMakeLists.txt << EOF
+cmake_minimum_required(VERSION 3.19)
+project(test_build)
+find_package(filament REQUIRED)
+add_executable(test_program main.cpp)
+target_link_libraries(test_program PRIVATE ${library})
+EOF
+echo '8< --------------------------------------------------------------------'
+rm -f main.cpp
+for header in "$@"
+do
+       echo '#include <'"$header"'>' >> main.cpp
+done
+cat >> main.cpp << EOF
+
+int main(int argc, char** argv)
+{
+       return 0;
+}
+EOF
+echo
+echo '8< -------------- main.cpp --------------------------------------------'
+cat main.cpp
+echo '8< --------------------------------------------------------------------'
+echo
+echo '$' mkdir build
+mkdir build
+echo
+echo '$' cd build '&&' cmake ..
+cd build && cmake ..
+echo
+echo '$' make VERBOSE=ON
+make VERBOSE=ON
diff --git a/tests/control b/tests/control
new file mode 100644 (file)
index 0000000..9fc3ada
--- /dev/null
@@ -0,0 +1,7 @@
+Test-Command: ./debian/tests/build filament::filament filament/Renderer.h
+Depends: libfilament-dev, cmake, g++
+Features: test-name=filament::filament
+
+Test-Command: ./debian/tests/build filament::filagui filagui/ImGuiMath.h
+Depends: libfilament-dev, cmake, g++
+Features: test-name=filament::filagui