90 ${CMAKE_CURRENT_BINARY_DIR}/config.inc |
90 ${CMAKE_CURRENT_BINARY_DIR}/config.inc |
91 ) |
91 ) |
92 |
92 |
93 if(${BUILD_ENGINE_LIBRARY}) |
93 if(${BUILD_ENGINE_LIBRARY}) |
94 message(WARNING "Engine will be built as library (experimental)") |
94 message(WARNING "Engine will be built as library (experimental)") |
95 set(pascal_flags "-dHWLIBRARY" ${pascal_flags}) |
95 list(APPEND pascal_flags "-dHWLIBRARY") |
96 |
96 |
97 # create position independent code, only required for x68_64 builds, similar to -fPIC |
97 # create position independent code, only required for x68_64 builds, similar to -fPIC |
98 if(CMAKE_SIZEOF_VOID_P MATCHES "8") |
98 if(CMAKE_SIZEOF_VOID_P MATCHES "8") |
99 set(pascal_flags "-Cg" ${pascal_flags}) |
99 list(APPEND pascal_flags "-Cg") |
100 endif(CMAKE_SIZEOF_VOID_P MATCHES "8") |
100 endif(CMAKE_SIZEOF_VOID_P MATCHES "8") |
101 |
101 |
102 # due to compiler/linker issues on Max OS X 10.6 -k-no_order_inits is needed to avoid linking fail |
102 # due to compiler/linker issues on Max OS X 10.6 -k-no_order_inits is needed to avoid linking fail |
103 if(APPLE AND current_macosx_version VERSION_GREATER "10.5") |
103 if(APPLE AND current_macosx_version VERSION_GREATER "10.5") |
104 set(pascal_flags "-k-no_order_inits" ${pascal_flags}) |
104 list(APPEND pascal_flags "-k-no_order_inits") |
105 endif() |
105 endif() |
106 set(destination_dir ${target_library_install_dir}) |
106 set(destination_dir ${target_library_install_dir}) |
107 else(${BUILD_ENGINE_LIBRARY}) |
107 else(${BUILD_ENGINE_LIBRARY}) |
108 set(destination_dir ${target_binary_install_dir}) |
108 set(destination_dir ${target_binary_install_dir}) |
109 endif(${BUILD_ENGINE_LIBRARY}) |
109 endif(${BUILD_ENGINE_LIBRARY}) |
138 |
138 |
139 if(SDLMAIN_LIB MATCHES "SDLMAIN_LIB-NOTFOUND") |
139 if(SDLMAIN_LIB MATCHES "SDLMAIN_LIB-NOTFOUND") |
140 include_directories(${SDL_INCLUDE_DIR}) |
140 include_directories(${SDL_INCLUDE_DIR}) |
141 add_library (SDLmain STATIC SDLMain.m) |
141 add_library (SDLmain STATIC SDLMain.m) |
142 #add a dependency to the hwengine target |
142 #add a dependency to the hwengine target |
143 set(engine_sources ${engine_sources} SDLmain) |
143 list(APPEND engine_sources SDLmain) |
144 set(SDLMAIN_LIB "${LIBRARY_OUTPUT_PATH}/libSDLmain.a") |
144 set(SDLMAIN_LIB "${LIBRARY_OUTPUT_PATH}/libSDLmain.a") |
145 endif() |
145 endif() |
146 |
146 |
147 set(pascal_flags "-k${SDLMAIN_LIB}" ${pascal_flags}) |
147 list(APPEND pascal_flags "-k${SDLMAIN_LIB}") |
148 endif() |
148 endif() |
149 endif(APPLE) |
149 endif(APPLE) |
150 |
150 |
151 if(NOT NOPNG) |
151 if(NOT NOPNG) |
152 find_package(PNG) |
152 find_package(PNG) |
153 if(${PNG_FOUND}) |
153 if(${PNG_FOUND}) |
154 set(pascal_flags "-dPNG_SCREENSHOTS" ${pascal_flags}) |
154 list(APPEND pascal_flags "-dPNG_SCREENSHOTS") |
155 if(APPLE) # fpc png unit doesn't pull the library (see bug 21833) |
155 if(APPLE) # fpc png unit doesn't pull the library (see bug 21833) |
156 set(pascal_flags "-k${PNG_LIBRARY}" ${pascal_flags}) |
156 list(APPEND pascal_flags "-k${PNG_LIBRARY}") |
157 endif() |
157 endif() |
158 else() |
158 else() |
159 message(WARNING "Screenshots will be in BMP format because libpng was not found") |
159 message(WARNING "Screenshots will be in BMP format because libpng was not found") |
160 endif() |
160 endif() |
161 else() |
161 else() |
183 # fpc will take care of linking but we need to have this library installed |
183 # fpc will take care of linking but we need to have this library installed |
184 find_package(GLUT REQUIRED) |
184 find_package(GLUT REQUIRED) |
185 |
185 |
186 #TODO: convert avwrapper to .pas unit so we can skip this step |
186 #TODO: convert avwrapper to .pas unit so we can skip this step |
187 include_directories(${FFMPEG_INCLUDE_DIR}) |
187 include_directories(${FFMPEG_INCLUDE_DIR}) |
188 set(pascal_flags "-dUSE_VIDEO_RECORDING" ${pascal_flags}) |
188 list(APPEND pascal_flags "-dUSE_VIDEO_RECORDING") |
189 IF (WIN32) |
189 IF (WIN32) |
190 # there are some problems with linking our avwrapper as static lib, so link it as shared |
190 # there are some problems with linking our avwrapper as static lib, so link it as shared |
191 add_library(avwrapper SHARED avwrapper.c) |
191 add_library(avwrapper SHARED avwrapper.c) |
192 target_link_libraries(avwrapper ${FFMPEG_LIBRARIES}) |
192 target_link_libraries(avwrapper ${FFMPEG_LIBRARIES}) |
193 install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}avwrapper${CMAKE_SHARED_LIBRARY_SUFFIX}" DESTINATION ${target_library_install_dir}) |
193 install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}avwrapper${CMAKE_SHARED_LIBRARY_SUFFIX}" DESTINATION ${target_library_install_dir}) |
194 ELSE() |
194 ELSE() |
195 add_library(avwrapper STATIC avwrapper.c) |
195 add_library(avwrapper STATIC avwrapper.c) |
196 set(pascal_flags "-k${FFMPEG_LIBAVCODEC}" "-k${FFMPEG_LIBAVFORMAT}" "-k${FFMPEG_LIBAVUTIL}" ${pascal_flags}) |
196 list(APPEND pascal_flags "-k${FFMPEG_LIBAVCODEC}" "-k${FFMPEG_LIBAVFORMAT}" "-k${FFMPEG_LIBAVUTIL}") |
197 ENDIF() |
197 ENDIF() |
198 else() |
198 else() |
199 message(WARNING "Could NOT find FFMPEG/LibAV, video recording will be disabled") |
199 message(WARNING "Could NOT find FFMPEG/LibAV, video recording will be disabled") |
200 endif() |
200 endif() |
201 else() |
201 else() |
214 DEPENDS ${engine_sources} |
214 DEPENDS ${engine_sources} |
215 ) |
215 ) |
216 else() |
216 else() |
217 #these are the dependencies for building a universal binary on Mac OS X |
217 #these are the dependencies for building a universal binary on Mac OS X |
218 foreach (build_arch ${powerpc_build} ${i386_build} ${x86_64_build}) |
218 foreach (build_arch ${powerpc_build} ${i386_build} ${x86_64_build}) |
219 set(lipo_args_list "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}" ${lipo_args_list}) |
219 list(APPEND lipo_args_list "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}") |
220 add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}" |
220 add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}" |
221 COMMAND "${FPC_EXECUTABLE}" |
221 COMMAND "${FPC_EXECUTABLE}" |
222 ARGS ${fpc_flags} -ohwengine.${build_arch} -P${build_arch} |
222 ARGS ${fpc_flags} -ohwengine.${build_arch} -P${build_arch} |
223 MAIN_DEPENDENCY ${hwengine_project} |
223 MAIN_DEPENDENCY ${hwengine_project} |
224 DEPENDS ${engine_sources} |
224 DEPENDS ${engine_sources} |