[AD] demo Mac OS X bundle |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On 2008-10-30, Peter Hull <peterhull90@xxxxxxxxxx> wrote:
>
> Can you help on my cmake problem
> (https://sourceforge.net/mailarchive/message.php?msg_name=8833de210810290415t51c9daa0oa50c4c51c7469dd5%40mail.gmail.com)?
>
> I need to be able to find out where cmake is putting the demo
> executable so my custom command can copy it into an osx bundle.
> (unless there's a better way?)
Like this? (compiled, not run)
I still have to check it has no adverse effects elsewhere.
Peter
Index: demo/CMakeLists.txt
===================================================================
--- demo/CMakeLists.txt (revision 11162)
+++ demo/CMakeLists.txt (working copy)
@@ -34,6 +34,9 @@
src/wave.cpp
)
+file(GLOB_RECURSE DEMO_GFX data/gfx/*.tga)
+file(GLOB_RECURSE DEMO_SFX data/sfx/*.ogg)
+
if(USE_CXX AND SUPPORT_FONT AND SUPPORT_KCM_AUDIO AND SUPPORT_ACODEC)
set_source_files_properties(${DEMO_SRCS} PROPERTIES LANGUAGE "CXX")
include_directories(
@@ -43,10 +46,18 @@
../addons/acodec
)
- add_executable(demo ${EXECUTABLE_TYPE} ${DEMO_SRCS})
+ if(APPLE)
+ set(DEMO_EXECUTABLE_TYPE MACOSX_BUNDLE)
+ else(APPLE)
+ set(DEMO_EXECUTABLE_TYPE "${EXECUTABLE_TYPE}")
+ endif(APPLE)
+
+ add_executable(demo ${DEMO_EXECUTABLE_TYPE} ${DEMO_SRCS}
+ ${DEMO_GFX} ${DEMO_SFX})
set_target_properties(demo PROPERTIES
COMPILE_FLAGS "${MAYBE_ALLEGRO_STATICLINK} ${WFLAGS} ${EXE_CFLAGS}"
)
+
target_link_libraries(demo
${FONT_LINK_WITH}
${IIO_LINK_WITH}
@@ -54,28 +65,22 @@
${AUDIO_LINK_WITH}
${LINK_WITH}
)
+
+ # Mac OS X bundle support.
+ set_target_properties(demo PROPERTIES
+ MACOSX_BUNDLE_COPYRIGHT "Copyright 2008 Allegro developers"
+ # etc.
+ )
+ set_source_files_properties(${DEMO_GFX} PROPERTIES
+ MACOSX_PACKAGE_LOCATION "Resources/data/gfx"
+ )
+ set_source_files_properties(${DEMO_SFX} PROPERTIES
+ MACOSX_PACKAGE_LOCATION "Resources/data/sfx"
+ )
+
else(USE_CXX AND SUPPORT_FONT AND SUPPORT_KCM_AUDIO AND SUPPORT_ACODEC)
message(STATUS "Not building demo")
endif(USE_CXX AND SUPPORT_FONT AND SUPPORT_KCM_AUDIO AND SUPPORT_ACODEC)
-if (MACOSX)
-FILE(GLOB_RECURSE GFX ${CMAKE_SOURCE_DIR}/demo/data/gfx/*.tga )
-FILE(GLOB_RECURSE SFX ${CMAKE_SOURCE_DIR}/demo/data/sfx/*.ogg)
-ADD_CUSTOM_COMMAND(TARGET demo
- POST_BUILD
- COMMAND install -d ${CMAKE_BINARY_DIR}/demo/Demo.app/Contents/Resources/data/sfx
- COMMAND install -d ${CMAKE_BINARY_DIR}/demo/Demo.app/Contents/Resources/data/gfx
- COMMAND install -d ${CMAKE_BINARY_DIR}/demo/Demo.app/Contents/MacOS
- COMMAND install ${CMAKE_BINARY_DIR}/demo/demo ${CMAKE_BINARY_DIR}/demo/Demo.app/Contents/MacOS
- COMMAND install ${CMAKE_SOURCE_DIR}/demo/Icon.icns ${CMAKE_BINARY_DIR}/demo/Demo.app/Contents/Resources
- COMMAND install ${CMAKE_SOURCE_DIR}/demo/Info.plist ${CMAKE_BINARY_DIR}/demo/Demo.app/Contents
- COMMAND install ${GFX} ${CMAKE_BINARY_DIR}/demo/Demo.app/Contents/Resources/data/gfx
- COMMAND install ${SFX} ${CMAKE_BINARY_DIR}/demo/Demo.app/Contents/Resources/data/sfx
- VERBATIM
-)
-
-endif (MACOSX)
-
#-----------------------------------------------------------------------------#
# vi: set ts=8 sts=4 sw=4 et:
-