mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 15:22:15 +00:00
Added support for Cocoa back-end in CMake build system
This commit is contained in:
parent
e12f860f1b
commit
177112603d
1 changed files with 71 additions and 8 deletions
|
@ -26,6 +26,8 @@ endif( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
|
||||||
|
|
||||||
option( DYN_FLUIDSYNTH "Dynamically load fluidsynth" ON )
|
option( DYN_FLUIDSYNTH "Dynamically load fluidsynth" ON )
|
||||||
|
|
||||||
|
option( OSX_COCOA_BACKEND "Use native Cocoa backend instead of SDL" OFF )
|
||||||
|
|
||||||
if( CMAKE_SIZEOF_VOID_P MATCHES "8" )
|
if( CMAKE_SIZEOF_VOID_P MATCHES "8" )
|
||||||
set( X64 64 )
|
set( X64 64 )
|
||||||
endif( CMAKE_SIZEOF_VOID_P MATCHES "8" )
|
endif( CMAKE_SIZEOF_VOID_P MATCHES "8" )
|
||||||
|
@ -211,7 +213,9 @@ else( WIN32 )
|
||||||
if( NOT SDL_FOUND )
|
if( NOT SDL_FOUND )
|
||||||
message( SEND_ERROR "SDL is required for building." )
|
message( SEND_ERROR "SDL is required for building." )
|
||||||
endif( NOT SDL_FOUND )
|
endif( NOT SDL_FOUND )
|
||||||
set( ZDOOM_LIBS ${ZDOOM_LIBS} "${SDL_LIBRARY}" )
|
if( NOT APPLE OR NOT OSX_COCOA_BACKEND )
|
||||||
|
set( ZDOOM_LIBS ${ZDOOM_LIBS} "${SDL_LIBRARY}" )
|
||||||
|
endif( NOT APPLE OR NOT OSX_COCOA_BACKEND )
|
||||||
include_directories( "${SDL_INCLUDE_DIR}" )
|
include_directories( "${SDL_INCLUDE_DIR}" )
|
||||||
|
|
||||||
find_path( FPU_CONTROL_DIR fpu_control.h )
|
find_path( FPU_CONTROL_DIR fpu_control.h )
|
||||||
|
@ -555,23 +559,62 @@ set( PLAT_WIN32_SOURCES
|
||||||
win32/i_system.cpp
|
win32/i_system.cpp
|
||||||
win32/st_start.cpp
|
win32/st_start.cpp
|
||||||
win32/win32video.cpp )
|
win32/win32video.cpp )
|
||||||
set( PLAT_SDL_SOURCES
|
set( PLAT_SDL_SYSTEM_SOURCES
|
||||||
sdl/crashcatcher.c
|
sdl/crashcatcher.c
|
||||||
sdl/hardware.cpp
|
sdl/hardware.cpp
|
||||||
sdl/i_cd.cpp
|
sdl/i_cd.cpp
|
||||||
sdl/i_cursor.cpp
|
|
||||||
sdl/i_input.cpp
|
|
||||||
sdl/i_joystick.cpp
|
|
||||||
sdl/i_main.cpp
|
sdl/i_main.cpp
|
||||||
sdl/i_movie.cpp
|
sdl/i_movie.cpp
|
||||||
sdl/i_system.cpp
|
sdl/i_system.cpp
|
||||||
sdl/i_timer.cpp
|
|
||||||
sdl/sdlvideo.cpp
|
sdl/sdlvideo.cpp
|
||||||
sdl/st_start.cpp )
|
sdl/st_start.cpp )
|
||||||
|
set( PLAT_SDL_INPUT_SOURCES
|
||||||
|
sdl/i_cursor.cpp
|
||||||
|
sdl/i_input.cpp
|
||||||
|
sdl/i_joystick.cpp
|
||||||
|
sdl/i_timer.cpp )
|
||||||
set( PLAT_MAC_SOURCES
|
set( PLAT_MAC_SOURCES
|
||||||
sdl/SDLMain.m
|
|
||||||
sdl/iwadpicker_cocoa.mm
|
sdl/iwadpicker_cocoa.mm
|
||||||
sdl/i_system_cocoa.mm )
|
sdl/i_system_cocoa.mm )
|
||||||
|
set( PLAT_COCOA_SOURCES
|
||||||
|
cocoa/HID_Config_Utilities.c
|
||||||
|
cocoa/HID_Error_Handler.c
|
||||||
|
cocoa/HID_Name_Lookup.c
|
||||||
|
cocoa/HID_Queue_Utilities.c
|
||||||
|
cocoa/HID_Utilities.c
|
||||||
|
cocoa/IOHIDDevice_.c
|
||||||
|
cocoa/IOHIDElement_.c
|
||||||
|
cocoa/ImmrHIDUtilAddOn.c
|
||||||
|
cocoa/i_backend_cocoa.mm
|
||||||
|
cocoa/i_joystick.cpp
|
||||||
|
cocoa/i_timer.cpp
|
||||||
|
cocoa/zdoom.icns )
|
||||||
|
|
||||||
|
if( APPLE )
|
||||||
|
if( OSX_COCOA_BACKEND )
|
||||||
|
find_program( IBTOOL ibtool HINTS "/usr/bin" "${OSX_DEVELOPER_ROOT}/usr/bin" )
|
||||||
|
if( ${IBTOOL} STREQUAL "IBTOOL-NOTFOUND" )
|
||||||
|
message( SEND_ERROR "ibtool can not be found to compile xib files." )
|
||||||
|
endif( ${IBTOOL} STREQUAL "IBTOOL-NOTFOUND" )
|
||||||
|
|
||||||
|
set( NIB_FILE "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/zdoom.dir/zdoom.nib" )
|
||||||
|
add_custom_command( OUTPUT "${NIB_FILE}"
|
||||||
|
COMMAND ${IBTOOL} --errors --warnings --notices --output-format human-readable-text
|
||||||
|
--compile "${NIB_FILE}" "${CMAKE_CURRENT_SOURCE_DIR}/cocoa/zdoom.xib"
|
||||||
|
COMMENT "Compiling zdoom.xib" )
|
||||||
|
|
||||||
|
set( PLAT_SDL_SOURCES ${PLAT_SDL_SYSTEM_SOURCES} ${PLAT_COCOA_SOURCES} "${NIB_FILE}" "${FMOD_LIBRARY}" )
|
||||||
|
|
||||||
|
set_source_files_properties( "${NIB_FILE}" PROPERTIES MACOSX_PACKAGE_LOCATION Resources )
|
||||||
|
else( OSX_COCOA_BACKEND )
|
||||||
|
set( PLAT_SDL_SOURCES ${PLAT_SDL_SYSTEM_SOURCES} ${PLAT_SDL_INPUT_SOURCES} "${FMOD_LIBRARY}" )
|
||||||
|
set( PLAT_MAC_SOURCES ${PLAT_MAC_SOURCES} sdl/SDLMain.m )
|
||||||
|
endif( OSX_COCOA_BACKEND )
|
||||||
|
|
||||||
|
set_source_files_properties( cocoa/zdoom.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources )
|
||||||
|
set_source_files_properties( "${FMOD_LIBRARY}" PROPERTIES MACOSX_PACKAGE_LOCATION Frameworks )
|
||||||
|
endif( APPLE )
|
||||||
|
|
||||||
if( WIN32 )
|
if( WIN32 )
|
||||||
set( SYSTEM_SOURCES_DIR win32 )
|
set( SYSTEM_SOURCES_DIR win32 )
|
||||||
set( SYSTEM_SOURCES ${PLAT_WIN32_SOURCES} )
|
set( SYSTEM_SOURCES ${PLAT_WIN32_SOURCES} )
|
||||||
|
@ -773,7 +816,7 @@ set( NOT_COMPILED_SOURCE_FILES
|
||||||
asm_x86_64/tmap3.s
|
asm_x86_64/tmap3.s
|
||||||
)
|
)
|
||||||
|
|
||||||
add_executable( zdoom WIN32
|
add_executable( zdoom WIN32 MACOSX_BUNDLE
|
||||||
${HEADER_FILES}
|
${HEADER_FILES}
|
||||||
${NOT_COMPILED_SOURCE_FILES}
|
${NOT_COMPILED_SOURCE_FILES}
|
||||||
__autostart.cpp
|
__autostart.cpp
|
||||||
|
@ -1165,6 +1208,25 @@ if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
|
||||||
endif( SSE_MATTERS )
|
endif( SSE_MATTERS )
|
||||||
endif( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
|
endif( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
|
||||||
|
|
||||||
|
if( APPLE )
|
||||||
|
set_target_properties(zdoom PROPERTIES
|
||||||
|
LINK_FLAGS "-framework Cocoa -framework IOKit -framework OpenGL"
|
||||||
|
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/cocoa/zdoom-info.plist" )
|
||||||
|
|
||||||
|
# Fix fmod link so that it can be found in the app bundle.
|
||||||
|
find_program( OTOOL otool HINTS "/usr/bin" "${OSX_DEVELOPER_ROOT}/usr/bin" )
|
||||||
|
find_program( INSTALL_NAME_TOOL install_name_tool HINTS "/usr/bin" "${OSX_DEVELOPER_ROOT}/usr/bin" )
|
||||||
|
execute_process( COMMAND "${OTOOL}" -L "${FMOD_LIBRARY}"
|
||||||
|
COMMAND grep "libfmodex.dylib (compat"
|
||||||
|
COMMAND head -n1
|
||||||
|
COMMAND awk "{print $1}"
|
||||||
|
OUTPUT_VARIABLE FMOD_LINK
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE )
|
||||||
|
add_custom_command( TARGET zdoom POST_BUILD
|
||||||
|
COMMAND "${INSTALL_NAME_TOOL}" -change "${FMOD_LINK}" @executable_path/../Frameworks/libfmodex.dylib "$<TARGET_FILE:zdoom>"
|
||||||
|
COMMENT "Relinking FMOD Ex" )
|
||||||
|
endif( APPLE )
|
||||||
|
|
||||||
source_group("Assembly Files\\ia32" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/asm_ia32/.+")
|
source_group("Assembly Files\\ia32" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/asm_ia32/.+")
|
||||||
source_group("Assembly Files\\x86_64" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/asm_x86_64/.+")
|
source_group("Assembly Files\\x86_64" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/asm_x86_64/.+")
|
||||||
source_group("Audio Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sound/.+")
|
source_group("Audio Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sound/.+")
|
||||||
|
@ -1172,6 +1234,7 @@ source_group("Audio Files\\OPL Synth" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURC
|
||||||
source_group("Audio Files\\OPL Synth\\DOSBox" FILES oplsynth/dosbox/opl.cpp oplsynth/dosbox/opl.h)
|
source_group("Audio Files\\OPL Synth\\DOSBox" FILES oplsynth/dosbox/opl.cpp oplsynth/dosbox/opl.h)
|
||||||
source_group("Audio Files\\Timidity\\Headers" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/timidity/.+\\.h$")
|
source_group("Audio Files\\Timidity\\Headers" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/timidity/.+\\.h$")
|
||||||
source_group("Audio Files\\Timidity\\Source" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/timidity/.+\\.cpp$")
|
source_group("Audio Files\\Timidity\\Source" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/timidity/.+\\.cpp$")
|
||||||
|
source_group("Cocoa Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/cocoa/.+")
|
||||||
source_group("Decorate++" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/thingdef/.+")
|
source_group("Decorate++" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/thingdef/.+")
|
||||||
source_group("FraggleScript" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/fragglescript/.+")
|
source_group("FraggleScript" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/fragglescript/.+")
|
||||||
source_group("Games\\Doom Game" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/g_doom/.+")
|
source_group("Games\\Doom Game" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/g_doom/.+")
|
||||||
|
|
Loading…
Reference in a new issue