2012-04-12 14:01:38 +00:00
|
|
|
# Force Release configuration for compiler checks
|
|
|
|
SET(CMAKE_TRY_COMPILE_CONFIGURATION "Release")
|
|
|
|
|
|
|
|
# Force Release configuration by default
|
|
|
|
IF(NOT CMAKE_BUILD_TYPE)
|
|
|
|
SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
|
|
|
|
ENDIF(NOT CMAKE_BUILD_TYPE)
|
|
|
|
|
2010-05-06 00:08:41 +00:00
|
|
|
###
|
2010-07-14 17:13:07 +00:00
|
|
|
# Helper macro that generates .pc and installs it.
|
|
|
|
# Argument: name - the name of the .pc package, e.g. "nel-pacs.pc"
|
|
|
|
###
|
|
|
|
MACRO(NL_GEN_PC name)
|
2011-09-11 12:44:37 +00:00
|
|
|
IF(NOT WIN32 AND WITH_INSTALL_LIBRARIES)
|
2010-07-15 12:22:19 +00:00
|
|
|
CONFIGURE_FILE(${name}.in "${CMAKE_CURRENT_BINARY_DIR}/${name}")
|
2012-10-03 08:08:56 +00:00
|
|
|
INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${name}" DESTINATION ${NL_LIB_PREFIX}/pkgconfig)
|
2011-09-11 12:44:37 +00:00
|
|
|
ENDIF(NOT WIN32 AND WITH_INSTALL_LIBRARIES)
|
2010-07-14 17:13:07 +00:00
|
|
|
ENDMACRO(NL_GEN_PC)
|
|
|
|
|
2012-03-06 13:21:23 +00:00
|
|
|
###
|
|
|
|
# Helper macro that generates revision.h from revision.h.in
|
|
|
|
###
|
|
|
|
MACRO(NL_GEN_REVISION_H)
|
|
|
|
IF(EXISTS ${CMAKE_SOURCE_DIR}/revision.h.in)
|
|
|
|
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR})
|
|
|
|
ADD_DEFINITIONS(-DHAVE_REVISION_H)
|
|
|
|
SET(HAVE_REVISION_H ON)
|
|
|
|
|
2012-10-02 11:12:13 +00:00
|
|
|
# if already generated
|
|
|
|
IF(EXISTS ${CMAKE_SOURCE_DIR}/revision.h)
|
|
|
|
# copy it
|
|
|
|
MESSAGE(STATUS "Copying provided revision.h...")
|
|
|
|
FILE(COPY ${CMAKE_SOURCE_DIR}/revision.h DESTINATION ${CMAKE_BINARY_DIR})
|
|
|
|
ELSE(EXISTS ${CMAKE_SOURCE_DIR}/revision.h)
|
|
|
|
# a custom target that is always built
|
|
|
|
ADD_CUSTOM_TARGET(revision ALL
|
|
|
|
DEPENDS ${CMAKE_BINARY_DIR}/revision.h)
|
2012-03-06 13:21:23 +00:00
|
|
|
|
2012-10-02 11:12:13 +00:00
|
|
|
# creates revision.h using cmake script
|
|
|
|
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/revision.h
|
|
|
|
COMMAND ${CMAKE_COMMAND}
|
|
|
|
-DSOURCE_DIR=${CMAKE_SOURCE_DIR}
|
|
|
|
-DROOT_DIR=${CMAKE_SOURCE_DIR}/..
|
|
|
|
-P ${CMAKE_SOURCE_DIR}/CMakeModules/GetRevision.cmake)
|
2012-03-06 13:21:23 +00:00
|
|
|
|
2012-10-02 11:12:13 +00:00
|
|
|
# revision.h is a generated file
|
|
|
|
SET_SOURCE_FILES_PROPERTIES(${CMAKE_BINARY_DIR}/revision.h
|
|
|
|
PROPERTIES GENERATED TRUE
|
|
|
|
HEADER_FILE_ONLY TRUE)
|
|
|
|
ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/revision.h)
|
2012-03-06 13:21:23 +00:00
|
|
|
ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/revision.h.in)
|
|
|
|
ENDMACRO(NL_GEN_REVISION_H)
|
|
|
|
|
2010-07-14 17:13:07 +00:00
|
|
|
###
|
2010-05-06 00:08:41 +00:00
|
|
|
#
|
|
|
|
###
|
2010-07-14 17:13:07 +00:00
|
|
|
MACRO(NL_TARGET_LIB name)
|
|
|
|
IF(WITH_STATIC)
|
|
|
|
ADD_LIBRARY(${name} STATIC ${ARGN})
|
|
|
|
ELSE(WITH_STATIC)
|
|
|
|
ADD_LIBRARY(${name} SHARED ${ARGN})
|
|
|
|
ENDIF(WITH_STATIC)
|
|
|
|
ENDMACRO(NL_TARGET_LIB)
|
2010-05-06 00:08:41 +00:00
|
|
|
|
2010-07-14 17:13:07 +00:00
|
|
|
###
|
|
|
|
#
|
|
|
|
###
|
|
|
|
MACRO(NL_TARGET_DRIVER name)
|
|
|
|
IF(WITH_STATIC_DRIVERS)
|
|
|
|
ADD_LIBRARY(${name} STATIC ${ARGN})
|
|
|
|
ELSE(WITH_STATIC_DRIVERS)
|
2010-08-28 12:10:56 +00:00
|
|
|
ADD_LIBRARY(${name} MODULE ${ARGN})
|
2010-07-14 17:13:07 +00:00
|
|
|
ENDIF(WITH_STATIC_DRIVERS)
|
|
|
|
ENDMACRO(NL_TARGET_DRIVER)
|
|
|
|
|
|
|
|
###
|
|
|
|
# Helper macro that sets the default library properties.
|
|
|
|
# Argument: name - the target name whose properties are being set
|
2010-08-08 19:14:34 +00:00
|
|
|
# Argument:
|
2010-07-14 17:13:07 +00:00
|
|
|
###
|
|
|
|
MACRO(NL_DEFAULT_PROPS name label)
|
2012-04-18 16:07:01 +00:00
|
|
|
# Note: This is just a workaround for a CMake bug generating VS10 files with a colon in the project name.
|
|
|
|
# CMake Bug ID: http://www.cmake.org/Bug/view.php?id=11819
|
|
|
|
STRING(REGEX REPLACE "\\:" " -" proj_label ${label})
|
|
|
|
SET_TARGET_PROPERTIES(${name} PROPERTIES PROJECT_LABEL ${proj_label})
|
2010-08-08 08:26:47 +00:00
|
|
|
GET_TARGET_PROPERTY(type ${name} TYPE)
|
2010-08-28 12:10:56 +00:00
|
|
|
IF(${type} STREQUAL SHARED_LIBRARY)
|
|
|
|
# Set versions only if target is a shared library
|
|
|
|
SET_TARGET_PROPERTIES(${name} PROPERTIES
|
2011-05-14 12:02:53 +00:00
|
|
|
VERSION ${NL_VERSION} SOVERSION ${NL_VERSION_MAJOR})
|
2011-05-14 14:08:58 +00:00
|
|
|
IF(NL_LIB_PREFIX)
|
|
|
|
SET_TARGET_PROPERTIES(${name} PROPERTIES INSTALL_NAME_DIR ${NL_LIB_PREFIX})
|
|
|
|
ENDIF(NL_LIB_PREFIX)
|
2010-08-28 12:10:56 +00:00
|
|
|
ENDIF(${type} STREQUAL SHARED_LIBRARY)
|
2011-08-19 14:58:18 +00:00
|
|
|
|
|
|
|
IF(${type} STREQUAL EXECUTABLE AND WIN32)
|
|
|
|
SET_TARGET_PROPERTIES(${name} PROPERTIES
|
|
|
|
VERSION ${NL_VERSION}
|
|
|
|
SOVERSION ${NL_VERSION_MAJOR}
|
|
|
|
COMPILE_FLAGS "/GA"
|
|
|
|
LINK_FLAGS "/VERSION:${NL_VERSION}")
|
|
|
|
ENDIF(${type} STREQUAL EXECUTABLE AND WIN32)
|
|
|
|
|
2011-01-22 12:27:40 +00:00
|
|
|
IF(WITH_STLPORT AND WIN32)
|
2011-01-22 12:26:19 +00:00
|
|
|
SET_TARGET_PROPERTIES(${name} PROPERTIES COMPILE_FLAGS "/X")
|
2011-01-22 12:27:40 +00:00
|
|
|
ENDIF(WITH_STLPORT AND WIN32)
|
2010-07-14 17:13:07 +00:00
|
|
|
ENDMACRO(NL_DEFAULT_PROPS)
|
|
|
|
|
|
|
|
###
|
|
|
|
# Adds the target suffix on Windows.
|
|
|
|
# Argument: name - the library's target name.
|
|
|
|
###
|
|
|
|
MACRO(NL_ADD_LIB_SUFFIX name)
|
2010-05-06 00:08:41 +00:00
|
|
|
IF(WIN32)
|
2010-07-14 17:13:07 +00:00
|
|
|
SET_TARGET_PROPERTIES(${name} PROPERTIES DEBUG_POSTFIX "_d" RELEASE_POSTFIX "_r")
|
2010-05-06 00:08:41 +00:00
|
|
|
ENDIF(WIN32)
|
2010-07-14 17:13:07 +00:00
|
|
|
ENDMACRO(NL_ADD_LIB_SUFFIX)
|
2010-05-06 00:08:41 +00:00
|
|
|
|
2010-07-14 17:13:07 +00:00
|
|
|
###
|
2010-07-23 16:51:02 +00:00
|
|
|
# Adds the runtime link flags for Win32 binaries and links STLport.
|
2010-07-14 17:13:07 +00:00
|
|
|
# Argument: name - the target to add the link flags to.
|
|
|
|
###
|
|
|
|
MACRO(NL_ADD_RUNTIME_FLAGS name)
|
|
|
|
IF(WIN32)
|
2010-09-26 21:24:51 +00:00
|
|
|
# SET_TARGET_PROPERTIES(${name} PROPERTIES
|
|
|
|
# LINK_FLAGS_DEBUG "${CMAKE_LINK_FLAGS_DEBUG}"
|
|
|
|
# LINK_FLAGS_RELEASE "${CMAKE_LINK_FLAGS_RELEASE}")
|
2010-07-14 17:13:07 +00:00
|
|
|
ENDIF(WIN32)
|
2010-07-23 16:51:02 +00:00
|
|
|
IF(WITH_STLPORT)
|
2011-02-11 17:05:19 +00:00
|
|
|
TARGET_LINK_LIBRARIES(${name} ${STLPORT_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
|
2010-07-23 16:51:02 +00:00
|
|
|
ENDIF(WITH_STLPORT)
|
2010-07-14 17:13:07 +00:00
|
|
|
ENDMACRO(NL_ADD_RUNTIME_FLAGS)
|
2010-07-17 16:09:03 +00:00
|
|
|
|
2010-07-23 19:05:21 +00:00
|
|
|
MACRO(NL_ADD_STATIC_VID_DRIVERS name)
|
|
|
|
IF(WITH_STATIC_DRIVERS)
|
|
|
|
IF(WIN32)
|
2010-08-28 12:10:56 +00:00
|
|
|
IF(WITH_DRIVER_DIRECT3D)
|
|
|
|
TARGET_LINK_LIBRARIES(${name} nel_drv_direct3d_win)
|
2010-07-23 19:05:21 +00:00
|
|
|
ENDIF(WITH_DRIVER_DIRECT3D)
|
|
|
|
ENDIF(WIN32)
|
2010-08-08 19:14:34 +00:00
|
|
|
|
2010-07-23 19:05:21 +00:00
|
|
|
IF(WITH_DRIVER_OPENGL)
|
|
|
|
IF(WIN32)
|
2010-08-28 12:10:56 +00:00
|
|
|
TARGET_LINK_LIBRARIES(${name} nel_drv_opengl_win)
|
|
|
|
ELSE(WIN32)
|
|
|
|
TARGET_LINK_LIBRARIES(${name} nel_drv_opengl)
|
2010-07-23 19:05:21 +00:00
|
|
|
ENDIF(WIN32)
|
|
|
|
ENDIF(WITH_DRIVER_OPENGL)
|
2011-05-01 15:01:11 +00:00
|
|
|
|
|
|
|
IF(WITH_DRIVER_OPENGLES)
|
|
|
|
IF(WIN32)
|
|
|
|
TARGET_LINK_LIBRARIES(${name} nel_drv_opengles_win)
|
|
|
|
ELSE(WIN32)
|
|
|
|
TARGET_LINK_LIBRARIES(${name} nel_drv_opengles)
|
|
|
|
ENDIF(WIN32)
|
|
|
|
ENDIF(WITH_DRIVER_OPENGLES)
|
2010-07-23 19:05:21 +00:00
|
|
|
ENDIF(WITH_STATIC_DRIVERS)
|
|
|
|
ENDMACRO(NL_ADD_STATIC_VID_DRIVERS)
|
|
|
|
|
|
|
|
MACRO(NL_ADD_STATIC_SND_DRIVERS name)
|
|
|
|
IF(WITH_STATIC_DRIVERS)
|
|
|
|
IF(WIN32)
|
2010-08-28 12:10:56 +00:00
|
|
|
IF(WITH_DRIVER_DSOUND)
|
2011-02-24 14:37:55 +00:00
|
|
|
TARGET_LINK_LIBRARIES(${name} nel_drv_dsound_win)
|
2010-08-28 12:10:56 +00:00
|
|
|
ENDIF(WITH_DRIVER_DSOUND)
|
|
|
|
|
|
|
|
IF(WITH_DRIVER_XAUDIO2)
|
2011-02-24 14:37:55 +00:00
|
|
|
TARGET_LINK_LIBRARIES(${name} nel_drv_xaudio2_win)
|
2010-08-28 12:10:56 +00:00
|
|
|
ENDIF(WITH_DRIVER_XAUDIO2)
|
2010-08-08 19:14:34 +00:00
|
|
|
|
2011-02-24 14:37:55 +00:00
|
|
|
IF(WITH_DRIVER_OPENAL)
|
|
|
|
TARGET_LINK_LIBRARIES(${name} nel_drv_openal_win)
|
|
|
|
ENDIF(WITH_DRIVER_OPENAL)
|
|
|
|
|
|
|
|
IF(WITH_DRIVER_FMOD)
|
|
|
|
TARGET_LINK_LIBRARIES(${name} nel_drv_fmod_win)
|
|
|
|
ENDIF(WITH_DRIVER_FMOD)
|
|
|
|
ELSE(WIN32)
|
|
|
|
IF(WITH_DRIVER_OPENAL)
|
|
|
|
TARGET_LINK_LIBRARIES(${name} nel_drv_openal)
|
|
|
|
ENDIF(WITH_DRIVER_OPENAL)
|
|
|
|
|
|
|
|
IF(WITH_DRIVER_FMOD)
|
|
|
|
TARGET_LINK_LIBRARIES(${name} nel_drv_fmod)
|
|
|
|
ENDIF(WITH_DRIVER_FMOD)
|
|
|
|
ENDIF(WIN32)
|
2010-08-08 19:14:34 +00:00
|
|
|
|
2010-07-23 19:05:21 +00:00
|
|
|
ENDIF(WITH_STATIC_DRIVERS)
|
|
|
|
ENDMACRO(NL_ADD_STATIC_SND_DRIVERS)
|
|
|
|
|
2010-05-06 00:08:41 +00:00
|
|
|
###
|
|
|
|
# Checks build vs. source location. Prevents In-Source builds.
|
|
|
|
###
|
|
|
|
MACRO(CHECK_OUT_OF_SOURCE)
|
|
|
|
IF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
|
|
|
|
MESSAGE(FATAL_ERROR "
|
|
|
|
|
|
|
|
CMake generation for this project is not allowed within the source directory!
|
|
|
|
Remove the CMakeCache.txt file and try again from another folder, e.g.:
|
|
|
|
|
|
|
|
rm CMakeCache.txt
|
|
|
|
mkdir cmake
|
|
|
|
cd cmake
|
2012-04-07 13:11:18 +00:00
|
|
|
cmake ..
|
2010-05-06 00:08:41 +00:00
|
|
|
")
|
|
|
|
ENDIF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
|
|
|
|
|
|
|
|
ENDMACRO(CHECK_OUT_OF_SOURCE)
|
|
|
|
|
|
|
|
MACRO(NL_SETUP_DEFAULT_OPTIONS)
|
|
|
|
###
|
|
|
|
# Features
|
|
|
|
###
|
|
|
|
OPTION(WITH_LOGGING "With Logging" ON )
|
|
|
|
OPTION(WITH_COVERAGE "With Code Coverage Support" OFF)
|
2010-06-26 15:14:08 +00:00
|
|
|
OPTION(WITH_PCH "With Precompiled Headers" ON )
|
2010-07-17 21:04:22 +00:00
|
|
|
OPTION(FINAL_VERSION "Build in Final Version mode" ON )
|
|
|
|
|
2010-07-14 17:13:07 +00:00
|
|
|
# Default to static building on Windows.
|
|
|
|
IF(WIN32)
|
|
|
|
OPTION(WITH_STATIC "With static libraries." ON )
|
|
|
|
ELSE(WIN32)
|
|
|
|
OPTION(WITH_STATIC "With static libraries." OFF)
|
|
|
|
ENDIF(WIN32)
|
2010-07-17 21:04:22 +00:00
|
|
|
OPTION(WITH_STATIC_DRIVERS "With static drivers." OFF)
|
2011-09-10 16:45:54 +00:00
|
|
|
IF(WIN32)
|
|
|
|
OPTION(WITH_EXTERNAL "With provided external." ON )
|
|
|
|
ELSE(WIN32)
|
|
|
|
OPTION(WITH_EXTERNAL "With provided external." OFF)
|
|
|
|
ENDIF(WIN32)
|
2011-06-14 18:11:17 +00:00
|
|
|
OPTION(WITH_STATIC_EXTERNAL "With static external libraries" OFF)
|
2011-09-11 12:44:37 +00:00
|
|
|
OPTION(WITH_INSTALL_LIBRARIES "Install development files." ON )
|
2010-07-17 21:04:22 +00:00
|
|
|
|
2010-09-26 21:19:36 +00:00
|
|
|
###
|
|
|
|
# GUI toolkits
|
|
|
|
###
|
|
|
|
OPTION(WITH_GTK "With GTK Support" OFF)
|
|
|
|
OPTION(WITH_QT "With QT Support" OFF)
|
2010-09-02 19:53:33 +00:00
|
|
|
|
2010-09-28 08:49:30 +00:00
|
|
|
IF(WIN32 AND MFC_FOUND)
|
2010-09-26 21:19:36 +00:00
|
|
|
OPTION(WITH_MFC "With MFC Support" ON )
|
2010-09-28 08:49:30 +00:00
|
|
|
ELSE(WIN32 AND MFC_FOUND)
|
2010-09-26 21:19:36 +00:00
|
|
|
OPTION(WITH_MFC "With MFC Support" OFF)
|
2010-09-28 08:49:30 +00:00
|
|
|
ENDIF(WIN32 AND MFC_FOUND)
|
2011-02-11 17:05:19 +00:00
|
|
|
|
2010-09-02 19:53:33 +00:00
|
|
|
###
|
|
|
|
# Optional support
|
|
|
|
###
|
2012-10-03 08:08:56 +00:00
|
|
|
OPTION(WITH_SYMBOLS "Keep debug symbols in binaries" OFF)
|
2012-04-11 13:30:38 +00:00
|
|
|
|
2010-09-28 13:37:52 +00:00
|
|
|
IF(WIN32)
|
|
|
|
OPTION(WITH_STLPORT "With STLport support." ON )
|
|
|
|
ELSE(WIN32)
|
|
|
|
OPTION(WITH_STLPORT "With STLport support." OFF)
|
|
|
|
ENDIF(WIN32)
|
2011-02-11 17:05:19 +00:00
|
|
|
|
2010-09-26 21:19:36 +00:00
|
|
|
OPTION(BUILD_DASHBOARD "Build to the CDash dashboard" OFF)
|
|
|
|
|
2011-09-10 16:45:54 +00:00
|
|
|
OPTION(WITH_NEL "Build NeL (nearly always required)." ON )
|
|
|
|
OPTION(WITH_NELNS "Build NeL Network Services." OFF)
|
|
|
|
OPTION(WITH_RYZOM "Build Ryzom Core." ON )
|
2011-09-11 12:44:37 +00:00
|
|
|
OPTION(WITH_SNOWBALLS "Build Snowballs." OFF)
|
2010-09-02 19:53:33 +00:00
|
|
|
ENDMACRO(NL_SETUP_DEFAULT_OPTIONS)
|
|
|
|
|
|
|
|
MACRO(NL_SETUP_NEL_DEFAULT_OPTIONS)
|
2010-05-06 00:08:41 +00:00
|
|
|
###
|
|
|
|
# Core libraries
|
|
|
|
###
|
|
|
|
OPTION(WITH_NET "Build NLNET" ON )
|
|
|
|
OPTION(WITH_3D "Build NL3D" ON )
|
|
|
|
OPTION(WITH_PACS "Build NLPACS" ON )
|
|
|
|
OPTION(WITH_GEORGES "Build NLGEORGES" ON )
|
|
|
|
OPTION(WITH_LIGO "Build NLLIGO" ON )
|
|
|
|
OPTION(WITH_LOGIC "Build NLLOGIC" ON )
|
|
|
|
OPTION(WITH_SOUND "Build NLSOUND" ON )
|
|
|
|
|
|
|
|
###
|
|
|
|
# Drivers Support
|
|
|
|
###
|
|
|
|
OPTION(WITH_DRIVER_OPENGL "Build OpenGL Driver (3D)" ON )
|
2011-05-01 15:01:11 +00:00
|
|
|
OPTION(WITH_DRIVER_OPENGLES "Build OpenGL ES Driver (3D)" OFF)
|
2010-05-06 00:08:41 +00:00
|
|
|
OPTION(WITH_DRIVER_DIRECT3D "Build Direct3D Driver (3D)" OFF)
|
|
|
|
OPTION(WITH_DRIVER_OPENAL "Build OpenAL Driver (Sound)" ON )
|
|
|
|
OPTION(WITH_DRIVER_FMOD "Build FMOD Driver (Sound)" OFF)
|
|
|
|
OPTION(WITH_DRIVER_DSOUND "Build DirectSound Driver (Sound)" OFF)
|
|
|
|
OPTION(WITH_DRIVER_XAUDIO2 "Build XAudio2 Driver (Sound)" OFF)
|
|
|
|
|
|
|
|
###
|
|
|
|
# Optional support
|
|
|
|
###
|
2010-09-25 15:24:19 +00:00
|
|
|
OPTION(WITH_NEL_CEGUI "Build CEGUI Renderer" OFF)
|
|
|
|
OPTION(WITH_NEL_TOOLS "Build NeL Tools" ON )
|
|
|
|
OPTION(WITH_NEL_MAXPLUGIN "Build NeL 3dsMax Plugin" OFF)
|
|
|
|
OPTION(WITH_NEL_SAMPLES "Build NeL Samples" ON )
|
|
|
|
OPTION(WITH_NEL_TESTS "Build NeL Unit Tests" ON )
|
2010-09-02 19:53:33 +00:00
|
|
|
ENDMACRO(NL_SETUP_NEL_DEFAULT_OPTIONS)
|
|
|
|
|
2010-09-25 15:24:19 +00:00
|
|
|
MACRO(NL_SETUP_NELNS_DEFAULT_OPTIONS)
|
|
|
|
###
|
|
|
|
# Core libraries
|
|
|
|
###
|
|
|
|
OPTION(WITH_NELNS_SERVER "Build NeLNS Services" ON )
|
|
|
|
OPTION(WITH_NELNS_LOGIN_SYSTEM "Build NeLNS Login System Tools" ON )
|
|
|
|
ENDMACRO(NL_SETUP_NELNS_DEFAULT_OPTIONS)
|
|
|
|
|
2010-09-02 19:53:33 +00:00
|
|
|
MACRO(NL_SETUP_RYZOM_DEFAULT_OPTIONS)
|
|
|
|
###
|
|
|
|
# Core libraries
|
|
|
|
###
|
2010-09-25 15:24:19 +00:00
|
|
|
OPTION(WITH_RYZOM_CLIENT "Build Ryzom Core Client" ON )
|
|
|
|
OPTION(WITH_RYZOM_TOOLS "Build Ryzom Core Tools" ON )
|
|
|
|
OPTION(WITH_RYZOM_SERVER "Build Ryzom Core Services" ON )
|
|
|
|
OPTION(WITH_RYZOM_SOUND "Enable Ryzom Core Sound" ON )
|
2010-09-02 19:53:33 +00:00
|
|
|
|
2010-09-25 15:24:19 +00:00
|
|
|
###
|
|
|
|
# Optional support
|
|
|
|
###
|
|
|
|
OPTION(WITH_LUA51 "Build Ryzom Core using Lua51" ON )
|
2010-09-02 19:53:33 +00:00
|
|
|
ENDMACRO(NL_SETUP_RYZOM_DEFAULT_OPTIONS)
|
2010-05-06 00:08:41 +00:00
|
|
|
|
2010-09-25 15:24:19 +00:00
|
|
|
MACRO(NL_SETUP_SNOWBALLS_DEFAULT_OPTIONS)
|
|
|
|
###
|
|
|
|
# Core libraries
|
|
|
|
###
|
|
|
|
OPTION(WITH_SNOWBALLS_CLIENT "Build Snowballs Client" ON )
|
|
|
|
OPTION(WITH_SNOWBALLS_SERVER "Build Snowballs Services" ON )
|
|
|
|
ENDMACRO(NL_SETUP_SNOWBALLS_DEFAULT_OPTIONS)
|
|
|
|
|
2010-05-06 00:08:41 +00:00
|
|
|
MACRO(NL_SETUP_BUILD)
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Setup the buildmode variables.
|
|
|
|
#
|
|
|
|
# None = NL_RELEASE
|
|
|
|
# Debug = NL_DEBUG
|
2010-09-26 21:24:51 +00:00
|
|
|
# Release = NL_RELEASE
|
|
|
|
|
|
|
|
SET(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
|
2010-05-06 00:08:41 +00:00
|
|
|
|
|
|
|
IF(CMAKE_BUILD_TYPE MATCHES "Debug")
|
|
|
|
SET(NL_BUILD_MODE "NL_DEBUG")
|
|
|
|
ELSE(CMAKE_BUILD_TYPE MATCHES "Debug")
|
|
|
|
IF(CMAKE_BUILD_TYPE MATCHES "Release")
|
|
|
|
SET(NL_BUILD_MODE "NL_RELEASE")
|
|
|
|
ELSE(CMAKE_BUILD_TYPE MATCHES "Release")
|
|
|
|
SET(NL_BUILD_MODE "NL_RELEASE")
|
|
|
|
# enforce release mode if it's neither Debug nor Release
|
2010-09-26 21:24:51 +00:00
|
|
|
SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
|
2010-05-06 00:08:41 +00:00
|
|
|
ENDIF(CMAKE_BUILD_TYPE MATCHES "Release")
|
|
|
|
ENDIF(CMAKE_BUILD_TYPE MATCHES "Debug")
|
|
|
|
|
2012-05-07 08:27:54 +00:00
|
|
|
SET(HOST_CPU ${CMAKE_HOST_SYSTEM_PROCESSOR})
|
2011-05-29 15:54:58 +00:00
|
|
|
|
2012-04-07 13:11:18 +00:00
|
|
|
IF(HOST_CPU MATCHES "amd64")
|
|
|
|
SET(HOST_CPU "x86_64")
|
|
|
|
ELSEIF(HOST_CPU MATCHES "i.86")
|
|
|
|
SET(HOST_CPU "x86")
|
|
|
|
ENDIF(HOST_CPU MATCHES "amd64")
|
|
|
|
|
2012-02-27 14:19:53 +00:00
|
|
|
# Determine target CPU
|
|
|
|
|
|
|
|
# If not specified, use the same CPU as host
|
|
|
|
IF(NOT TARGET_CPU)
|
|
|
|
SET(TARGET_CPU ${CMAKE_SYSTEM_PROCESSOR})
|
|
|
|
ENDIF(NOT TARGET_CPU)
|
|
|
|
|
|
|
|
IF(TARGET_CPU MATCHES "amd64")
|
|
|
|
SET(TARGET_CPU "x86_64")
|
|
|
|
ELSEIF(TARGET_CPU MATCHES "i.86")
|
|
|
|
SET(TARGET_CPU "x86")
|
|
|
|
ENDIF(TARGET_CPU MATCHES "amd64")
|
|
|
|
|
2012-05-07 08:27:54 +00:00
|
|
|
IF(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
|
|
|
|
SET(CLANG ON)
|
|
|
|
MESSAGE(STATUS "Using Clang compiler")
|
|
|
|
ENDIF(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
|
|
|
|
|
2012-05-07 22:07:14 +00:00
|
|
|
IF(CMAKE_GENERATOR MATCHES "Xcode")
|
|
|
|
SET(XCODE ON)
|
|
|
|
MESSAGE(STATUS "Generating Xcode project")
|
|
|
|
ENDIF(CMAKE_GENERATOR MATCHES "Xcode")
|
|
|
|
|
2012-02-27 14:19:53 +00:00
|
|
|
# If target and host CPU are the same
|
|
|
|
IF("${HOST_CPU}" STREQUAL "${TARGET_CPU}")
|
|
|
|
# x86-compatible CPU
|
|
|
|
IF(HOST_CPU MATCHES "x86")
|
|
|
|
IF(NOT CMAKE_SIZEOF_VOID_P)
|
|
|
|
INCLUDE (CheckTypeSize)
|
|
|
|
CHECK_TYPE_SIZE("void*" CMAKE_SIZEOF_VOID_P)
|
|
|
|
ENDIF(NOT CMAKE_SIZEOF_VOID_P)
|
|
|
|
|
|
|
|
# Using 32 or 64 bits libraries
|
|
|
|
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|
|
|
SET(TARGET_CPU "x86_64")
|
|
|
|
ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|
|
|
SET(TARGET_CPU "x86")
|
|
|
|
ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
2012-05-07 08:27:54 +00:00
|
|
|
ELSEIF(HOST_CPU MATCHES "arm")
|
|
|
|
SET(TARGET_CPU "arm")
|
|
|
|
ELSE(HOST_CPU MATCHES "x86")
|
|
|
|
SET(TARGET_CPU "unknown")
|
|
|
|
MESSAGE(STATUS "Unknown architecture: ${HOST_CPU}")
|
2012-02-27 14:19:53 +00:00
|
|
|
ENDIF(HOST_CPU MATCHES "x86")
|
2012-05-07 08:27:54 +00:00
|
|
|
# TODO: add checks for PPC
|
2012-02-27 14:19:53 +00:00
|
|
|
ELSE("${HOST_CPU}" STREQUAL "${TARGET_CPU}")
|
|
|
|
MESSAGE(STATUS "Compiling on ${HOST_CPU} for ${TARGET_CPU}")
|
|
|
|
ENDIF("${HOST_CPU}" STREQUAL "${TARGET_CPU}")
|
|
|
|
|
2012-09-22 20:57:38 +00:00
|
|
|
# Use values from environment variables
|
2012-10-03 20:31:12 +00:00
|
|
|
SET(PLATFORM_CFLAGS "$ENV{CFLAGS} $ENV{CPPFLAGS} ${PLATFORM_CFLAGS}")
|
|
|
|
SET(PLATFORM_CXXFLAGS "$ENV{CXXFLAGS} $ENV{CPPFLAGS} ${PLATFORM_CXXFLAGS}")
|
2012-09-22 20:57:38 +00:00
|
|
|
SET(PLATFORM_LINKFLAGS "$ENV{LDFLAGS} ${PLATFORM_LINKFLAGS}")
|
|
|
|
|
2012-09-23 18:30:28 +00:00
|
|
|
# Remove -g and -O flag because we are managing them ourself
|
2012-09-22 20:57:38 +00:00
|
|
|
STRING(REPLACE "-g" "" PLATFORM_CFLAGS ${PLATFORM_CFLAGS})
|
2012-10-03 20:31:12 +00:00
|
|
|
STRING(REPLACE "-g" "" PLATFORM_CXXFLAGS ${PLATFORM_CXXFLAGS})
|
2012-09-23 18:30:28 +00:00
|
|
|
STRING(REGEX REPLACE "-O[0-9s]" "" PLATFORM_CFLAGS ${PLATFORM_CFLAGS})
|
2012-10-03 20:31:12 +00:00
|
|
|
STRING(REGEX REPLACE "-O[0-9s]" "" PLATFORM_CXXFLAGS ${PLATFORM_CXXFLAGS})
|
2012-09-22 20:57:38 +00:00
|
|
|
|
|
|
|
# Strip spaces
|
|
|
|
STRING(STRIP ${PLATFORM_CFLAGS} PLATFORM_CFLAGS)
|
2012-10-03 20:31:12 +00:00
|
|
|
STRING(STRIP ${PLATFORM_CXXFLAGS} PLATFORM_CXXFLAGS)
|
2012-09-22 20:57:38 +00:00
|
|
|
STRING(STRIP ${PLATFORM_LINKFLAGS} PLATFORM_LINKFLAGS)
|
|
|
|
|
2012-02-27 14:19:53 +00:00
|
|
|
IF(TARGET_CPU STREQUAL "x86_64")
|
|
|
|
SET(TARGET_X64 1)
|
2012-04-07 13:11:18 +00:00
|
|
|
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DHAVE_X86_64")
|
2012-10-03 20:31:12 +00:00
|
|
|
SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -DHAVE_X86_64")
|
2012-02-27 14:19:53 +00:00
|
|
|
ELSEIF(TARGET_CPU STREQUAL "x86")
|
2011-05-29 15:54:58 +00:00
|
|
|
SET(TARGET_X86 1)
|
2012-04-07 13:11:18 +00:00
|
|
|
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DHAVE_X86")
|
2012-10-03 20:31:12 +00:00
|
|
|
SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -DHAVE_X86")
|
2012-05-07 08:27:54 +00:00
|
|
|
ELSEIF(TARGET_CPU STREQUAL "arm")
|
|
|
|
SET(TARGET_ARM 1)
|
|
|
|
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DHAVE_ARM")
|
2012-10-03 20:31:12 +00:00
|
|
|
SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -DHAVE_ARM")
|
2012-02-27 14:19:53 +00:00
|
|
|
ENDIF(TARGET_CPU STREQUAL "x86_64")
|
2011-08-19 14:58:18 +00:00
|
|
|
|
2012-02-27 14:19:53 +00:00
|
|
|
# Fix library paths suffixes for Debian MultiArch
|
2012-10-07 11:58:59 +00:00
|
|
|
IF(LIBRARY_ARCHITECTURE)
|
|
|
|
SET(CMAKE_LIBRARY_PATH /lib/${LIBRARY_ARCHITECTURE} /usr/lib/${LIBRARY_ARCHITECTURE} ${CMAKE_LIBRARY_PATH})
|
2012-04-11 13:30:38 +00:00
|
|
|
IF(TARGET_X64)
|
|
|
|
SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /lib64 /usr/lib64)
|
|
|
|
ENDIF(TARGET_X64)
|
|
|
|
IF(TARGET_X86)
|
|
|
|
SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /lib32 /usr/lib32)
|
|
|
|
ENDIF(TARGET_X86)
|
2012-10-07 11:58:59 +00:00
|
|
|
ENDIF(LIBRARY_ARCHITECTURE)
|
2012-02-27 14:19:53 +00:00
|
|
|
|
|
|
|
IF(MSVC)
|
2011-05-12 10:49:17 +00:00
|
|
|
IF(MSVC10)
|
|
|
|
# /Ox is working with VC++ 2010, but custom optimizations don't exist
|
|
|
|
SET(SPEED_OPTIMIZATIONS "/Ox /GF /GS-")
|
|
|
|
# without inlining it's unusable, use custom optimizations again
|
|
|
|
SET(MIN_OPTIMIZATIONS "/Od /Ob1")
|
2011-09-11 12:44:37 +00:00
|
|
|
ELSEIF(MSVC90)
|
2011-05-12 10:49:17 +00:00
|
|
|
# don't use a /O[012x] flag if you want custom optimizations
|
|
|
|
SET(SPEED_OPTIMIZATIONS "/Ob2 /Oi /Ot /Oy /GT /GF /GS-")
|
|
|
|
# without inlining it's unusable, use custom optimizations again
|
|
|
|
SET(MIN_OPTIMIZATIONS "/Ob1")
|
2011-09-11 12:44:37 +00:00
|
|
|
ELSEIF(MSVC80)
|
2011-08-19 14:58:18 +00:00
|
|
|
# don't use a /O[012x] flag if you want custom optimizations
|
|
|
|
SET(SPEED_OPTIMIZATIONS "/Ox /GF /GS-")
|
|
|
|
# without inlining it's unusable, use custom optimizations again
|
|
|
|
SET(MIN_OPTIMIZATIONS "/Od /Ob1")
|
2011-09-11 12:44:37 +00:00
|
|
|
ELSE(MSVC10)
|
|
|
|
MESSAGE(FATAL_ERROR "Can't determine compiler version ${MSVC_VERSION}")
|
2011-05-12 10:49:17 +00:00
|
|
|
ENDIF(MSVC10)
|
2010-08-28 12:56:29 +00:00
|
|
|
|
2012-04-11 13:30:38 +00:00
|
|
|
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /W3 /Zm1000 /MP /Gy-")
|
2012-10-03 20:31:12 +00:00
|
|
|
SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /W3 /Zm1000 /MP /Gy-")
|
2010-09-26 21:24:51 +00:00
|
|
|
|
2011-05-29 15:54:58 +00:00
|
|
|
IF(TARGET_X64)
|
|
|
|
# Fix a bug with Intellisense
|
|
|
|
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} /D_WIN64")
|
2012-10-03 20:31:12 +00:00
|
|
|
SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} /D_WIN64")
|
2011-05-29 15:54:58 +00:00
|
|
|
# Fix a compilation error for some big C++ files
|
|
|
|
SET(MIN_OPTIMIZATIONS "${MIN_OPTIMIZATIONS} /bigobj")
|
|
|
|
ELSE(TARGET_X64)
|
|
|
|
# Allows 32 bits applications to use 3 GB of RAM
|
|
|
|
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /LARGEADDRESSAWARE")
|
|
|
|
ENDIF(TARGET_X64)
|
|
|
|
|
|
|
|
# Exceptions are only set for C++
|
2012-10-03 20:31:12 +00:00
|
|
|
SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} /EHa")
|
2010-09-26 21:24:51 +00:00
|
|
|
|
2012-04-11 13:30:38 +00:00
|
|
|
IF(WITH_SYMBOLS)
|
|
|
|
SET(NL_RELEASE_CFLAGS "/Zi ${NL_RELEASE_CFLAGS}")
|
|
|
|
SET(NL_RELEASE_LINKFLAGS "/DEBUG ${NL_RELEASE_LINKFLAGS}")
|
|
|
|
ELSE(WITH_SYMBOLS)
|
|
|
|
SET(NL_RELEASE_LINKFLAGS "/RELEASE ${NL_RELEASE_LINKFLAGS}")
|
|
|
|
ENDIF(WITH_SYMBOLS)
|
|
|
|
|
|
|
|
SET(NL_DEBUG_CFLAGS "/Zi /MDd /RTC1 /D_DEBUG ${MIN_OPTIMIZATIONS} ${NL_DEBUG_CFLAGS}")
|
|
|
|
SET(NL_RELEASE_CFLAGS "/MD /DNDEBUG ${SPEED_OPTIMIZATIONS} ${NL_RELEASE_CFLAGS}")
|
|
|
|
SET(NL_DEBUG_LINKFLAGS "/DEBUG /OPT:NOREF /OPT:NOICF /NODEFAULTLIB:msvcrt /INCREMENTAL:YES ${NL_DEBUG_LINKFLAGS}")
|
|
|
|
SET(NL_RELEASE_LINKFLAGS "/OPT:REF /OPT:ICF /INCREMENTAL:NO ${NL_RELEASE_LINKFLAGS}")
|
2012-02-29 15:32:53 +00:00
|
|
|
ELSE(MSVC)
|
2012-05-07 22:07:14 +00:00
|
|
|
IF(WIN32)
|
|
|
|
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DWIN32 -D_WIN32")
|
|
|
|
ENDIF(WIN32)
|
2012-02-27 14:19:53 +00:00
|
|
|
|
2012-05-07 22:07:14 +00:00
|
|
|
IF(APPLE)
|
|
|
|
IF(TARGET_CPU STREQUAL "x86")
|
|
|
|
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -arch i386")
|
2012-10-03 20:31:12 +00:00
|
|
|
SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -arch i386")
|
2012-05-07 22:07:14 +00:00
|
|
|
ENDIF(TARGET_CPU STREQUAL "x86")
|
|
|
|
|
|
|
|
IF(TARGET_CPU STREQUAL "x86_64")
|
|
|
|
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -arch x86_64")
|
2012-10-03 20:31:12 +00:00
|
|
|
SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -arch x86_64")
|
2012-05-07 22:07:14 +00:00
|
|
|
ENDIF(TARGET_CPU STREQUAL "x86_64")
|
|
|
|
ELSE(APPLE)
|
|
|
|
IF(HOST_CPU STREQUAL "x86_64" AND TARGET_CPU STREQUAL "x86")
|
|
|
|
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -m32 -march=i686")
|
2012-10-03 20:31:12 +00:00
|
|
|
SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -m32 -march=i686")
|
2012-05-07 22:07:14 +00:00
|
|
|
ENDIF(HOST_CPU STREQUAL "x86_64" AND TARGET_CPU STREQUAL "x86")
|
|
|
|
|
|
|
|
IF(HOST_CPU STREQUAL "x86" AND TARGET_CPU STREQUAL "x86_64")
|
|
|
|
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -m64")
|
2012-10-03 20:31:12 +00:00
|
|
|
SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -m64")
|
2012-05-07 22:07:14 +00:00
|
|
|
ENDIF(HOST_CPU STREQUAL "x86" AND TARGET_CPU STREQUAL "x86_64")
|
|
|
|
ENDIF(APPLE)
|
2012-02-27 14:19:53 +00:00
|
|
|
|
2012-09-25 10:33:02 +00:00
|
|
|
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -D_REENTRANT -pipe -Wall -W -Wpointer-arith -Wsign-compare -Wno-deprecated-declarations -Wno-multichar -Wno-unused -fno-strict-aliasing")
|
2012-10-03 20:31:12 +00:00
|
|
|
SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -D_REENTRANT -pipe -Wall -W -Wpointer-arith -Wsign-compare -Wno-deprecated-declarations -Wno-multichar -Wno-unused -fno-strict-aliasing")
|
2012-04-11 21:59:55 +00:00
|
|
|
|
|
|
|
IF(NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
|
|
|
|
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -ansi")
|
2012-10-03 20:31:12 +00:00
|
|
|
SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -ansi")
|
2012-04-11 21:59:55 +00:00
|
|
|
ENDIF(NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
|
2012-02-27 14:19:53 +00:00
|
|
|
|
2010-05-06 00:08:41 +00:00
|
|
|
IF(WITH_COVERAGE)
|
|
|
|
SET(PLATFORM_CFLAGS "-fprofile-arcs -ftest-coverage ${PLATFORM_CFLAGS}")
|
2012-10-03 20:31:12 +00:00
|
|
|
SET(PLATFORM_CXXFLAGS "-fprofile-arcs -ftest-coverage ${PLATFORM_CXXFLAGS}")
|
2010-05-06 00:08:41 +00:00
|
|
|
ENDIF(WITH_COVERAGE)
|
2011-02-18 08:10:37 +00:00
|
|
|
|
|
|
|
IF(APPLE)
|
|
|
|
SET(PLATFORM_CFLAGS "-gdwarf-2 ${PLATFORM_CFLAGS}")
|
2012-10-03 20:31:12 +00:00
|
|
|
SET(PLATFORM_CXXFLAGS "-gdwarf-2 ${PLATFORM_CXXFLAGS}")
|
2011-02-18 08:10:37 +00:00
|
|
|
ENDIF(APPLE)
|
|
|
|
|
2012-05-07 22:07:14 +00:00
|
|
|
IF(APPLE AND XCODE)
|
2012-09-05 13:08:12 +00:00
|
|
|
# SET(CMAKE_OSX_SYSROOT "macosx" CACHE PATH "" FORCE)
|
2012-05-07 22:07:14 +00:00
|
|
|
ELSEIF(APPLE AND NOT XCODE)
|
|
|
|
IF(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
|
|
|
|
SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.6")
|
|
|
|
ENDIF(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
|
|
|
|
|
|
|
|
FOREACH(_SDK ${_CMAKE_OSX_SDKS})
|
|
|
|
IF(${_SDK} MATCHES "MacOSX${CMAKE_OSX_DEPLOYMENT_TARGET}\\.sdk")
|
|
|
|
SET(CMAKE_OSX_SYSROOT ${_SDK} CACHE PATH "" FORCE)
|
|
|
|
ENDIF(${_SDK} MATCHES "MacOSX${CMAKE_OSX_DEPLOYMENT_TARGET}\\.sdk")
|
|
|
|
ENDFOREACH(_SDK)
|
|
|
|
|
|
|
|
IF(CMAKE_OSX_SYSROOT)
|
|
|
|
SET(PLATFORM_CFLAGS "-isysroot ${CMAKE_OSX_SYSROOT} ${PLATFORM_CFLAGS}")
|
2012-10-03 20:31:12 +00:00
|
|
|
SET(PLATFORM_CXXFLAGS "-isysroot ${CMAKE_OSX_SYSROOT} ${PLATFORM_CXXFLAGS}")
|
2012-05-07 22:07:14 +00:00
|
|
|
ELSE(CMAKE_OSX_SYSROOT)
|
|
|
|
MESSAGE(FATAL_ERROR "CMAKE_OSX_SYSROOT can't be determinated")
|
|
|
|
ENDIF(CMAKE_OSX_SYSROOT)
|
|
|
|
|
|
|
|
IF(CMAKE_OSX_ARCHITECTURES)
|
|
|
|
FOREACH(_ARCH ${CMAKE_OSX_ARCHITECTURES})
|
|
|
|
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -arch ${_ARCH}")
|
2012-10-03 20:31:12 +00:00
|
|
|
SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -arch ${_ARCH}")
|
2012-05-07 22:07:14 +00:00
|
|
|
ENDFOREACH(_ARCH)
|
|
|
|
ENDIF(CMAKE_OSX_ARCHITECTURES)
|
|
|
|
IF(CMAKE_C_OSX_DEPLOYMENT_TARGET_FLAG)
|
|
|
|
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
|
2012-10-03 20:31:12 +00:00
|
|
|
SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
|
2012-05-07 22:07:14 +00:00
|
|
|
ENDIF(CMAKE_C_OSX_DEPLOYMENT_TARGET_FLAG)
|
|
|
|
|
|
|
|
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-headerpad_max_install_names")
|
|
|
|
|
|
|
|
IF(HAVE_FLAG_SEARCH_PATHS_FIRST)
|
|
|
|
SET(PLATFORM_LINKFLAGS "-Wl,-search_paths_first ${PLATFORM_LINKFLAGS}")
|
|
|
|
ENDIF(HAVE_FLAG_SEARCH_PATHS_FIRST)
|
|
|
|
ENDIF(APPLE AND XCODE)
|
|
|
|
|
2011-09-10 16:43:21 +00:00
|
|
|
# Fix "relocation R_X86_64_32 against.." error on x64 platforms
|
|
|
|
IF(TARGET_X64 AND WITH_STATIC AND NOT WITH_STATIC_DRIVERS)
|
|
|
|
SET(PLATFORM_CFLAGS "-fPIC ${PLATFORM_CFLAGS}")
|
2012-10-03 20:31:12 +00:00
|
|
|
SET(PLATFORM_CXXFLAGS "-fPIC ${PLATFORM_CXXFLAGS}")
|
2011-09-10 16:43:21 +00:00
|
|
|
ENDIF(TARGET_X64 AND WITH_STATIC AND NOT WITH_STATIC_DRIVERS)
|
|
|
|
|
2012-10-03 20:31:12 +00:00
|
|
|
SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -ftemplate-depth-48")
|
2010-09-26 21:24:51 +00:00
|
|
|
|
2010-09-09 12:57:59 +00:00
|
|
|
IF(NOT APPLE)
|
2012-02-27 14:19:53 +00:00
|
|
|
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,--no-undefined -Wl,--as-needed")
|
2010-09-09 12:57:59 +00:00
|
|
|
ENDIF(NOT APPLE)
|
2010-09-26 21:24:51 +00:00
|
|
|
|
2012-04-11 13:30:38 +00:00
|
|
|
IF(WITH_SYMBOLS)
|
|
|
|
SET(NL_RELEASE_CFLAGS "${NL_RELEASE_CFLAGS} -g")
|
|
|
|
ELSE(WITH_SYMBOLS)
|
2012-05-07 08:27:54 +00:00
|
|
|
IF(APPLE)
|
|
|
|
SET(NL_RELEASE_LINKFLAGS "-Wl,-dead_strip -Wl,-x ${NL_RELEASE_LINKFLAGS}")
|
|
|
|
ELSE(APPLE)
|
2012-04-11 13:30:38 +00:00
|
|
|
SET(NL_RELEASE_LINKFLAGS "-Wl,-s ${NL_RELEASE_LINKFLAGS}")
|
2012-05-07 08:27:54 +00:00
|
|
|
ENDIF(APPLE)
|
2012-04-11 13:30:38 +00:00
|
|
|
ENDIF(WITH_SYMBOLS)
|
|
|
|
|
2012-05-07 08:27:54 +00:00
|
|
|
SET(NL_DEBUG_CFLAGS "-g -DNL_DEBUG -D_DEBUG ${NL_DEBUG_CFLAGS}")
|
2012-04-11 13:30:38 +00:00
|
|
|
SET(NL_RELEASE_CFLAGS "-DNL_RELEASE -DNDEBUG -O3 ${NL_RELEASE_CFLAGS}")
|
2012-02-29 15:32:53 +00:00
|
|
|
ENDIF(MSVC)
|
2010-05-06 00:08:41 +00:00
|
|
|
ENDMACRO(NL_SETUP_BUILD)
|
|
|
|
|
|
|
|
MACRO(NL_SETUP_BUILD_FLAGS)
|
2010-09-26 21:24:51 +00:00
|
|
|
SET(CMAKE_C_FLAGS ${PLATFORM_CFLAGS} CACHE STRING "" FORCE)
|
|
|
|
SET(CMAKE_CXX_FLAGS ${PLATFORM_CXXFLAGS} CACHE STRING "" FORCE)
|
2011-02-11 17:05:19 +00:00
|
|
|
|
2010-05-06 00:08:41 +00:00
|
|
|
## Debug
|
2010-09-26 21:24:51 +00:00
|
|
|
SET(CMAKE_C_FLAGS_DEBUG ${NL_DEBUG_CFLAGS} CACHE STRING "" FORCE)
|
|
|
|
SET(CMAKE_CXX_FLAGS_DEBUG ${NL_DEBUG_CFLAGS} CACHE STRING "" FORCE)
|
|
|
|
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${PLATFORM_LINKFLAGS} ${NL_DEBUG_LINKFLAGS}" CACHE STRING "" FORCE)
|
|
|
|
SET(CMAKE_MODULE_LINKER_FLAGS_DEBUG "${PLATFORM_LINKFLAGS} ${NL_DEBUG_LINKFLAGS}" CACHE STRING "" FORCE)
|
|
|
|
SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${PLATFORM_LINKFLAGS} ${NL_DEBUG_LINKFLAGS}" CACHE STRING "" FORCE)
|
2010-05-06 00:08:41 +00:00
|
|
|
|
|
|
|
## Release
|
2010-09-26 21:24:51 +00:00
|
|
|
SET(CMAKE_C_FLAGS_RELEASE ${NL_RELEASE_CFLAGS} CACHE STRING "" FORCE)
|
|
|
|
SET(CMAKE_CXX_FLAGS_RELEASE ${NL_RELEASE_CFLAGS} CACHE STRING "" FORCE)
|
|
|
|
SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${PLATFORM_LINKFLAGS} ${NL_RELEASE_LINKFLAGS}" CACHE STRING "" FORCE)
|
|
|
|
SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${PLATFORM_LINKFLAGS} ${NL_RELEASE_LINKFLAGS}" CACHE STRING "" FORCE)
|
|
|
|
SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${PLATFORM_LINKFLAGS} ${NL_RELEASE_LINKFLAGS}" CACHE STRING "" FORCE)
|
2010-05-06 00:08:41 +00:00
|
|
|
ENDMACRO(NL_SETUP_BUILD_FLAGS)
|
|
|
|
|
2012-09-23 21:56:34 +00:00
|
|
|
# Macro to create x_ABSOLUTE_PREFIX from x_PREFIX
|
|
|
|
MACRO(NL_MAKE_ABSOLUTE_PREFIX NAME_RELATIVE NAME_ABSOLUTE)
|
2012-09-24 06:56:10 +00:00
|
|
|
IF(IS_ABSOLUTE "${${NAME_RELATIVE}}")
|
|
|
|
SET(${NAME_ABSOLUTE} ${${NAME_RELATIVE}})
|
|
|
|
ELSE(IS_ABSOLUTE "${${{NAME_RELATIVE}}")
|
2012-09-23 21:56:34 +00:00
|
|
|
IF(WIN32)
|
|
|
|
SET(${NAME_ABSOLUTE} ${${NAME_RELATIVE}})
|
|
|
|
ELSE(WIN32)
|
|
|
|
SET(${NAME_ABSOLUTE} ${CMAKE_INSTALL_PREFIX}/${${NAME_RELATIVE}})
|
|
|
|
ENDIF(WIN32)
|
2012-09-24 06:56:10 +00:00
|
|
|
ENDIF(IS_ABSOLUTE "${${NAME_RELATIVE}}")
|
2012-09-23 21:56:34 +00:00
|
|
|
ENDMACRO(NL_MAKE_ABSOLUTE_PREFIX)
|
|
|
|
|
2010-05-06 00:08:41 +00:00
|
|
|
MACRO(NL_SETUP_PREFIX_PATHS)
|
|
|
|
## Allow override of install_prefix/etc path.
|
|
|
|
IF(NOT NL_ETC_PREFIX)
|
|
|
|
IF(WIN32)
|
2012-09-26 10:51:11 +00:00
|
|
|
SET(NL_ETC_PREFIX "." CACHE PATH "Installation path for configurations")
|
2010-05-06 00:08:41 +00:00
|
|
|
ELSE(WIN32)
|
2012-09-22 20:57:38 +00:00
|
|
|
SET(NL_ETC_PREFIX "etc/nel" CACHE PATH "Installation path for configurations")
|
2010-05-06 00:08:41 +00:00
|
|
|
ENDIF(WIN32)
|
|
|
|
ENDIF(NOT NL_ETC_PREFIX)
|
2012-09-23 21:56:34 +00:00
|
|
|
NL_MAKE_ABSOLUTE_PREFIX(NL_ETC_PREFIX NL_ETC_ABSOLUTE_PREFIX)
|
2010-05-06 00:08:41 +00:00
|
|
|
|
|
|
|
## Allow override of install_prefix/share path.
|
|
|
|
IF(NOT NL_SHARE_PREFIX)
|
|
|
|
IF(WIN32)
|
2012-09-26 10:51:11 +00:00
|
|
|
SET(NL_SHARE_PREFIX "." CACHE PATH "Installation path for data.")
|
2010-08-28 12:10:56 +00:00
|
|
|
ELSE(WIN32)
|
2012-09-22 20:57:38 +00:00
|
|
|
SET(NL_SHARE_PREFIX "share/nel" CACHE PATH "Installation path for data.")
|
2010-08-28 12:10:56 +00:00
|
|
|
ENDIF(WIN32)
|
2010-05-06 00:08:41 +00:00
|
|
|
ENDIF(NOT NL_SHARE_PREFIX)
|
2012-09-23 21:56:34 +00:00
|
|
|
NL_MAKE_ABSOLUTE_PREFIX(NL_SHARE_PREFIX NL_SHARE_ABSOLUTE_PREFIX)
|
2010-05-06 00:08:41 +00:00
|
|
|
|
|
|
|
## Allow override of install_prefix/sbin path.
|
|
|
|
IF(NOT NL_SBIN_PREFIX)
|
2010-08-28 12:10:56 +00:00
|
|
|
IF(WIN32)
|
2012-09-26 10:51:11 +00:00
|
|
|
SET(NL_SBIN_PREFIX "." CACHE PATH "Installation path for admin tools and services.")
|
2010-08-28 12:10:56 +00:00
|
|
|
ELSE(WIN32)
|
2012-09-22 20:57:38 +00:00
|
|
|
SET(NL_SBIN_PREFIX "sbin" CACHE PATH "Installation path for admin tools and services.")
|
2010-08-28 12:10:56 +00:00
|
|
|
ENDIF(WIN32)
|
2010-05-06 00:08:41 +00:00
|
|
|
ENDIF(NOT NL_SBIN_PREFIX)
|
2012-09-23 21:56:34 +00:00
|
|
|
NL_MAKE_ABSOLUTE_PREFIX(NL_SBIN_PREFIX NL_SBIN_ABSOLUTE_PREFIX)
|
2010-05-06 00:08:41 +00:00
|
|
|
|
|
|
|
## Allow override of install_prefix/bin path.
|
|
|
|
IF(NOT NL_BIN_PREFIX)
|
|
|
|
IF(WIN32)
|
2012-09-26 10:51:11 +00:00
|
|
|
SET(NL_BIN_PREFIX "." CACHE PATH "Installation path for tools and applications.")
|
2010-05-06 00:08:41 +00:00
|
|
|
ELSE(WIN32)
|
2012-09-22 20:57:38 +00:00
|
|
|
SET(NL_BIN_PREFIX "bin" CACHE PATH "Installation path for tools and applications.")
|
2010-05-06 00:08:41 +00:00
|
|
|
ENDIF(WIN32)
|
|
|
|
ENDIF(NOT NL_BIN_PREFIX)
|
2012-09-23 21:56:34 +00:00
|
|
|
NL_MAKE_ABSOLUTE_PREFIX(NL_BIN_PREFIX NL_BIN_ABSOLUTE_PREFIX)
|
2010-05-06 00:08:41 +00:00
|
|
|
|
2010-08-28 12:10:56 +00:00
|
|
|
## Allow override of install_prefix/lib path.
|
|
|
|
IF(NOT NL_LIB_PREFIX)
|
2012-10-07 11:58:59 +00:00
|
|
|
IF(LIBRARY_ARCHITECTURE)
|
|
|
|
SET(NL_LIB_PREFIX "lib/${LIBRARY_ARCHITECTURE}" CACHE PATH "Installation path for libraries.")
|
|
|
|
ELSE(LIBRARY_ARCHITECTURE)
|
2012-09-26 10:51:11 +00:00
|
|
|
SET(NL_LIB_PREFIX "lib" CACHE PATH "Installation path for libraries.")
|
2012-10-07 11:58:59 +00:00
|
|
|
ENDIF(LIBRARY_ARCHITECTURE)
|
2010-08-28 12:10:56 +00:00
|
|
|
ENDIF(NOT NL_LIB_PREFIX)
|
2012-09-23 21:56:34 +00:00
|
|
|
NL_MAKE_ABSOLUTE_PREFIX(NL_LIB_PREFIX NL_LIB_ABSOLUTE_PREFIX)
|
2010-08-28 12:10:56 +00:00
|
|
|
|
|
|
|
## Allow override of install_prefix/lib path.
|
|
|
|
IF(NOT NL_DRIVER_PREFIX)
|
|
|
|
IF(WIN32)
|
2012-09-26 10:51:11 +00:00
|
|
|
SET(NL_DRIVER_PREFIX "." CACHE PATH "Installation path for drivers.")
|
2010-08-28 12:10:56 +00:00
|
|
|
ELSE(WIN32)
|
2012-10-07 11:58:59 +00:00
|
|
|
IF(LIBRARY_ARCHITECTURE)
|
|
|
|
SET(NL_DRIVER_PREFIX "lib/${LIBRARY_ARCHITECTURE}/nel" CACHE PATH "Installation path for drivers.")
|
|
|
|
ELSE(LIBRARY_ARCHITECTURE)
|
2012-09-22 20:57:38 +00:00
|
|
|
SET(NL_DRIVER_PREFIX "lib/nel" CACHE PATH "Installation path for drivers.")
|
2012-10-07 11:58:59 +00:00
|
|
|
ENDIF(LIBRARY_ARCHITECTURE)
|
2010-08-28 12:10:56 +00:00
|
|
|
ENDIF(WIN32)
|
|
|
|
ENDIF(NOT NL_DRIVER_PREFIX)
|
2012-09-23 21:56:34 +00:00
|
|
|
NL_MAKE_ABSOLUTE_PREFIX(NL_DRIVER_PREFIX NL_DRIVER_ABSOLUTE_PREFIX)
|
2011-02-11 17:05:19 +00:00
|
|
|
|
2010-05-06 00:08:41 +00:00
|
|
|
ENDMACRO(NL_SETUP_PREFIX_PATHS)
|
2010-09-08 07:31:00 +00:00
|
|
|
|
|
|
|
MACRO(RYZOM_SETUP_PREFIX_PATHS)
|
|
|
|
## Allow override of install_prefix/etc path.
|
|
|
|
IF(NOT RYZOM_ETC_PREFIX)
|
|
|
|
IF(WIN32)
|
|
|
|
SET(RYZOM_ETC_PREFIX "." CACHE PATH "Installation path for configurations")
|
|
|
|
ELSE(WIN32)
|
2012-09-22 20:57:38 +00:00
|
|
|
SET(RYZOM_ETC_PREFIX "etc/ryzom" CACHE PATH "Installation path for configurations")
|
2010-09-08 07:31:00 +00:00
|
|
|
ENDIF(WIN32)
|
|
|
|
ENDIF(NOT RYZOM_ETC_PREFIX)
|
2012-09-23 21:56:34 +00:00
|
|
|
NL_MAKE_ABSOLUTE_PREFIX(RYZOM_ETC_PREFIX RYZOM_ETC_ABSOLUTE_PREFIX)
|
2010-09-08 07:31:00 +00:00
|
|
|
|
|
|
|
## Allow override of install_prefix/share path.
|
|
|
|
IF(NOT RYZOM_SHARE_PREFIX)
|
|
|
|
IF(WIN32)
|
2011-09-11 12:44:37 +00:00
|
|
|
SET(RYZOM_SHARE_PREFIX "." CACHE PATH "Installation path for data.")
|
|
|
|
ELSE(WIN32)
|
2012-09-22 20:57:38 +00:00
|
|
|
SET(RYZOM_SHARE_PREFIX "share/ryzom" CACHE PATH "Installation path for data.")
|
2011-09-11 12:44:37 +00:00
|
|
|
ENDIF(WIN32)
|
2010-09-08 07:31:00 +00:00
|
|
|
ENDIF(NOT RYZOM_SHARE_PREFIX)
|
2012-09-23 21:56:34 +00:00
|
|
|
NL_MAKE_ABSOLUTE_PREFIX(RYZOM_SHARE_PREFIX RYZOM_SHARE_ABSOLUTE_PREFIX)
|
2010-09-08 07:31:00 +00:00
|
|
|
|
|
|
|
## Allow override of install_prefix/sbin path.
|
|
|
|
IF(NOT RYZOM_SBIN_PREFIX)
|
2011-09-11 12:44:37 +00:00
|
|
|
IF(WIN32)
|
|
|
|
SET(RYZOM_SBIN_PREFIX "." CACHE PATH "Installation path for admin tools and services.")
|
|
|
|
ELSE(WIN32)
|
2012-09-22 20:57:38 +00:00
|
|
|
SET(RYZOM_SBIN_PREFIX "sbin" CACHE PATH "Installation path for admin tools and services.")
|
2011-09-11 12:44:37 +00:00
|
|
|
ENDIF(WIN32)
|
2010-09-08 07:31:00 +00:00
|
|
|
ENDIF(NOT RYZOM_SBIN_PREFIX)
|
2012-09-23 21:56:34 +00:00
|
|
|
NL_MAKE_ABSOLUTE_PREFIX(RYZOM_SBIN_PREFIX RYZOM_SBIN_ABSOLUTE_PREFIX)
|
2010-09-08 07:31:00 +00:00
|
|
|
|
|
|
|
## Allow override of install_prefix/bin path.
|
|
|
|
IF(NOT RYZOM_BIN_PREFIX)
|
|
|
|
IF(WIN32)
|
2011-09-11 12:44:37 +00:00
|
|
|
SET(RYZOM_BIN_PREFIX "." CACHE PATH "Installation path for tools and applications.")
|
2010-09-08 07:31:00 +00:00
|
|
|
ELSE(WIN32)
|
2012-09-22 20:57:38 +00:00
|
|
|
SET(RYZOM_BIN_PREFIX "bin" CACHE PATH "Installation path for tools.")
|
2010-09-08 07:31:00 +00:00
|
|
|
ENDIF(WIN32)
|
|
|
|
ENDIF(NOT RYZOM_BIN_PREFIX)
|
2012-09-23 21:56:34 +00:00
|
|
|
NL_MAKE_ABSOLUTE_PREFIX(RYZOM_BIN_PREFIX RYZOM_BIN_ABSOLUTE_PREFIX)
|
2010-09-08 07:31:00 +00:00
|
|
|
|
2012-09-22 20:57:38 +00:00
|
|
|
## Allow override of install_prefix/lib path.
|
|
|
|
IF(NOT RYZOM_LIB_PREFIX)
|
2012-10-07 11:58:59 +00:00
|
|
|
IF(LIBRARY_ARCHITECTURE)
|
|
|
|
SET(RYZOM_LIB_PREFIX "lib/${LIBRARY_ARCHITECTURE}" CACHE PATH "Installation path for libraries.")
|
|
|
|
ELSE(LIBRARY_ARCHITECTURE)
|
2012-09-26 10:51:11 +00:00
|
|
|
SET(RYZOM_LIB_PREFIX "lib" CACHE PATH "Installation path for libraries.")
|
2012-10-07 11:58:59 +00:00
|
|
|
ENDIF(LIBRARY_ARCHITECTURE)
|
2012-09-22 20:57:38 +00:00
|
|
|
ENDIF(NOT RYZOM_LIB_PREFIX)
|
2012-09-23 21:56:34 +00:00
|
|
|
NL_MAKE_ABSOLUTE_PREFIX(RYZOM_LIB_PREFIX RYZOM_LIB_ABSOLUTE_PREFIX)
|
2012-09-22 20:57:38 +00:00
|
|
|
|
2010-09-08 07:31:00 +00:00
|
|
|
## Allow override of install_prefix/games path.
|
|
|
|
IF(NOT RYZOM_GAMES_PREFIX)
|
|
|
|
IF(WIN32)
|
2011-09-11 12:44:37 +00:00
|
|
|
SET(RYZOM_GAMES_PREFIX "." CACHE PATH "Installation path for tools and applications.")
|
2010-09-08 07:31:00 +00:00
|
|
|
ELSE(WIN32)
|
2012-09-22 20:57:38 +00:00
|
|
|
SET(RYZOM_GAMES_PREFIX "games" CACHE PATH "Installation path for client.")
|
2010-09-08 07:31:00 +00:00
|
|
|
ENDIF(WIN32)
|
|
|
|
ENDIF(NOT RYZOM_GAMES_PREFIX)
|
2012-09-23 21:56:34 +00:00
|
|
|
NL_MAKE_ABSOLUTE_PREFIX(RYZOM_GAMES_PREFIX RYZOM_GAMES_ABSOLUTE_PREFIX)
|
2010-09-08 07:31:00 +00:00
|
|
|
|
|
|
|
ENDMACRO(RYZOM_SETUP_PREFIX_PATHS)
|
2011-06-08 09:46:11 +00:00
|
|
|
|
|
|
|
MACRO(SETUP_EXTERNAL)
|
2011-09-10 16:45:54 +00:00
|
|
|
IF(WITH_EXTERNAL)
|
2011-06-08 09:46:11 +00:00
|
|
|
FIND_PACKAGE(External REQUIRED)
|
2011-09-10 16:45:54 +00:00
|
|
|
ENDIF(WITH_EXTERNAL)
|
2011-06-08 09:46:11 +00:00
|
|
|
|
2011-09-10 16:45:54 +00:00
|
|
|
IF(WIN32)
|
2012-04-07 13:11:18 +00:00
|
|
|
FIND_PACKAGE(External REQUIRED)
|
|
|
|
|
2011-06-08 09:46:11 +00:00
|
|
|
IF(MSVC10)
|
2011-08-19 14:58:18 +00:00
|
|
|
IF(NOT MSVC10_REDIST_DIR)
|
|
|
|
# If you have VC++ 2010 Express, put x64/Microsoft.VC100.CRT/*.dll in ${EXTERNAL_PATH}/redist
|
|
|
|
SET(MSVC10_REDIST_DIR "${EXTERNAL_PATH}/redist")
|
|
|
|
ENDIF(NOT MSVC10_REDIST_DIR)
|
2012-04-07 13:11:18 +00:00
|
|
|
|
|
|
|
IF(NOT VC_DIR)
|
|
|
|
IF(NOT VC_ROOT_DIR)
|
|
|
|
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")
|
|
|
|
FILE(TO_CMAKE_PATH $ENV{VS100COMNTOOLS} VC_ROOT_DIR)
|
|
|
|
IF(NOT VC_ROOT_DIR)
|
|
|
|
MESSAGE(FATAL_ERROR "Unable to find VC++ 2010 directory!")
|
|
|
|
ENDIF(NOT VC_ROOT_DIR)
|
|
|
|
ENDIF(VC_ROOT_DIR MATCHES "registry")
|
|
|
|
ENDIF(VC_ROOT_DIR MATCHES "registry")
|
|
|
|
ENDIF(NOT VC_ROOT_DIR)
|
2011-06-08 09:46:11 +00:00
|
|
|
# convert IDE fullpath to VC++ path
|
2012-04-07 13:11:18 +00:00
|
|
|
STRING(REGEX REPLACE "Common7/.*" "VC" VC_DIR ${VC_ROOT_DIR})
|
|
|
|
ENDIF(NOT VC_DIR)
|
|
|
|
ELSE(MSVC10)
|
|
|
|
IF(NOT VC_DIR)
|
|
|
|
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(NOT VC_DIR)
|
2011-06-08 09:46:11 +00:00
|
|
|
ENDIF(MSVC10)
|
2011-06-14 18:11:17 +00:00
|
|
|
ELSE(WIN32)
|
2012-03-07 19:47:32 +00:00
|
|
|
IF(APPLE)
|
2011-06-14 18:11:17 +00:00
|
|
|
IF(WITH_STATIC_EXTERNAL)
|
2012-05-07 08:27:54 +00:00
|
|
|
SET(CMAKE_FIND_LIBRARY_SUFFIXES .a)
|
2011-06-14 18:11:17 +00:00
|
|
|
ELSE(WITH_STATIC_EXTERNAL)
|
2012-03-07 19:47:32 +00:00
|
|
|
SET(CMAKE_FIND_LIBRARY_SUFFIXES .dylib .so .a)
|
2011-08-03 12:51:10 +00:00
|
|
|
ENDIF(WITH_STATIC_EXTERNAL)
|
2012-03-07 19:47:32 +00:00
|
|
|
ELSE(APPLE)
|
|
|
|
IF(WITH_STATIC_EXTERNAL)
|
|
|
|
SET(CMAKE_FIND_LIBRARY_SUFFIXES .a .so)
|
|
|
|
ELSE(WITH_STATIC_EXTERNAL)
|
|
|
|
SET(CMAKE_FIND_LIBRARY_SUFFIXES .so .a)
|
|
|
|
ENDIF(WITH_STATIC_EXTERNAL)
|
|
|
|
ENDIF(APPLE)
|
2011-06-08 09:46:11 +00:00
|
|
|
ENDIF(WIN32)
|
|
|
|
|
|
|
|
IF(WITH_STLPORT)
|
|
|
|
FIND_PACKAGE(STLport REQUIRED)
|
|
|
|
INCLUDE_DIRECTORIES(${STLPORT_INCLUDE_DIR})
|
2012-04-07 13:11:18 +00:00
|
|
|
IF(MSVC)
|
2011-06-08 09:46:11 +00:00
|
|
|
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})
|
2012-04-07 13:11:18 +00:00
|
|
|
ENDIF(MSVC)
|
2011-06-08 09:46:11 +00:00
|
|
|
ENDIF(WITH_STLPORT)
|
|
|
|
ENDMACRO(SETUP_EXTERNAL)
|