From 26a481e478a426a97b8586f47dc894218d33ad42 Mon Sep 17 00:00:00 2001 From: Benau Date: Thu, 11 Jan 2018 14:40:33 +0800 Subject: [PATCH] Allow using system libsquish --- CMakeLists.txt | 20 +++++++++++++------- src/graphics/sp/sp_texture.cpp | 3 +++ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0a74c0fa9..00fbe5a35 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -175,8 +175,18 @@ if(NOT SERVER_ONLY AND NOT USE_GLES2) include_directories("${PROJECT_SOURCE_DIR}/lib/graphics_utils") endif() -add_subdirectory("${PROJECT_SOURCE_DIR}/lib/libsquish") -include_directories("${PROJECT_SOURCE_DIR}/lib/libsquish") +if(NOT SERVER_ONLY AND NOT USE_GLES2) + find_library(SQUISH_LIBRARY NAMES squish libsquish) + find_path(SQUISH_INCLUDEDIR NAMES squish.h PATHS) + if (NOT SQUISH_LIBRARY OR NOT SQUISH_INCLUDEDIR) + add_subdirectory("${PROJECT_SOURCE_DIR}/lib/libsquish") + include_directories("${PROJECT_SOURCE_DIR}/lib/libsquish") + SET(SQUISH_LIBRARY squish) + else() + include_directories("${SQUISH_INCLUDEDIR}") + MESSAGE(STATUS "Use system libsquish: ${SQUISH_LIBRARY}") + endif() +endif() # Build the irrlicht library add_subdirectory("${PROJECT_SOURCE_DIR}/lib/irrlicht") @@ -430,7 +440,7 @@ if(NOT SERVER_ONLY) endif() if(NOT SERVER_ONLY AND NOT USE_GLES2) - target_link_libraries(supertuxkart squish) + target_link_libraries(supertuxkart ${SQUISH_LIBRARY}) endif() if(UNIX AND NOT APPLE) @@ -447,10 +457,6 @@ if(BUILD_RECORDER) target_link_libraries(supertuxkart ${OPENGLRECORDER_LIBRARY}) endif() -if(TEX_COMPRESS) - target_link_libraries(supertuxkart ${TC_LIBRARY}) -endif() - # FreeBSD does not search in /usr/local/lib, but at least Freetype is installed there :( if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L/usr/local/lib") diff --git a/src/graphics/sp/sp_texture.cpp b/src/graphics/sp/sp_texture.cpp index e17709c65..d1739844d 100644 --- a/src/graphics/sp/sp_texture.cpp +++ b/src/graphics/sp/sp_texture.cpp @@ -30,6 +30,9 @@ #if !(defined(SERVER_ONLY) || defined(USE_GLES2)) #include +static_assert(squish::kColourClusterFit == (1 << 5), "Wrong header"); +static_assert(squish::kColourRangeFit == (1 << 6), "Wrong header"); +static_assert(squish::kColourIterativeClusterFit == (1 << 8), "Wrong header"); #endif #if !(defined(SERVER_ONLY) || defined(USE_GLES2))