diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 0cd9afd54..97feb494c 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -106,7 +106,6 @@ IF(WIN32) ENDIF(WITH_MFC) ENDIF(WIN32) -FIND_PACKAGE(Threads REQUIRED) FIND_PACKAGE(LibXml2 REQUIRED) FIND_PACKAGE(PNG REQUIRED) FIND_PACKAGE(Jpeg) @@ -114,6 +113,7 @@ FIND_PACKAGE(Jpeg) IF(WITH_STATIC_LIBXML2) SET(LIBXML2_DEFINITIONS ${LIBXML2_DEFINITIONS} -DLIBXML_STATIC) ENDIF(WITH_STATIC_LIBXML2) + IF(WITH_STATIC) # libxml2 could need winsock2 library SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${WINSOCK2_LIB}) @@ -144,6 +144,36 @@ IF(WITH_NEL) IF(WITH_GUI) FIND_PACKAGE(Libwww REQUIRED) + IF(WITH_LUA51) + FIND_PACKAGE(Lua51 REQUIRED) + ELSE(WITH_LUA51) + FIND_PACKAGE(Lua50 REQUIRED) + ENDIF(WITH_LUA51) + FIND_PACKAGE(Luabind REQUIRED) + FIND_PACKAGE(CURL REQUIRED) + + IF(WIN32 OR CURL_LIBRARIES MATCHES "\\.a") + SET(CURL_STATIC ON) + ENDIF(WIN32 OR CURL_LIBRARIES MATCHES "\\.a") + + IF(CURL_STATIC) + SET(CURL_DEFINITIONS -DCURL_STATICLIB) + + FIND_PACKAGE(OpenSSL QUIET) + + IF(OPENSSL_FOUND) + SET(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR}) + SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES}) + ENDIF(OPENSSL_FOUND) + + # CURL Macports version depends on libidn, libintl and libiconv too + IF(APPLE) + FIND_LIBRARY(IDN_LIBRARY idn) + FIND_LIBRARY(INTL_LIBRARY intl) + + SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${IDN_LIBRARY} ${INTL_LIBRARY}) + ENDIF(APPLE) + ENDIF(CURL_STATIC) ENDIF(WITH_GUI) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/nel/include ${LIBXML2_INCLUDE_DIR}) diff --git a/code/CMakeModules/FindFreeType.cmake b/code/CMakeModules/FindFreeType.cmake index 4f3c84cbe..e15f55793 100644 --- a/code/CMakeModules/FindFreeType.cmake +++ b/code/CMakeModules/FindFreeType.cmake @@ -1,14 +1,13 @@ # - Locate FreeType library # This module defines -# FREETYPE_LIBRARY, the library to link against +# FREETYPE_LIBRARIES, libraries to link against # FREETYPE_FOUND, if false, do not try to link to FREETYPE # FREETYPE_INCLUDE_DIRS, where to find headers. -IF(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS) +IF(FREETYPE_LIBRARIES AND FREETYPE_INCLUDE_DIRS) # in cache already - SET(FREETYPE_FIND_QUIETLY TRUE) -ENDIF(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS) - + SET(Freetype_FIND_QUIETLY TRUE) +ENDIF(FREETYPE_LIBRARIES AND FREETYPE_INCLUDE_DIRS) FIND_PATH(FREETYPE_INCLUDE_DIRS freetype @@ -40,7 +39,7 @@ IF(FREETYPE_ADDITIONAL_INCLUDE_DIR) SET(FREETYPE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS} ${FREETYPE_ADDITIONAL_INCLUDE_DIR}) ENDIF(FREETYPE_ADDITIONAL_INCLUDE_DIR) -FIND_LIBRARY(FREETYPE_LIBRARY +FIND_LIBRARY(FREETYPE_LIBRARY_RELEASE NAMES freetype libfreetype freetype219 freetype246 PATHS $ENV{FREETYPE_DIR}/lib @@ -55,20 +54,50 @@ FIND_LIBRARY(FREETYPE_LIBRARY /usr/freeware/lib64 ) -IF(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS) - SET(FREETYPE_FOUND "YES") +FIND_LIBRARY(FREETYPE_LIBRARY_DEBUG + NAMES freetyped libfreetyped freetype219d freetype246d + PATHS + $ENV{FREETYPE_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(FREETYPE_INCLUDE_DIRS) + IF(FREETYPE_LIBRARY_RELEASE AND FREETYPE_LIBRARY_DEBUG) + # Case where both Release and Debug versions are provided + SET(FREETYPE_FOUND ON) + SET(FREETYPE_LIBRARIES optimized ${FREETYPE_LIBRARY_RELEASE} debug ${FREETYPE_LIBRARY_DEBUG}) + ELSEIF(FREETYPE_LIBRARY_RELEASE) + # Normal case + SET(FREETYPE_FOUND ON) + SET(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY_RELEASE}) + ELSEIF(FREETYPE_LIBRARY_DEBUG) + # Case where Freetype is compiled from sources (debug version is compiled by default) + SET(FREETYPE_FOUND ON) + SET(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY_DEBUG}) + ENDIF(FREETYPE_LIBRARY_RELEASE AND FREETYPE_LIBRARY_DEBUG) +ENDIF(FREETYPE_INCLUDE_DIRS) + +IF(FREETYPE_FOUND) IF(WITH_STATIC_EXTERNAL AND APPLE) FIND_PACKAGE(BZip2) IF(BZIP2_FOUND) SET(FREETYPE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS} ${BZIP2_INCLUDE_DIR}) - SET(FREETYPE_LIBRARY ${FREETYPE_LIBRARY} ${BZIP2_LIBRARIES}) + SET(FREETYPE_LIBRARIES ${FREETYPE_LIBRARIES} ${BZIP2_LIBRARIES}) ENDIF(BZIP2_FOUND) ENDIF(WITH_STATIC_EXTERNAL AND APPLE) - IF(NOT FREETYPE_FIND_QUIETLY) - MESSAGE(STATUS "Found FreeType: ${FREETYPE_LIBRARY}") - ENDIF(NOT FREETYPE_FIND_QUIETLY) + IF(NOT Freetype_FIND_QUIETLY) + MESSAGE(STATUS "Found FreeType: ${FREETYPE_LIBRARIES}") + ENDIF(NOT Freetype_FIND_QUIETLY) ELSE(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS) - IF(NOT FREETYPE_FIND_QUIETLY) + IF(NOT Freetype_FIND_QUIETLY) MESSAGE(STATUS "Warning: Unable to find FreeType!") - ENDIF(NOT FREETYPE_FIND_QUIETLY) -ENDIF(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS) + ENDIF(NOT Freetype_FIND_QUIETLY) +ENDIF(FREETYPE_FOUND) diff --git a/code/CMakeModules/FindLibwww.cmake b/code/CMakeModules/FindLibwww.cmake index e59d981c7..e742c6ae5 100644 --- a/code/CMakeModules/FindLibwww.cmake +++ b/code/CMakeModules/FindLibwww.cmake @@ -3,17 +3,15 @@ # # This module defines # LIBWWW_INCLUDE_DIR, where to find tiff.h, etc. -# LIBWWW_LIBRARY, where to find the LibWWW library. -# LIBWWW_FOUND, If false, do not try to use LibWWW. +# LIBWWW_LIBRARY, where to find the Libwww library. +# LIBWWW_FOUND, If false, do not try to use Libwww. OPTION(WITH_LIBWWW_STATIC "Use only static libraries for libwww" OFF) -SET(LIBWWW_FIND_QUIETLY ${Libwww_FIND_QUIETLY}) - # also defined, but not for general use are IF(LIBWWW_LIBRARIES AND LIBWWW_INCLUDE_DIR) # in cache already - SET(LIBWWW_FIND_QUIETLY TRUE) + SET(Libwww_FIND_QUIETLY TRUE) ENDIF(LIBWWW_LIBRARIES AND LIBWWW_INCLUDE_DIR) FIND_PATH(LIBWWW_INCLUDE_DIR @@ -47,14 +45,29 @@ IF(LIBWWW_ADDITIONAL_INCLUDE_DIR) ENDIF(LIBWWW_ADDITIONAL_INCLUDE_DIR) # helper to find all the libwww sub libraries -MACRO(FIND_WWW_LIBRARY MYLIBRARY OPTION) +MACRO(FIND_WWW_LIBRARY MYLIBRARY OPTION FILE) IF(WITH_LIBWWW_STATIC AND UNIX AND NOT APPLE AND NOT WITH_STATIC_EXTERNAL) SET(CMAKE_FIND_LIBRARY_SUFFIXES_OLD ${CMAKE_FIND_LIBRARY_SUFFIXES}) SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a") ENDIF(WITH_LIBWWW_STATIC AND UNIX AND NOT APPLE AND NOT WITH_STATIC_EXTERNAL) - FIND_LIBRARY(${MYLIBRARY} - NAMES ${ARGN} + FIND_LIBRARY(${MYLIBRARY}_RELEASE + NAMES ${FILE} + PATHS + /usr/local/lib + /usr/lib + /usr/lib/x86_64-linux-gnu + /usr/local/X11R6/lib + /usr/X11R6/lib + /sw/lib + /opt/local/lib + /opt/csw/lib + /opt/lib + /usr/freeware/lib64 + ) + + FIND_LIBRARY(${MYLIBRARY}_DEBUG + NAMES ${FILE}d PATHS /usr/local/lib /usr/lib @@ -72,17 +85,25 @@ MACRO(FIND_WWW_LIBRARY MYLIBRARY OPTION) SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_OLD}) ENDIF(CMAKE_FIND_LIBRARY_SUFFIXES_OLD) - IF(${MYLIBRARY}) + IF(${MYLIBRARY}_RELEASE AND ${MYLIBRARY}_DEBUG) IF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC) - SET(LIBWWW_LIBRARIES ${LIBWWW_LIBRARIES} ${${MYLIBRARY}}) + SET(LIBWWW_LIBRARIES ${LIBWWW_LIBRARIES} optimized ${${MYLIBRARY}_RELEASE} debug ${${MYLIBRARY}_DEBUG}) ENDIF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC) - ELSE(${MYLIBRARY}) - IF(NOT LIBWWW_FIND_QUIETLY AND NOT WIN32) + ELSEIF(${MYLIBRARY}_RELEASE) + IF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC) + SET(LIBWWW_LIBRARIES ${LIBWWW_LIBRARIES} ${${MYLIBRARY}_RELEASE}) + ENDIF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC) + ELSEIF(${MYLIBRARY}_DEBUG) + IF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC) + SET(LIBWWW_LIBRARIES ${LIBWWW_LIBRARIES} ${${MYLIBRARY}_DEBUG}) + ENDIF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC) + ELSE(${MYLIBRARY}_RELEASE AND ${MYLIBRARY}_DEBUG) + IF(NOT Libwww_FIND_QUIETLY AND NOT WIN32) MESSAGE(STATUS "Warning: Libwww: Library not found: ${MYLIBRARY}") - ENDIF(NOT LIBWWW_FIND_QUIETLY AND NOT WIN32) - ENDIF(${MYLIBRARY}) + ENDIF(NOT Libwww_FIND_QUIETLY AND NOT WIN32) + ENDIF(${MYLIBRARY}_RELEASE AND ${MYLIBRARY}_DEBUG) - MARK_AS_ADVANCED(${MYLIBRARY}) + MARK_AS_ADVANCED(${MYLIBRARY}_RELEASE ${MYLIBRARY}_DEBUG) ENDMACRO(FIND_WWW_LIBRARY) MACRO(LINK_WWW_LIBRARY MYLIBRARY OTHERLIBRARY SYMBOL) @@ -163,7 +184,7 @@ LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBREGEX_LIBRARY regexec) LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY OPENSSL_LIBRARIES SSL_new) INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibWWW DEFAULT_MSG +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Libwww DEFAULT_MSG LIBWWW_LIBRARIES LIBWWW_INCLUDE_DIR ) diff --git a/code/nel/src/3d/CMakeLists.txt b/code/nel/src/3d/CMakeLists.txt index a6ecf1ce8..15eb77734 100644 --- a/code/nel/src/3d/CMakeLists.txt +++ b/code/nel/src/3d/CMakeLists.txt @@ -709,7 +709,7 @@ NL_TARGET_LIB(nel3d ${HEADERS} ${SRC}) INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${FREETYPE_INCLUDE_DIRS} ${LIBOVR_INCLUDE_DIR} ${LIBVR_INCLUDE_DIR}) -TARGET_LINK_LIBRARIES(nel3d nelmisc ${FREETYPE_LIBRARY} ${LIBOVR_LIBRARIES} ${LIBVR_LIBRARY}) +TARGET_LINK_LIBRARIES(nel3d nelmisc ${FREETYPE_LIBRARIES} ${LIBOVR_LIBRARIES} ${LIBVR_LIBRARY}) SET_TARGET_PROPERTIES(nel3d PROPERTIES LINK_INTERFACE_LIBRARIES "") NL_DEFAULT_PROPS(nel3d "NeL, Library: NeL 3D") NL_ADD_RUNTIME_FLAGS(nel3d) diff --git a/code/nel/src/gui/CMakeLists.txt b/code/nel/src/gui/CMakeLists.txt index 3f183a2ff..e6a943594 100644 --- a/code/nel/src/gui/CMakeLists.txt +++ b/code/nel/src/gui/CMakeLists.txt @@ -1,8 +1,3 @@ -FIND_PACKAGE( Libwww REQUIRED ) -FIND_PACKAGE( CURL REQUIRED ) -FIND_PACKAGE( Lua51 REQUIRED ) -FIND_PACKAGE( Luabind REQUIRED ) - FILE(GLOB SRC *.cpp *.h) FILE(GLOB HEADERS ../../include/nel/gui/*.h) @@ -31,6 +26,8 @@ TARGET_LINK_LIBRARIES( nelgui ${CURL_LIBRARIES} ) +ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} ${CURL_DEFINITIONS} ${LUABIND_DEFINITIONS}) + IF(WITH_PCH) ADD_NATIVE_PRECOMPILED_HEADER(nelgui ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.h ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.cpp) ENDIF(WITH_PCH) diff --git a/code/nel/tools/3d/CMakeLists.txt b/code/nel/tools/3d/CMakeLists.txt index 7f4ed6b8c..58bf81f5a 100644 --- a/code/nel/tools/3d/CMakeLists.txt +++ b/code/nel/tools/3d/CMakeLists.txt @@ -62,7 +62,7 @@ IF(WITH_NEL_TOOLS) ENDIF(WITH_QT) IF(SQUISH_FOUND) - ADD_SUBDIRECTORY(s3tc_compressor_lib) + 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/object_viewer_qt/src/plugins/CMakeLists.txt b/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt index 43900fe9e..7903114d1 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt @@ -8,7 +8,7 @@ ADD_SUBDIRECTORY(object_viewer) ADD_SUBDIRECTORY(georges_editor) IF(WITH_GUI) -ADD_SUBDIRECTORY(gui_editor) + ADD_SUBDIRECTORY(gui_editor) ENDIF(WITH_GUI) ADD_SUBDIRECTORY(translation_manager) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/CMakeLists.txt b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/CMakeLists.txt index 0a5d8533d..409005a6a 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/CMakeLists.txt +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/CMakeLists.txt @@ -1,40 +1,7 @@ -IF(WITH_LUA51) - FIND_PACKAGE(Lua51 REQUIRED) -ELSE(WITH_LUA51) - FIND_PACKAGE(Lua50 REQUIRED) -ENDIF(WITH_LUA51) - FIND_PACKAGE(Luabind REQUIRED) - FIND_PACKAGE(CURL REQUIRED) - -IF(WIN32 OR CURL_LIBRARIES MATCHES "\\.a") - SET(CURL_STATIC ON) -ENDIF(WIN32 OR CURL_LIBRARIES MATCHES "\\.a") - -IF(CURL_STATIC) - SET(CURL_DEFINITIONS -DCURL_STATICLIB) - FIND_PACKAGE(OpenSSL QUIET) - - IF(OPENSSL_FOUND) - SET(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR}) - SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES}) - ENDIF(OPENSSL_FOUND) - - # CURL Macports version depends on libidn, libintl and libiconv too - IF(APPLE) - FIND_LIBRARY(IDN_LIBRARY idn) - FIND_LIBRARY(INTL_LIBRARY intl) - SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${IDN_LIBRARY} ${INTL_LIBRARY}) - ENDIF(APPLE) -ENDIF(CURL_STATIC) - -FIND_PACKAGE(Libwww REQUIRED) - - -INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR} - ${LIBXML2_INCLUDE_DIR} - ${LUA_INCLUDE_DIR} - ${QT_INCLUDES}) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${LIBXML2_INCLUDE_DIR} + ${QT_INCLUDES}) FILE(GLOB SRC *.cpp *.h) @@ -105,11 +72,6 @@ TARGET_LINK_LIBRARIES( ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY} qt_property_browser - ${LUA_LIBRARIES} - ${LUABIND_LIBRARIES} - ${CURL_LIBRARIES} - ${LIBWWW_LIBRARIES} - ${LIBXML2_LIBRARIES} ) NL_DEFAULT_PROPS(ovqt_plugin_gui_editor "NeL, Tools, 3D: Object Viewer Qt Plugin: GUI Editor") diff --git a/code/ryzom/CMakeLists.txt b/code/ryzom/CMakeLists.txt index 95ed56c46..6e0747350 100644 --- a/code/ryzom/CMakeLists.txt +++ b/code/ryzom/CMakeLists.txt @@ -14,44 +14,10 @@ IF(WITH_RYZOM_CLIENT) MESSAGE( FATAL_ERROR "The client cannot be built without the NeL GUI Library (WITH_GUI)") ENDIF(NOT WITH_GUI) - IF(WITH_LUA51) - FIND_PACKAGE(Lua51 REQUIRED) - ELSE(WITH_LUA51) - FIND_PACKAGE(Lua50 REQUIRED) - ENDIF(WITH_LUA51) - FIND_PACKAGE(Luabind REQUIRED) - FIND_PACKAGE(CURL REQUIRED) - - IF(WIN32 OR CURL_LIBRARIES MATCHES "\\.a") - SET(CURL_STATIC ON) - ENDIF(WIN32 OR CURL_LIBRARIES MATCHES "\\.a") - - IF(CURL_STATIC) - SET(CURL_DEFINITIONS -DCURL_STATICLIB) - - FIND_PACKAGE(OpenSSL QUIET) - - IF(OPENSSL_FOUND) - SET(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR}) - SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES}) - ENDIF(OPENSSL_FOUND) - - # CURL Macports version depends on libidn, libintl and libiconv too - IF(APPLE) - FIND_LIBRARY(IDN_LIBRARY idn) - FIND_LIBRARY(INTL_LIBRARY intl) - - SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${IDN_LIBRARY} ${INTL_LIBRARY}) - ENDIF(APPLE) - ENDIF(CURL_STATIC) - ADD_SUBDIRECTORY(client) - ELSEIF(WITH_RYZOM_TOOLS) - # Need clientsheets lib for sheets packer tool ADD_SUBDIRECTORY(client) - ENDIF(WITH_RYZOM_CLIENT) IF(WITH_RYZOM_TOOLS)