Skip to content

Commit

Permalink
Added support for source tarballs
Browse files Browse the repository at this point in the history
  • Loading branch information
maths22 committed Dec 10, 2015
1 parent c62b00e commit 93e7715
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 31 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Debug/
Release/
tools/innosetup/Output

# Version file
version.cmake

# Qt Creator project file
CMakeLists.txt.user

Expand Down
64 changes: 33 additions & 31 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -172,36 +172,37 @@ ENDIF(NOT WIN32 OR WIN64)
#INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR})
#LINK_LIBRARIES(${ICONV_LIBRARY})

## Find revision of WC
MARK_AS_ADVANCED(GIT_EXECUTABLE)
FIND_PROGRAM(GIT_EXECUTABLE git)

IF(GIT_EXECUTABLE EQUAL "GIT_EXECUTABLE-NOTFOUND")
MESSAGE( SEND_ERROR "Cound not find GIT or valid version.cmake. Version information will be invalid." )
ENDIF(GIT_EXECUTABLE EQUAL "GIT_EXECUTABLE-NOTFOUND")

INCLUDE(GetGitRevisionDescription)
git_describe(VERSION_STRING "--tags")
STRING(REPLACE "v" "" VERSION_LIST ${VERSION_STRING})
STRING(REGEX REPLACE "(-|_|\\.)" ";" VERSION_LIST ${VERSION_LIST})

LIST(LENGTH VERSION_LIST VERSION_LIST_SIZE)

LIST(GET VERSION_LIST 0 MAJOR_VERSION_GIT)
LIST(GET VERSION_LIST 1 MINOR_VERSION_GIT)
LIST(GET VERSION_LIST 2 PATCH_VERSION_GIT)
SET(SUPERTUX_VERSION_MAJOR ${MAJOR_VERSION_GIT})
SET(SUPERTUX_VERSION_MINOR ${MINOR_VERSION_GIT})
SET(SUPERTUX_VERSION_PATCH ${PATCH_VERSION_GIT})

IF(${VERSION_LIST_SIZE} EQUAL 5)
LIST(GET VERSION_LIST 3 TWEAK_VERSION_GIT)
LIST(GET VERSION_LIST 4 GIT_HASH)

SET(SUPERTUX_VERSION_TWEAK ${TWEAK_VERSION_GIT})
ENDIF()

SET(SUPERTUX_VERSION ${VERSION_STRING})
IF(EXISTS "${CMAKE_SOURCE_DIR}/.git")
## Find revision of WC
MARK_AS_ADVANCED(GIT_EXECUTABLE)
FIND_PROGRAM(GIT_EXECUTABLE git)
IF(NOT GIT_EXECUTABLE EQUAL "GIT_EXECUTABLE-NOTFOUND")
INCLUDE(GetGitRevisionDescription)
git_describe(VERSION_STRING_GIT "--tags")
STRING(REPLACE "v" "" VERSION_LIST ${VERSION_STRING_GIT})
STRING(REGEX REPLACE "(-|_|\\.)" ";" VERSION_LIST ${VERSION_LIST})

LIST(LENGTH VERSION_LIST VERSION_LIST_SIZE)

LIST(GET VERSION_LIST 0 MAJOR_VERSION_GIT)
LIST(GET VERSION_LIST 1 MINOR_VERSION_GIT)
LIST(GET VERSION_LIST 2 PATCH_VERSION_GIT)

IF(${VERSION_LIST_SIZE} EQUAL 5)
LIST(GET VERSION_LIST 3 TWEAK_VERSION_GIT)
LIST(GET VERSION_LIST 4 GIT_HASH)
ENDIF()

CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/version.cmake.in" "${CMAKE_SOURCE_DIR}/version.cmake")
ENDIF(NOT GIT_EXECUTABLE EQUAL "GIT_EXECUTABLE-NOTFOUND")
ENDIF(EXISTS "${CMAKE_SOURCE_DIR}/.git")
IF(NOT EXISTS "${CMAKE_SOURCE_DIR}/version.cmake")
MESSAGE( SEND_ERROR "Cound not find GIT or valid version.cmake. Version information will be invalid." )
ENDIF(NOT EXISTS "${CMAKE_SOURCE_DIR}/version.cmake")
INCLUDE("${CMAKE_SOURCE_DIR}/version.cmake")


SET(SUPERTUX_VERSION ${SUPERTUX_VERSION_STRING})

configure_file(version.h.in ${CMAKE_BINARY_DIR}/version.h )

Expand Down Expand Up @@ -623,7 +624,7 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
SET(CPACK_BUNDLE_PLIST "${CMAKE_BINARY_DIR}/tools/darwin/info.plist")
SET(CPACK_BUNDLE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/data/images/engine/icons/supertux.icns")
SET(CPACK_BUNDLE_STARTUP_COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/tools/darwin/startup.sh")
SET(CPACK_DMG_VOLUME_NAME "SuperTux ${VERSION_STRING}")
SET(CPACK_DMG_VOLUME_NAME "SuperTux ${SUPERTUX_VERSION_STRING}")
SET(CPACK_DMG_DS_STORE "${CMAKE_CURRENT_SOURCE_DIR}/tools/darwin/DS_Store")
SET(CPACK_DMG_BACKGROUND_IMAGE "${CMAKE_CURRENT_SOURCE_DIR}/tools/darwin/background.png")
ENDIF()
Expand All @@ -634,6 +635,7 @@ SET(CPACK_PACKAGE_NAME "SuperTux")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Jump'n'Run Game featuring Tux")
SET(CPACK_PACKAGE_VENDOR "SuperTux Devel Team")
SET(CPACK_PACKAGE_CONTACT "SuperTux Devel Team <[email protected]>")
SET(CPACK_SOURCE_IGNORE_FILES "/\\\\.git/;/build/")
SET(CPACK_DEBIAN_PACKAGE_NAME "supertux2")
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.5), libgcc1 (>= 1:4.1), libgl1-mesa-glx | libgl1, libogg0 (>= 1.1.3), libopenal0a, libphysfs-1.0-0, libsdl-image1.2 (>= 1.2.5), libsdl1.2debian (>= 1.2.10-1), libstdc++6 (>= 4.1.2), libvorbis0a (>= 1.1.2), libvorbisfile3 (>= 1.1.2), libcurl3 (>= 7.16)")
SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION "Classic 2D jump 'n run sidescroller with Tux\n SuperTux is a classic 2D jump 'n run sidescroller game in a similar\n style like the original SuperMario games. This release of SuperTux\n features 9 enemies, 26 playable levels, software and OpenGL rendering\n modes, configurable joystick and keyboard input, new music and\n completely redone graphics.\n .\n This is a development snapshot of SuperTux. It may suffer from\n critical bugs and has not been fully tested. \n .\n Homepage: http://supertux.lethargik.org/")
Expand Down
5 changes: 5 additions & 0 deletions version.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
SET(SUPERTUX_VERSION_MAJOR ${MAJOR_VERSION_GIT})
SET(SUPERTUX_VERSION_MINOR ${MINOR_VERSION_GIT})
SET(SUPERTUX_VERSION_PATCH ${PATCH_VERSION_GIT})
SET(SUPERTUX_VERSION_TWEAK ${TWEAK_VERSION_GIT})
SET(SUPERTUX_VERSION_STRING ${VERSION_STRING_GIT})

0 comments on commit 93e7715

Please sign in to comment.