From fee5c0112eaf3e90b6039174efffbfd8bfd6c195 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 25 Sep 2012 12:19:13 +0200 Subject: [PATCH] Fixed: #1254 Error while compiling with current stable squish --- code/CMakeModules/FindSquish.cmake | 7 ++++++- code/nel/tools/3d/CMakeLists.txt | 1 + code/nel/tools/3d/hls_bank_maker/CMakeLists.txt | 6 ++---- code/nel/tools/3d/panoply_maker/CMakeLists.txt | 6 ++---- .../tools/3d/s3tc_compressor_lib/CMakeLists.txt | 16 ++++++++++++++++ .../3d/s3tc_compressor_lib/s3tc_compressor.cpp | 4 ++++ code/nel/tools/3d/tga_2_dds/CMakeLists.txt | 6 ++---- 7 files changed, 33 insertions(+), 13 deletions(-) create mode 100644 code/nel/tools/3d/s3tc_compressor_lib/CMakeLists.txt diff --git a/code/CMakeModules/FindSquish.cmake b/code/CMakeModules/FindSquish.cmake index 04f657485..ad0f7ce80 100644 --- a/code/CMakeModules/FindSquish.cmake +++ b/code/CMakeModules/FindSquish.cmake @@ -12,7 +12,7 @@ IF(SQUISH_LIBRARIES AND SQUISH_INCLUDE_DIR) SET(SQUISH_FIND_QUIETLY TRUE) ENDIF(SQUISH_LIBRARIES AND SQUISH_INCLUDE_DIR) -FIND_PATH(SQUISH_INCLUDE_DIR +FIND_PATH(SQUISH_INCLUDE_DIR squish.h PATHS /usr/local/include @@ -67,6 +67,11 @@ IF(SQUISH_FOUND) IF(NOT SQUISH_FIND_QUIETLY) MESSAGE(STATUS "Found Squish: ${SQUISH_LIBRARIES}") ENDIF(NOT SQUISH_FIND_QUIETLY) + FILE(STRINGS ${SQUISH_INCLUDE_DIR}/squish.h METRIC REGEX "metric = 0") + IF(METRIC) + SET(SQUISH_COMPRESS_HAS_METRIC ON) + SET(SQUISH_DEFINITIONS -DSQUISH_COMPRESS_HAS_METRIC) + ENDIF(METRIC) ELSE(SQUISH_FOUND) IF(NOT SQUISH_FIND_QUIETLY) MESSAGE(STATUS "Warning: Unable to find Squish!") diff --git a/code/nel/tools/3d/CMakeLists.txt b/code/nel/tools/3d/CMakeLists.txt index 2d8c4a03a..58360aec0 100644 --- a/code/nel/tools/3d/CMakeLists.txt +++ b/code/nel/tools/3d/CMakeLists.txt @@ -51,6 +51,7 @@ IF(WITH_QT) ENDIF(WITH_QT) IF(SQUISH_FOUND) + ADD_SUBDIRECTORY(s3tc_compressor_lib) ADD_SUBDIRECTORY(panoply_maker) ADD_SUBDIRECTORY(tga_2_dds) ADD_SUBDIRECTORY(hls_bank_maker) diff --git a/code/nel/tools/3d/hls_bank_maker/CMakeLists.txt b/code/nel/tools/3d/hls_bank_maker/CMakeLists.txt index 4b4717087..5b3189b2d 100644 --- a/code/nel/tools/3d/hls_bank_maker/CMakeLists.txt +++ b/code/nel/tools/3d/hls_bank_maker/CMakeLists.txt @@ -1,10 +1,8 @@ -FILE(GLOB SRC *.cpp *.h ../panoply_maker/hls_bank_texture_info.cpp ../panoply_maker/hls_bank_texture_info.h ../s3tc_compressor_lib/*.cpp ../s3tc_compressor_lib/*.h) +FILE(GLOB SRC *.cpp *.h ../panoply_maker/hls_bank_texture_info.cpp ../panoply_maker/hls_bank_texture_info.h) ADD_EXECUTABLE(hls_bank_maker ${SRC}) -INCLUDE_DIRECTORIES(${SQUISH_INCLUDE_DIR}) - -TARGET_LINK_LIBRARIES(hls_bank_maker ${SQUISH_LIBRARIES} nelmisc nel3d) +TARGET_LINK_LIBRARIES(hls_bank_maker s3tc_compressor nelmisc nel3d) NL_DEFAULT_PROPS(hls_bank_maker "NeL, Tools, 3D: hls_bank_maker") NL_ADD_RUNTIME_FLAGS(hls_bank_maker) diff --git a/code/nel/tools/3d/panoply_maker/CMakeLists.txt b/code/nel/tools/3d/panoply_maker/CMakeLists.txt index 4a39ab154..2b17b4877 100644 --- a/code/nel/tools/3d/panoply_maker/CMakeLists.txt +++ b/code/nel/tools/3d/panoply_maker/CMakeLists.txt @@ -1,10 +1,8 @@ -FILE(GLOB SRC *.cpp *.h ../s3tc_compressor_lib/*.h ../s3tc_compressor_lib/*.cpp) +FILE(GLOB SRC *.cpp *.h) ADD_EXECUTABLE(panoply_maker ${SRC}) -INCLUDE_DIRECTORIES(${SQUISH_INCLUDE_DIR}) - -TARGET_LINK_LIBRARIES(panoply_maker ${SQUISH_LIBRARIES} nelmisc nel3d) +TARGET_LINK_LIBRARIES(panoply_maker s3tc_compressor nelmisc nel3d) NL_DEFAULT_PROPS(panoply_maker "NeL, Tools, 3D: panoply_maker") NL_ADD_RUNTIME_FLAGS(panoply_maker) diff --git a/code/nel/tools/3d/s3tc_compressor_lib/CMakeLists.txt b/code/nel/tools/3d/s3tc_compressor_lib/CMakeLists.txt new file mode 100644 index 000000000..e40b5abf8 --- /dev/null +++ b/code/nel/tools/3d/s3tc_compressor_lib/CMakeLists.txt @@ -0,0 +1,16 @@ +FILE(GLOB SRC *.cpp) +FILE(GLOB HEADER *.h) + +INCLUDE_DIRECTORIES(${SQUISH_INCLUDE_DIR}) + +NL_TARGET_LIB(s3tc_compressor ${SRC} ${HEADER}) + +TARGET_LINK_LIBRARIES(s3tc_compressor ${SQUISH_LIBRARIES}) +NL_DEFAULT_PROPS(s3tc_compressor "NeL, Tools, 3D: S3TC Compressor Library") +NL_ADD_RUNTIME_FLAGS(s3tc_compressor) + +ADD_DEFINITIONS(${SQUISH_DEFINITIONS}) + +IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC) + INSTALL(TARGETS s3tc_compressor LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT tools3d) +ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC) diff --git a/code/nel/tools/3d/s3tc_compressor_lib/s3tc_compressor.cpp b/code/nel/tools/3d/s3tc_compressor_lib/s3tc_compressor.cpp index f714dcd6d..6423f77f2 100644 --- a/code/nel/tools/3d/s3tc_compressor_lib/s3tc_compressor.cpp +++ b/code/nel/tools/3d/s3tc_compressor_lib/s3tc_compressor.cpp @@ -60,8 +60,12 @@ static void compressMipMap(uint8 *pixSrc, sint width, sint height, vector