1 #-----------------------------------------------------------------------------
4 # Authors: Nevrax and the Ryzom Core Community
8 # * Changing install location: add -DCMAKE_INSTALL_PREFIX:PATH=/my/new/path
9 # * Changing specific install location variables:
10 # * NL_ETC_PREFIX (default: $CMAKE_INSTALL_PREFIX/etc)
11 # * NL_SHARE_PREFIX (default: $CMAKE_INSTALL_PREFIX/share)
12 # * NL_BIN_PREFIX (default: $CMAKE_INSTALL_PREFIX/bin)
13 # * NL_SBIN_PREFIX (default: $CMAKE_INSTALL_PREFIX/sbin)
14 # * NL_LIB_PREFIX (default: $CMAKE_INSTALL_PREFIX/lib)
15 # * NL_DRIVER_PREFIX (default: $CMAKE_INSTALL_PREFIX/lib (windows) or $CMAKE_INSTALL_PREFIX/lib/nel)
16 # * Enable building of documentation: add -DBUILD_DOCUMENTATION:BOOL=ON - new make target: DoxygenDoc
17 # * Updating version: update header (above) but also update NL_VERSION below.
18 # * To build binary archive, use the 'package' target.
19 # To build source archive, use the 'package_source' target.
21 #-----------------------------------------------------------------------------
23 SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}")
24 #-----------------------------------------------------------------------------
25 # Set CMake 2.6 Policies.
26 IF(COMMAND cmake_policy)
27 # Works around warnings libraries linked against that don't
28 # have absolute paths (e.g. -lpthread)
29 cmake_policy(SET CMP0003 NEW)
31 # allow to link to qtmain automatically under Windows
33 CMAKE_POLICY(SET CMP0020 NEW)
38 INCLUDE(ConfigureChecks)
40 INCLUDE(${CMAKE_ROOT}/Modules/Documentation.cmake OPTIONAL)
42 # Force out of source builds.
45 # To be able to specify a different deployment target on Mac OS X :
46 # export MACOSX_DEPLOYMENT_TARGET=10.6
48 IF(CMAKE_VERSION VERSION_GREATER "2.8.10")
49 STRING(TIMESTAMP CURRENT_YEAR "%Y")
51 SET(CURRENT_YEAR "2016")
54 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
55 PROJECT(RyzomCore CXX C)
56 SET(NL_VERSION_MAJOR 1)
57 SET(NL_VERSION_MINOR 0)
58 SET(NL_VERSION_PATCH 0)
59 SET(YEAR "2004-${CURRENT_YEAR}")
60 SET(AUTHOR "Winch Gate and The Ryzom Core Community")
62 #-----------------------------------------------------------------------------
63 # Redirect output files
64 SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
65 SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
67 # DLL should be in the same directory as EXE under Windows
69 SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
71 SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
76 FIND_PACKAGE(MFC QUIET)
80 #-----------------------------------------------------------------------------
81 # Set default config options
83 NL_SETUP_DEFAULT_OPTIONS()
84 NL_SETUP_NEL_DEFAULT_OPTIONS()
85 NL_SETUP_NELNS_DEFAULT_OPTIONS()
86 NL_SETUP_RYZOM_DEFAULT_OPTIONS()
87 NL_SETUP_SNOWBALLS_DEFAULT_OPTIONS()
90 NL_SETUP_BUILD_FLAGS()
92 NL_SETUP_PREFIX_PATHS()
93 RYZOM_SETUP_PREFIX_PATHS()
95 #-----------------------------------------------------------------------------
101 SET(WINSOCK2_LIB ws2_32.lib)
104 FIND_PACKAGE(CustomMFC REQUIRED)
108 FIND_PACKAGE(ZLIB REQUIRED)
109 FIND_PACKAGE(LibXml2 REQUIRED)
110 FIND_PACKAGE(PNG REQUIRED)
111 FIND_PACKAGE(OpenSSL REQUIRED)
116 SET(OPENSSL_LIBRARIES ${OPENSSL_LIBRARIES} Crypt32.lib)
127 NL_CONFIGURE_CHECKS()
129 IF(WITH_STATIC_LIBXML2)
130 SET(LIBXML2_DEFINITIONS ${LIBXML2_DEFINITIONS} -DLIBXML_STATIC)
133 IF(WITH_LIBXML2_ICONV)
134 FIND_PACKAGE(Iconv REQUIRED)
135 INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR})
136 SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${ICONV_LIBRARIES})
140 # libxml2 could need winsock2 library
142 SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${WINSOCK2_LIB})
146 # under Linux and OS X, recent libxml2 versions are linked against liblzma
147 FIND_PACKAGE(LibLZMA)
148 IF(LIBLZMA_LIBRARIES)
149 SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${LIBLZMA_LIBRARIES})
154 INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/PCHSupport.cmake)
157 ADD_DEFINITIONS(-DFINAL_VERSION=1)
161 ADD_DEFINITIONS(-DNL_HAS_SSE2)
163 ADD_DEFINITIONS(-DNL_HAS_SSE3)
168 FIND_LIBRARY(CARBON_FRAMEWORK Carbon)
169 FIND_LIBRARY(FOUNDATION_FRAMEWORK Foundation)
170 FIND_LIBRARY(SECURITY_FRAMEWORK Security)
172 IF(APPLE_CERTIFICATE)
173 # Find codesign_allocate
175 # Xcode 7.0 and later versions
176 SET(CODESIGN_ALLOCATE ${OSX_DEVELOPER_ROOT}/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate)
178 IF(NOT EXISTS "${CODESIGN_ALLOCATE}")
179 # Xcode 6.4 and previous versions
180 SET(CODESIGN_ALLOCATE ${CMAKE_OSX_SYSROOT}/usr/bin/codesign_allocate)
183 IF(NOT EXISTS "${CODESIGN_ALLOCATE}")
185 SET(CODESIGN_ALLOCATE /usr/bin/codesign_allocate)
188 IF(NOT EXISTS "${CODESIGN_ALLOCATE}")
189 MESSAGE(WARNING "Unable to find codesign_allocate in standard directories")
190 SET(CODESIGN_ALLOCATE)
202 SET(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${QTDIR} $ENV{QTDIR})
205 FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui QtXml QtOpenGL REQUIRED)
209 FIND_PACKAGE(assimp REQUIRED)
214 FIND_PACKAGE(CppTest)
218 FIND_PACKAGE(Luabind REQUIRED)
219 FIND_PACKAGE(CURL REQUIRED)
221 IF((WIN32 OR CURL_LIBRARIES MATCHES "\\.a") AND WITH_STATIC_CURL)
228 SET(CURL_DEFINITIONS -DCURL_STATICLIB)
230 LIST(APPEND CURL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR})
231 LIST(APPEND CURL_LIBRARIES ${OPENSSL_LIBRARIES})
234 LIST(APPEND CURL_LIBRARIES Crypt32 Cryptui)
236 # CURL depends on libidn
237 FIND_LIBRARY(IDN_LIBRARY idn)
239 LIST(APPEND CURL_LIBRARIES ${IDN_LIBRARY})
242 # CURL Macports version can depend on libidn, libidn2, libintl, libpsl and libiconv too
244 FIND_LIBRARY(INTL_LIBRARY intl)
246 LIST(APPEND CURL_LIBRARIES ${INTL_LIBRARY})
249 FIND_LIBRARY(IDN2_LIBRARY idn2)
251 LIST(APPEND CURL_LIBRARIES ${IDN2_LIBRARY})
254 FIND_LIBRARY(PSL_LIBRARY psl)
256 LIST(APPEND CURL_LIBRARIES ${PSL_LIBRARY})
259 FIND_LIBRARY(UNISTRING_LIBRARY unistring)
260 IF(UNISTRING_LIBRARY)
261 LIST(APPEND CURL_LIBRARIES ${UNISTRING_LIBRARY})
264 LIST(APPEND CURL_LIBRARIES ${SECURITY_FRAMEWORK})
270 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/nel/include)
271 ADD_SUBDIRECTORY(nel)
273 # Aliases for targets
274 SET(NELMISC_LIBRARIES nelmisc)
275 SET(NELNET_LIBRARIES nelnet)
276 SET(NELLIGO_LIBRARIES nelligo)
277 SET(NELGEORGES_LIBRARIES nelgeorges)
278 SET(NEL3D_LIBRARIES nel3d)
279 SET(NELGUI_LIBRARIES nelgui)
280 SET(NELSOUND_LIBRARIES nelsound)
282 # FIND_PACKAGE(NeL COMPONENTS 3d misc pacs sound nimp REQUIRED)
283 FIND_PACKAGE(NeL REQUIRED)
284 INCLUDE_DIRECTORIES(${NEL_INCLUDE_DIRS})
288 ADD_SUBDIRECTORY(ryzom)
292 ADD_SUBDIRECTORY(nelns)
296 ADD_SUBDIRECTORY(snowballs2)
300 ADD_SUBDIRECTORY(tool)
304 ADD_SUBDIRECTORY(studio)
308 ADD_SUBDIRECTORY(personal)
311 # To build the documention, you will have to enable it
312 # and then do the equivalent of "make DoxygenDoc".
313 IF(BUILD_DOCUMENTATION)
319 # This processes our Doxyfile.in and substitutes paths to generate
321 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/doc/Doxyfile.cmake.in ${CMAKE_BINARY_DIR}/doc/Doxyfile)
323 ADD_CUSTOM_TARGET(DoxygenDoc ${DOXYGEN} ${CMAKE_BINARY_DIR}/doc/Doxyfile)
328 ADD_TEST(nel_unit_test ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nel_unit_test --html)
332 SET(SVNSOURCEDIR http://dev.ryzom.com/svn/trunk/nel)
333 SET(GENERATELOGS svn2cl)
337 # packaging information
338 SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Ryzom Core MMORPG Framework")
339 SET(CPACK_PACKAGE_VENDOR "Ryzom Core")
340 SET(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_SOURCE_DIR}/README)
341 SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/COPYING)
342 SET(CPACK_PACKAGE_VERSION_MAJOR "${NL_VERSION_MAJOR}")
343 SET(CPACK_PACKAGE_VERSION_MINOR "${NL_VERSION_MINOR}")
344 SET(CPACK_PACKAGE_VERSION_PATCH "${NL_VERSION_PATCH}")
345 SET(CPACK_INSTALL_CMAKE_PROJECTS "${CMAKE_BINARY_DIR};NeL;ALL;/")
346 SET(CPACK_PACKAGE_EXECUTABLES "ryzomcore${NL_VERSION}" "ryzomcore")
347 SET(CPACK_SET_DESTDIR TRUE)
349 # NSIS Specific Packing Setup
350 SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "RyzomCore")
351 SET(CPACK_NSIS_MODIFY_PATH "ON")
352 SET(CPACK_NSIS_MUI_ICON ${CMAKE_SOURCE_DIR}/resources/nevraxpill.ico)
353 SET(CPACK_NSIS_MUI_UNIICON ${CMAKE_SOURCE_DIR}/resources/nevraxpill.ico)
354 SET(CPACK_PACKAGE_ICON ${CMAKE_SOURCE_DIR}/resources\\\\nel.bmp)
355 SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} RyzomCore")
356 SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\dev.ryzom.com")
357 SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\dev.ryzom.com\\\\projects\\\\nel\\\\wiki")
358 SET(CPACK_NSIS_CONTACT "matt.raykowski@gmail.com")
361 SET(CPACK_PACKAGE_FILE_NAME "ryzomcore-${NL_VERSION}")
362 SET(CPACK_SOURCE_PACKAGE_FILE_NAME "ryzomcore-${NL_VERSION}")
364 #SET(CPACK_GENERATOR "NSIS")
365 SET(CPACK_GENERATOR "NSIS;ZIP")
366 SET(CPACK_SOURCE_GENERATOR "ZIP")
368 SET(CPACK_GENERATOR "TGZ")
369 SET(CPACK_SOURCE_GENERATOR "TGZ")
371 set(CPACK_SOURCE_IGNORE_FILES
374 "^${CMAKE_SOURCE_DIR}.*/CVS/"
375 "^${CMAKE_SOURCE_DIR}.*/\\\\.svn/"
376 "^${CMAKE_SOURCE_DIR}/debian/"
377 "^${CMAKE_SOURCE_DIR}/old/")
379 IF(NOT CMAKE_BUILD_TYPE STREQUAL "Release")
380 SET(CMAKE_INSTALL_DEBUG_LIBRARIES TRUE)
382 INCLUDE(${QT_USE_FILE})
384 "${QT_LIBRARY_DIR}/../bin/QtGuid4.dll"
385 "${QT_LIBRARY_DIR}/../bin/QtXmld4.dll"
386 "${QT_LIBRARY_DIR}/../bin/QtCored4.dll"
387 DESTINATION ${NL_BIN_PREFIX})
391 INCLUDE(${QT_USE_FILE})
393 "${QT_LIBRARY_DIR}/../bin/QtGui4.dll"
394 "${QT_LIBRARY_DIR}/../bin/QtXml4.dll"
395 "${QT_LIBRARY_DIR}/../bin/QtCore4.dll"
396 DESTINATION ${NL_BIN_PREFIX})
400 # Install CEGUI and its dependencies.
402 INSTALL(FILES "${CEGUI_LIB_DIR}/CEGUIBase.dll" DESTINATION ${NL_BIN_PREFIX})
403 INSTALL(FILES "${CEGUI_LIB_DIR}/CEGUIDevilImageCodec.dll" DESTINATION ${NL_BIN_PREFIX})
404 INSTALL(FILES "${CEGUI_LIB_DIR}/CEGUIExpatParser.dll" DESTINATION ${NL_BIN_PREFIX})
405 INSTALL(FILES "${CEGUI_LIB_DIR}/CEGUIFalagardWRBase.dll" DESTINATION ${NL_BIN_PREFIX})
406 INSTALL(FILES "${CEGUI_LIB_DIR}/Devil.dll" DESTINATION ${NL_BIN_PREFIX})
407 INSTALL(FILES "${CEGUI_LIB_DIR}/ILU.dll" DESTINATION ${NL_BIN_PREFIX})
410 # Only the tools require MFC.
412 SET(CMAKE_INSTALL_MFC_LIBRARIES TRUE)
414 #INCLUDE(InstallRequiredSystemLibraries)
419 INCLUDE(CMakePackaging.txt)
424 # ADD_DEBIAN_TARGETS(nel)