# --- T2-COPYRIGHT-NOTE-BEGIN --- # T2 SDE: package/*/diligent-engine/no-build-third-party.patch # Copyright (C) 2024 The T2 SDE Project # # This Copyright note is generated by scripts/Create-CopyPatch, # more information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License version 2 as used by the T2 SDE. # --- T2-COPYRIGHT-NOTE-END --- diff --git a/DiligentTools/ThirdParty/CMakeLists.txt b/DiligentTools/ThirdParty/CMakeLists.txt index 3526783..8a1eb14 100644 --- a/DiligentTools/ThirdParty/CMakeLists.txt +++ b/DiligentTools/ThirdParty/CMakeLists.txt @@ -1,5 +1,10 @@ cmake_minimum_required (VERSION 3.6) +find_package(PNG REQUIRED GLOBAL) +find_package(TIFF REQUIRED GLOBAL) +find_package(JPEG REQUIRED GLOBAL) +find_package(ZLIB REQUIRED GLOBAL) + set(LICENSE_INSTALL_PATH "Licenses/ThirdParty/${DILIGENT_TOOLS_DIR}") # Helper interface library to disable -Werror for the third-party libs @@ -11,55 +16,6 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR target_compile_options(NO_WERROR INTERFACE -Wno-error) endif() - -if (NOT TARGET JPEG::JPEG) - add_subdirectory(libjpeg-9e) - install(FILES libjpeg-9e/README DESTINATION ${LICENSE_INSTALL_PATH} RENAME libjpeg-readme.txt) - list(APPEND THIRD_PARTY_TARGETS LibJpeg) -endif() - -if (NOT TARGET TIFF::TIFF) - add_subdirectory(libtiff) - install(FILES libtiff/COPYRIGHT DESTINATION ${LICENSE_INSTALL_PATH} RENAME libtiff-copyright.txt) - list(APPEND THIRD_PARTY_TARGETS LibTiff) - if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") - target_compile_options(LibTiff PRIVATE -Wno-shorten-64-to-32) - endif() -endif() - -if (NOT TARGET ZLIB::ZLIB) - include(zlib.cmake) - install(FILES zlib/README DESTINATION ${LICENSE_INSTALL_PATH} RENAME zlib-readme.txt) - list(APPEND THIRD_PARTY_TARGETS ZLib) - if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") - target_compile_options(ZLib PRIVATE -Wno-shorten-64-to-32) - endif() -endif() - -if (NOT TARGET PNG::PNG) - set(PNG_BUILD_ZLIB ON CACHE BOOL "Use find_package(zlib) to find ZLib location") - set(PNG_SHARED OFF CACHE BOOL "Build shared version of libpng") - set(PNG_TOOLS OFF CACHE BOOL "Build libpng tools") - set(PNG_TESTS OFF CACHE BOOL "Build libpng tests") - set(SKIP_INSTALL_ALL ON) - set(PNG_FRAMEWORK OFF) - if(PLATFORM_TVOS) - # libpng does not support tvOS, but it does support iOS, so we can use the iOS target - set(IOS TRUE) - endif() - add_subdirectory(libpng) - set_target_properties(png_static PROPERTIES POSITION_INDEPENDENT_CODE ON) - set_directory_root_folder(libpng DiligentTools/ThirdParty/png) - install(FILES libpng/LICENSE DESTINATION ${LICENSE_INSTALL_PATH} RENAME lpng-license.txt) - add_library(PNG::PNG ALIAS png_static) - list(APPEND THIRD_PARTY_TARGETS png_static) - - if (PLATFORM_EMSCRIPTEN) - set_targets_emscripten_properties(png_static) - endif() -endif() - - if (NOT DILIGENT_ARGS_DIR) set(DILIGENT_ARGS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/args" CACHE PATH "args source directory") endif() @@ -75,15 +31,7 @@ endif() install(FILES tinygltf/LICENSE DESTINATION ${LICENSE_INSTALL_PATH} RENAME tinygltf-license.txt) install(FILES imGuIZMO.quat/license.txt DESTINATION ${LICENSE_INSTALL_PATH} RENAME imGuIZMO.quat-license.txt) install(FILES stb/LICENSE DESTINATION "${LICENSE_INSTALL_PATH}" RENAME stb-license.txt) -install(FILES json/LICENSE.MIT DESTINATION ${LICENSE_INSTALL_PATH} RENAME json-license.txt) - - add_library(Diligent-JSON INTERFACE) -target_include_directories(Diligent-JSON INTERFACE json/single_include/nlohmann) -# WARNING: JSON_DIAGNOSTICS must be consistently defined for all inclusions of json.hpp, -# or there will be hard-to-diagnose run-time crashes. -# It is required by RenderStatePackager even in release builds. -target_compile_definitions(Diligent-JSON INTERFACE JSON_DIAGNOSTICS=1) if (NOT DILIGENT_DEAR_IMGUI_PATH)