From 067672c661ca9388706d78a16a177d3b30e51304 Mon Sep 17 00:00:00 2001 From: Sandy Carter Date: Sat, 14 Jan 2023 06:51:57 -0500 Subject: [PATCH] Move tinyexr definitions to file --- cmake/bimg/3rdparty/tinyexr.cmake | 23 +++++++++++++++++++++++ cmake/bimg/CMakeLists.txt | 1 + cmake/bimg/bimg_decode.cmake | 10 +++++++--- cmake/bimg/bimg_encode.cmake | 9 ++++++--- 4 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 cmake/bimg/3rdparty/tinyexr.cmake diff --git a/cmake/bimg/3rdparty/tinyexr.cmake b/cmake/bimg/3rdparty/tinyexr.cmake new file mode 100644 index 0000000..f3cbc55 --- /dev/null +++ b/cmake/bimg/3rdparty/tinyexr.cmake @@ -0,0 +1,23 @@ +# 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 TINYEXR_LIBRARIES) + file(GLOB_RECURSE # + TINYEXR_SOURCES # + ${BIMG_DIR}/3rdparty/tinyexr/**.h # + ) + set(TINYEXR_INCLUDE_DIR ${BIMG_DIR}/3rdparty) +endif() diff --git a/cmake/bimg/CMakeLists.txt b/cmake/bimg/CMakeLists.txt index 6b3fa05..340e856 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/tinyexr.cmake) include(3rdparty/miniz.cmake) include(bimg.cmake) include(bimg_decode.cmake) diff --git a/cmake/bimg/bimg_decode.cmake b/cmake/bimg/bimg_decode.cmake index ece4aa9..72b0c5e 100644 --- a/cmake/bimg/bimg_decode.cmake +++ b/cmake/bimg/bimg_decode.cmake @@ -19,9 +19,11 @@ add_library(bimg_decode STATIC) # Put in a "bgfx" folder in Visual Studio set_target_properties(bimg_decode PROPERTIES FOLDER "bgfx") target_include_directories( - bimg_decode PUBLIC $ $ + bimg_decode + PUBLIC $ $ PRIVATE ${BIMG_DIR}/3rdparty # ${MINIZ_INCLUDE_DIR} # + ${TINYEXR_INCLUDE_DIR} # ) file( @@ -36,6 +38,8 @@ file( target_sources(bimg_decode PRIVATE ${BIMG_DECODE_SOURCES}) target_link_libraries( - bimg_decode PUBLIC bx # - ${MINIZ_LIBRARIES} # + bimg_decode + PUBLIC bx # + ${MINIZ_LIBRARIES} # + ${TINYEXR_LIBRARIES} # ) diff --git a/cmake/bimg/bimg_encode.cmake b/cmake/bimg/bimg_encode.cmake index c934ccf..2f4ec03 100644 --- a/cmake/bimg/bimg_encode.cmake +++ b/cmake/bimg/bimg_encode.cmake @@ -27,6 +27,7 @@ target_include_directories( ${BIMG_DIR}/3rdparty/astc-encoder/include # ${BIMG_DIR}/3rdparty/iqa/include # ${BIMG_DIR}/3rdparty/nvtt # + ${TINYEXR_INCLUDE_DIR} # ${MINIZ_INCLUDE_DIR} # ) @@ -47,7 +48,7 @@ file( ${BIMG_DIR}/3rdparty/nvtt/**.h # ${BIMG_DIR}/3rdparty/pvrtc/**.cpp # ${BIMG_DIR}/3rdparty/pvrtc/**.h # - ${BIMG_DIR}/3rdparty/tinyexr/**.h # + ${TINYEXR_SOURCES} ${BIMG_DIR}/3rdparty/iqa/include/**.h # ${BIMG_DIR}/3rdparty/iqa/source/**.c # ) @@ -55,8 +56,10 @@ file( target_sources(bimg_encode PRIVATE ${BIMG_ENCODE_SOURCES}) target_link_libraries( - bimg_encode PUBLIC bx # - ${LIBSQUISH_LIBRARIES} # + bimg_encode + PUBLIC bx # + ${LIBSQUISH_LIBRARIES} # + ${TINYEXR_LIBRARIES} # ) include(CheckCXXCompilerFlag)