From 372920f72e15697c9d9d688ce29fcf18b9d56149 Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 12 Sep 2010 00:40:26 +0200 Subject: [PATCH] Fixed: Use debug or release versions of C++ libraries (CppTest, STLport, Squish and Luabind) --- code/CMakeModules/FindCppTest.cmake | 43 +++++++++++++---- code/CMakeModules/FindLuabind.cmake | 46 +++++++++++++++---- code/CMakeModules/FindSTLport.cmake | 2 +- code/CMakeModules/FindSquish.cmake | 43 +++++++++++++---- .../tools/3d/hls_bank_maker/CMakeLists.txt | 2 +- .../nel/tools/3d/panoply_maker/CMakeLists.txt | 4 +- code/nel/tools/3d/tga_2_dds/CMakeLists.txt | 2 +- code/nel/tools/nel_unit_test/CMakeLists.txt | 2 +- code/ryzom/client/src/CMakeLists.txt | 5 +- 9 files changed, 112 insertions(+), 37 deletions(-) diff --git a/code/CMakeModules/FindCppTest.cmake b/code/CMakeModules/FindCppTest.cmake index 54144eb56..47c69c233 100644 --- a/code/CMakeModules/FindCppTest.cmake +++ b/code/CMakeModules/FindCppTest.cmake @@ -3,14 +3,14 @@ # # This module defines # CPPTEST_INCLUDE_DIR, where to find tiff.h, etc. -# CPPTEST_LIBRARY, where to find the CppTest library. +# CPPTEST_LIBRARIES, where to find the CppTest libraries. # CPPTEST_FOUND, If false, do not try to use CppTest. # also defined, but not for general use are -IF(CPPTEST_LIBRARY AND CPPTEST_INCLUDE_DIR) +IF(CPPTEST_LIBRARIES AND CPPTEST_INCLUDE_DIR) # in cache already SET(CPPTEST_FIND_QUIETLY TRUE) -ENDIF(CPPTEST_LIBRARY AND CPPTEST_INCLUDE_DIR) +ENDIF(CPPTEST_LIBRARIES AND CPPTEST_INCLUDE_DIR) FIND_PATH(CPPTEST_INCLUDE_DIR cpptest.h @@ -24,7 +24,7 @@ FIND_PATH(CPPTEST_INCLUDE_DIR PATH_SUFFIXES cppunit ) -FIND_LIBRARY(CPPTEST_LIBRARY +FIND_LIBRARY(CPPTEST_LIBRARY_RELEASE cpptest PATHS /usr/local/lib @@ -38,14 +38,39 @@ FIND_LIBRARY(CPPTEST_LIBRARY /usr/freeware/lib64 ) -IF(CPPTEST_LIBRARY AND CPPTEST_INCLUDE_DIR) - SET(CPPTEST_FOUND "YES") +FIND_LIBRARY(CPPTEST_LIBRARY_DEBUG + cpptestd + PATHS + /usr/local/lib + /usr/lib + /usr/local/X11R6/lib + /usr/X11R6/lib + /sw/lib + /opt/local/lib + /opt/csw/lib + /opt/lib + /usr/freeware/lib64 +) + +IF(CPPTEST_INCLUDE_DIR) + IF(CPPTEST_LIBRARY_RELEASE) + SET(CPPTEST_FOUND "YES") + + SET(CPPTEST_LIBRARIES "optimized;${CPPTEST_LIBRARY_RELEASE}") + IF(CPPTEST_LIBRARY_DEBUG) + SET(CPPTEST_LIBRARIES "${CPPTEST_LIBRARIES};debug;${CPPTEST_LIBRARY_DEBUG}") + ENDIF(CPPTEST_LIBRARY_DEBUG) + ENDIF(CPPTEST_LIBRARY_RELEASE) +ENDIF(CPPTEST_INCLUDE_DIR) + +IF(CPPTEST_FOUND) IF(NOT CPPTEST_FIND_QUIETLY) - MESSAGE(STATUS "Found CppTest: ${CPPTEST_LIBRARY}") + MESSAGE(STATUS "Found CppTest: ${CPPTEST_LIBRARIES}") ENDIF(NOT CPPTEST_FIND_QUIETLY) -ELSE(CPPTEST_LIBRARY AND CPPTEST_INCLUDE_DIR) +ELSE(CPPTEST_FOUND) IF(NOT CPPTEST_FIND_QUIETLY) MESSAGE(STATUS "Warning: Unable to find CppTest!") ENDIF(NOT CPPTEST_FIND_QUIETLY) -ENDIF(CPPTEST_LIBRARY AND CPPTEST_INCLUDE_DIR) +ENDIF(CPPTEST_FOUND) +MARK_AS_ADVANCED(CPPTEST_LIBRARY_RELEASE CPPTEST_LIBRARY_DEBUG) diff --git a/code/CMakeModules/FindLuabind.cmake b/code/CMakeModules/FindLuabind.cmake index c3722deb7..b634d30ac 100644 --- a/code/CMakeModules/FindLuabind.cmake +++ b/code/CMakeModules/FindLuabind.cmake @@ -1,14 +1,14 @@ # - Locate Luabind library # This module defines -# LUABIND_LIBRARY, the library to link against +# LUABIND_LIBRARIES, the libraries to link against # LUABIND_FOUND, if false, do not try to link to LUABIND # LUABIND_INCLUDE_DIR, where to find headers. -IF(LUABIND_LIBRARY AND LUABIND_INCLUDE_DIR) +IF(LUABIND_LIBRARIES AND LUABIND_INCLUDE_DIR) # in cache already SET(LUABIND_FIND_QUIETLY TRUE) -ENDIF(LUABIND_LIBRARY AND LUABIND_INCLUDE_DIR) +ENDIF(LUABIND_LIBRARIES AND LUABIND_INCLUDE_DIR) @@ -27,8 +27,8 @@ FIND_PATH(LUABIND_INCLUDE_DIR ) -FIND_LIBRARY(LUABIND_LIBRARY - NAMES luabind libluabind luabind_d libluabind_d libluabindd +FIND_LIBRARY(LUABIND_LIBRARY_RELEASE + NAMES luabind libluabind PATHS $ENV{LUABIND_DIR}/lib /usr/local/lib @@ -42,14 +42,40 @@ FIND_LIBRARY(LUABIND_LIBRARY /usr/freeware/lib64 ) +FIND_LIBRARY(LUABIND_LIBRARY_DEBUG + NAMES luabind_d libluabind_d libluabindd + PATHS + $ENV{LUABIND_DIR}/lib + /usr/local/lib + /usr/lib + /usr/local/X11R6/lib + /usr/X11R6/lib + /sw/lib + /opt/local/lib + /opt/csw/lib + /opt/lib + /usr/freeware/lib64 +) -IF(LUABIND_LIBRARY AND LUABIND_INCLUDE_DIR) - SET(LUABIND_FOUND "YES") +IF(LUABIND_INCLUDE_DIR) + IF(LUABIND_LIBRARY_RELEASE) + SET(LUABIND_FOUND "YES") + + SET(LUABIND_LIBRARIES "optimized;${LUABIND_LIBRARY_RELEASE}") + IF(LUABIND_LIBRARY_DEBUG) + SET(LUABIND_LIBRARIES "${LUABIND_LIBRARIES};debug;${LUABIND_LIBRARY_DEBUG}") + ENDIF(LUABIND_LIBRARY_DEBUG) + ENDIF(LUABIND_LIBRARY_RELEASE) +ENDIF(LUABIND_INCLUDE_DIR) + +IF(LUABIND_FOUND) IF(NOT LUABIND_FIND_QUIETLY) - MESSAGE(STATUS "Found Luabind: ${LUABIND_LIBRARY}") + MESSAGE(STATUS "Found Luabind: ${LUABIND_LIBRARIES}") ENDIF(NOT LUABIND_FIND_QUIETLY) -ELSE(LUABIND_LIBRARY AND LUABIND_INCLUDE_DIR) +ELSE(LUABIND_FOUND) IF(NOT LUABIND_FIND_QUIETLY) MESSAGE(STATUS "Warning: Unable to find Luabind!") ENDIF(NOT LUABIND_FIND_QUIETLY) -ENDIF(LUABIND_LIBRARY AND LUABIND_INCLUDE_DIR) +ENDIF(LUABIND_FOUND) + +MARK_AS_ADVANCED(LUABIND_LIBRARY_RELEASE LUABIND_LIBRARY_DEBUG) diff --git a/code/CMakeModules/FindSTLport.cmake b/code/CMakeModules/FindSTLport.cmake index 09acc0201..0cd1ec993 100644 --- a/code/CMakeModules/FindSTLport.cmake +++ b/code/CMakeModules/FindSTLport.cmake @@ -73,7 +73,7 @@ IF(STLPORT_INCLUDE_DIR) SET(STLPORT_LIBRARIES "optimized;${STLPORT_LIBRARY_RELEASE}") IF(STLPORT_LIBRARY_DEBUG) - SET(STLPORT_LIBRARIES ";debug;${STLPORT_LIBRARY_DEBUG}") + SET(STLPORT_LIBRARIES "${STLPORT_LIBRARIES};debug;${STLPORT_LIBRARY_DEBUG}") ENDIF(STLPORT_LIBRARY_DEBUG) ENDIF(STLPORT_LIBRARY_RELEASE) ENDIF(STLPORT_INCLUDE_DIR) diff --git a/code/CMakeModules/FindSquish.cmake b/code/CMakeModules/FindSquish.cmake index 2fcbc1a1a..04f657485 100644 --- a/code/CMakeModules/FindSquish.cmake +++ b/code/CMakeModules/FindSquish.cmake @@ -3,14 +3,14 @@ # # This module defines # SQUISH_INCLUDE_DIR, where to find squish.h -# SQUISH_LIBRARY, where to find the Squish library. +# SQUISH_LIBRARIES, where to find the Squish libraries. # SQUISH_FOUND, If false, do not try to use Squish. # also defined, but not for general use are -IF(SQUISH_LIBRARY AND SQUISH_INCLUDE_DIR) +IF(SQUISH_LIBRARIES AND SQUISH_INCLUDE_DIR) # in cache already SET(SQUISH_FIND_QUIETLY TRUE) -ENDIF(SQUISH_LIBRARY AND SQUISH_INCLUDE_DIR) +ENDIF(SQUISH_LIBRARIES AND SQUISH_INCLUDE_DIR) FIND_PATH(SQUISH_INCLUDE_DIR squish.h @@ -24,7 +24,7 @@ FIND_PATH(SQUISH_INCLUDE_DIR PATH_SUFFIXES cppunit ) -FIND_LIBRARY(SQUISH_LIBRARY +FIND_LIBRARY(SQUISH_LIBRARY_RELEASE squish PATHS /usr/local/lib @@ -38,14 +38,39 @@ FIND_LIBRARY(SQUISH_LIBRARY /usr/freeware/lib64 ) -IF(SQUISH_LIBRARY AND SQUISH_INCLUDE_DIR) - SET(SQUISH_FOUND "YES") +FIND_LIBRARY(SQUISH_LIBRARY_DEBUG + squishd + PATHS + /usr/local/lib + /usr/lib + /usr/local/X11R6/lib + /usr/X11R6/lib + /sw/lib + /opt/local/lib + /opt/csw/lib + /opt/lib + /usr/freeware/lib64 +) + +IF(SQUISH_INCLUDE_DIR) + IF(SQUISH_LIBRARY_RELEASE) + SET(SQUISH_FOUND "YES") + + SET(SQUISH_LIBRARIES "optimized;${SQUISH_LIBRARY_RELEASE}") + IF(SQUISH_LIBRARY_DEBUG) + SET(SQUISH_LIBRARIES "${SQUISH_LIBRARIES};debug;${SQUISH_LIBRARY_DEBUG}") + ENDIF(SQUISH_LIBRARY_DEBUG) + ENDIF(SQUISH_LIBRARY_RELEASE) +ENDIF(SQUISH_INCLUDE_DIR) + +IF(SQUISH_FOUND) IF(NOT SQUISH_FIND_QUIETLY) - MESSAGE(STATUS "Found Squish: ${SQUISH_LIBRARY}") + MESSAGE(STATUS "Found Squish: ${SQUISH_LIBRARIES}") ENDIF(NOT SQUISH_FIND_QUIETLY) -ELSE(SQUISH_LIBRARY AND SQUISH_INCLUDE_DIR) +ELSE(SQUISH_FOUND) IF(NOT SQUISH_FIND_QUIETLY) MESSAGE(STATUS "Warning: Unable to find Squish!") ENDIF(NOT SQUISH_FIND_QUIETLY) -ENDIF(SQUISH_LIBRARY AND SQUISH_INCLUDE_DIR) +ENDIF(SQUISH_FOUND) +MARK_AS_ADVANCED(SQUISH_LIBRARY_RELEASE SQUISH_LIBRARY_DEBUG) diff --git a/code/nel/tools/3d/hls_bank_maker/CMakeLists.txt b/code/nel/tools/3d/hls_bank_maker/CMakeLists.txt index d24d1fdea..07a2a0320 100644 --- a/code/nel/tools/3d/hls_bank_maker/CMakeLists.txt +++ b/code/nel/tools/3d/hls_bank_maker/CMakeLists.txt @@ -4,7 +4,7 @@ ADD_EXECUTABLE(hls_bank_maker ${SRC}) INCLUDE_DIRECTORIES(${SQUISH_INCLUDE_DIR}) -TARGET_LINK_LIBRARIES(hls_bank_maker ${PLATFORM_LINKFLAGS} ${SQUISH_LIBRARY} nelmisc nel3d) +TARGET_LINK_LIBRARIES(hls_bank_maker ${PLATFORM_LINKFLAGS} ${SQUISH_LIBRARIES} 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 f214a2de8..a435441f8 100644 --- a/code/nel/tools/3d/panoply_maker/CMakeLists.txt +++ b/code/nel/tools/3d/panoply_maker/CMakeLists.txt @@ -4,8 +4,8 @@ ADD_EXECUTABLE(panoply_maker ${SRC}) INCLUDE_DIRECTORIES(${SQUISH_INCLUDE_DIR}) -TARGET_LINK_LIBRARIES(panoply_maker ${PLATFORM_LINKFLAGS} ${SQUISH_LIBRARY} nelmisc nel3d) +TARGET_LINK_LIBRARIES(panoply_maker ${PLATFORM_LINKFLAGS} ${SQUISH_LIBRARIES} nelmisc nel3d) NL_DEFAULT_PROPS(panoply_maker "NeL, Tools, 3D: panoply_maker") NL_ADD_RUNTIME_FLAGS(panoply_maker) -INSTALL(TARGETS panoply_maker RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) +INSTALL(TARGETS panoply_maker RUNTIME DESTINATION bin COMPONENT tools3d) diff --git a/code/nel/tools/3d/tga_2_dds/CMakeLists.txt b/code/nel/tools/3d/tga_2_dds/CMakeLists.txt index 5d72fc226..eef0e630b 100644 --- a/code/nel/tools/3d/tga_2_dds/CMakeLists.txt +++ b/code/nel/tools/3d/tga_2_dds/CMakeLists.txt @@ -4,7 +4,7 @@ ADD_EXECUTABLE(tga2dds ${SRC}) INCLUDE_DIRECTORIES(${SQUISH_INCLUDE_DIR}) -TARGET_LINK_LIBRARIES(tga2dds ${PLATFORM_LINKFLAGS} ${SQUISH_LIBRARY} nelmisc nel3d) +TARGET_LINK_LIBRARIES(tga2dds ${PLATFORM_LINKFLAGS} ${SQUISH_LIBRARIES} nelmisc nel3d) NL_DEFAULT_PROPS(tga2dds "NeL, Tools, 3D: tga2dds") NL_ADD_RUNTIME_FLAGS(tga2dds) diff --git a/code/nel/tools/nel_unit_test/CMakeLists.txt b/code/nel/tools/nel_unit_test/CMakeLists.txt index f939bcaf5..54a67426a 100644 --- a/code/nel/tools/nel_unit_test/CMakeLists.txt +++ b/code/nel/tools/nel_unit_test/CMakeLists.txt @@ -4,7 +4,7 @@ ADD_EXECUTABLE(nel_unit_test ${SRC}) INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${CPPTEST_INCLUDE_DIR}) -TARGET_LINK_LIBRARIES(nel_unit_test ${CPPTEST_LIBRARY} ${PLATFORM_LINKFLAGS} nelmisc nelnet nelligo) +TARGET_LINK_LIBRARIES(nel_unit_test ${CPPTEST_LIBRARIES} ${PLATFORM_LINKFLAGS} nelmisc nelnet nelligo) NL_DEFAULT_PROPS(nel_unit_test "Unit Tests") NL_ADD_RUNTIME_FLAGS(nel_unit_test) diff --git a/code/ryzom/client/src/CMakeLists.txt b/code/ryzom/client/src/CMakeLists.txt index 9ac9df373..7042c5af2 100644 --- a/code/ryzom/client/src/CMakeLists.txt +++ b/code/ryzom/client/src/CMakeLists.txt @@ -81,11 +81,10 @@ TARGET_LINK_LIBRARIES(ryzom_client ${PLATFORM_LINKFLAGS} nelpacs ${LIBXML2_LIBRARIES} ${LUA_LIBRARIES} - ${LUABIND_LIBRARY} + ${LUABIND_LIBRARIES} ${CURL_LIBRARIES} ${LIBWWW_LIBRARIES} - ${SEVENZIP_LIBRARY} - ${EXPAT_LIBRARY}) # TODO: find expat cleanly using a find script + ${SEVENZIP_LIBRARY}) IF(NOT APPLE AND NOT WIN32) TARGET_LINK_LIBRARIES(ryzom_client ${X11_LIBRARIES})