From 32508a2289c4147285beece54104082eb7d4a1db Mon Sep 17 00:00:00 2001 From: Sandy Carter Date: Sat, 14 Jan 2023 07:42:53 -0500 Subject: [PATCH] Add loadpng sources to file --- cmake/bimg/3rdparty/loadpng.cmake | 26 ++++++++++++++++++++++++++ cmake/bimg/CMakeLists.txt | 1 + cmake/bimg/bimg_decode.cmake | 4 +++- 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 cmake/bimg/3rdparty/loadpng.cmake diff --git a/cmake/bimg/3rdparty/loadpng.cmake b/cmake/bimg/3rdparty/loadpng.cmake new file mode 100644 index 0000000..5f99436 --- /dev/null +++ b/cmake/bimg/3rdparty/loadpng.cmake @@ -0,0 +1,26 @@ +# 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 LOADPNG_LIBRARIES) + file( + GLOB_RECURSE # + LOADPNG_SOURCES # + ${BIMG_DIR}/3rdparty/lodepng/lodepng.cpp # + ${BIMG_DIR}/3rdparty/lodepng/lodepng.h # + ) + set_source_files_properties(${BIMG_DIR}/3rdparty/lodepng/lodepng.cpp PROPERTIES HEADER_FILE_ONLY ON) + set(LOADPNG_INCLUDE_DIR ${BIMG_DIR}/3rdparty) +endif() diff --git a/cmake/bimg/CMakeLists.txt b/cmake/bimg/CMakeLists.txt index 7f8a0e8..2427376 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/loadpng.cmake) include(3rdparty/libsquish.cmake) include(3rdparty/astc_encoder.cmake) include(3rdparty/tinyexr.cmake) diff --git a/cmake/bimg/bimg_decode.cmake b/cmake/bimg/bimg_decode.cmake index 72b0c5e..060a049 100644 --- a/cmake/bimg/bimg_decode.cmake +++ b/cmake/bimg/bimg_decode.cmake @@ -21,7 +21,7 @@ set_target_properties(bimg_decode PROPERTIES FOLDER "bgfx") target_include_directories( bimg_decode PUBLIC $ $ - PRIVATE ${BIMG_DIR}/3rdparty # + PRIVATE ${LOADPNG_INCLUDE_DIR} # ${MINIZ_INCLUDE_DIR} # ${TINYEXR_INCLUDE_DIR} # ) @@ -32,6 +32,7 @@ file( ${BIMG_DIR}/include/* # ${BIMG_DIR}/src/image_decode.* # # + ${LOADPNG_SOURCES} # ${MINIZ_SOURCES} # ) @@ -40,6 +41,7 @@ target_sources(bimg_decode PRIVATE ${BIMG_DECODE_SOURCES}) target_link_libraries( bimg_decode PUBLIC bx # + ${LOADPNG_LIBRARIES} # ${MINIZ_LIBRARIES} # ${TINYEXR_LIBRARIES} # )