21 if(${FFMPEG_FOUND}) |
21 if(${FFMPEG_FOUND}) |
22 add_definitions(-DVIDEOREC -D__STDC_CONSTANT_MACROS) |
22 add_definitions(-DVIDEOREC -D__STDC_CONSTANT_MACROS) |
23 endif() |
23 endif() |
24 endif() |
24 endif() |
25 |
25 |
26 include_directories(.) |
26 # server messages localization |
|
27 file(GLOB ServerSources ${CMAKE_SOURCE_DIR}/gameServer/*.hs) |
|
28 foreach(hsfile ${ServerSources}) |
|
29 file(READ ${hsfile} hs) |
|
30 string(REGEX MATCHALL "loc *\"[^\n\"]+\"" locs ${hs}) |
|
31 foreach(str ${locs}) |
|
32 string(REGEX REPLACE "loc *\"([^\n\"]+)\"" "QT_TRANSLATE_NOOP(\"server\", \"\\1\")" s ${str}) |
|
33 list(APPEND serverlocs ${s}) |
|
34 endforeach(str) |
|
35 endforeach(hsfile) |
|
36 |
|
37 list(REMOVE_DUPLICATES serverlocs) |
|
38 list(GET serverlocs 0 firstline) |
|
39 list(REMOVE_AT serverlocs 0) |
|
40 set(locsout "const char * serverMessages[] = {\n") |
|
41 foreach(l ${serverlocs}) |
|
42 list(APPEND locsout ${l} ",\n") |
|
43 endforeach(l) |
|
44 list(APPEND locsout ${firstline} "\n}\\;\n") |
|
45 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/servermessages.h ${locsout}) |
|
46 |
|
47 include_directories(${CMAKE_CURRENT_BINARY_DIR}) |
|
48 include_directories(${CMAKE_CURRENT_SOURCE_DIR}) |
27 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/model) |
49 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/model) |
28 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/net) |
50 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/net) |
29 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ui) |
51 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ui) |
30 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ui/dialog) |
52 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ui/dialog) |
31 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ui/page) |
53 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ui/page) |
32 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ui/widget) |
54 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ui/widget) |
33 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/util) |
55 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/util) |
|
56 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/util/platform) |
34 include_directories(${SDL_INCLUDE_DIR}) |
57 include_directories(${SDL_INCLUDE_DIR}) |
35 include_directories(${SDLMIXER_INCLUDE_DIR}) |
58 include_directories(${SDLMIXER_INCLUDE_DIR}) |
36 include_directories(${FFMPEG_INCLUDE_DIR}) |
59 include_directories(${FFMPEG_INCLUDE_DIR}) |
37 include_directories(${CMAKE_SOURCE_DIR}/misc/physfs/src) |
60 include_directories(${CMAKE_SOURCE_DIR}/misc/physfs/src) |
38 include_directories(${CMAKE_SOURCE_DIR}/misc/physfs/extras) |
61 include_directories(${CMAKE_SOURCE_DIR}/misc/physfs/extras) |
39 if(UNIX) |
62 if(UNIX) |
40 # HACK: in freebsd cannot find iconv.h included via SDL.h |
63 # HACK: in freebsd cannot find iconv.h included via SDL.h |
41 include_directories("/usr/local/include") |
64 include_directories("/usr/local/include") |
42 endif(UNIX) |
65 endif(UNIX) |
43 |
66 |
44 #directory for resources, relative to the one above on certain platforms/configurations |
67 #directory for resources, relative to bindir (on linux an absolute path is always used) |
45 if(DEFINED DATA_INSTALL_DIR OR WIN32 OR APPLE) |
68 string(SUBSTRING "${SHAREPATH}" 0 1 sharepath_start) |
|
69 if(APPLE OR WIN32 OR ${sharepath_start} MATCHES "/") |
46 set(HEDGEWARS_DATADIR ${SHAREPATH}) |
70 set(HEDGEWARS_DATADIR ${SHAREPATH}) |
47 else() |
71 else() |
48 set(HEDGEWARS_DATADIR ${CMAKE_INSTALL_PREFIX}/${SHAREPATH}/) |
72 set(HEDGEWARS_DATADIR ${CMAKE_INSTALL_PREFIX}/${SHAREPATH}) |
49 endif() |
73 endif() |
50 |
74 |
51 #only the cocoa version of qt supports building 64 bit apps |
75 #only the cocoa version of qt supports building 64 bit apps |
52 if(APPLE AND (CMAKE_OSX_ARCHITECTURES MATCHES "x86_64*") AND (NOT QT_MAC_USE_COCOA)) |
76 if(APPLE AND (CMAKE_OSX_ARCHITECTURES MATCHES "x86_64*") AND (NOT QT_MAC_USE_COCOA)) |
53 message(FATAL_ERROR "Building the 64 bit version of Hedgewars *requires* the Cocoa variant of QT on Mac OS X") |
77 message(FATAL_ERROR "Building the 64 bit version of Hedgewars *requires* the Cocoa variant of QT on Mac OS X") |
80 ${CMAKE_CURRENT_BINARY_DIR}/hwconsts.cpp |
104 ${CMAKE_CURRENT_BINARY_DIR}/hwconsts.cpp |
81 ) |
105 ) |
82 |
106 |
83 #xfire integration |
107 #xfire integration |
84 if(WIN32) |
108 if(WIN32) |
85 set(hwfr_src ${hwfr_src} xfire.cpp ../misc/xfire/xfiregameclient.cpp) |
109 list(APPEND hwfr_src util/platform/xfire.cpp util/platform/xfiregameclient.cpp) |
86 endif(WIN32) |
110 endif(WIN32) |
87 |
111 |
88 if(MINGW) |
112 if(MINGW) |
89 # resource compilation for mingw |
113 # resource compilation for mingw |
90 add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/hedgewars_rc.o |
114 add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/hedgewars_rc.o |
91 COMMAND windres -I ${CMAKE_CURRENT_SOURCE_DIR} |
115 COMMAND windres -I ${CMAKE_CURRENT_SOURCE_DIR} |
92 -i ${CMAKE_CURRENT_SOURCE_DIR}/hedgewars.rc |
116 -i ${CMAKE_CURRENT_SOURCE_DIR}/hedgewars.rc |
93 -o ${CMAKE_CURRENT_BINARY_DIR}/hedgewars_rc.o) |
117 -o ${CMAKE_CURRENT_BINARY_DIR}/hedgewars_rc.o) |
94 set(hwfr_src ${hwfr_src} ${CMAKE_CURRENT_BINARY_DIR}/hedgewars_rc.o) |
118 list(APPEND hwfr_src ${CMAKE_CURRENT_BINARY_DIR}/hedgewars_rc.o) |
95 else(MINGW) |
119 else(MINGW) |
96 set(hwfr_src ${hwfr_src} hedgewars.rc) |
120 list(APPEND hwfr_src hedgewars.rc) |
97 endif(MINGW) |
121 endif(MINGW) |
98 |
122 |
99 file(GLOB ModelHdr model/*.h) |
123 file(GLOB ModelHdr model/*.h) |
100 file(GLOB NetHdr net/*.h) |
124 file(GLOB NetHdr net/*.h) |
101 file(GLOB_RECURSE UIhdr ui/*.h) |
125 file(GLOB_RECURSE UIhdr ui/*.h) |
123 binds.h |
148 binds.h |
124 ui_hwform.h |
149 ui_hwform.h |
125 hwconsts.h |
150 hwconsts.h |
126 sdlkeys.h |
151 sdlkeys.h |
127 campaign.h |
152 campaign.h |
|
153 ${CMAKE_CURRENT_BINARY_DIR}/servermessages.h |
128 ) |
154 ) |
129 |
155 |
130 set(hwfr_rez hedgewars.qrc) |
156 set(hwfr_rez hedgewars.qrc) |
131 |
157 |
132 if(${BUILD_ENGINE_LIBRARY}) |
158 if(${BUILD_ENGINE_LIBRARY}) |
133 add_definitions(-DHWLIBRARY=1) |
159 add_definitions(-DHWLIBRARY=1) |
134 set(hwlibname "${EXECUTABLE_OUTPUT_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}hwengine${CMAKE_SHARED_LIBRARY_SUFFIX}") |
160 set(hwlibname "${EXECUTABLE_OUTPUT_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}hwengine${CMAKE_SHARED_LIBRARY_SUFFIX}") |
135 set(HW_LINK_LIBS ${hwlibname} ${HW_LINK_LIBS}) |
161 list(APPEND HW_LINK_LIBS ${hwlibname}) |
136 endif() |
162 endif() |
137 |
163 |
138 qt4_add_resources(hwfr_rez_src ${hwfr_rez}) |
164 qt4_add_resources(hwfr_rez_src ${hwfr_rez}) |
139 |
165 |
140 qt4_wrap_cpp(hwfr_moc_srcs ${hwfr_moc_hdrs}) |
166 qt4_wrap_cpp(hwfr_moc_srcs ${hwfr_moc_hdrs}) |
141 |
167 |
142 |
168 |
143 if(APPLE) |
169 if(APPLE) |
144 find_library(iokit_framework NAMES IOKit) |
170 find_library(iokit_framework NAMES IOKit) |
145 set(HW_LINK_LIBS ${iokit_framework} ${HW_LINK_LIBS}) |
171 list(APPEND HW_LINK_LIBS ${iokit_framework}) |
146 set(hwfr_src ${hwfr_src} CocoaInitializer.mm |
172 list(APPEND hwfr_src util/platform/CocoaInitializer.mm |
147 InstallController.cpp |
173 util/platform/InstallController.cpp |
148 M3Panel.mm |
174 util/platform/M3Panel.mm |
149 M3InstallController.m |
175 util/platform/M3InstallController.m |
150 NSWorkspace_RBAdditions.m |
176 util/platform/NSWorkspace_RBAdditions.m |
151 ) |
177 ) |
152 if(NOT NOAUTOUPDATE) |
178 if(NOT NOAUTOUPDATE) |
153 find_package(Sparkle) |
179 find_package(Sparkle) |
154 if(SPARKLE_FOUND) |
180 if(SPARKLE_FOUND) |
155 add_definitions(-DSPARKLE_ENABLED) |
181 add_definitions(-DSPARKLE_ENABLED) |
156 set(hwfr_src ${hwfr_src} AutoUpdater.cpp SparkleAutoUpdater.mm) |
182 list(APPEND hwfr_src util/platform/AutoUpdater.cpp |
157 set(HW_LINK_LIBS ${SPARKLE_LIBRARY} ${HW_LINK_LIBS}) |
183 util/platform/SparkleAutoUpdater.mm) |
|
184 list(APPEND HW_LINK_LIBS ${SPARKLE_LIBRARY}) |
158 endif() |
185 endif() |
159 endif() |
186 endif() |
160 endif() |
187 endif() |
161 |
188 |
162 #when debugging, always prompt a console to see fronted messages |
189 #when debugging, always prompt a console to see fronted messages |