mirror of
https://github.com/SFML/SFML.git
synced 2024-12-01 15:51:04 +08:00
2a083ea202
Removes Xcode project Fixes a crash and Silences system alerts in this example
64 lines
2.2 KiB
CMake
64 lines
2.2 KiB
CMake
|
|
set(SRCROOT ${PROJECT_SOURCE_DIR}/examples/cocoa)
|
|
|
|
# all source files
|
|
set(SRC ${SRCROOT}/CocoaAppDelegate.h
|
|
${SRCROOT}/CocoaAppDelegate.mm
|
|
${SRCROOT}/NSString+stdstring.h
|
|
${SRCROOT}/NSString+stdstring.mm
|
|
${SRCROOT}/main.m)
|
|
|
|
# all XIB files
|
|
set(XIBS MainMenu)
|
|
|
|
# all resource files
|
|
set(RESOURCES ${SRCROOT}/resources/logo.png
|
|
${SRCROOT}/resources/icon.icns
|
|
${SRCROOT}/resources/blue.png
|
|
${SRCROOT}/resources/green.png
|
|
${SRCROOT}/resources/red.png
|
|
${SRCROOT}/resources/Credits.rtf)
|
|
|
|
# define the cocoa target and customize it
|
|
add_executable(cocoa MACOSX_BUNDLE ${SRC} ${RESOURCES})
|
|
set_source_files_properties(${RESOURCES} PROPERTIES
|
|
MACOSX_PACKAGE_LOCATION Resources)
|
|
set_target_properties(cocoa PROPERTIES
|
|
MACOSX_BUNDLE_INFO_PLIST ${SRCROOT}/resources/Cocoa-Info.plist)
|
|
target_link_libraries(cocoa "-framework Cocoa -framework Foundation"
|
|
sfml-system sfml-window sfml-graphics)
|
|
|
|
# compile XIB files
|
|
find_program(IBTOOL ibtool HINTS "/usr/bin" "${OSX_DEVELOPER_ROOT}/usr/bin")
|
|
if(${IBTOOL} STREQUAL "IBTOOL-NOTFOUND")
|
|
message(FATAL_ERROR "ibtool is required to compile .xib files but wasn't found.")
|
|
endif()
|
|
set(RESOURCE_PATH "cocoa.app/Contents/Resources")
|
|
set(XIB_OUTPUT_PATH "${RESOURCE_PATH}/")
|
|
set(XIB_INPUT_PATH "${SRCROOT}/")
|
|
foreach(XIB ${XIBS})
|
|
add_custom_command(TARGET cocoa
|
|
POST_BUILD
|
|
COMMAND ${IBTOOL} --errors
|
|
--output-format human-readable-text
|
|
--compile ${XIB_OUTPUT_PATH}/${XIB}.nib
|
|
${XIB_INPUT_PATH}/${XIB}.xib
|
|
COMMENT "Compiling ${XIB}.xib")
|
|
# deactivated options : --warnings --notices
|
|
endforeach()
|
|
|
|
# add install rule
|
|
install(TARGETS cocoa
|
|
BUNDLE DESTINATION ${INSTALL_MISC_DIR}/examples/cocoa
|
|
COMPONENT examples)
|
|
|
|
#
|
|
# define the cocoa target
|
|
# sfml_add_example is not compatible with application bundles !
|
|
#
|
|
#sfml_add_example(cocoa
|
|
# SOURCES ${SRC}
|
|
# DEPENDS sfml-system sfml-window sfml-graphics)
|
|
#
|
|
|