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 #-----------------------------------------------------------------------------
39 # Downloads and install Hunger into HUNTER_ROOT directory.
40 OPTION(HUNTER_ENABLED "Enable Hunter package manager" OFF)
42 INCLUDE("CMakeModules/HunterGate.cmake")
44 URL "https://github.com/cpp-pm/hunter/archive/v0.23.321.tar.gz"
45 SHA1 "5e53cbb0429037ea8e2592bfd92704b8ff3ab492"
46 FILEPATH "${CMAKE_CURRENT_LIST_DIR}/CMakeModules/HunterConfig.cmake"
49 # default options for hunterized build
50 SET(WITH_STATIC ON CACHE BOOL "static" FORCE)
51 SET(WITH_STATIC_DRIVERS ON CACHE BOOL "static drivers" FORCE)
52 SET(WITH_STATIC_CURL ON CACHE BOOL "static curl" FORCE)
53 SET(WITH_STATIC_LIBXML2 ON CACHE BOOL "static libxml2" FORCE)
54 SET(WITH_STATIC_EXTERNAL ON CACHE BOOL "static external" FORCE)
55 SET(WITH_EXTERNAL OFF CACHE BOOL "external libs" FORCE)
59 #-----------------------------------------------------------------------------
62 INCLUDE(ConfigureChecks)
64 INCLUDE(${CMAKE_ROOT}/Modules/Documentation.cmake OPTIONAL)
66 MESSAGE("EXTERNAL ${WITH_EXTERNAL}")
68 # Force out of source builds.
71 # To be able to specify a different deployment target on Mac OS X :
72 # export MACOSX_DEPLOYMENT_TARGET=10.6
74 IF(CMAKE_VERSION VERSION_GREATER "2.8.10")
75 STRING(TIMESTAMP CURRENT_YEAR "%Y")
77 SET(CURRENT_YEAR "2019")
80 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
81 PROJECT(RyzomCore CXX C)
82 SET(NL_VERSION_MAJOR 1)
83 SET(NL_VERSION_MINOR 1)
84 SET(NL_VERSION_PATCH 0 CACHE STRING "Patch version")
85 SET(YEAR "2001-${CURRENT_YEAR}")
86 SET(AUTHOR "Winch Gate and The Ryzom Core Community")
88 SET(RYZOM_VERSION_MAJOR 3)
89 SET(RYZOM_VERSION_MINOR 6)
90 SET(RYZOM_VERSION_PATCH 0)
92 #-----------------------------------------------------------------------------
93 # Redirect output files
94 SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
95 SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
97 # DLL should be in the same directory as EXE under Windows
99 SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
101 SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
106 FIND_PACKAGE(MFC QUIET)
110 #-----------------------------------------------------------------------------
111 # Set default config options
113 NL_SETUP_DEFAULT_OPTIONS()
114 NL_SETUP_NEL_DEFAULT_OPTIONS()
115 NL_SETUP_NELNS_DEFAULT_OPTIONS()
116 NL_SETUP_RYZOM_DEFAULT_OPTIONS()
117 NL_SETUP_SNOWBALLS_DEFAULT_OPTIONS()
120 NL_SETUP_BUILD_FLAGS()
122 NL_SETUP_PREFIX_PATHS()
123 RYZOM_SETUP_PREFIX_PATHS()
125 #-----------------------------------------------------------------------------
126 # Default values for URL's
127 SET(RYZOM_CLIENT_CREATE_ACCOUNT_URL "https://open.ryzom.dev/ams/" CACHE STRING "Ryzom Client Create Account URL")
128 SET(RYZOM_CLIENT_EDIT_ACCOUNT_URL "https://open.ryzom.dev/ams/" CACHE STRING "Ryzom Client Edit Account URL")
129 SET(RYZOM_CLIENT_FORGET_PASSWORD_URL "https://open.ryzom.dev/ams/" CACHE STRING "Ryzom Client Forget Password URL")
130 SET(RYZOM_CLIENT_PATCH_URL "https://cdn.ryzom.dev/open/patch/" CACHE STRING "Ryzom Client Patch URL")
131 SET(RYZOM_CLIENT_APP_NAME "default")
133 SET(RYZOM_WEBIG_MAIN_URL "https://open.ryzom.dev/" CACHE STRING "Ryzom Client WebIG Main URL")
134 SET(RYZOM_WEBIG_TRUSTED_DOMAIN "open.ryzom.dev" CACHE STRING "Ryzom Client WebIG Trusted Domain")
136 #-----------------------------------------------------------------------------
137 # urls when compiling ryzom live client
139 MESSAGE("Using RYZOM_LIVE urls")
140 SET(RYZOM_CLIENT_CREATE_ACCOUNT_URL "https://me.ryzom.com")
141 SET(RYZOM_CLIENT_EDIT_ACCOUNT_URL "https://me.ryzom.com")
142 SET(RYZOM_CLIENT_FORGET_PASSWORD_URL "https://me.ryzom.com/?forget_password=1")
143 SET(RYZOM_CLIENT_PATCH_URL "http://dl.ryzom.com/patch_live")
144 SET(RYZOM_CLIENT_APP_NAME "ryzom_live")
146 SET(RYZOM_WEBIG_MAIN_URL "https://app.ryzom.com/")
147 SET(RYZOM_WEBIG_TRUSTED_DOMAIN "app.ryzom.com")
150 #-----------------------------------------------------------------------------
156 SET(WINSOCK2_LIB ws2_32.lib)
159 FIND_PACKAGE(CustomMFC REQUIRED)
164 ## TODO: hack for freetype hunter package
167 HUNTER_ADD_PACKAGE(ZLIB)
169 FIND_PACKAGE(ZLIB CONFIG REQUIRED)
170 SET(ZLIB_LIBRARY ZLIB::zlib)
172 HUNTER_ADD_PACKAGE(libxml2)
173 FIND_PACKAGE(libxml2 CONFIG REQUIRED)
174 SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} libxml2::libxml2)
176 HUNTER_ADD_PACKAGE(OpenSSL)
177 FIND_PACKAGE(OpenSSL REQUIRED)
178 # TODO: is OpenSSL::Crypto only needed for WIN32?
179 SET(OPENSSL_LIBRARIES OpenSSL::SSL OpenSSL::Crypto)
181 # for precompiled headers, not needed if using TARGET_PRECOMPILE_HEADERS() from cmake 3.16+
182 SET(ZLIB_INCLUDE_DIR ZLIB_ROOT/include)
183 SET(LIBXML2_INCLUDE_DIR ${LIBXML2_ROOT}/include/libxml2)
185 FIND_PACKAGE(ZLIB REQUIRED)
186 FIND_PACKAGE(LibXml2 REQUIRED)
187 FIND_PACKAGE(PNG REQUIRED)
188 FIND_PACKAGE(OpenSSL REQUIRED)
193 SET(OPENSSL_LIBRARIES ${OPENSSL_LIBRARIES} Crypt32.lib)
205 NL_CONFIGURE_CHECKS()
207 IF(WITH_STATIC_LIBXML2)
208 SET(LIBXML2_DEFINITIONS ${LIBXML2_DEFINITIONS} -DLIBXML_STATIC)
211 IF(WITH_LIBXML2_ICONV)
212 FIND_PACKAGE(Iconv REQUIRED)
213 INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR})
214 SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${ICONV_LIBRARIES})
218 # libxml2 could need winsock2 library
220 SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${WINSOCK2_LIB})
224 # under Linux and OS X, recent libxml2 versions are linked against liblzma
225 FIND_PACKAGE(LibLZMA)
226 IF(LIBLZMA_LIBRARIES)
227 SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${LIBLZMA_LIBRARIES})
230 # under Linux and OS X, recent libxml2 versions are linked against libicu
232 FIND_LIBRARY(ICU_LIBRARY icuuc)
234 FIND_LIBRARY(ICU_DATA_LIBRARY icudata)
236 MESSAGE(STATUS "ICU UC was found: ${ICU_LIBRARY}")
238 MESSAGE(STATUS "ICU UC was NOT found")
240 SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${ICU_DATA_LIBRARY} ${ICU_LIBRARY})
246 INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/PCHSupport.cmake)
249 ADD_DEFINITIONS(-DFINAL_VERSION=1)
253 ADD_DEFINITIONS(-DNL_HAS_SSE2)
255 ADD_DEFINITIONS(-DNL_HAS_SSE3)
260 FIND_LIBRARY(CARBON_FRAMEWORK Carbon)
261 FIND_LIBRARY(FOUNDATION_FRAMEWORK Foundation)
262 FIND_LIBRARY(SECURITY_FRAMEWORK Security)
264 IF(APPLE_CERTIFICATE)
265 # Find codesign_allocate
267 # Xcode 7.0 and later versions
268 SET(CODESIGN_ALLOCATE ${OSX_DEVELOPER_ROOT}/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate)
270 IF(NOT EXISTS "${CODESIGN_ALLOCATE}")
271 # Xcode 6.4 and previous versions
272 SET(CODESIGN_ALLOCATE ${CMAKE_OSX_SYSROOT}/usr/bin/codesign_allocate)
275 IF(NOT EXISTS "${CODESIGN_ALLOCATE}")
277 SET(CODESIGN_ALLOCATE /usr/bin/codesign_allocate)
280 IF(NOT EXISTS "${CODESIGN_ALLOCATE}")
281 MESSAGE(WARNING "Unable to find codesign_allocate in standard directories")
282 SET(CODESIGN_ALLOCATE)
289 #TODO: hunter qt package
295 SET(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${QTDIR} $ENV{QTDIR})
298 FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui QtXml QtOpenGL REQUIRED)
301 #TODO: hunter assimp package
303 FIND_PACKAGE(assimp REQUIRED)
308 FIND_PACKAGE(CppTest)
313 HUNTER_ADD_PACKAGE(luabind)
314 FIND_PACKAGE(Luabind REQUIRED)
317 HUNTER_ADD_PACKAGE(CURL)
318 FIND_PACKAGE(CURL CONFIG REQUIRED)
320 SET(CURL_LIBRARIES CURL::libcurl libxml2::libxml2)
323 FIND_PACKAGE(Luabind REQUIRED)
326 FIND_PACKAGE(CURL REQUIRED)
328 IF((WIN32 OR CURL_LIBRARIES MATCHES "\\.a") AND WITH_STATIC_CURL)
335 SET(CURL_DEFINITIONS -DCURL_STATICLIB)
337 LIST(APPEND CURL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR})
338 LIST(APPEND CURL_LIBRARIES ${OPENSSL_LIBRARIES})
341 LIST(APPEND CURL_LIBRARIES Crypt32 Cryptui)
343 # CURL depends on libidn
344 FIND_LIBRARY(IDN_LIBRARY idn)
346 LIST(APPEND CURL_LIBRARIES ${IDN_LIBRARY})
349 # CURL Macports version can depend on libidn, libidn2, libintl, libpsl and libiconv too
351 FIND_LIBRARY(INTL_LIBRARY intl)
353 LIST(APPEND CURL_LIBRARIES ${INTL_LIBRARY})
356 FIND_LIBRARY(IDN2_LIBRARY idn2)
358 LIST(APPEND CURL_LIBRARIES ${IDN2_LIBRARY})
361 FIND_LIBRARY(PSL_LIBRARY psl)
363 LIST(APPEND CURL_LIBRARIES ${PSL_LIBRARY})
366 FIND_LIBRARY(UNISTRING_LIBRARY unistring)
367 IF(UNISTRING_LIBRARY)
368 LIST(APPEND CURL_LIBRARIES ${UNISTRING_LIBRARY})
371 LIST(APPEND CURL_LIBRARIES ${SECURITY_FRAMEWORK})
377 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/nel/include)
378 ADD_SUBDIRECTORY(nel)
380 # Aliases for targets
381 SET(NELMISC_LIBRARIES nelmisc)
382 SET(NELNET_LIBRARIES nelnet)
383 SET(NELLIGO_LIBRARIES nelligo)
384 SET(NELGEORGES_LIBRARIES nelgeorges)
385 SET(NEL3D_LIBRARIES nel3d)
386 SET(NELGUI_LIBRARIES nelgui)
387 SET(NELSOUND_LIBRARIES nelsound)
388 SET(NELPACS_LIBRARIES nelpacs)
390 # FIND_PACKAGE(NeL COMPONENTS 3d misc pacs sound nimp REQUIRED)
391 FIND_PACKAGE(NeL REQUIRED)
392 INCLUDE_DIRECTORIES(${NEL_INCLUDE_DIRS})
396 ADD_SUBDIRECTORY(ryzom)
400 ADD_SUBDIRECTORY(nelns)
404 ADD_SUBDIRECTORY(snowballs2)
408 ADD_SUBDIRECTORY(tool)
412 ADD_SUBDIRECTORY(studio)
416 ADD_SUBDIRECTORY(personal)
419 # To build the documention, you will have to enable it
420 # and then do the equivalent of "make DoxygenDoc".
421 IF(BUILD_DOCUMENTATION)
427 # This processes our Doxyfile.in and substitutes paths to generate
429 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/doc/Doxyfile.cmake.in ${CMAKE_BINARY_DIR}/doc/Doxyfile)
431 ADD_CUSTOM_TARGET(DoxygenDoc ${DOXYGEN} ${CMAKE_BINARY_DIR}/doc/Doxyfile)
436 ADD_TEST(nel_unit_test ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nel_unit_test --html)
440 SET(SVNSOURCEDIR http://dev.ryzom.com/svn/trunk/nel)
441 SET(GENERATELOGS svn2cl)
445 # packaging information
446 SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Ryzom Core MMORPG Framework")
447 SET(CPACK_PACKAGE_VENDOR "Ryzom Core")
448 SET(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_SOURCE_DIR}/README)
449 SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/COPYING)
450 SET(CPACK_PACKAGE_VERSION_MAJOR "${NL_VERSION_MAJOR}")
451 SET(CPACK_PACKAGE_VERSION_MINOR "${NL_VERSION_MINOR}")
452 SET(CPACK_PACKAGE_VERSION_PATCH "${NL_VERSION_PATCH}")
453 SET(CPACK_INSTALL_CMAKE_PROJECTS "${CMAKE_BINARY_DIR};NeL;ALL;/")
454 SET(CPACK_PACKAGE_EXECUTABLES "ryzomcore${NL_VERSION}" "ryzomcore")
455 SET(CPACK_SET_DESTDIR TRUE)
457 # NSIS Specific Packing Setup
458 SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "RyzomCore")
459 SET(CPACK_NSIS_MODIFY_PATH "ON")
460 SET(CPACK_NSIS_MUI_ICON ${CMAKE_SOURCE_DIR}/resources/nevraxpill.ico)
461 SET(CPACK_NSIS_MUI_UNIICON ${CMAKE_SOURCE_DIR}/resources/nevraxpill.ico)
462 SET(CPACK_PACKAGE_ICON ${CMAKE_SOURCE_DIR}/resources\\\\nel.bmp)
463 SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} RyzomCore")
464 SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\dev.ryzom.com")
465 SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\dev.ryzom.com\\\\projects\\\\nel\\\\wiki")
466 SET(CPACK_NSIS_CONTACT "matt.raykowski@gmail.com")
469 SET(CPACK_PACKAGE_FILE_NAME "ryzomcore-${NL_VERSION}")
470 SET(CPACK_SOURCE_PACKAGE_FILE_NAME "ryzomcore-${NL_VERSION}")
472 #SET(CPACK_GENERATOR "NSIS")
473 SET(CPACK_GENERATOR "NSIS;ZIP")
474 SET(CPACK_SOURCE_GENERATOR "ZIP")
476 SET(CPACK_GENERATOR "TGZ")
477 SET(CPACK_SOURCE_GENERATOR "TGZ")
479 set(CPACK_SOURCE_IGNORE_FILES
482 "^${CMAKE_SOURCE_DIR}.*/CVS/"
483 "^${CMAKE_SOURCE_DIR}.*/\\\\.svn/"
484 "^${CMAKE_SOURCE_DIR}/debian/"
485 "^${CMAKE_SOURCE_DIR}/old/")
487 IF(NOT CMAKE_BUILD_TYPE STREQUAL "Release")
488 SET(CMAKE_INSTALL_DEBUG_LIBRARIES TRUE)
490 INCLUDE(${QT_USE_FILE})
492 "${QT_LIBRARY_DIR}/../bin/QtGuid4.dll"
493 "${QT_LIBRARY_DIR}/../bin/QtXmld4.dll"
494 "${QT_LIBRARY_DIR}/../bin/QtCored4.dll"
495 DESTINATION ${NL_BIN_PREFIX})
499 INCLUDE(${QT_USE_FILE})
501 "${QT_LIBRARY_DIR}/../bin/QtGui4.dll"
502 "${QT_LIBRARY_DIR}/../bin/QtXml4.dll"
503 "${QT_LIBRARY_DIR}/../bin/QtCore4.dll"
504 DESTINATION ${NL_BIN_PREFIX})
508 # Install CEGUI and its dependencies.
510 INSTALL(FILES "${CEGUI_LIB_DIR}/CEGUIBase.dll" DESTINATION ${NL_BIN_PREFIX})
511 INSTALL(FILES "${CEGUI_LIB_DIR}/CEGUIDevilImageCodec.dll" DESTINATION ${NL_BIN_PREFIX})
512 INSTALL(FILES "${CEGUI_LIB_DIR}/CEGUIExpatParser.dll" DESTINATION ${NL_BIN_PREFIX})
513 INSTALL(FILES "${CEGUI_LIB_DIR}/CEGUIFalagardWRBase.dll" DESTINATION ${NL_BIN_PREFIX})
514 INSTALL(FILES "${CEGUI_LIB_DIR}/Devil.dll" DESTINATION ${NL_BIN_PREFIX})
515 INSTALL(FILES "${CEGUI_LIB_DIR}/ILU.dll" DESTINATION ${NL_BIN_PREFIX})
518 # Only the tools require MFC.
520 SET(CMAKE_INSTALL_MFC_LIBRARIES TRUE)
522 #INCLUDE(InstallRequiredSystemLibraries)
527 INCLUDE(CMakePackaging.txt)
532 # ADD_DEBIAN_TARGETS(nel)