aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-07-26 14:33:12 +0000
committertobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-07-26 14:33:12 +0000
commit3e61ccc391546f50b7a57f19d9ec3321c4ea4f5c (patch)
treecc9c1d6f1ec973432450daac9991fe533a9b1e51
parent9573122ba337c1f5f6b9937b24f7c4ad2aacbe3f (diff)
downloadusdx-3e61ccc391546f50b7a57f19d9ec3321c4ea4f5c.tar.gz
usdx-3e61ccc391546f50b7a57f19d9ec3321c4ea4f5c.tar.xz
usdx-3e61ccc391546f50b7a57f19d9ec3321c4ea4f5c.zip
some cmake changes
- everything finished except mac os x bundle creation git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@1930 b956fd51-792f-4845-bead-9b4dfca2ff2c
-rw-r--r--cmake/CMakeLists.txt111
-rw-r--r--cmake/artwork/.PLACEHOLDER2
-rw-r--r--cmake/dists/cmake/Modules/FindPPC.cmake9
-rw-r--r--cmake/dists/cmake/Modules/MacOSXBundle.cmake99
-rw-r--r--cmake/dists/gentoo/ultrastardx-1.1.0_alpha1.ebuild (renamed from cmake/dists/gentoo/ultrastardx-1.1_alpha.ebuild)39
-rw-r--r--cmake/dists/gentoo/ultrastardx-9999.ebuild47
-rw-r--r--cmake/game/plugins/.PLACEHOLDER2
-rw-r--r--cmake/game/visuals/.PLACEHOLDER2
-rw-r--r--cmake/src/CMakeLists.txt81
9 files changed, 259 insertions, 133 deletions
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index ddd76c6f..ee983d08 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -34,7 +34,7 @@ set(CPACK_PACKAGE_VERSION_MAJOR "1")
set(CPACK_PACKAGE_VERSION_MINOR "1")
set(CPACK_PACKAGE_VERSION_PATCH "0")
-set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
+set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}_alpha1")
set(PACKAGE_WEBSITE "http://www.ultrastardeluxe.org/")
set(PACKAGE_IRC "#ultrastardx at quakenet.org")
@@ -161,14 +161,28 @@ endif(NOT WIN32)
add_subdirectory(src)
add_subdirectory(plugins)
+macro(add_configuration_target target build_type)
+ADD_CUSTOM_TARGET(${target}
+ COMMAND ${CMAKE_COMMAND} -E chdir ${PROJECT_BINARY_DIR}
+ ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE:STRING=${build_type} ${PROJECT_SOURCE_DIR}
+ COMMAND ${CMAKE_BUILD_TOOL}
+ COMMAND ${CMAKE_COMMAND} -E echo "Configuration switched: ${build_type}"
+)
+endmacro()
+
+# convenience targets to switch between debug and release configuration
+add_configuration_target(debug Debug)
+add_configuration_target(release Release)
+
##
# INSTALLATION
##
-get_target_property(usdx_exe ultrastardx PASCAL_LOCATION)
-install(PROGRAMS ${usdx_exe} DESTINATION bin)
+set(BINDIR "bin" CACHE STRING "Where to install binaries. Either relative to CMAKE_INSTALL_PREFIX or absolute.")
+set(DATADIR "share/ultrastardx" CACHE STRING "Where to install game content. Either relative to CMAKE_INSTALL_PREFIX or absolute.")
-set(USDX_INSTALL_DATA_DIR share/ultrastardx)
+get_target_property(usdx_exe ultrastardx PASCAL_LOCATION)
+install(PROGRAMS ${usdx_exe} DESTINATION ${BINDIR})
install(
DIRECTORY
@@ -179,44 +193,26 @@ install(
game/resources
game/sounds
game/themes
- DESTINATION ${USDX_INSTALL_DATA_DIR}
+ DESTINATION ${DATADIR}
PATTERN .svn EXCLUDE
+ PATTERN .PLACEHOLDER EXCLUDE
)
install(
DIRECTORY ${USDX_PLUGIN_DIR}
- DESTINATION ${USDX_INSTALL_DATA_DIR}
+ DESTINATION ${DATADIR}
USE_SOURCE_PERMISSIONS
PATTERN .svn EXCLUDE
+ PATTERN .PLACEHOLDER EXCLUDE
)
install(
FILES
COPYING.txt
- DESTINATION ${USDX_INSTALL_DATA_DIR}
+ DESTINATION ${DATADIR}
)
-# install fink libs
-if(APPLE)
- if(EXISTS ${usdx_exe})
- include(AnalyzeDylibDeps)
- analyze_dylib_deps(${usdx_exe} libdeps)
- set(USDX_DYLIB_DIR ${CMAKE_CURRENT_BINARY_DIR}/dylib)
-
- # install() does not follow symlinks so we have to copy the libs at cmake time
- file(MAKE_DIRECTORY ${USDX_DYLIB_DIR})
- foreach(dylib ${libdeps})
- get_filename_component(dylib_name ${dylib} NAME)
- file_copy_if_different(${dylib} ${USDX_DYLIB_DIR}/${dylib_name})
- endforeach()
-
- install(DIRECTORY ${USDX_DYLIB_DIR}/ DESTINATION dylib USE_SOURCE_PERMISSIONS)
- else()
- message("
-!! To create a Mac OS X bundle, first compile with
-!! \"make\" then
-!! reconfigure with cmake (e.g. \"cmake ..\") and finally call
-!! \"cpack -G Bundle\"
-")
- endif()
-endif(APPLE)
+
+#if(APPLE)
+ include(MacOSXBundle)
+#endif(APPLE)
# add "uninstall" target
# See: http://www.vtk.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F
@@ -233,71 +229,62 @@ ADD_CUSTOM_TARGET(uninstall
# CPACK
##
-#if(DEFINED DATA_INSTALL_DIR)
-# set(SHAREPATH ${DATA_INSTALL_DIR}/ultrastardx/)
-#else(DEFINED DATA_INSTALL_DIR)
-# set(SHAREPATH share/ultrastardx/)
-#endif(DEFINED DATA_INSTALL_DIR)
-#set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
-
# CPack vars
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Karaoke program that evaluates your performance")
set(CPACK_PACKAGE_VENDOR "UltraStar Deluxe Team")
set(CPACK_PACKAGE_FILE_NAME "ultrastardx-${CPACK_PACKAGE_VERSION}")
-set(CPACK_SOURCE_PACKAGE_FILE_NAME "ultrastardx-src-${CPACK_PACKAGE_VERSION}")
-set(CPACK_SOURCE_GENERATOR "TBZ2")
set(CPACK_PACKAGE_EXECUTABLES "ultrastardx" "ultrastardx")
-set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.txt")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "ultrastardx ${CPACK_PACKAGE_VERSION}")
-
-if(APPLE)
- set(CPACK_BUNDLE_NAME UltraStarDeluxe)
- set(CPACK_BUNDLE_ICON ${CMAKE_CURRENT_SOURCE_DIR}/icons/ultrastardx.icns)
- set(CPACK_BUNDLE_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/src/macosx/Info.plist)
- set(CPACK_BUNDLE_STARTUP_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/dists/bundle-startup.sh)
- #CPACK_PACKAGE_ICON
-endif(APPLE)
+set(CPACK_SOURCE_PACKAGE_FILE_NAME "ultrastardx-${CPACK_PACKAGE_VERSION}-src")
+set(CPACK_SOURCE_GENERATOR "TGZ")
+set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.txt")
if(WIN32 AND NOT UNIX)
- set(CPACK_NSIS_DISPLAY_NAME "Ultrastar Deluxe")
+ set(CPACK_NSIS_DISPLAY_NAME "UltraStar Deluxe")
set(CPACK_NSIS_HELP_LINK ${PACKAGE_WEBSITE})
set(CPACK_NSIS_URL_INFO_ABOUT ${PACKAGE_WEBSITE})
set(CPACK_NSIS_CONTACT "help@ultrastardx.org")
set(CPACK_NSIS_MODIFY_PATH OFF)
set(CPACK_GENERATOR "ZIP;NSIS")
else(WIN32 AND NOT UNIX)
- set(CPACK_STRIP_FILES "bin/ultrastardx")
+ set(CPACK_STRIP_FILES TRUE)
endif(WIN32 AND NOT UNIX)
+
set(CPACK_SOURCE_IGNORE_FILES
"~"
"\\\\.svn"
+ "\\\\.history"
"\\\\.exe$"
"\\\\.a$"
"\\\\.dll$"
"\\\\.dof$"
- "\\\\.cmake$"
"\\\\.zip$"
"\\\\.gz$"
"\\\\.bz2$"
"\\\\.tmp$"
- "\\\\.sh$"
"\\\\.dcu$"
"\\\\.ppu$"
"\\\\.o$"
- "Makefile"
+ "\\\\.obj$"
+ "link\\\\.res$"
"CMakeFiles"
- "debug"
- "release$"
- "Debug$"
- "Release$"
+ "Makefile$"
"CPack"
- "^${PROJECT_SOURCE_DIR}/bin/[a-z]"
- "^${PROJECT_SOURCE_DIR}/install_manifest.txt"
- "^${PROJECT_SOURCE_DIR}/CMakeCache.txt"
- "^${PROJECT_SOURCE_DIR}/ultrastardx\\\\."
+ "install_manifest\\\\.txt$"
+ "CMakeCache\\\\.txt$"
+ "^${PROJECT_SOURCE_DIR}/[^/]*\\\\.cmake$"
+ "^${PROJECT_SOURCE_DIR}/src/.*\\\\.cmake$"
+ "^${PROJECT_SOURCE_DIR}/plugins/.*\\\\.cmake$"
+ "^${PROJECT_SOURCE_DIR}/game/ultrastardx$"
+ "^${PROJECT_SOURCE_DIR}/src/paths\\\\.inc$"
+ "^${PROJECT_SOURCE_DIR}/src/config-[^w].*\\\\.inc$"
+ "^${PROJECT_SOURCE_DIR}/build/[^d]"
)
+if(NOT ${PROJECT_SOURCE_DIR} STREQUAL ${PROJECT_BINARY_DIR})
+ list(APPEND CPACK_SOURCE_IGNORE_FILES "^${PROJECT_BINARY_DIR}")
+endif()
include(CPack)
diff --git a/cmake/artwork/.PLACEHOLDER b/cmake/artwork/.PLACEHOLDER
new file mode 100644
index 00000000..e6e5ed81
--- /dev/null
+++ b/cmake/artwork/.PLACEHOLDER
@@ -0,0 +1,2 @@
+Placeholder for empty directories that might be ignored by "make package_source" otherwise.
+
diff --git a/cmake/dists/cmake/Modules/FindPPC.cmake b/cmake/dists/cmake/Modules/FindPPC.cmake
index 2c4f2da3..d016763f 100644
--- a/cmake/dists/cmake/Modules/FindPPC.cmake
+++ b/cmake/dists/cmake/Modules/FindPPC.cmake
@@ -88,7 +88,7 @@ foreach(once 1)
"$ENV{SystemDrive}/lazarus/fpc/*/bin/*"
"$ENV{ProgramFiles}/lazarus/fpc/*/bin/*"
)
- find_program(PASCAL_COMPILER fpc PATHS ${ppc_bin_path})
+ find_program(PASCAL_COMPILER NAMES fpc ppc386 ppc PATHS ${ppc_bin_path})
if(NOT PASCAL_COMPILER)
set(ppc_error "Executable not found")
break()
@@ -102,6 +102,7 @@ foreach(once 1)
execute_process(COMMAND ${PASCAL_COMPILER} -iV
OUTPUT_VARIABLE FPC_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
+ set(FPC_VERSION ${FPC_VERSION} CACHE INTERNAL "")
# check version
if(${current_pkg}_FIND_VERSION_EXACT)
@@ -121,16 +122,20 @@ foreach(once 1)
execute_process(COMMAND ${PASCAL_COMPILER} -iTO
OUTPUT_VARIABLE FPC_PLATFORM
OUTPUT_STRIP_TRAILING_WHITESPACE)
+ set(FPC_PLATFORM ${FPC_PLATFORM} CACHE INTERNAL "")
execute_process(COMMAND ${PASCAL_COMPILER} -iTP
OUTPUT_VARIABLE FPC_PROCESSOR
OUTPUT_STRIP_TRAILING_WHITESPACE)
+ set(FPC_PROCESSOR ${FPC_PROCESSOR} CACHE INTERNAL "")
execute_process(COMMAND ${PASCAL_COMPILER} -iSO
OUTPUT_VARIABLE FPC_CPLATFORM
OUTPUT_STRIP_TRAILING_WHITESPACE)
+ set(FPC_CPLATFORM ${FPC_CPLATFORM} CACHE INTERNAL "")
execute_process(COMMAND ${PASCAL_COMPILER} -iSP
OUTPUT_VARIABLE FPC_CPROCESSOR
OUTPUT_STRIP_TRAILING_WHITESPACE)
- set(FPC_TARGET "${FPC_PROCESSOR}-${FPC_PLATFORM}")
+ set(FPC_CPROCESSOR ${FPC_CPROCESSOR} CACHE INTERNAL "")
+ set(FPC_TARGET "${FPC_PROCESSOR}-${FPC_PLATFORM}" CACHE INTERNAL "")
##
# Compiler checks
diff --git a/cmake/dists/cmake/Modules/MacOSXBundle.cmake b/cmake/dists/cmake/Modules/MacOSXBundle.cmake
new file mode 100644
index 00000000..bffe8b1f
--- /dev/null
+++ b/cmake/dists/cmake/Modules/MacOSXBundle.cmake
@@ -0,0 +1,99 @@
+# otool: Mac OS X object file displaying tool
+find_program(OTOOL otool)
+# install_name_tool: Mac OS X tool to change dynamic shared library install names
+find_program(INSTALL_NAME_TOOL install_name_tool)
+# hdiutil: Mac OS X disk image tool
+find_program(HDIUTIL hdiutil)
+
+set(macosx_bundle_path "${PROJECT_BINARY_DIR}/UltraStarDeluxe.app/Contents")
+
+add_custom_target(macosx-switch-installdir
+ COMMAND mkdir -p "${macosx_bundle_path}"
+ COMMAND ${CMAKE_COMMAND}
+ -DCMAKE_INSTALL_DIR=${PROJECT_BINARY_DIR}
+ -DBINDIR=${macosx_bundle_path}/MacOS
+ -DDATADIR=${macosx_bundle_path}
+ ${PROJECT_SOURCE_DIR}
+)
+
+add_custom_target(macosx-app
+ COMMENT "Creating Mac OS X application"
+
+ COMMAND mkdir -p "${macosx_bundle_path}/Resources"
+
+ # copy the icon (MUST be done BEFORE info.plist is created)
+ COMMAND install "${PROJECT_SOURCE_DIR}/icons/ultrastardx.icns" "${macosx_bundle_path}/Resources/"
+ COMMAND install "${PROJECT_SOURCE_DIR}/src/macosx/Info.plist" "${macosx_bundle_path}/"
+
+ # copy the resources
+ COMMAND ${CMAKE_BUILD_TOOL} install
+
+ # create the song directory
+ COMMAND mkdir -p "${macosx_bundle_path}/songs"
+)
+add_dependencies(macosx-app macosx-switch-installdir all)
+
+
+#define install_osx_libraries
+# # copy the dylib and change its install names
+# $(shell $(INSTALL) -m 755 $(dylib) $(macosx_bundle_path)/MacOS)
+# $(shell $(INSTALL_NAME_TOOL) -change $(dylib) @executable_path/$(notdir $(dylib)) $(macosx_bundle_path)/MacOS/ultrastardx)
+# $(shell $(INSTALL_NAME_TOOL) -id @executable_path/$(notdir $(dylib)) $(macosx_bundle_path)/MacOS/$(notdir $(dylib)))
+# $(foreach linked_dylibs_2,$(shell $(OTOOL) -L $(dylib) | grep version | cut -f 1 -d ' ' | grep -v \/System\/Library | grep -v \usr\/lib | grep -v executable_path),$(rename_secondary_osx_libraries))
+#endef
+#
+#define rename_secondary_osx_libraries
+# $(shell $(INSTALL_NAME_TOOL) -change $(linked_dylibs_2) @executable_path/$(notdir $(linked_dylibs_2)) $(macosx_bundle_path)/MacOS/$(notdir $(dylib)))
+#endef
+#
+#$(foreach dylib,$(shell $(OTOOL) -L $(macosx_bundle_path)/MacOS/ultrastardx | grep version | cut -f 1 -d ' ' | grep -v \/System\/Library | grep -v \/usr\/lib),$(install_osx_libraries))
+#$(foreach dylib,$(shell $(OTOOL) -L /sw/lib/libavcodec.dylib | grep version | cut -f 1 -d ' ' | grep -v \/System\/Library | grep -v \/usr\/lib),$(install_osx_libraries))
+
+
+# Create double clickable standalone (does not need fink) Mac OS X
+# application. Not fully test, but should work on 10.5.
+add_custom_target(macosx-standalone-app
+ COMMENT "Creating standalone Mac OS X application"
+
+ # install fink libs
+
+ include(AnalyzeDylibDeps)
+ analyze_dylib_deps(${usdx_exe} libdeps)
+ set(USDX_DYLIB_DIR ${CMAKE_CURRENT_BINARY_DIR}/dylib)
+
+ # install() does not follow symlinks so we have to copy the libs at cmake time
+ file(MAKE_DIRECTORY ${USDX_DYLIB_DIR})
+ foreach(dylib ${libdeps})
+ get_filename_component(dylib_name ${dylib} NAME)
+ file_copy_if_different(${dylib} ${USDX_DYLIB_DIR}/${dylib_name})
+ endforeach()
+
+ install(DIRECTORY ${USDX_DYLIB_DIR}/ DESTINATION dylib USE_SOURCE_PERMISSIONS)
+)
+add_dependencies(macosx-standalone-app macosx-app)
+
+add_custom_target(macosx-dmg
+ COMMENT "Creating Mac OS X DMG-image"
+
+ COMMAND rm UltraStarDeluxe.dmg
+ COMMAND ${HDIUTIL} create -type SPARSE -size 100m -fs HFS+ -volname UltraStarDeluxe -ov -attach UltraStarDeluxe.sparseimage
+ COMMAND cp -R UltraStarDeluxe.app /Volumes/UltraStarDeluxe
+ #cp ultrastardx/icons/UltraStarDeluxeVolumeIcon.icns /Volumes/UltraStarDeluxe/.VolumeIcon.icns
+ #/Developer/Tools/SetFile -a C /Volumes/UltraStarDeluxe/.VolumeIcon.icns /Volumes/UltraStarDeluxe
+ COMMAND ${HDIUTIL} detach /Volumes/UltraStarDeluxe
+ COMMAND ${HDIUTIL} convert UltraStarDeluxe.sparseimage -format UDBZ -o UltraStarDeluxe.dmg
+ COMMAND rm UltraStarDeluxe.sparseimage
+)
+add_dependencies(macosx-dmg macosx-standalone-app)
+
+# remove Mac OS X apllication bundle and disk image
+add_custom_target(clean-macosx)
+add_dependencies(clean-macosx clean-macosx-app clean-macosx-dmg)
+
+add_custom_target(clean-macosx-app
+ COMMAND rm -r UltraStarDeluxe.app
+)
+
+add_custom_target(clean-macosx-dmg
+ COMMAND rm UltraStarDeluxe.dmg
+)
diff --git a/cmake/dists/gentoo/ultrastardx-1.1_alpha.ebuild b/cmake/dists/gentoo/ultrastardx-1.1.0_alpha1.ebuild
index 7170fcdb..2b2ea032 100644
--- a/cmake/dists/gentoo/ultrastardx-1.1_alpha.ebuild
+++ b/cmake/dists/gentoo/ultrastardx-1.1.0_alpha1.ebuild
@@ -2,7 +2,7 @@
# Distributed under the terms of the GNU General Public License v2
# $Header $
-inherit eutils games
+inherit cmake-utils games
SONGS_PKG=USDX-SongPackage
SONGS_VER=01
@@ -19,7 +19,7 @@ LICENSE="GPL-2
)"
SLOT="0"
KEYWORDS="~amd64 ~x86"
-IUSE="projectm debug songs"
+IUSE="projectm debug songs plugins"
RDEPEND="virtual/opengl
virtual/glu
@@ -33,33 +33,46 @@ RDEPEND="virtual/opengl
projectm? ( media-libs/libprojectm )"
DEPEND="${RDEPEND}
dev-util/pkgconfig
- >=dev-lang/fpc-2.2.0"
+ >=dev-lang/fpc-2.2.2"
S=${WORKDIR}/${P}-src
pkg_setup() {
- games_pkg_setup
- built_with_use media-libs/libsdl opengl \
- || die "You need to compile media-libs/libsdl with USE=opengl."
+ games_pkg_setup
+ built_with_use media-libs/libsdl opengl \
+ || die "You need to compile media-libs/libsdl with USE=opengl."
}
src_compile() {
- egamesconf \
- $(use_with projectm libprojectM) \
- $(use_enable debug) \
- || die
- emake || die "emake failed"
+ # set build-type as the "Gentoo" build-type does not work with
+ # Pascal (no optimization, etc.)
+ if use debug ; then
+ CMAKE_BUILD_TYPE="Debug"
+ else
+ CMAKE_BUILD_TYPE="Release"
+ fi
+
+ # set PREFIX so that CMAKE_INSTALL_PREFIX will be set to GAMES_PREFIX
+ PREFIX="${GAMES_PREFIX}"
+
+ # configure flags
+ local mycmakeargs="$(cmake-utils_use_enable projectm PROJECTM) \
+ $(cmake-utils_use_build plugins PLUGINS) \
+ -DBINDIR=${GAMES_BINDIR} \
+ -DDATADIR=${GAMES_DATADIR}/${PN}"
+
+ cmake-utils_src_compile
}
src_install() {
- emake DESTDIR="${D}" install || die "emake install failed"
+ cmake-utils_src_install
if use songs; then
insinto "${GAMES_DATADIR}"/${PN}/songs
doins -r ${WORKDIR}/Songs/* || die "doins songs failed"
fi
- dodoc AUTHORS.txt ChangeLog.german.txt ChangeLog.txt README.txt
+ dodoc AUTHORS.txt ChangeLog.GERMAN.txt ChangeLog.txt README.txt
doicon icons/${PN}-icon.svg
make_desktop_entry ${PN} "UltraStar Deluxe"
diff --git a/cmake/dists/gentoo/ultrastardx-9999.ebuild b/cmake/dists/gentoo/ultrastardx-9999.ebuild
index b1ffb5a4..51c8c91b 100644
--- a/cmake/dists/gentoo/ultrastardx-9999.ebuild
+++ b/cmake/dists/gentoo/ultrastardx-9999.ebuild
@@ -9,7 +9,7 @@ SONGS_VER=01
DESCRIPTION="An open-source karaoke game"
HOMEPAGE="http://www.ultrastardeluxe.org/"
-ESVN_REPO_URI="https://ultrastardx.svn.sourceforge.net/svnroot/ultrastardx/trunk"
+ESVN_REPO_URI="https://ultrastardx.svn.sourceforge.net/svnroot/ultrastardx/branches/experimental/cmake"
ESVN_PROJECT="ultrastardx"
SRC_URI="songs? ( mirror://sourceforge/${PN}/${SONGS_PKG}-${SONGS_VER}.zip )"
@@ -20,7 +20,7 @@ LICENSE="GPL-2
)"
SLOT="0"
KEYWORDS="~amd64 ~x86"
-IUSE="projectm debug songs"
+IUSE="projectm debug songs plugins"
RDEPEND="virtual/opengl
virtual/glu
@@ -39,45 +39,48 @@ DEPEND="${RDEPEND}
S=${WORKDIR}/${P}-src
pkg_setup() {
- games_pkg_setup
- built_with_use media-libs/libsdl opengl \
- || die "You need to compile media-libs/libsdl with USE=opengl."
+ games_pkg_setup
+ built_with_use media-libs/libsdl opengl \
+ || die "You need to compile media-libs/libsdl with USE=opengl."
}
src_unpack() {
- unpack ${A}
+ if use songs; then
+ unpack ${A}
+ fi
subversion_src_unpack
}
src_compile() {
- if use projectm ; then
- enable_projectm="ON"
- else
- enable_projectm="OFF"
- fi
+ # set build-type as the "Gentoo" build-type does not work with
+ # Pascal (no optimization, etc.)
if use debug ; then
- build_type="Debug"
+ CMAKE_BUILD_TYPE="Debug"
else
- build_type="Release"
+ CMAKE_BUILD_TYPE="Release"
fi
- cmake \
- -DCMAKE_BUILD_TYPE=$build_type \
- -DENABLE_PROJECTM=$enable_projectm \
- -DCMAKE_INSTALL_PREFIX="/usr" \
- . \
- || die "cmake failed"
- emake || die "emake failed"
+
+ # set PREFIX so that CMAKE_INSTALL_PREFIX will be set to GAMES_PREFIX
+ PREFIX="${GAMES_PREFIX}"
+
+ # configure flags
+ local mycmakeargs="$(cmake-utils_use_enable projectm PROJECTM) \
+ $(cmake-utils_use_build plugins PLUGINS) \
+ -DBINDIR=${GAMES_BINDIR} \
+ -DDATADIR=${GAMES_DATADIR}/${PN}"
+
+ cmake-utils_src_compile
}
src_install() {
- emake DESTDIR="${D}" install || die "emake install failed"
+ cmake-utils_src_install
if use songs; then
insinto "${GAMES_DATADIR}"/${PN}/songs
doins -r ${WORKDIR}/Songs/* || die "doins songs failed"
fi
- dodoc AUTHORS.txt ChangeLog.german.txt ChangeLog.txt README.txt
+ dodoc AUTHORS.txt ChangeLog.GERMAN.txt ChangeLog.txt README.txt
doicon icons/${PN}-icon.svg
make_desktop_entry ${PN} "UltraStar Deluxe"
diff --git a/cmake/game/plugins/.PLACEHOLDER b/cmake/game/plugins/.PLACEHOLDER
new file mode 100644
index 00000000..e6e5ed81
--- /dev/null
+++ b/cmake/game/plugins/.PLACEHOLDER
@@ -0,0 +1,2 @@
+Placeholder for empty directories that might be ignored by "make package_source" otherwise.
+
diff --git a/cmake/game/visuals/.PLACEHOLDER b/cmake/game/visuals/.PLACEHOLDER
new file mode 100644
index 00000000..e6e5ed81
--- /dev/null
+++ b/cmake/game/visuals/.PLACEHOLDER
@@ -0,0 +1,2 @@
+Placeholder for empty directories that might be ignored by "make package_source" otherwise.
+
diff --git a/cmake/src/CMakeLists.txt b/cmake/src/CMakeLists.txt
index 08a08197..df0006d3 100644
--- a/cmake/src/CMakeLists.txt
+++ b/cmake/src/CMakeLists.txt
@@ -10,31 +10,60 @@ add_subdirectory(lib)
pascal_configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.inc.in
${CMAKE_CURRENT_BINARY_DIR}/config-${FPC_PLATFORM}.inc)
-# To conform to the GNU Coding Standards, INSTALL_DATADIR is
-# not hardcoded at configure-time so $prefix and $datadir can be
-# changed at make-time.
-# Paths cannot be passed to fpc via -d as with gcc's -D parameter.
-# We use an intermediate file instead.
-# See [info autoconf], "19.5 How Do I `#define' Installation Directories?"
-file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/paths.inc
- "INSTALL_DATADIR = '${CMAKE_INSTALL_PREFIX}/share/ultrastardx';")
+# write path to shared data to paths.inc
+if(UNIX AND NOT APPLE)
+ if(IS_ABSOLUTE ${DATADIR})
+ set(usdx_install_datadir "${DATADIR}")
+ else()
+ set(usdx_install_datadir "${CMAKE_INSTALL_PREFIX}/${DATADIR}")
+ endif()
+ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/paths.inc
+ "INSTALL_DATADIR = '${usdx_install_datadir}';")
+endif()
##
# BUILD
##
+# includes used by ultrastardx
+set(usdx_includes
+ ${CMAKE_CURRENT_BINARY_DIR}/config-${FPC_PLATFORM}.inc
+)
+if(UNIX AND NOT APPLE)
+ list(APPEND usdx_includes ${CMAKE_CURRENT_BINARY_DIR}/paths.inc)
+endif()
+
+# packages by ultrastardx
+set(usdx_packages
+ collections
+ ffmpeg
+ fft
+ freetype
+ sdl
+ sdl_image
+ opengl
+ portaudio
+ portmixer
+ projectm
+ png
+ samplerate
+ sqlite3
+ zlib
+)
+if(WIN32)
+ list(APPEND usdx_packages bass midi)
+endif(WIN32)
#if(DELPHI)
-# PACKAGES ctypes
+# list(APPEND usdx_packages ctypes)
#endif(DELPHI)
-#if(WIN32)
-# PACKAGES bass midi
-#endif(WIN32)
-set(depends)
+# dependencies by ultrastardx
+set(usdx_depends)
if(libprojectM_USE_CWRAPPER)
- list(APPEND depends projectM-cwrapper)
-endif(libprojectM_USE_CWRAPPER)
+ list(APPEND usdx_depends projectM-cwrapper)
+endif()
+# add target for ultrastardx binary
pascal_add_module(ultrastardx ultrastardx.dpr
#FPC_FLAGS -Si -Cs2000000 # maybe set stack size?
OUTPUT_DIR ${USDX_GAME_DIR}
@@ -46,23 +75,7 @@ pascal_add_module(ultrastardx ultrastardx.dpr
screens/*.pas
lib/other/*.pas
../plugins/SDK/*.pas
- INCLUDES
- ${CMAKE_CURRENT_BINARY_DIR}/config-${FPC_PLATFORM}.inc
- ${CMAKE_CURRENT_BINARY_DIR}/paths.inc
- PACKAGES
- collections
- ffmpeg
- fft
- freetype
- sdl
- sdl_image
- opengl
- portaudio
- portmixer
- projectm
- png
- samplerate
- sqlite3
- zlib
- DEPENDS ${depends}
+ INCLUDES ${usdx_includes}
+ PACKAGES ${usdx_packages}
+ DEPENDS ${usdx_depends}
)