1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
|
From: =?utf-8?q?Timo_R=C3=B6hling?= <roehling@debian.org>
Date: Sat, 17 Jun 2023 21:36:21 +0200
Subject: Link against system libraries
Forwarded: not-needed
---
CMakeLists.txt | 5 +++++
Source/astcenccli_image_external.cpp | 6 +++---
Source/astcenccli_image_load_store.cpp | 6 +++---
Source/cmake_core.cmake | 11 ++++++-----
4 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 673cf04..e16e6d3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -152,6 +152,11 @@ printopt("ASAN " ${ASTCENC_ASAN})
printopt("UBSAN " ${ASTCENC_UBSAN})
printopt("Unit tests " ${ASTCENC_UNITTEST})
+find_package(ZLIB REQUIRED)
+find_package(tinyexr REQUIRED)
+find_path(stb_INCLUDE_DIR NAMES stb.h PATH_SUFFIXES stb)
+find_package(Threads REQUIRED)
+
# Subcomponents
add_subdirectory(Source)
diff --git a/Source/astcenccli_image_external.cpp b/Source/astcenccli_image_external.cpp
index e41b9ab..1fba965 100644
--- a/Source/astcenccli_image_external.cpp
+++ b/Source/astcenccli_image_external.cpp
@@ -66,9 +66,9 @@ static void astcenc_runtime_assert(bool condition)
}
}
-#include "ThirdParty/stb_image.h"
-#include "ThirdParty/stb_image_write.h"
-#include "ThirdParty/tinyexr.h"
+//#include "ThirdParty/stb_image.h"
+//#include "ThirdParty/stb_image_write.h"
+//#include "ThirdParty/tinyexr.h"
/**
* @brief Load an image using Wuffs to provide the loader.
diff --git a/Source/astcenccli_image_load_store.cpp b/Source/astcenccli_image_load_store.cpp
index fff7fb3..f34516d 100644
--- a/Source/astcenccli_image_load_store.cpp
+++ b/Source/astcenccli_image_load_store.cpp
@@ -30,9 +30,9 @@
#include "astcenccli_internal.h"
-#include "ThirdParty/stb_image.h"
-#include "ThirdParty/stb_image_write.h"
-#include "ThirdParty/tinyexr.h"
+#include <stb_image.h>
+#include <stb_image_write.h>
+#include <tinyexr.h>
/**
* @brief Reverse the bytes in a uint32_t value.
diff --git a/Source/cmake_core.cmake b/Source/cmake_core.cmake
index ae4e052..c42d865 100644
--- a/Source/cmake_core.cmake
+++ b/Source/cmake_core.cmake
@@ -105,8 +105,12 @@ if(${ASTCENC_CLI})
astcenccli_toplevel.cpp
astcenccli_toplevel_help.cpp)
+ target_include_directories(${ASTCENC_TARGET} PRIVATE ${stb_INCLUDE_DIR})
target_link_libraries(${ASTCENC_TARGET}
PRIVATE
+ tinyexr::tinyexr
+ stb
+ ZLIB::ZLIB
${ASTCENC_TARGET}-veneer1
${ASTCENC_TARGET}-veneer2
${ASTCENC_TARGET}-static)
@@ -142,9 +146,6 @@ macro(astcenc_set_properties ASTCENC_TARGET_NAME ASTCENC_VENEER_TYPE)
target_compile_options(${ASTCENC_TARGET_NAME}
PRIVATE
- # Use pthreads on Linux/macOS
- $<$<PLATFORM_ID:Linux,Darwin>:-pthread>
-
# MSVC compiler defines
$<${is_msvc_fe}:/EHsc>
$<$<AND:$<BOOL:${ASTCENC_WERROR}>,${is_msvc_fe}>:/WX>
@@ -183,10 +184,10 @@ macro(astcenc_set_properties ASTCENC_TARGET_NAME ASTCENC_VENEER_TYPE)
# Disable non-portable Windows.h warning (fixing it fails builds on MinGW)
$<$<AND:$<PLATFORM_ID:Windows>,${is_clang}>:-Wno-nonportable-system-include-path>)
- target_link_options(${ASTCENC_TARGET_NAME}
+ target_link_libraries(${ASTCENC_TARGET_NAME}
PRIVATE
# Use pthreads on Linux/macOS
- $<$<PLATFORM_ID:Linux,Darwin>:-pthread>)
+ Threads::Threads)
if(${ASTCENC_ASAN})
target_compile_options(${ASTCENC_TARGET_NAME}
|