From 590523ac8cd095b0a4865ffe98520504ec478927 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Tue, 20 Feb 2018 18:58:52 -0700 Subject: [PATCH] CMake: Rename FindSquish to FindLibSquish CMake already has a "FindSquish" for finding the GUI testing product. This minimizes the chances of the wrong module being run on accident. --- cmake/modules/FindLibSquish.cmake | 80 +++++++++++++++++++++++++++++++ cmake/modules/FindSquish.cmake | 80 ------------------------------- dtool/Package.cmake | 5 +- 3 files changed, 83 insertions(+), 82 deletions(-) create mode 100644 cmake/modules/FindLibSquish.cmake delete mode 100644 cmake/modules/FindSquish.cmake diff --git a/cmake/modules/FindLibSquish.cmake b/cmake/modules/FindLibSquish.cmake new file mode 100644 index 0000000000..9a21d65852 --- /dev/null +++ b/cmake/modules/FindLibSquish.cmake @@ -0,0 +1,80 @@ +# Filename: FindLibSquish.cmake +# Author: kestred (7 Dec, 2013) +# +# Usage: +# find_package(LibSquish [REQUIRED] [QUIET]) +# +# Once done this will define: +# LIBSQUISH_FOUND - system has libsquish +# LIBSQUISH_INCLUDE_DIR - the libsquish include directory +# LIBSQUISH_LIBRARY_DIR - the libsquish library directory +# LIBSQUISH_LIBRARY - the path to the library binary +# +# LIBSQUISH_RELEASE_LIBRARY - the filepath of the libsquish release library +# LIBSQUISH_DEBUG_LIBRARY - the filepath of the libsquish debug library +# + +if(NOT LIBSQUISH_INCLUDE_DIR OR NOT LIBSQUISH_LIBRARY_DIR) + # Find the libsquish include files + find_path(LIBSQUISH_INCLUDE_DIR + NAMES "squish.h" + PATHS "/usr/include" + "/usr/local/include" + "/sw/include" + "/opt/include" + "/opt/local/include" + "/opt/csw/include" + PATH_SUFFIXES "" "cppunit" + ) + + # Find the libsquish library built for release + find_library(LIBSQUISH_RELEASE_LIBRARY + NAMES "squish" "libsquish" + PATHS "/usr" + "/usr/local" + "/usr/freeware" + "/sw" + "/opt" + "/opt/csw" + PATH_SUFFIXES "lib" "lib32" "lib64" + ) + + # Find the libsquish library built for debug + find_library(LIBSQUISH_DEBUG_LIBRARY + NAMES "squishd" "libsquishd" + PATHS "/usr" + "/usr/local" + "/usr/freeware" + "/sw" + "/opt" + "/opt/csw" + PATH_SUFFIXES "lib" "lib32" "lib64" + ) + + + mark_as_advanced(LIBSQUISH_INCLUDE_DIR) + mark_as_advanced(LIBSQUISH_RELEASE_LIBRARY) + mark_as_advanced(LIBSQUISH_DEBUG_LIBRARY) +endif() + +# Choose library +if(CMAKE_BUILD_TYPE MATCHES "Debug" AND LIBSQUISH_DEBUG_LIBRARY) + set(LIBSQUISH_LIBRARY ${LIBSQUISH_DEBUG_LIBRARY} CACHE FILEPATH "The filepath to libsquish's library binary.") +elseif(LIBSQUISH_RELEASE_LIBRARY) + set(LIBSQUISH_LIBRARY ${LIBSQUISH_RELEASE_LIBRARY} CACHE FILEPATH "The filepath to libsquish's library binary.") +elseif(LIBSQUISH_DEBUG_LIBRARY) + set(LIBSQUISH_LIBRARY ${LIBSQUISH_DEBUG_LIBRARY} CACHE FILEPATH "The filepath to libsquish's library binary.") +endif() + +# Translate library into library directory +if(LIBSQUISH_LIBRARY) + unset(LIBSQUISH_LIBRARY_DIR CACHE) + get_filename_component(LIBSQUISH_LIBRARY_DIR "${LIBSQUISH_LIBRARY}" PATH) + set(LIBSQUISH_LIBRARY_DIR "${LIBSQUISH_LIBRARY_DIR}" CACHE PATH "The path to libsquish's library directory.") # Library path +endif() + +mark_as_advanced(LIBSQUISH_LIBRARY) +mark_as_advanced(LIBSQUISH_LIBRARY_DIR) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(LibSquish DEFAULT_MSG LIBSQUISH_LIBRARY LIBSQUISH_INCLUDE_DIR LIBSQUISH_LIBRARY_DIR) diff --git a/cmake/modules/FindSquish.cmake b/cmake/modules/FindSquish.cmake deleted file mode 100644 index 9a0acb80ae..0000000000 --- a/cmake/modules/FindSquish.cmake +++ /dev/null @@ -1,80 +0,0 @@ -# Filename: FindSquish.cmake -# Author: kestred (7 Dec, 2013) -# -# Usage: -# find_package(Squish [REQUIRED] [QUIET]) -# -# Once done this will define: -# SQUISH_FOUND - system has squish -# SQUISH_INCLUDE_DIR - the squish include directory -# SQUISH_LIBRARY_DIR - the squish library directory -# SQUISH_LIBRARY - the path to the library binary -# -# SQUISH_RELEASE_LIBRARY - the filepath of the squish release library -# SQUISH_DEBUG_LIBRARY - the filepath of the squish debug library -# - -if(NOT SQUISH_INCLUDE_DIR OR NOT SQUISH_LIBRARY_DIR) - # Find the libsquish include files - find_path(SQUISH_INCLUDE_DIR - NAMES "squish.h" - PATHS "/usr/include" - "/usr/local/include" - "/sw/include" - "/opt/include" - "/opt/local/include" - "/opt/csw/include" - PATH_SUFFIXES "" "cppunit" - ) - - # Find the libsquish library built for release - find_library(SQUISH_RELEASE_LIBRARY - NAMES "squish" "libsquish" - PATHS "/usr" - "/usr/local" - "/usr/freeware" - "/sw" - "/opt" - "/opt/csw" - PATH_SUFFIXES "lib" "lib32" "lib64" - ) - - # Find the libsquish library built for debug - find_library(SQUISH_DEBUG_LIBRARY - NAMES "squishd" "libsquishd" - PATHS "/usr" - "/usr/local" - "/usr/freeware" - "/sw" - "/opt" - "/opt/csw" - PATH_SUFFIXES "lib" "lib32" "lib64" - ) - - - mark_as_advanced(SQUISH_INCLUDE_DIR) - mark_as_advanced(SQUISH_RELEASE_LIBRARY) - mark_as_advanced(SQUISH_DEBUG_LIBRARY) -endif() - -# Choose library -if(CMAKE_BUILD_TYPE MATCHES "Debug" AND SQUISH_DEBUG_LIBRARY) - set(SQUISH_LIBRARY ${SQUISH_DEBUG_LIBRARY} CACHE FILEPATH "The filepath to libsquish's library binary.") -elseif(SQUISH_RELEASE_LIBRARY) - set(SQUISH_LIBRARY ${SQUISH_RELEASE_LIBRARY} CACHE FILEPATH "The filepath to libsquish's library binary.") -elseif(SQUISH_DEBUG_LIBRARY) - set(SQUISH_LIBRARY ${SQUISH_DEBUG_LIBRARY} CACHE FILEPATH "The filepath to libsquish's library binary.") -endif() - -# Translate library into library directory -if(SQUISH_LIBRARY) - unset(SQUISH_LIBRARY_DIR CACHE) - get_filename_component(SQUISH_LIBRARY_DIR "${SQUISH_LIBRARY}" PATH) - set(SQUISH_LIBRARY_DIR "${SQUISH_LIBRARY_DIR}" CACHE PATH "The path to libsquish's library directory.") # Library path -endif() - -mark_as_advanced(SQUISH_LIBRARY) -mark_as_advanced(SQUISH_LIBRARY_DIR) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Squish DEFAULT_MSG SQUISH_LIBRARY SQUISH_INCLUDE_DIR SQUISH_LIBRARY_DIR) diff --git a/dtool/Package.cmake b/dtool/Package.cmake index b965c0244c..26b2e8ac05 100644 --- a/dtool/Package.cmake +++ b/dtool/Package.cmake @@ -89,10 +89,11 @@ config_package(FFTW "FFTW") # ------------ libsquish ------------ # -find_package(Squish QUIET) +find_package(LibSquish QUIET) package_option(SQUISH - "Enables support for automatic compression of DXT textures.") + "Enables support for automatic compression of DXT textures." + FOUND_AS LIBSQUISH) config_package(SQUISH "libsquish")