Fix css style order when using external css files
[ryzomcore.git] / CMakeLists.txt
blob6bbf6235e7720dca77628746d276bc351e623070
1 #-----------------------------------------------------------------------------
3 # Ryzom Core
4 #  Authors: Nevrax and the Ryzom Core Community
5 #  Version: 0.12.0
7 # Notes:
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 #-----------------------------------------------------------------------------
22 # Load some macros.
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
32   IF(POLICY CMP0020)
33     CMAKE_POLICY(SET CMP0020 NEW)
34   ENDIF()
35 ENDIF()
37 INCLUDE(nel)
38 INCLUDE(ConfigureChecks)
39 INCLUDE(CheckDepends)
40 INCLUDE(${CMAKE_ROOT}/Modules/Documentation.cmake OPTIONAL)
42 # Force out of source builds.
43 CHECK_OUT_OF_SOURCE()
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")
50 ELSE()
51   SET(CURRENT_YEAR "2019")
52 ENDIF()
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
72 IF(WIN32)
73   SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
74 ELSE()
75   SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
76 ENDIF()
78 IF(WIN32)
79   IF(WITH_MFC)
80     FIND_PACKAGE(MFC QUIET)
81   ENDIF()
82 ENDIF()
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()
93 NL_SETUP_BUILD()
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
112 IF(WITH_RYZOM_LIVE)
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")
122 ENDIF()
124 #-----------------------------------------------------------------------------
125 #Platform specifics
127 SETUP_EXTERNAL()
129 IF(WIN32)
130   SET(WINSOCK2_LIB ws2_32.lib)
132   IF(WITH_MFC)
133     FIND_PACKAGE(CustomMFC REQUIRED)
134   ENDIF()
135 ENDIF()
137 FIND_PACKAGE(ZLIB REQUIRED)
138 FIND_PACKAGE(LibXml2 REQUIRED)
139 FIND_PACKAGE(PNG REQUIRED)
140 FIND_PACKAGE(OpenSSL REQUIRED)
141 FIND_PACKAGE(GIF)
142 FIND_PACKAGE(Jpeg)
144 IF(WIN32)
145   SET(OPENSSL_LIBRARIES ${OPENSSL_LIBRARIES} Crypt32.lib)
146 ENDIF()
148 IF(WITH_LIBOVR)
149   FIND_PACKAGE(LibOVR)
150 ENDIF()
152 IF(WITH_LIBVR)
153   FIND_PACKAGE(LibVR)
154 ENDIF()
156 NL_CONFIGURE_CHECKS()
158 IF(WITH_STATIC_LIBXML2)
159   SET(LIBXML2_DEFINITIONS ${LIBXML2_DEFINITIONS} -DLIBXML_STATIC)
160 ENDIF()
162 IF(WITH_LIBXML2_ICONV)
163   FIND_PACKAGE(Iconv REQUIRED)
164   INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR})
165   SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${ICONV_LIBRARIES})
166 ENDIF()
168 IF(WITH_STATIC)
169   # libxml2 could need winsock2 library
170   IF(WINSOCK2_LIB)
171     SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${WINSOCK2_LIB})
172   ENDIF()
174   IF(UNIX)
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})
179     ENDIF()
181     # under Linux and OS X, recent libxml2 versions are linked against libicu
182     # FIND_PACKAGE(Icu)
183     FIND_LIBRARY(ICU_LIBRARY icuuc)
184     IF(ICU_LIBRARY)
185        FIND_LIBRARY(ICU_DATA_LIBRARY icudata)
186        IF(ICU_LIBRARY)
187          MESSAGE(STATUS "ICU UC was found: ${ICU_LIBRARY}")
188        ELSE()
189          MESSAGE(STATUS "ICU UC was NOT found")
190        ENDIF()
191        SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${ICU_DATA_LIBRARY} ${ICU_LIBRARY})
192     ENDIF()
194   ENDIF()
195 ENDIF()
197 INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/PCHSupport.cmake)
199 IF(FINAL_VERSION)
200   ADD_DEFINITIONS(-DFINAL_VERSION=1)
201 ENDIF()
203 IF(WITH_SSE2)
204   ADD_DEFINITIONS(-DNL_HAS_SSE2)
205   IF(WITH_SSE3)
206     ADD_DEFINITIONS(-DNL_HAS_SSE3)
207   ENDIF()
208 ENDIF()
210 IF(APPLE)
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)
224     ENDIF()
226     IF(NOT EXISTS "${CODESIGN_ALLOCATE}")
227       # System path
228       SET(CODESIGN_ALLOCATE /usr/bin/codesign_allocate)
229     ENDIF()
231     IF(NOT EXISTS "${CODESIGN_ALLOCATE}")
232       MESSAGE(WARNING "Unable to find codesign_allocate in standard directories")
233       SET(CODESIGN_ALLOCATE)
234     ENDIF()
235   ENDIF()
236 ENDIF()
238 INCLUDE(FindHelpers)
240 IF(WITH_QT5)
241   FIND_QT5()
242 ENDIF()
244 IF(WITH_QT)
245   SET(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${QTDIR} $ENV{QTDIR})
247   # Use Qt 4
248   FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui QtXml QtOpenGL REQUIRED)
249 ENDIF()
251 IF(WITH_ASSIMP)
252   FIND_PACKAGE(assimp REQUIRED)
253 ENDIF()
255 IF(WITH_NEL)
256   IF(WITH_NEL_TESTS)
257     FIND_PACKAGE(CppTest)
258   ENDIF()
260   IF(WITH_GUI)
261     FIND_PACKAGE(Luabind REQUIRED)
262   ENDIF()
264     FIND_PACKAGE(CURL REQUIRED)
266     IF((WIN32 OR CURL_LIBRARIES MATCHES "\\.a") AND WITH_STATIC_CURL)
267       SET(CURL_STATIC ON)
268     ELSE()
269       SET(CURL_STATIC OFF)
270     ENDIF()
272     IF(CURL_STATIC)
273       SET(CURL_DEFINITIONS -DCURL_STATICLIB)
275       LIST(APPEND CURL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR})
276       LIST(APPEND CURL_LIBRARIES ${OPENSSL_LIBRARIES})
278       IF(WIN32)
279         LIST(APPEND CURL_LIBRARIES Crypt32 Cryptui)
280       ELSE()
281         # CURL depends on libidn
282         FIND_LIBRARY(IDN_LIBRARY idn)
283         IF(IDN_LIBRARY)
284           LIST(APPEND CURL_LIBRARIES ${IDN_LIBRARY})
285         ENDIF()
287         # CURL Macports version can depend on libidn, libidn2, libintl, libpsl and libiconv too
288         IF(APPLE)
289           FIND_LIBRARY(INTL_LIBRARY intl)
290           IF(INTL_LIBRARY)
291             LIST(APPEND CURL_LIBRARIES ${INTL_LIBRARY})
292           ENDIF()
294           FIND_LIBRARY(IDN2_LIBRARY idn2)
295           IF(IDN2_LIBRARY)
296             LIST(APPEND CURL_LIBRARIES ${IDN2_LIBRARY})
297           ENDIF()
299           FIND_LIBRARY(PSL_LIBRARY psl)
300           IF(PSL_LIBRARY)
301             LIST(APPEND CURL_LIBRARIES ${PSL_LIBRARY})
302           ENDIF()
304           FIND_LIBRARY(UNISTRING_LIBRARY unistring)
305           IF(UNISTRING_LIBRARY)
306             LIST(APPEND CURL_LIBRARIES ${UNISTRING_LIBRARY})
307           ENDIF()
309           LIST(APPEND CURL_LIBRARIES ${SECURITY_FRAMEWORK})
310         ENDIF()
311       ENDIF()
312     ENDIF()
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)
325 ELSE()
326 #  FIND_PACKAGE(NeL COMPONENTS 3d misc pacs sound nimp REQUIRED)
327   FIND_PACKAGE(NeL REQUIRED)
328   INCLUDE_DIRECTORIES(${NEL_INCLUDE_DIRS})
329 ENDIF()
331 IF(WITH_RYZOM)
332   ADD_SUBDIRECTORY(ryzom)
333 ENDIF()
335 IF(WITH_NELNS)
336   ADD_SUBDIRECTORY(nelns)
337 ENDIF()
339 IF(WITH_SNOWBALLS)
340   ADD_SUBDIRECTORY(snowballs2)
341 ENDIF()
343 IF(WITH_TOOLS)
344   ADD_SUBDIRECTORY(tool)
345 ENDIF()
347 IF(WITH_STUDIO)
348   ADD_SUBDIRECTORY(studio)
349 ENDIF()
351 IF(WITH_PERSONAL)
352   ADD_SUBDIRECTORY(personal)
353 ENDIF()
355 # To build the documention, you will have to enable it
356 # and then do the equivalent of "make DoxygenDoc".
357 IF(BUILD_DOCUMENTATION)
358     IF(DOT)
359         SET(HAVE_DOT YES)
360     ELSE()
361         SET(HAVE_DOT NO)
362     ENDIF()
363     # This processes our Doxyfile.in and substitutes paths to generate
364     # a final Doxyfile
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)
368 ENDIF()
370 IF(WITH_NEL_TESTS)
371   ENABLE_TESTING()
372   ADD_TEST(nel_unit_test ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nel_unit_test --html)
373   IF(BUILD_DASHBOARD)
374     INCLUDE(Dart)
375     SET(SVNCOMMAND svn)
376     SET(SVNSOURCEDIR http://dev.ryzom.com/svn/trunk/nel)
377     SET(GENERATELOGS svn2cl)
378   ENDIF()
379 ENDIF()
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")
404 ## Source Packages
405 SET(CPACK_PACKAGE_FILE_NAME "ryzomcore-${NL_VERSION}")
406 SET(CPACK_SOURCE_PACKAGE_FILE_NAME "ryzomcore-${NL_VERSION}")
407 IF(WIN32)
408   #SET(CPACK_GENERATOR "NSIS")
409   SET(CPACK_GENERATOR "NSIS;ZIP")
410   SET(CPACK_SOURCE_GENERATOR "ZIP")
411 ELSE()
412   SET(CPACK_GENERATOR "TGZ")
413   SET(CPACK_SOURCE_GENERATOR "TGZ")
414 ENDIF()
415 set(CPACK_SOURCE_IGNORE_FILES
416         "~$"
417         "\\\\.cvsignore$"
418         "^${CMAKE_SOURCE_DIR}.*/CVS/"
419         "^${CMAKE_SOURCE_DIR}.*/\\\\.svn/"
420         "^${CMAKE_SOURCE_DIR}/debian/"
421         "^${CMAKE_SOURCE_DIR}/old/")
422 IF(WIN32)
423   IF(NOT CMAKE_BUILD_TYPE STREQUAL "Release")
424     SET(CMAKE_INSTALL_DEBUG_LIBRARIES TRUE)
425     IF(WITH_QT)
426       INCLUDE(${QT_USE_FILE})
427       INSTALL(FILES
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})
432     ENDIF()
433   ELSE()
434     IF(WITH_QT)
435       INCLUDE(${QT_USE_FILE})
436       INSTALL(FILES
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})
441     ENDIF()
442   ENDIF()
444   # Install CEGUI and its dependencies.
445   IF(WITH_NEL_CEGUI)
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})
452   ENDIF()
454   # Only the tools require MFC.
455   IF(WITH_TOOLS)
456     SET(CMAKE_INSTALL_MFC_LIBRARIES TRUE)
457   ENDIF()
458   #INCLUDE(InstallRequiredSystemLibraries)
459 ENDIF()
461 INCLUDE(CPack)
463 INCLUDE(CMakePackaging.txt)
465 ## Debian Packages
466 #INCLUDE(UseDebian)
467 #IF(DEBIAN_FOUND)
468 #  ADD_DEBIAN_TARGETS(nel)
469 #ENDIF()