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 "2019")
54 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
55 PROJECT(RyzomCore CXX C)
56 SET(NL_VERSION_MAJOR 1)
57 SET(NL_VERSION_MINOR 1)
58 SET(NL_VERSION_PATCH 0 CACHE STRING "Patch version")
59 SET(YEAR "2001-${CURRENT_YEAR}")
60 SET(AUTHOR "Winch Gate and The Ryzom Core Community")
62 SET(RYZOM_VERSION_MAJOR 3)
63 SET(RYZOM_VERSION_MINOR 6)
64 SET(RYZOM_VERSION_PATCH 0)
66 #-----------------------------------------------------------------------------
67 # Redirect output files
68 SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
69 SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
71 # DLL should be in the same directory as EXE under Windows
73 SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
75 SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
80 FIND_PACKAGE(MFC QUIET)
84 #-----------------------------------------------------------------------------
85 # Set default config options
87 NL_SETUP_DEFAULT_OPTIONS()
88 NL_SETUP_NEL_DEFAULT_OPTIONS()
89 NL_SETUP_NELNS_DEFAULT_OPTIONS()
90 NL_SETUP_RYZOM_DEFAULT_OPTIONS()
91 NL_SETUP_SNOWBALLS_DEFAULT_OPTIONS()
94 NL_SETUP_BUILD_FLAGS()
96 NL_SETUP_PREFIX_PATHS()
97 RYZOM_SETUP_PREFIX_PATHS()
99 #-----------------------------------------------------------------------------
100 # Default values for URL's
101 SET(RYZOM_CLIENT_CREATE_ACCOUNT_URL "https://open.ryzom.dev/ams/" CACHE STRING "Ryzom Client Create Account URL")
102 SET(RYZOM_CLIENT_EDIT_ACCOUNT_URL "https://open.ryzom.dev/ams/" CACHE STRING "Ryzom Client Edit Account URL")
103 SET(RYZOM_CLIENT_FORGET_PASSWORD_URL "https://open.ryzom.dev/ams/" CACHE STRING "Ryzom Client Forget Password URL")
104 SET(RYZOM_CLIENT_PATCH_URL "https://cdn.ryzom.dev/open/patch/" CACHE STRING "Ryzom Client Patch URL")
105 SET(RYZOM_CLIENT_APP_NAME "default")
107 SET(RYZOM_WEBIG_MAIN_URL "https://open.ryzom.dev/" CACHE STRING "Ryzom Client WebIG Main URL")
108 SET(RYZOM_WEBIG_TRUSTED_DOMAIN "open.ryzom.dev" CACHE STRING "Ryzom Client WebIG Trusted Domain")
110 #-----------------------------------------------------------------------------
111 # urls when compiling ryzom live client
113 MESSAGE("Using RYZOM_LIVE urls")
114 SET(RYZOM_CLIENT_CREATE_ACCOUNT_URL "https://account.ryzom.com/signup/from_client.php")
115 SET(RYZOM_CLIENT_EDIT_ACCOUNT_URL "https://account.ryzom.com/payment_profile/index.php")
116 SET(RYZOM_CLIENT_FORGET_PASSWORD_URL "https://account.ryzom.com/payment_profile/lost_secure_password.php")
117 SET(RYZOM_CLIENT_PATCH_URL "http://dl.ryzom.com/patch_live")
118 SET(RYZOM_CLIENT_APP_NAME "ryzom_live")
120 SET(RYZOM_WEBIG_MAIN_URL "https://app.ryzom.com/")
121 SET(RYZOM_WEBIG_TRUSTED_DOMAIN "app.ryzom.com")
124 #-----------------------------------------------------------------------------
130 SET(WINSOCK2_LIB ws2_32.lib)
133 FIND_PACKAGE(CustomMFC REQUIRED)
137 FIND_PACKAGE(ZLIB REQUIRED)
138 FIND_PACKAGE(LibXml2 REQUIRED)
139 FIND_PACKAGE(PNG REQUIRED)
140 FIND_PACKAGE(OpenSSL REQUIRED)
145 SET(OPENSSL_LIBRARIES ${OPENSSL_LIBRARIES} Crypt32.lib)
156 NL_CONFIGURE_CHECKS()
158 IF(WITH_STATIC_LIBXML2)
159 SET(LIBXML2_DEFINITIONS ${LIBXML2_DEFINITIONS} -DLIBXML_STATIC)
162 IF(WITH_LIBXML2_ICONV)
163 FIND_PACKAGE(Iconv REQUIRED)
164 INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR})
165 SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${ICONV_LIBRARIES})
169 # libxml2 could need winsock2 library
171 SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${WINSOCK2_LIB})
175 # under Linux and OS X, recent libxml2 versions are linked against liblzma
176 FIND_PACKAGE(LibLZMA)
177 IF(LIBLZMA_LIBRARIES)
178 SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${LIBLZMA_LIBRARIES})
181 # under Linux and OS X, recent libxml2 versions are linked against libicu
183 FIND_LIBRARY(ICU_LIBRARY icuuc)
185 FIND_LIBRARY(ICU_DATA_LIBRARY icudata)
187 MESSAGE(STATUS "ICU UC was found: ${ICU_LIBRARY}")
189 MESSAGE(STATUS "ICU UC was NOT found")
191 SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${ICU_DATA_LIBRARY} ${ICU_LIBRARY})
197 INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/PCHSupport.cmake)
200 ADD_DEFINITIONS(-DFINAL_VERSION=1)
204 ADD_DEFINITIONS(-DNL_HAS_SSE2)
206 ADD_DEFINITIONS(-DNL_HAS_SSE3)
211 FIND_LIBRARY(CARBON_FRAMEWORK Carbon)
212 FIND_LIBRARY(FOUNDATION_FRAMEWORK Foundation)
213 FIND_LIBRARY(SECURITY_FRAMEWORK Security)
215 IF(APPLE_CERTIFICATE)
216 # Find codesign_allocate
218 # Xcode 7.0 and later versions
219 SET(CODESIGN_ALLOCATE ${OSX_DEVELOPER_ROOT}/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate)
221 IF(NOT EXISTS "${CODESIGN_ALLOCATE}")
222 # Xcode 6.4 and previous versions
223 SET(CODESIGN_ALLOCATE ${CMAKE_OSX_SYSROOT}/usr/bin/codesign_allocate)
226 IF(NOT EXISTS "${CODESIGN_ALLOCATE}")
228 SET(CODESIGN_ALLOCATE /usr/bin/codesign_allocate)
231 IF(NOT EXISTS "${CODESIGN_ALLOCATE}")
232 MESSAGE(WARNING "Unable to find codesign_allocate in standard directories")
233 SET(CODESIGN_ALLOCATE)
245 SET(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${QTDIR} $ENV{QTDIR})
248 FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui QtXml QtOpenGL REQUIRED)
252 FIND_PACKAGE(assimp REQUIRED)
257 FIND_PACKAGE(CppTest)
261 FIND_PACKAGE(Luabind REQUIRED)
264 FIND_PACKAGE(CURL REQUIRED)
266 IF((WIN32 OR CURL_LIBRARIES MATCHES "\\.a") AND WITH_STATIC_CURL)
273 SET(CURL_DEFINITIONS -DCURL_STATICLIB)
275 LIST(APPEND CURL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR})
276 LIST(APPEND CURL_LIBRARIES ${OPENSSL_LIBRARIES})
279 LIST(APPEND CURL_LIBRARIES Crypt32 Cryptui)
281 # CURL depends on libidn
282 FIND_LIBRARY(IDN_LIBRARY idn)
284 LIST(APPEND CURL_LIBRARIES ${IDN_LIBRARY})
287 # CURL Macports version can depend on libidn, libidn2, libintl, libpsl and libiconv too
289 FIND_LIBRARY(INTL_LIBRARY intl)
291 LIST(APPEND CURL_LIBRARIES ${INTL_LIBRARY})
294 FIND_LIBRARY(IDN2_LIBRARY idn2)
296 LIST(APPEND CURL_LIBRARIES ${IDN2_LIBRARY})
299 FIND_LIBRARY(PSL_LIBRARY psl)
301 LIST(APPEND CURL_LIBRARIES ${PSL_LIBRARY})
304 FIND_LIBRARY(UNISTRING_LIBRARY unistring)
305 IF(UNISTRING_LIBRARY)
306 LIST(APPEND CURL_LIBRARIES ${UNISTRING_LIBRARY})
309 LIST(APPEND CURL_LIBRARIES ${SECURITY_FRAMEWORK})
314 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/nel/include)
315 ADD_SUBDIRECTORY(nel)
317 # Aliases for targets
318 SET(NELMISC_LIBRARIES nelmisc)
319 SET(NELNET_LIBRARIES nelnet)
320 SET(NELLIGO_LIBRARIES nelligo)
321 SET(NELGEORGES_LIBRARIES nelgeorges)
322 SET(NEL3D_LIBRARIES nel3d)
323 SET(NELGUI_LIBRARIES nelgui)
324 SET(NELSOUND_LIBRARIES nelsound)
326 # FIND_PACKAGE(NeL COMPONENTS 3d misc pacs sound nimp REQUIRED)
327 FIND_PACKAGE(NeL REQUIRED)
328 INCLUDE_DIRECTORIES(${NEL_INCLUDE_DIRS})
332 ADD_SUBDIRECTORY(ryzom)
336 ADD_SUBDIRECTORY(nelns)
340 ADD_SUBDIRECTORY(snowballs2)
344 ADD_SUBDIRECTORY(tool)
348 ADD_SUBDIRECTORY(studio)
352 ADD_SUBDIRECTORY(personal)
355 # To build the documention, you will have to enable it
356 # and then do the equivalent of "make DoxygenDoc".
357 IF(BUILD_DOCUMENTATION)
363 # This processes our Doxyfile.in and substitutes paths to generate
365 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/doc/Doxyfile.cmake.in ${CMAKE_BINARY_DIR}/doc/Doxyfile)
367 ADD_CUSTOM_TARGET(DoxygenDoc ${DOXYGEN} ${CMAKE_BINARY_DIR}/doc/Doxyfile)
372 ADD_TEST(nel_unit_test ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nel_unit_test --html)
376 SET(SVNSOURCEDIR http://dev.ryzom.com/svn/trunk/nel)
377 SET(GENERATELOGS svn2cl)
381 # packaging information
382 SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Ryzom Core MMORPG Framework")
383 SET(CPACK_PACKAGE_VENDOR "Ryzom Core")
384 SET(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_SOURCE_DIR}/README)
385 SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/COPYING)
386 SET(CPACK_PACKAGE_VERSION_MAJOR "${NL_VERSION_MAJOR}")
387 SET(CPACK_PACKAGE_VERSION_MINOR "${NL_VERSION_MINOR}")
388 SET(CPACK_PACKAGE_VERSION_PATCH "${NL_VERSION_PATCH}")
389 SET(CPACK_INSTALL_CMAKE_PROJECTS "${CMAKE_BINARY_DIR};NeL;ALL;/")
390 SET(CPACK_PACKAGE_EXECUTABLES "ryzomcore${NL_VERSION}" "ryzomcore")
391 SET(CPACK_SET_DESTDIR TRUE)
393 # NSIS Specific Packing Setup
394 SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "RyzomCore")
395 SET(CPACK_NSIS_MODIFY_PATH "ON")
396 SET(CPACK_NSIS_MUI_ICON ${CMAKE_SOURCE_DIR}/resources/nevraxpill.ico)
397 SET(CPACK_NSIS_MUI_UNIICON ${CMAKE_SOURCE_DIR}/resources/nevraxpill.ico)
398 SET(CPACK_PACKAGE_ICON ${CMAKE_SOURCE_DIR}/resources\\\\nel.bmp)
399 SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} RyzomCore")
400 SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\dev.ryzom.com")
401 SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\dev.ryzom.com\\\\projects\\\\nel\\\\wiki")
402 SET(CPACK_NSIS_CONTACT "matt.raykowski@gmail.com")
405 SET(CPACK_PACKAGE_FILE_NAME "ryzomcore-${NL_VERSION}")
406 SET(CPACK_SOURCE_PACKAGE_FILE_NAME "ryzomcore-${NL_VERSION}")
408 #SET(CPACK_GENERATOR "NSIS")
409 SET(CPACK_GENERATOR "NSIS;ZIP")
410 SET(CPACK_SOURCE_GENERATOR "ZIP")
412 SET(CPACK_GENERATOR "TGZ")
413 SET(CPACK_SOURCE_GENERATOR "TGZ")
415 set(CPACK_SOURCE_IGNORE_FILES
418 "^${CMAKE_SOURCE_DIR}.*/CVS/"
419 "^${CMAKE_SOURCE_DIR}.*/\\\\.svn/"
420 "^${CMAKE_SOURCE_DIR}/debian/"
421 "^${CMAKE_SOURCE_DIR}/old/")
423 IF(NOT CMAKE_BUILD_TYPE STREQUAL "Release")
424 SET(CMAKE_INSTALL_DEBUG_LIBRARIES TRUE)
426 INCLUDE(${QT_USE_FILE})
428 "${QT_LIBRARY_DIR}/../bin/QtGuid4.dll"
429 "${QT_LIBRARY_DIR}/../bin/QtXmld4.dll"
430 "${QT_LIBRARY_DIR}/../bin/QtCored4.dll"
431 DESTINATION ${NL_BIN_PREFIX})
435 INCLUDE(${QT_USE_FILE})
437 "${QT_LIBRARY_DIR}/../bin/QtGui4.dll"
438 "${QT_LIBRARY_DIR}/../bin/QtXml4.dll"
439 "${QT_LIBRARY_DIR}/../bin/QtCore4.dll"
440 DESTINATION ${NL_BIN_PREFIX})
444 # Install CEGUI and its dependencies.
446 INSTALL(FILES "${CEGUI_LIB_DIR}/CEGUIBase.dll" DESTINATION ${NL_BIN_PREFIX})
447 INSTALL(FILES "${CEGUI_LIB_DIR}/CEGUIDevilImageCodec.dll" DESTINATION ${NL_BIN_PREFIX})
448 INSTALL(FILES "${CEGUI_LIB_DIR}/CEGUIExpatParser.dll" DESTINATION ${NL_BIN_PREFIX})
449 INSTALL(FILES "${CEGUI_LIB_DIR}/CEGUIFalagardWRBase.dll" DESTINATION ${NL_BIN_PREFIX})
450 INSTALL(FILES "${CEGUI_LIB_DIR}/Devil.dll" DESTINATION ${NL_BIN_PREFIX})
451 INSTALL(FILES "${CEGUI_LIB_DIR}/ILU.dll" DESTINATION ${NL_BIN_PREFIX})
454 # Only the tools require MFC.
456 SET(CMAKE_INSTALL_MFC_LIBRARIES TRUE)
458 #INCLUDE(InstallRequiredSystemLibraries)
463 INCLUDE(CMakePackaging.txt)
468 # ADD_DEBIAN_TARGETS(nel)