From f1dfec38d3841f827e3297b59c1e252599b09f8f Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 25 Sep 2010 15:41:37 +0200 Subject: [PATCH] Changed: Updated CMake modules for 64bits and STLport --- code/CMakeLists.txt | 16 ++--- code/CMakeModules/FindExternal.cmake | 6 ++ code/CMakeModules/FindLibwww.cmake | 39 +++++----- code/CMakeModules/FindLuabind.cmake | 98 ++++++++++++++++---------- code/CMakeModules/FindWindowsSDK.cmake | 2 +- code/nel/CMakeLists.txt | 6 +- 6 files changed, 101 insertions(+), 66 deletions(-) diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index a1d72e742..a3423794c 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -40,14 +40,6 @@ INCLUDE(${CMAKE_ROOT}/Modules/Documentation.cmake OPTIONAL) # Force out of source builds. CHECK_OUT_OF_SOURCE() -IF(WIN32) - FIND_PACKAGE(External REQUIRED) - - IF(NOT DEFINED ENV{QTDIR}) - SET(ENV{QTDIR} "c:/qt/4.5.0") - ENDIF(NOT DEFINED ENV{QTDIR}) -ENDIF(WIN32) - CMAKE_MINIMUM_REQUIRED(VERSION 2.6) PROJECT(RyzomCore CXX C) SET(NL_VERSION_MAJOR 0) @@ -60,6 +52,14 @@ SET(NL_VERSION "${NL_VERSION_MAJOR}.${NL_VERSION_MINOR}.${NL_VERSION_PATCH}") SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin) SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib) +IF(WIN32) + FIND_PACKAGE(External REQUIRED) + + IF(NOT DEFINED ENV{QTDIR}) + SET(ENV{QTDIR} "c:/qt/4.5.0") + ENDIF(NOT DEFINED ENV{QTDIR}) +ENDIF(WIN32) + #----------------------------------------------------------------------------- # Set default config options # diff --git a/code/CMakeModules/FindExternal.cmake b/code/CMakeModules/FindExternal.cmake index 11489287d..506f69697 100644 --- a/code/CMakeModules/FindExternal.cmake +++ b/code/CMakeModules/FindExternal.cmake @@ -24,6 +24,10 @@ IF(EXTERNAL_PATH) SET(EXTERNAL_FOUND TRUE) SET(EXTERNAL_INCLUDE_PATH "${EXTERNAL_PATH}/include") + IF(NOT CMAKE_SIZEOF_VOID_P) + MESSAGE(FATAL_ERROR "Size of void* is not set, you should call PROJECT(...) before") + ENDIF(NOT CMAKE_SIZEOF_VOID_P) + # Using 32 or 64 bits libraries IF(CMAKE_SIZEOF_VOID_P EQUAL 8) SET(EXTERNAL_LIBRARY_PATH "${EXTERNAL_PATH}/lib64") @@ -46,3 +50,5 @@ ELSE(EXTERNAL_FOUND) MESSAGE(STATUS "Warning: Unable to find external!") ENDIF(NOT EXTERNAL_FIND_QUIETLY) ENDIF(EXTERNAL_FOUND) + +MARK_AS_ADVANCED(EXTERNAL_INCLUDE_PATH EXTERNAL_LIBRARY_PATH) diff --git a/code/CMakeModules/FindLibwww.cmake b/code/CMakeModules/FindLibwww.cmake index 3ff51bbc1..e130b1062 100644 --- a/code/CMakeModules/FindLibwww.cmake +++ b/code/CMakeModules/FindLibwww.cmake @@ -91,7 +91,7 @@ FIND_WWW_LIBRARY(LIBWWWZIP_LIBRARY wwwzip) FIND_WWW_LIBRARY(LIBMD5_LIBRARY md5) # Windows libwww version needs GNU Regex -IF(WIN32) +IF(WIN32 AND WITH_STATIC) FIND_PATH(LIBWWW_REGEX_INCLUDE_DIR regex.h PATHS @@ -108,19 +108,26 @@ IF(WIN32) SET(LIBWWW_INCLUDE_DIR ${LIBWWW_INCLUDE_DIR} ${LIBWWW_REGEX_INCLUDE_DIR}) FIND_WWW_LIBRARY(LIBREGEX_LIBRARY gnu_regex) ENDIF(LIBWWW_REGEX_INCLUDE_DIR) -ELSE(WIN32) - FIND_PACKAGE(EXPAT) - SET(LIBWWW_INCLUDE_DIR ${LIBWWW_INCLUDE_DIR} ${EXPAT_INCLUDE_DIRS}) - SET(LIBWWW_LIBRARIES ${LIBWWW_LIBRARIES} ${EXPAT_LIBRARIES}) -ENDIF(WIN32) +ENDIF(WIN32 AND WITH_STATIC) -IF(LIBWWW_LIBRARIES AND LIBWWW_INCLUDE_DIR) - SET(LIBWWW_FOUND "YES") - IF(NOT LIBWWW_FIND_QUIETLY) - MESSAGE(STATUS "Found LibWWW: ${LIBWWW_LIBRARIES}") - ENDIF(NOT LIBWWW_FIND_QUIETLY) -ELSE(LIBWWW_LIBRARIES AND LIBWWW_INCLUDE_DIR) - IF(NOT LIBWWW_FIND_QUIETLY) - MESSAGE(STATUS "Warning: Unable to find LibWWW!") - ENDIF(NOT LIBWWW_FIND_QUIETLY) -ENDIF(LIBWWW_LIBRARIES AND LIBWWW_INCLUDE_DIR) +IF(WITH_STATIC) + # If compiled with expat support + FIND_PACKAGE(EXPAT QUIET) + IF(EXPAT_FOUND) + SET(LIBWWW_INCLUDE_DIR ${LIBWWW_INCLUDE_DIR} ${EXPAT_INCLUDE_DIRS}) + SET(LIBWWW_LIBRARIES ${LIBWWW_LIBRARIES} ${EXPAT_LIBRARIES}) + ENDIF(EXPAT_FOUND) + + # If compiled with OpenSSL support + FIND_PACKAGE(OpenSSL QUIET) + IF(OPENSSL_FOUND) + SET(LIBWWW_INCLUDE_DIR ${LIBWWW_INCLUDE_DIR} ${OPENSSL_INCLUDE_DIR}) + SET(LIBWWW_LIBRARIES ${LIBWWW_LIBRARIES} ${OPENSSL_LIBRARIES}) + ENDIF(OPENSSL_FOUND) +ENDIF(WITH_STATIC) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibWWW DEFAULT_MSG + LIBWWW_LIBRARIES + LIBWWW_INCLUDE_DIR +) diff --git a/code/CMakeModules/FindLuabind.cmake b/code/CMakeModules/FindLuabind.cmake index b634d30ac..522f6386e 100644 --- a/code/CMakeModules/FindLuabind.cmake +++ b/code/CMakeModules/FindLuabind.cmake @@ -4,17 +4,13 @@ # LUABIND_FOUND, if false, do not try to link to LUABIND # LUABIND_INCLUDE_DIR, where to find headers. - IF(LUABIND_LIBRARIES AND LUABIND_INCLUDE_DIR) # in cache already SET(LUABIND_FIND_QUIETLY TRUE) ENDIF(LUABIND_LIBRARIES AND LUABIND_INCLUDE_DIR) - - - FIND_PATH(LUABIND_INCLUDE_DIR - luabind.hpp + luabind/luabind.hpp PATHS $ENV{LUABIND_DIR}/include /usr/local/include @@ -23,45 +19,75 @@ FIND_PATH(LUABIND_INCLUDE_DIR /opt/local/include /opt/csw/include /opt/include - PATH_SUFFIXES luabind ) +IF(WITH_STLPORT) + FIND_LIBRARY(LUABIND_LIBRARY_RELEASE + NAMES libluabind_stlport luabind libluabind + 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 + ) -FIND_LIBRARY(LUABIND_LIBRARY_RELEASE - NAMES luabind libluabind - 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 -) + FIND_LIBRARY(LUABIND_LIBRARY_DEBUG + NAMES libluabind_stlportd 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 + ) +ELSE(WITH_STLPORT) + FIND_LIBRARY(LUABIND_LIBRARY_RELEASE + NAMES luabind libluabind + 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 + ) -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 -) + 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 + ) +ENDIF(WITH_STLPORT) IF(LUABIND_INCLUDE_DIR) IF(LUABIND_LIBRARY_RELEASE) - SET(LUABIND_FOUND "YES") + SET(LUABIND_FOUND TRUE) - SET(LUABIND_LIBRARIES "optimized;${LUABIND_LIBRARY_RELEASE}") + SET(LUABIND_LIBRARIES "optimized;${LUABIND_LIBRARY_RELEASE}") IF(LUABIND_LIBRARY_DEBUG) SET(LUABIND_LIBRARIES "${LUABIND_LIBRARIES};debug;${LUABIND_LIBRARY_DEBUG}") ENDIF(LUABIND_LIBRARY_DEBUG) diff --git a/code/CMakeModules/FindWindowsSDK.cmake b/code/CMakeModules/FindWindowsSDK.cmake index 99c9e5518..04059a6a5 100644 --- a/code/CMakeModules/FindWindowsSDK.cmake +++ b/code/CMakeModules/FindWindowsSDK.cmake @@ -16,7 +16,7 @@ FIND_PATH(WINSDK_INCLUDE_DIR Windows.h ) IF(WINSDK_INCLUDE_DIR) - SET(WINSDK_FOUND "YES") + SET(WINSDK_FOUND TRUE) IF(NOT WINSDK_FIND_QUIETLY) MESSAGE(STATUS "Found Windows SDK.") ENDIF(NOT WINSDK_FIND_QUIETLY) diff --git a/code/nel/CMakeLists.txt b/code/nel/CMakeLists.txt index 0f8b4fd75..3bf3dc72b 100644 --- a/code/nel/CMakeLists.txt +++ b/code/nel/CMakeLists.txt @@ -7,7 +7,7 @@ ENDIF(WITH_STATIC_DRIVERS) # On Windows we need to find DirectInput for NLMISC. # This is how we get events. IF(WIN32) - FIND_PACKAGE(DirectXSDK) + FIND_PACKAGE(DirectXSDK REQUIRED) # On Win32 we can also build the MAX plugins. IF(WITH_MAXPLUGIN) @@ -51,10 +51,6 @@ IF(WITH_SOUND) ENDIF(WITH_DRIVER_FMOD) ENDIF(WITH_SOUND) -IF(WITH_MFC) - FIND_PACKAGE(MFC) -ENDIF(WITH_MFC) - IF(WITH_GTK) FIND_PACKAGE(GTK2) ENDIF(WITH_GTK)