aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/libsquish
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/libsquish')
-rw-r--r--vcpkg/ports/libsquish/cmake-version.patch16
-rw-r--r--vcpkg/ports/libsquish/export-target.patch28
-rw-r--r--vcpkg/ports/libsquish/fix-export-symbols.patch105
-rw-r--r--vcpkg/ports/libsquish/portfile.cmake32
-rw-r--r--vcpkg/ports/libsquish/vcpkg.json24
5 files changed, 205 insertions, 0 deletions
diff --git a/vcpkg/ports/libsquish/cmake-version.patch b/vcpkg/ports/libsquish/cmake-version.patch
new file mode 100644
index 0000000..8dde416
--- /dev/null
+++ b/vcpkg/ports/libsquish/cmake-version.patch
@@ -0,0 +1,16 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index a36e574..6f137d5 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -9,9 +9,9 @@
+ # Unix and VS: SSE2 support is enabled by default
+ # use BUILD_SQUISH_WITH_SSE2 and BUILD_SQUISH_WITH_ALTIVEC to override
+
+-PROJECT(squish)
++CMAKE_MINIMUM_REQUIRED(VERSION 3.5)
+
+-CMAKE_MINIMUM_REQUIRED(VERSION 2.8.3)
++PROJECT(squish)
+
+ OPTION(BUILD_SQUISH_WITH_OPENMP "Build with OpenMP." ON)
+
diff --git a/vcpkg/ports/libsquish/export-target.patch b/vcpkg/ports/libsquish/export-target.patch
new file mode 100644
index 0000000..92df9e6
--- /dev/null
+++ b/vcpkg/ports/libsquish/export-target.patch
@@ -0,0 +1,28 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index a3ecdde..6aa9e64 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -75,6 +75,8 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
+
+ ADD_LIBRARY(squish ${SQUISH_SRCS} ${SQUISH_HDRS})
+
++TARGET_INCLUDE_DIRECTORIES(squish PUBLIC $<INSTALL_INTERFACE:include>)
++
+ INCLUDE(GenerateExportHeader)
+ GENERATE_EXPORT_HEADER(squish
+ EXPORT_FILE_NAME ${CMAKE_CURRENT_SOURCE_DIR}/squish_export.h
+@@ -120,8 +122,14 @@ INCLUDE(GNUInstallDirs)
+
+ INSTALL(
+ TARGETS squish
++ EXPORT unofficial-libsquishConfig
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ )
++
++INSTALL(EXPORT unofficial-libsquishConfig
++ NAMESPACE unofficial::libsquish::
++ DESTINATION share/unofficial-libsquish
++)
diff --git a/vcpkg/ports/libsquish/fix-export-symbols.patch b/vcpkg/ports/libsquish/fix-export-symbols.patch
new file mode 100644
index 0000000..a777eea
--- /dev/null
+++ b/vcpkg/ports/libsquish/fix-export-symbols.patch
@@ -0,0 +1,105 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index a36e574..a3ecdde 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -75,6 +75,13 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
+
+ ADD_LIBRARY(squish ${SQUISH_SRCS} ${SQUISH_HDRS})
+
++INCLUDE(GenerateExportHeader)
++GENERATE_EXPORT_HEADER(squish
++ EXPORT_FILE_NAME ${CMAKE_CURRENT_SOURCE_DIR}/squish_export.h
++ )
++
++list(APPEND SQUISH_HDRS "squish_export.h")
++
+ SET_TARGET_PROPERTIES(
+ squish PROPERTIES
+ PUBLIC_HEADER "${SQUISH_HDRS}"
+@@ -109,9 +116,12 @@ IF (BUILD_SQUISH_EXTRA)
+ ENDIF (PNG_FOUND)
+ ENDIF (BUILD_SQUISH_EXTRA)
+
++INCLUDE(GNUInstallDirs)
++
+ INSTALL(
+ TARGETS squish
+- LIBRARY DESTINATION lib
+- ARCHIVE DESTINATION lib
+- PUBLIC_HEADER DESTINATION include
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
++ PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ )
+diff --git a/squish.h b/squish.h
+index 14c9bb5..aaffbb2 100644
+--- a/squish.h
++++ b/squish.h
+@@ -26,6 +26,8 @@
+ #ifndef SQUISH_H
+ #define SQUISH_H
+
++#include "squish_export.h"
++
+ //! All squish API functions live in this namespace.
+ namespace squish {
+
+@@ -115,5 +117,5 @@
+ */
+-void CompressMasked( u8 const* rgba, int mask, void* block, int flags, float* metric = 0 );
++SQUISH_EXPORT void CompressMasked( u8 const* rgba, int mask, void* block, int flags, float* metric = 0 );
+
+ // -----------------------------------------------------------------------------
+
+@@ -176,7 +178,7 @@ inline void Compress( u8 const* rgba, void* block, int flags, float* metric = 0
+ however, DXT1 will be used by default if none is specified. All other flags
+ are ignored.
+ */
+-void Decompress( u8* rgba, void const* block, int flags );
++SQUISH_EXPORT void Decompress( u8* rgba, void const* block, int flags );
+
+ // -----------------------------------------------------------------------------
+
+@@ -194,7 +196,7 @@ void Decompress( u8* rgba, void const* block, int flags );
+ function supports arbitrary size images by allowing the outer blocks to
+ be only partially used.
+ */
+-int GetStorageRequirements( int width, int height, int flags );
++SQUISH_EXPORT int GetStorageRequirements( int width, int height, int flags );
+
+ // -----------------------------------------------------------------------------
+
+@@ -249,8 +251,8 @@ int GetStorageRequirements( int width, int height, int flags );
+ Windows platform but for other platforms like MacOS X a different
+ gamma value may be more suitable.
+ */
+-void CompressImage( u8 const* rgba, int width, int height, int pitch, void* blocks, int flags, float* metric = 0 );
+-void CompressImage( u8 const* rgba, int width, int height, void* blocks, int flags, float* metric = 0 );
++SQUISH_EXPORT void CompressImage( u8 const* rgba, int width, int height, int pitch, void* blocks, int flags, float* metric = 0 );
++SQUISH_EXPORT void CompressImage( u8 const* rgba, int width, int height, void* blocks, int flags, float* metric = 0 );
+
+ // -----------------------------------------------------------------------------
+
+@@ -274,8 +276,8 @@ void CompressImage( u8 const* rgba, int width, int height, void* blocks, int fla
+
+ Internally this function calls squish::Decompress for each block.
+ */
+-void DecompressImage( u8* rgba, int width, int height, int pitch, void const* blocks, int flags );
+-void DecompressImage( u8* rgba, int width, int height, void const* blocks, int flags );
++SQUISH_EXPORT void DecompressImage( u8* rgba, int width, int height, int pitch, void const* blocks, int flags );
++SQUISH_EXPORT void DecompressImage( u8* rgba, int width, int height, void const* blocks, int flags );
+
+ // -----------------------------------------------------------------------------
+
+@@ -299,8 +301,8 @@ void DecompressImage( u8* rgba, int width, int height, void const* blocks, int f
+
+ Internally this function calls squish::Decompress for each block.
+ */
+-void ComputeMSE(u8 const *rgba, int width, int height, int pitch, u8 const *dxt, int flags, double &colourMSE, double &alphaMSE);
+-void ComputeMSE(u8 const *rgba, int width, int height, u8 const *dxt, int flags, double &colourMSE, double &alphaMSE);
++SQUISH_EXPORT void ComputeMSE(u8 const *rgba, int width, int height, int pitch, u8 const *dxt, int flags, double &colourMSE, double &alphaMSE);
++SQUISH_EXPORT void ComputeMSE(u8 const *rgba, int width, int height, u8 const *dxt, int flags, double &colourMSE, double &alphaMSE);
+
+ // -----------------------------------------------------------------------------
+
diff --git a/vcpkg/ports/libsquish/portfile.cmake b/vcpkg/ports/libsquish/portfile.cmake
new file mode 100644
index 0000000..9112e11
--- /dev/null
+++ b/vcpkg/ports/libsquish/portfile.cmake
@@ -0,0 +1,32 @@
+vcpkg_from_sourceforge(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO libsquish
+ FILENAME "libsquish-1.15.tgz"
+ NO_REMOVE_ONE_LEVEL
+ SHA512 5b569b7023874c7a43063107e2e428ea19e6eb00de045a4a13fafe852ed5402093db4b65d540b5971ec2be0d21cb97dfad9161ebfe6cf6e5376174ff6c6c3e7a
+ PATCHES
+ fix-export-symbols.patch
+ export-target.patch
+ cmake-version.patch
+)
+
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ FEATURES
+ sse2 BUILD_SQUISH_WITH_SSE2
+)
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ DISABLE_PARALLEL_CONFIGURE
+ OPTIONS
+ ${FEATURE_OPTIONS}
+ -DBUILD_SQUISH_WITH_OPENMP=OFF
+)
+
+vcpkg_cmake_install()
+
+vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-libsquish CONFIG_PATH share/unofficial-libsquish)
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share")
+
+file(INSTALL "${SOURCE_PATH}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
diff --git a/vcpkg/ports/libsquish/vcpkg.json b/vcpkg/ports/libsquish/vcpkg.json
new file mode 100644
index 0000000..1d1d947
--- /dev/null
+++ b/vcpkg/ports/libsquish/vcpkg.json
@@ -0,0 +1,24 @@
+{
+ "name": "libsquish",
+ "version": "1.15",
+ "port-version": 14,
+ "description": "Open source DXT compression library.",
+ "homepage": "https://sourceforge.net/projects/libsquish",
+ "license": "MIT",
+ "dependencies": [
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ],
+ "features": {
+ "sse2": {
+ "description": "Build with SSE2",
+ "supports": "osx & x64"
+ }
+ }
+}