Allow using system libsquish

This commit is contained in:
Benau 2018-01-11 14:40:33 +08:00
parent 7859a00967
commit 26a481e478
2 changed files with 16 additions and 7 deletions

View File

@ -175,8 +175,18 @@ if(NOT SERVER_ONLY AND NOT USE_GLES2)
include_directories("${PROJECT_SOURCE_DIR}/lib/graphics_utils")
endif()
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")

View File

@ -30,6 +30,9 @@
#if !(defined(SERVER_ONLY) || defined(USE_GLES2))
#include <squish.h>
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))