From 4f4e484333ca706948ccbaa4e0eb6a52354369a0 Mon Sep 17 00:00:00 2001 From: Sandy Carter Date: Sat, 14 Jan 2023 07:28:49 -0500 Subject: [PATCH] Move astc-encode to file --- cmake/bimg/3rdparty/astc_encoder.cmake | 25 +++++++++++++++++++++++++ cmake/bimg/CMakeLists.txt | 1 + cmake/bimg/bimg.cmake | 12 ++++++------ cmake/bimg/bimg_encode.cmake | 3 ++- 4 files changed, 34 insertions(+), 7 deletions(-) create mode 100644 cmake/bimg/3rdparty/astc_encoder.cmake diff --git a/cmake/bimg/3rdparty/astc_encoder.cmake b/cmake/bimg/3rdparty/astc_encoder.cmake new file mode 100644 index 0000000..a215595 --- /dev/null +++ b/cmake/bimg/3rdparty/astc_encoder.cmake @@ -0,0 +1,25 @@ +# bgfx.cmake - bgfx building in cmake +# Written in 2017 by Joshua Brookover +# +# To the extent possible under law, the author(s) have dedicated all copyright +# and related and neighboring rights to this software to the public domain +# worldwide. This software is distributed without any warranty. +# +# You should have received a copy of the CC0 Public Domain Dedication along with +# this software. If not, see . + +# Ensure the directory exists +if(NOT IS_DIRECTORY ${BIMG_DIR}) + message(SEND_ERROR "Could not load bimg, directory does not exist. ${BIMG_DIR}") + return() +endif() + +if(NOT ASTC_ENCODER_LIBRARIES) + file( + GLOB_RECURSE # + ASTC_ENCODER_SOURCES # + ${BIMG_DIR}/3rdparty/astc-encoder/source/*.cpp # + ${BIMG_DIR}/3rdparty/astc-encoder/source/*.h # + ) + set(ASTC_ENCODER_INCLUDE_DIR ${BIMG_DIR}/3rdparty/astc-encoder/include) +endif() diff --git a/cmake/bimg/CMakeLists.txt b/cmake/bimg/CMakeLists.txt index 340e856..7f8a0e8 100644 --- a/cmake/bimg/CMakeLists.txt +++ b/cmake/bimg/CMakeLists.txt @@ -9,6 +9,7 @@ # this software. If not, see . include(3rdparty/libsquish.cmake) +include(3rdparty/astc_encoder.cmake) include(3rdparty/tinyexr.cmake) include(3rdparty/miniz.cmake) include(bimg.cmake) diff --git a/cmake/bimg/bimg.cmake b/cmake/bimg/bimg.cmake index e9eb740..de66315 100644 --- a/cmake/bimg/bimg.cmake +++ b/cmake/bimg/bimg.cmake @@ -21,7 +21,7 @@ set_target_properties(bimg PROPERTIES FOLDER "bgfx") target_include_directories( bimg PUBLIC $$ - PRIVATE ${BIMG_DIR}/3rdparty/astc-encoder/include # + PRIVATE ${ASTC_ENCODER_INCLUDE_DIR} # ${MINIZ_INCLUDE_DIR} # ) @@ -32,15 +32,15 @@ file( ${BIMG_DIR}/src/image.* # ${BIMG_DIR}/src/image_gnf.cpp # # - ${BIMG_DIR}/3rdparty/astc-encoder/source/*.cpp # - ${BIMG_DIR}/3rdparty/astc-encoder/source/*.h # - # + ${ASTC_ENCODER_SOURCES} ${MINIZ_SOURCES} ) target_sources(bimg PRIVATE ${BIMG_SOURCES}) target_link_libraries( - bimg PUBLIC bx # - ${MINIZ_LIBRARIES} # + bimg + PUBLIC bx # + ${ASTC_ENCODER_LIBRARIES} # + ${MINIZ_LIBRARIES} # ) diff --git a/cmake/bimg/bimg_encode.cmake b/cmake/bimg/bimg_encode.cmake index 2f4ec03..2486349 100644 --- a/cmake/bimg/bimg_encode.cmake +++ b/cmake/bimg/bimg_encode.cmake @@ -24,7 +24,7 @@ target_include_directories( PUBLIC $ $ PRIVATE ${BIMG_DIR}/3rdparty # ${LIBSQUISH_INCLUDE_DIR} # - ${BIMG_DIR}/3rdparty/astc-encoder/include # + ${ASTC_ENCODER_INCLUDE_DIR} ${BIMG_DIR}/3rdparty/iqa/include # ${BIMG_DIR}/3rdparty/nvtt # ${TINYEXR_INCLUDE_DIR} # @@ -59,6 +59,7 @@ target_link_libraries( bimg_encode PUBLIC bx # ${LIBSQUISH_LIBRARIES} # + ${ASTC_ENCODER_LIBRARIES} # ${TINYEXR_LIBRARIES} # )