equal
deleted
inserted
replaced
10 #IMG_Init/IMG_Quit from SDL_image 1.2.8 |
10 #IMG_Init/IMG_Quit from SDL_image 1.2.8 |
11 check_library_exists(${SDLIMAGE_LIBRARY} IMG_Init "" HAVE_IMGINIT) |
11 check_library_exists(${SDLIMAGE_LIBRARY} IMG_Init "" HAVE_IMGINIT) |
12 |
12 |
13 enable_language(Pascal) |
13 enable_language(Pascal) |
14 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.inc.in ${CMAKE_CURRENT_BINARY_DIR}/config.inc) |
14 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.inc.in ${CMAKE_CURRENT_BINARY_DIR}/config.inc) |
15 |
|
16 #SOURCE AND PROGRAMS SECTION |
|
17 if(${BUILD_ENGINE_LIBRARY}) |
|
18 set(engine_output_name "${CMAKE_SHARED_LIBRARY_PREFIX}hwengine${CMAKE_SHARED_LIBRARY_SUFFIX}") |
|
19 set(hwengine_project hwLibrary.pas) |
|
20 else() |
|
21 set(engine_output_name "hwengine${CMAKE_EXECUTABLE_SUFFIX}") |
|
22 endif() |
|
23 |
15 |
24 if (APPLE) |
16 if (APPLE) |
25 set(required_fpc_version 2.6) |
17 set(required_fpc_version 2.6) |
26 else() |
18 else() |
27 set(required_fpc_version 2.2) |
19 set(required_fpc_version 2.2) |
119 if(powerpc_build) |
111 if(powerpc_build) |
120 set(powerpc_build "powerpc") |
112 set(powerpc_build "powerpc") |
121 endif() |
113 endif() |
122 |
114 |
123 #on OSX we need to provide the SDL_main() function when building as executable |
115 #on OSX we need to provide the SDL_main() function when building as executable |
124 if(NOT ${BUILD_ENGINE_LIBRARY}) |
116 if(NOT BUILD_ENGINE_LIBRARY) |
125 add_subdirectory(sdlmain) |
117 add_subdirectory(sdlmain) |
126 add_flag_append(CMAKE_Pascal_FLAGS -Fl${LIBRARY_OUTPUT_PATH}) |
118 add_flag_append(CMAKE_Pascal_FLAGS -Fl${LIBRARY_OUTPUT_PATH}) |
127 endif() |
119 endif() |
128 endif(APPLE) |
120 endif(APPLE) |
129 |
121 |
162 add_flag_append(CMAKE_Pascal_FLAGS -Pi386) |
154 add_flag_append(CMAKE_Pascal_FLAGS -Pi386) |
163 endif() |
155 endif() |
164 |
156 |
165 |
157 |
166 if(BUILD_ENGINE_LIBRARY) |
158 if(BUILD_ENGINE_LIBRARY) |
167 message(${WARNING} "Engine will be built as library (experimental)") |
|
168 add_definitions(-dHWLIBRARY) |
|
169 |
|
170 # due to compiler/linker issues on Max OS X 10.6 -k-no_order_inits is needed to avoid linking fail |
|
171 if(APPLE AND current_macosx_version VERSION_GREATER "10.5") |
|
172 add_flag_append(CMAKE_Pascal_FLAGS "-k-no_order_inits") |
|
173 endif() |
|
174 set(destination_dir ${target_library_install_dir}) |
|
175 else(BUILD_ENGINE_LIBRARY) |
159 else(BUILD_ENGINE_LIBRARY) |
176 set(destination_dir ${target_binary_install_dir}) |
|
177 endif(BUILD_ENGINE_LIBRARY) |
160 endif(BUILD_ENGINE_LIBRARY) |
178 |
161 |
179 |
162 |
180 if(HAVE_MIXINIT) |
163 if(HAVE_MIXINIT) |
181 add_definitions(-dSDL_MIXER_NEWER) |
164 add_definitions(-dSDL_MIXER_NEWER) |
184 if(HAVE_IMGINIT) |
167 if(HAVE_IMGINIT) |
185 add_definitions(-dSDL_IMAGE_NEWER) |
168 add_definitions(-dSDL_IMAGE_NEWER) |
186 endif(HAVE_IMGINIT) |
169 endif(HAVE_IMGINIT) |
187 |
170 |
188 add_definitions(-dDEBUGFILE) |
171 add_definitions(-dDEBUGFILE) |
189 add_executable(hwengine ${engine_sources}) |
172 |
|
173 #SOURCE AND PROGRAMS SECTION |
|
174 if(BUILD_ENGINE_LIBRARY) |
|
175 message(${WARNING} "Engine will be built as library (experimental)") |
|
176 if(APPLE AND current_macosx_version VERSION_GREATER "10.5") |
|
177 # due to compiler/linker issues on Max OS X 10.6 -k-no_order_inits is needed to avoid linking fail |
|
178 add_flag_append(CMAKE_Pascal_FLAGS "-k-no_order_inits") |
|
179 endif() |
|
180 |
|
181 #workaround for missing <TARGET> support during object generation |
|
182 set(engine_output_name "${CMAKE_SHARED_LIBRARY_PREFIX}hwengine${CMAKE_SHARED_LIBRARY_SUFFIX}") |
|
183 set(destination_dir ${target_library_install_dir}) |
|
184 add_flags_prepend(CMAKE_Pascal_FLAGS "-o${LIBRARY_OUTPUT_PATH}/${engine_output_name}") |
|
185 |
|
186 add_definitions(-dHWLIBRARY) |
|
187 add_library(hwengine SHARED ${engine_sources} hwLibrary.pas) |
|
188 else() |
|
189 # no need to change name here because target has same name |
|
190 set(engine_output_name "hwengine${CMAKE_EXECUTABLE_SUFFIX}") |
|
191 set(destination_dir ${target_binary_install_dir}) |
|
192 add_executable(hwengine ${engine_sources}) |
|
193 endif() |
|
194 |
190 |
195 |
191 #when system Lua is not found we need to compile it before engine |
196 #when system Lua is not found we need to compile it before engine |
192 if(NOT LUA_FOUND) |
197 if(NOT LUA_FOUND) |
193 target_link_libraries(hwengine lua) |
198 target_link_libraries(hwengine lua) |
194 endif() |
199 endif() |
204 #TODO: convert avwrapper to .pas unit so we can skip this step |
209 #TODO: convert avwrapper to .pas unit so we can skip this step |
205 if(${FFMPEG_FOUND}) |
210 if(${FFMPEG_FOUND}) |
206 target_link_libraries(hwengine avwrapper) |
211 target_link_libraries(hwengine avwrapper) |
207 endif() |
212 endif() |
208 |
213 |
209 if(APPLE) |
214 if(APPLE AND NOT BUILD_ENGINE_LIBRARY) |
210 target_link_libraries(hwengine SDLmain) |
215 target_link_libraries(hwengine SDLmain) |
211 endif() |
216 endif() |
212 |
217 |
213 install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}" DESTINATION ${destination_dir}) |
218 install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}" DESTINATION ${destination_dir}) |