diff --git a/cmake/bimg/3rdparty/miniz.cmake b/cmake/bimg/3rdparty/miniz.cmake new file mode 100644 index 0000000..65b0152 --- /dev/null +++ b/cmake/bimg/3rdparty/miniz.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 MINIZ_LIBRARIES) + file(GLOB_RECURSE # + MINIZ_SOURCES # + ${BIMG_DIR}/3rdparty/tinyexr/deps/miniz/miniz.* # + ) + set(MINIZ_INCLUDE_DIR ${BIMG_DIR}/3rdparty/tinyexr/deps/miniz) +endif() diff --git a/cmake/bimg/CMakeLists.txt b/cmake/bimg/CMakeLists.txt index 3603f5f..c1274de 100644 --- a/cmake/bimg/CMakeLists.txt +++ b/cmake/bimg/CMakeLists.txt @@ -8,6 +8,7 @@ # You should have received a copy of the CC0 Public Domain Dedication along with # this software. If not, see . +include(3rdparty/miniz.cmake) include(bimg.cmake) include(bimg_decode.cmake) include(bimg_encode.cmake) diff --git a/cmake/bimg/bimg.cmake b/cmake/bimg/bimg.cmake index 3ae413a..e9eb740 100644 --- a/cmake/bimg/bimg.cmake +++ b/cmake/bimg/bimg.cmake @@ -22,7 +22,7 @@ set_target_properties(bimg PROPERTIES FOLDER "bgfx") target_include_directories( bimg PUBLIC $$ PRIVATE ${BIMG_DIR}/3rdparty/astc-encoder/include # - ${BIMG_DIR}/3rdparty/tinyexr/deps/miniz # + ${MINIZ_INCLUDE_DIR} # ) file( @@ -35,9 +35,12 @@ file( ${BIMG_DIR}/3rdparty/astc-encoder/source/*.cpp # ${BIMG_DIR}/3rdparty/astc-encoder/source/*.h # # - ${BIMG_DIR}/3rdparty/tinyexr/deps/miniz/miniz.* # + ${MINIZ_SOURCES} ) target_sources(bimg PRIVATE ${BIMG_SOURCES}) -target_link_libraries(bimg PUBLIC bx) +target_link_libraries( + bimg PUBLIC bx # + ${MINIZ_LIBRARIES} # +) diff --git a/cmake/bimg/bimg_decode.cmake b/cmake/bimg/bimg_decode.cmake index 689f946..ece4aa9 100644 --- a/cmake/bimg/bimg_decode.cmake +++ b/cmake/bimg/bimg_decode.cmake @@ -18,20 +18,24 @@ 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 $ $ PRIVATE ${BIMG_DIR}/3rdparty # - ${BIMG_DIR}/3rdparty/tinyexr/deps/miniz # + ${MINIZ_INCLUDE_DIR} # ) -file(GLOB_RECURSE BIMG_DECODE_SOURCES # - ${BIMG_DIR}/include/* # - ${BIMG_DIR}/src/image_decode.* # - # - ${BIMG_DIR}/3rdparty/tinyexr/deps/miniz/miniz.* # +file( + GLOB_RECURSE + BIMG_DECODE_SOURCES # + ${BIMG_DIR}/include/* # + ${BIMG_DIR}/src/image_decode.* # + # + ${MINIZ_SOURCES} # ) target_sources(bimg_decode PRIVATE ${BIMG_DECODE_SOURCES}) -target_link_libraries(bimg_decode PUBLIC bx) +target_link_libraries( + bimg_decode PUBLIC bx # + ${MINIZ_LIBRARIES} # +) diff --git a/cmake/bimg/bimg_encode.cmake b/cmake/bimg/bimg_encode.cmake index 5910d5d..e9f05fb 100644 --- a/cmake/bimg/bimg_encode.cmake +++ b/cmake/bimg/bimg_encode.cmake @@ -26,7 +26,7 @@ target_include_directories( ${BIMG_DIR}/3rdparty/astc-encoder/include # ${BIMG_DIR}/3rdparty/iqa/include # ${BIMG_DIR}/3rdparty/nvtt # - ${BIMG_DIR}/3rdparty/tinyexr/deps/miniz # + ${MINIZ_INCLUDE_DIR} # ) file(