diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index eaaede806..630ff4414 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -90,27 +90,11 @@ NL_CONFIGURE_CHECKS() #----------------------------------------------------------------------------- #Platform specifics +SETUP_EXTERNAL() + IF(WIN32) - INCLUDE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake) SET(WINSOCK2_LIB ws2_32.lib) - FIND_PACKAGE(External REQUIRED) - - IF(${CMAKE_MAKE_PROGRAM} MATCHES "Common7") - # convert IDE fullpath to VC++ path - STRING(REGEX REPLACE "Common7/IDE/.+" "VC" VC_DIR ${CMAKE_MAKE_PROGRAM}) - ELSE(${CMAKE_MAKE_PROGRAM} MATCHES "Common7") - IF(${CMAKE_CXX_COMPILER} MATCHES "VC") - # convert compiler fullpath to VC++ path - STRING(REGEX REPLACE "VC/bin/.+" "VC" VC_DIR ${CMAKE_CXX_COMPILER}) - ELSE(${CMAKE_CXX_COMPILER} MATCHES "VC") - # Hack for Visual C++ 2010 - GET_FILENAME_COMPONENT(VC_ROOT_PATH "[HKEY_CURRENT_USER\\Software\\Microsoft\\VCExpress\\10.0_Config;InstallDir]" ABSOLUTE) - # convert IDE fullpath to VC++ path - STRING(REGEX REPLACE "Common7/.*" "VC" VC_DIR ${VC_ROOT_PATH}) - ENDIF(${CMAKE_CXX_COMPILER} MATCHES "VC") - ENDIF(${CMAKE_MAKE_PROGRAM} MATCHES "Common7") - IF(WITH_MFC) FIND_PACKAGE(CustomMFC REQUIRED) ENDIF(WITH_MFC) @@ -134,18 +118,6 @@ IF(WITH_STATIC) ENDIF(APPLE) ENDIF(WITH_STATIC) -IF(WITH_STLPORT) - FIND_PACKAGE(STLport REQUIRED) - INCLUDE_DIRECTORIES(${STLPORT_INCLUDE_DIR}) - IF(WIN32) - SET(VC_INCLUDE_DIR "${VC_DIR}/include") - - FIND_PACKAGE(WindowsSDK REQUIRED) - # use VC++ and Windows SDK include paths - INCLUDE_DIRECTORIES(${VC_INCLUDE_DIR} ${WINSDK_INCLUDE_DIR}) - ENDIF(WIN32) -ENDIF(WITH_STLPORT) - INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/PCHSupport.cmake) IF(FINAL_VERSION) diff --git a/code/CMakeModules/FindExternal.cmake b/code/CMakeModules/FindExternal.cmake index 436997d99..fae4af92d 100644 --- a/code/CMakeModules/FindExternal.cmake +++ b/code/CMakeModules/FindExternal.cmake @@ -3,6 +3,7 @@ # The following values are defined # EXTERNAL_PATH - where to find external # EXTERNAL_INCLUDE_PATH - where to find external includes +# EXTERNAL_BINARY_PATH - where to find external binaries # EXTERNAL_LIBRARY_PATH - where to find external libraries # EXTERNAL_FOUND - True if the external libraries are available @@ -34,6 +35,13 @@ IF(EXTERNAL_PATH) SET(EXTERNAL_FOUND TRUE) SET(EXTERNAL_INCLUDE_PATH "${EXTERNAL_PATH}/include") + # Using 32 or 64 bits binaries + IF(TARGET_X64) + SET(EXTERNAL_BINARY_PATH "${EXTERNAL_PATH}/bin64") + ELSE(TARGET_X64) + SET(EXTERNAL_BINARY_PATH "${EXTERNAL_PATH}/bin") + ENDIF(TARGET_X64) + # Using 32 or 64 bits libraries IF(TARGET_X64) SET(EXTERNAL_LIBRARY_PATH "${EXTERNAL_PATH}/lib64") @@ -61,4 +69,4 @@ ELSE(EXTERNAL_FOUND) ENDIF(External_FIND_REQUIRED) ENDIF(EXTERNAL_FOUND) -MARK_AS_ADVANCED(EXTERNAL_INCLUDE_PATH EXTERNAL_LIBRARY_PATH) +MARK_AS_ADVANCED(EXTERNAL_INCLUDE_PATH EXTERNAL_BINARY_PATH EXTERNAL_LIBRARY_PATH) diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index 220e4132d..fbd70c842 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -496,3 +496,44 @@ MACRO(RYZOM_SETUP_PREFIX_PATHS) ENDIF(NOT RYZOM_GAMES_PREFIX) ENDMACRO(RYZOM_SETUP_PREFIX_PATHS) + +MACRO(SETUP_EXTERNAL) + IF(WIN32) + FIND_PACKAGE(External REQUIRED) + + INCLUDE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake) + IF(MSVC10) + GET_FILENAME_COMPONENT(VC_ROOT_DIR "[HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\10.0_Config;InstallDir]" ABSOLUTE) + # VC_ROOT_DIR is set to "registry" when a key is not found + IF(VC_ROOT_DIR MATCHES "registry") + GET_FILENAME_COMPONENT(VC_ROOT_DIR "[HKEY_CURRENT_USER\\Software\\Microsoft\\VCExpress\\10.0_Config;InstallDir]" ABSOLUTE) + IF(VC_ROOT_DIR MATCHES "registry") + MESSAGE(FATAL_ERROR "Unable to find VC++ 2010 directory!") + ENDIF(VC_ROOT_DIR MATCHES "registry") + ENDIF(VC_ROOT_DIR MATCHES "registry") + # convert IDE fullpath to VC++ path + STRING(REGEX REPLACE "Common7/.*" "VC" VC_DIR ${VC_ROOT_DIR}) + ELSE(MSVC10) + IF(${CMAKE_MAKE_PROGRAM} MATCHES "Common7") + # convert IDE fullpath to VC++ path + STRING(REGEX REPLACE "Common7/.*" "VC" VC_DIR ${CMAKE_MAKE_PROGRAM}) + ELSE(${CMAKE_MAKE_PROGRAM} MATCHES "Common7") + # convert compiler fullpath to VC++ path + STRING(REGEX REPLACE "VC/bin/.+" "VC" VC_DIR ${CMAKE_CXX_COMPILER}) + ENDIF(${CMAKE_MAKE_PROGRAM} MATCHES "Common7") + ENDIF(MSVC10) + ENDIF(WIN32) + + IF(WITH_STLPORT) + FIND_PACKAGE(STLport REQUIRED) + INCLUDE_DIRECTORIES(${STLPORT_INCLUDE_DIR}) + IF(WIN32) + SET(VC_INCLUDE_DIR "${VC_DIR}/include") + + FIND_PACKAGE(WindowsSDK REQUIRED) + # use VC++ and Windows SDK include paths + INCLUDE_DIRECTORIES(${VC_INCLUDE_DIR} ${WINSDK_INCLUDE_DIR}) + ENDIF(WIN32) + ENDIF(WITH_STLPORT) + +ENDMACRO(SETUP_EXTERNAL)