Fix css style order when using external css files
[ryzomcore.git] / ryzom / client / src / CMakeLists.txt
blobf5d19f1d5485bc910c51009aede79cf779a9d5d8
1 IF(WITH_RYZOM_TOOLS OR WITH_RYZOM_CLIENT)
2   # Need clientsheets lib for sheets packer tool
3   ADD_SUBDIRECTORY(client_sheets)
4 ENDIF()
6 IF(WITH_RYZOM_CLIENT)
7   IF(NOT WITH_GUI)
8     MESSAGE(FATAL_ERROR "The client cannot be built without the NeL GUI Library (WITH_GUI)")
9   ENDIF()
11   # Patch should never be enabled on Steam
12   IF(WITH_RYZOM_STEAM)
13     ADD_DEFINITIONS(-DRZ_USE_STEAM)
14     FIND_PACKAGE(Steam)
15   ELSEIF(WITH_RYZOM_PATCH)
16     ADD_DEFINITIONS(-DRZ_USE_PATCH)
18     IF(WITH_RYZOM_CUSTOM_PATCH_SERVER)
19       ADD_DEFINITIONS(-DRZ_USE_CUSTOM_PATCH_SERVER)
20     ENDIF()
21   ENDIF()
23   FILE(GLOB CFG ../*.cfg)
24   FILE(GLOB SRC *.cpp *.h motion/*.cpp motion/*.h client.rc *.manifest)
25   FILE(GLOB SRC_INTERFACE interface_v3/*.h interface_v3/*.cpp)
26   FILE(GLOB SRC_MODE motion/modes/*.cpp motion/modes/*.h)
27   FILE(GLOB SRC_R2 r2/*.h r2/*.cpp r2/dmc/*.h r2/dmc/*.cpp)
29   # Filter out the source files not actually compiled.
30   LIST(REMOVE_ITEM SRC
31     ${CMAKE_CURRENT_SOURCE_DIR}/animated_scene_object.cpp
32     ${CMAKE_CURRENT_SOURCE_DIR}/animated_scene_object.h
33     ${CMAKE_CURRENT_SOURCE_DIR}/animation_fx_sheet.h
34     ${CMAKE_CURRENT_SOURCE_DIR}/animation_fx_sheet.cpp
35     ${CMAKE_CURRENT_SOURCE_DIR}/3d_notes.cpp
36     ${CMAKE_CURRENT_SOURCE_DIR}/3d_notes.h
37     ${CMAKE_CURRENT_SOURCE_DIR}/rosace_functions.cpp
38     ${CMAKE_CURRENT_SOURCE_DIR}/rosace_functions.h
39     ${CMAKE_CURRENT_SOURCE_DIR}/scene_parser.cpp
40     ${CMAKE_CURRENT_SOURCE_DIR}/scene_parser.h)
41   LIST(REMOVE_ITEM SRC_MODE
42     ${CMAKE_CURRENT_SOURCE_DIR}/motion/modes/free_head.cpp
43     ${CMAKE_CURRENT_SOURCE_DIR}/motion/modes/free_head.h)
44   LIST(REMOVE_ITEM SRC_INTERFACE
45     ${CMAKE_CURRENT_SOURCE_DIR}/interface_v3/lua_dll.cpp
46     ${CMAKE_CURRENT_SOURCE_DIR}/interface_v3/lua_dll.h
47     ${CMAKE_CURRENT_SOURCE_DIR}/interface_v3/view_bitmap_progress.cpp
48     ${CMAKE_CURRENT_SOURCE_DIR}/interface_v3/view_bitmap_progress.h)
50   SOURCE_GROUP("" FILES ${SRC})
51   SOURCE_GROUP("cfg" FILES ${CFG})
52   SOURCE_GROUP("interface_v3" FILES ${SRC_INTERFACE})
53   SOURCE_GROUP("mode" FILES ${SRC_MODE})
54   SOURCE_GROUP("r2" FILES ${SRC_R2})
56   # on Mac, create a .App Bundle
57   if(APPLE)
58     # We could force another build version for the bundle
59     IF(NOT RYZOM_BUILD)
60       SET(RYZOM_BUILD ${RYZOM_VERSION_SHORT})
61     ENDIF()
63     SET(MACOSX_BUNDLE_INFO_STRING "Ryzom")
64     SET(MACOSX_BUNDLE_ICON_FILE "ryzom.icns")
65     SET(MACOSX_BUNDLE_GUI_IDENTIFIER "com.winchgate.Ryzom")
66     SET(MACOSX_BUNDLE_LONG_VERSION_STRING ${RYZOM_VERSION})
67     SET(MACOSX_BUNDLE_BUNDLE_NAME "Ryzom")
68     SET(MACOSX_BUNDLE_SHORT_VERSION_STRING ${RYZOM_VERSION_SHORT})
69     SET(MACOSX_BUNDLE_BUNDLE_VERSION ${RYZOM_BUILD})
70     SET(MACOSX_BUNDLE_COPYRIGHT ${COPYRIGHT})
71     SET(RYZOM_OUTPUT_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${MACOSX_BUNDLE_BUNDLE_NAME}.app)
72     SET(RYZOM_CONTENTS_DIR ${RYZOM_OUTPUT_DIR}/Contents)
73     SET(RYZOM_RESOURCES_DIR ${RYZOM_CONTENTS_DIR}/Resources)
74     SET(MAC_RESOURCES_DIR ${CMAKE_SOURCE_DIR}/ryzom/client/macosx)
75   ENDIF()
77   ADD_EXECUTABLE(ryzom_client WIN32 MACOSX_BUNDLE ${SRC} ${SRC_INTERFACE} ${SRC_MODE} ${SRC_R2})
79   IF(APPLE)
80     SET_TARGET_PROPERTIES(ryzom_client PROPERTIES OUTPUT_NAME ${MACOSX_BUNDLE_BUNDLE_NAME})
81     SET_TARGET_PROPERTIES(ryzom_client PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${MAC_RESOURCES_DIR}/Info.plist)
82     ADD_CUSTOM_COMMAND(TARGET ryzom_client PRE_BUILD COMMAND mkdir -p ${RYZOM_RESOURCES_DIR})
83     ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp ARGS -p ${MAC_RESOURCES_DIR}/PkgInfo ${RYZOM_CONTENTS_DIR})
84     ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp ARGS -p ${MAC_RESOURCES_DIR}/ryzom.icns ${RYZOM_RESOURCES_DIR})
85     ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp ARGS -p ${CMAKE_SOURCE_DIR}/ryzom/client/client_default.cfg ${RYZOM_RESOURCES_DIR})
87     # remove any present installscript_osx.vdf before signing
88     ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND rm -f ${RYZOM_OUTPUT_DIR}/installscript_osx.vdf)
90     IF(RYZOM_DATA_DIR)
91       ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp ARGS -RpX ${RYZOM_DATA_DIR} ${RYZOM_RESOURCES_DIR})
92     ENDIF()
94     IF(WITH_RYZOM_SANDBOX)
95       SET(ENTITLEMENTS --entitlements ${MAC_RESOURCES_DIR}/ryzom.entitlements)
96     ELSE()
97       SET(ENTITLEMENTS)
98     ENDIF()
100     IF(TARGET crash_report)
101       ADD_DEPENDENCIES(ryzom_client crash_report)
103       # copy crash_report to bundle
104       ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp -p ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/crash_report ${RYZOM_CONTENTS_DIR}/MacOS/CrashReport)
106       IF(CODESIGN_ALLOCATE AND APPLE_CERTIFICATE)
107         ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign ${ENTITLEMENTS} -fs "${APPLE_CERTIFICATE}" "${RYZOM_CONTENTS_DIR}/MacOS/CrashReport" COMMENT "Signing CrashReport executable...")
108       ENDIF()
109     ENDIF()
111     IF(TARGET ryzom_client_patcher)
112       ADD_DEPENDENCIES(ryzom_client ryzom_client_patcher)
114       # copy ryzom_client_patcher to bundle
115       ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp -p ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ryzom_client_patcher ${RYZOM_CONTENTS_DIR}/MacOS/RyzomClientPatcher)
117       IF(CODESIGN_ALLOCATE AND APPLE_CERTIFICATE)
118         ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign ${ENTITLEMENTS} -fs "${APPLE_CERTIFICATE}" "${RYZOM_CONTENTS_DIR}/MacOS/RyzomClientPatcher" COMMENT "Signing RyzomClientPatcher executable...")
119       ENDIF()
120     ENDIF()
122     IF(TARGET ryzom_configuration_qt)
123       ADD_DEPENDENCIES(ryzom_client ryzom_configuration_qt)
125       # copy ryzom_configuration_qt to bundle
126       ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp -p ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ryzom_configuration_qt ${RYZOM_CONTENTS_DIR}/MacOS/RyzomConfiguration)
128       IF(CODESIGN_ALLOCATE AND APPLE_CERTIFICATE)
129         ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign ${ENTITLEMENTS} -fs "${APPLE_CERTIFICATE}" "${RYZOM_CONTENTS_DIR}/MacOS/RyzomConfiguration" COMMENT "Signing RyzomConfiguration executable...")
130       ENDIF()
131     ENDIF()
133     IF(WITH_RYZOM_STEAM AND STEAM_RUNTIME)
134       ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp -p ${STEAM_RUNTIME} ${RYZOM_CONTENTS_DIR}/MacOS)
136       IF(CODESIGN_ALLOCATE AND APPLE_CERTIFICATE)
137         ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --no-strict -fs "${APPLE_CERTIFICATE}" "${RYZOM_CONTENTS_DIR}/MacOS/${STEAM_RUNTIMENAME}" COMMENT "Signing Steam client runtime...")
138       ENDIF()
139     ENDIF()
141     IF(CODESIGN_ALLOCATE AND APPLE_CERTIFICATE)
142       ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign ${ENTITLEMENTS} -fs "${APPLE_CERTIFICATE}" "${RYZOM_OUTPUT_DIR}" COMMENT "Signing Ryzom bundle...")
143     ENDIF()
144   ENDIF()
146   INCLUDE_DIRECTORIES(
147         ${CMAKE_CURRENT_SOURCE_DIR}
148         ${LIBXML2_INCLUDE_DIR}
149         ${LUA_INCLUDE_DIR}
150         ${LUABIND_INCLUDE_DIR}
151         ${CURL_INCLUDE_DIRS}
152         ${ZLIB_INCLUDE_DIR}
153         ${OPENSSL_INCLUDE_DIR}
154   )
156   INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/nel/3rdparty)
158   IF(STEAM_FOUND)
159     INCLUDE_DIRECTORIES(${STEAM_INCLUDE_DIRS})
160   ENDIF()
162   TARGET_LINK_LIBRARIES(ryzom_client
163               nelmisc
164               nelnet
165               nelligo
166               nelgeorges
167               nel3d
168               nelgui
169               nelsound
170               nel_sevenzip
171               ryzom_clientsheets
172               ryzom_gameshare
173               nelpacs
174               ${LUA_LIBRARIES}
175               ${LUABIND_LIBRARIES}
176               ${CURL_LIBRARIES}
177               ${OPENSSL_LIBRARIES}
178   )
180   IF(NOT APPLE AND NOT WIN32)
181     TARGET_LINK_LIBRARIES(ryzom_client ${X11_LIBRARIES})
182   ENDIF()
184   IF(APPLE)
185     TARGET_LINK_LIBRARIES(ryzom_client ${FOUNDATION_FRAMEWORK})
186   ENDIF()
188   ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} ${CURL_DEFINITIONS} ${LUABIND_DEFINITIONS})
190   NL_DEFAULT_PROPS(ryzom_client "Ryzom, Client: Ryzom Client")
191   NL_ADD_RUNTIME_FLAGS(ryzom_client)
193   IF(FINAL_VERSION)
194     NL_ADD_LIB_SUFFIX(ryzom_client)
195   ELSE()
196     IF(WIN32)
197       SET_TARGET_PROPERTIES(ryzom_client PROPERTIES DEBUG_POSTFIX "_dev_d" RELEASE_POSTFIX "_dev_r")
198     ELSEIF(NOT APPLE)
199       SET_TARGET_PROPERTIES(ryzom_client PROPERTIES DEBUG_POSTFIX "_dev" RELEASE_POSTFIX "_dev")
200     ENDIF()
201   ENDIF()
203   IF(WITH_RYZOM_CLIENT_UAC)
204     IF(CMAKE_GENERATOR MATCHES "Visual Studio")
205       SET_PROPERTY(TARGET ryzom_client PROPERTY LINK_FLAGS_RELEASE "/level='requireAdministrator'")
206     ELSEIF(CMAKE_GENERATOR MATCHES "NMake Makefiles")
207       SET_PROPERTY(TARGET ryzom_client PROPERTY LINK_FLAGS_RELEASE "/MANIFESTUAC:\"level='requireAdministrator' uiAccess='false'\"")
208     ENDIF()
209   ENDIF()
211   IF(WITH_PCH AND (NOT MINGW OR NOT WITH_SYMBOLS))
212     ADD_NATIVE_PRECOMPILED_HEADER(ryzom_client ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.h ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.cpp)
213   ENDIF()
215   INSTALL(TARGETS ryzom_client RUNTIME DESTINATION ${RYZOM_GAMES_PREFIX} COMPONENT client BUNDLE DESTINATION /Applications)
216 ENDIF()