mirror of
https://github.com/SFML/SFML.git
synced 2024-11-24 20:31:05 +08:00
Use built-in CMake project version functionality
This commit is contained in:
parent
60deef9997
commit
a322d18e63
@ -35,7 +35,9 @@ if(NOT CMAKE_OSX_SYSROOT)
|
||||
endif()
|
||||
|
||||
# project name
|
||||
project(SFML)
|
||||
project(SFML VERSION 3.0.0)
|
||||
|
||||
set(VERSION_IS_RELEASE OFF)
|
||||
|
||||
# include the configuration file
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Config.cmake)
|
||||
@ -45,12 +47,6 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Config.cmake)
|
||||
# https://cmake.org/cmake/help/v3.0/module/GNUInstallDirs.html
|
||||
include(GNUInstallDirs)
|
||||
|
||||
# setup version numbers
|
||||
set(VERSION_MAJOR 3)
|
||||
set(VERSION_MINOR 0)
|
||||
set(VERSION_PATCH 0)
|
||||
set(VERSION_IS_RELEASE OFF)
|
||||
|
||||
# add an option for choosing the build type (shared or static)
|
||||
if(NOT (SFML_OS_IOS OR SFML_OS_ANDROID))
|
||||
sfml_set_option(BUILD_SHARED_LIBS TRUE BOOL "TRUE to build SFML as shared libraries, FALSE to build it as static libraries")
|
||||
@ -347,10 +343,10 @@ else()
|
||||
# edit target properties
|
||||
set_target_properties(SFML PROPERTIES
|
||||
FRAMEWORK TRUE
|
||||
FRAMEWORK_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}
|
||||
FRAMEWORK_VERSION ${PROJECT_VERSION}
|
||||
MACOSX_FRAMEWORK_IDENTIFIER org.sfml-dev.SFML
|
||||
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}
|
||||
MACOSX_FRAMEWORK_BUNDLE_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}
|
||||
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${PROJECT_VERSION}
|
||||
MACOSX_FRAMEWORK_BUNDLE_VERSION ${PROJECT_VERSION}
|
||||
PUBLIC_HEADER "${SFML_HEADERS}")
|
||||
|
||||
# add the non-optional SFML headers
|
||||
@ -523,17 +519,17 @@ sfml_export_targets()
|
||||
|
||||
set(CPACK_PACKAGE_NAME_SUMMARY "Simple and Fast Multimedia Library")
|
||||
set(CPACK_PACKAGE_VENDOR "SFML Team")
|
||||
set(CPACK_PACKAGE_FILE_NAME "SFML-${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}-${CMAKE_CXX_COMPILER_ID}-${CMAKE_CXX_COMPILER_VERSION}-${CMAKE_BUILD_TYPE}")
|
||||
set(CPACK_PACKAGE_FILE_NAME "SFML-${PROJECT_VERSION}-${CMAKE_CXX_COMPILER_ID}-${CMAKE_CXX_COMPILER_VERSION}-${CMAKE_BUILD_TYPE}")
|
||||
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/readme.md")
|
||||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/license.md")
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}")
|
||||
set(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}")
|
||||
set(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}")
|
||||
set(CPACK_PACKAGE_INSTALL_DIRECTORY "SFML ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
|
||||
set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
|
||||
set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
|
||||
set(CPACK_PACKAGE_INSTALL_DIRECTORY "SFML ${PROJECT_VERSION}")
|
||||
set(CPACK_MONOLITHIC_INSTALL ON)
|
||||
|
||||
# NSIS configurations
|
||||
set(CPACK_NSIS_DISPLAY_NAME "SFML ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH} (${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION})")
|
||||
set(CPACK_NSIS_DISPLAY_NAME "SFML ${PROJECT_VERSION} (${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION})")
|
||||
set(CPACK_NSIS_CONTACT "team@sfml-dev.org")
|
||||
set(NSIS_IMAGE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/tools/nsis/")
|
||||
string(REGEX REPLACE "/" "\\\\\\\\" NSIS_IMAGE_PATH ${NSIS_IMAGE_PATH})
|
||||
|
@ -44,7 +44,7 @@ function(sfml_set_common_ios_properties target)
|
||||
MACOSX_BUNDLE TRUE # Bare executables are not usable on iOS, only bundle applications
|
||||
MACOSX_BUNDLE_GUI_IDENTIFIER "org.sfml-dev.${target}" # If missing, trying to launch an example in simulator will make Xcode < 9.3 crash
|
||||
MACOSX_BUNDLE_BUNDLE_NAME "${target}"
|
||||
MACOSX_BUNDLE_LONG_VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}"
|
||||
MACOSX_BUNDLE_LONG_VERSION_STRING "${PROJECT_VERSION}"
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
@ -88,7 +88,7 @@ macro(sfml_add_library module)
|
||||
if(SFML_OS_WINDOWS)
|
||||
# include the major version number in Windows shared library names (but not import library names)
|
||||
set_target_properties(${target} PROPERTIES DEBUG_POSTFIX -d)
|
||||
set_target_properties(${target} PROPERTIES SUFFIX "-${VERSION_MAJOR}${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
set_target_properties(${target} PROPERTIES SUFFIX "-${PROJECT_VERSION_MAJOR}${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
|
||||
# fill out all variables we use to generate the .rc file
|
||||
string(TIMESTAMP RC_CURRENT_YEAR "%Y")
|
||||
@ -99,7 +99,7 @@ macro(sfml_add_library module)
|
||||
set(RC_VERSION_SUFFIX "") # Add something like the git revision short SHA-1 in the future
|
||||
set(RC_PRERELEASE "0") # Set to 1 to mark the DLL as a pre-release DLL
|
||||
set(RC_TARGET_NAME "${target}")
|
||||
set(RC_TARGET_FILE_NAME_SUFFIX "-${VERSION_MAJOR}${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
set(RC_TARGET_FILE_NAME_SUFFIX "-${PROJECT_VERSION_MAJOR}${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
|
||||
# generate the .rc file
|
||||
configure_file(
|
||||
@ -128,8 +128,8 @@ macro(sfml_add_library module)
|
||||
# set the version and soversion of the target (for compatible systems -- mostly Linuxes)
|
||||
# except for Android which strips soversion suffixes
|
||||
if(NOT SFML_OS_ANDROID)
|
||||
set_target_properties(${target} PROPERTIES SOVERSION ${VERSION_MAJOR}.${VERSION_MINOR})
|
||||
set_target_properties(${target} PROPERTIES VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
|
||||
set_target_properties(${target} PROPERTIES SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR})
|
||||
set_target_properties(${target} PROPERTIES VERSION ${PROJECT_VERSION})
|
||||
endif()
|
||||
|
||||
# set the target's folder (for IDEs that support it, e.g. Visual Studio)
|
||||
@ -172,10 +172,10 @@ macro(sfml_add_library module)
|
||||
# adapt target to build frameworks instead of dylibs
|
||||
set_target_properties(${target} PROPERTIES
|
||||
FRAMEWORK TRUE
|
||||
FRAMEWORK_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}
|
||||
FRAMEWORK_VERSION ${PROJECT_VERSION}
|
||||
MACOSX_FRAMEWORK_IDENTIFIER org.sfml-dev.${target}
|
||||
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}
|
||||
MACOSX_FRAMEWORK_BUNDLE_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
|
||||
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${PROJECT_VERSION}
|
||||
MACOSX_FRAMEWORK_BUNDLE_VERSION ${PROJECT_VERSION})
|
||||
endif()
|
||||
|
||||
# adapt install directory to allow distributing dylibs/frameworks in user's frameworks/application bundle
|
||||
@ -426,7 +426,7 @@ function(sfml_export_targets)
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/SFMLConfigVersion.cmake"
|
||||
VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}
|
||||
VERSION ${PROJECT_VERSION}
|
||||
COMPATIBILITY SameMajorVersion)
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
|
@ -155,5 +155,5 @@ if (NOT SFML_FOUND)
|
||||
endif()
|
||||
|
||||
if (SFML_FOUND AND NOT SFML_FIND_QUIETLY)
|
||||
message(STATUS "Found SFML @VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@ in ${CMAKE_CURRENT_LIST_DIR}")
|
||||
message(STATUS "Found SFML @PROJECT_VERSION@ in ${CMAKE_CURRENT_LIST_DIR}")
|
||||
endif()
|
||||
|
@ -38,7 +38,7 @@ PROJECT_NAME = SFML
|
||||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER = @VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@
|
||||
PROJECT_NUMBER = @PROJECT_VERSION@
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer a
|
||||
|
@ -12,7 +12,7 @@
|
||||
<body>
|
||||
<div id="banner-container">
|
||||
<div id="banner">
|
||||
<span id="sfml">SFML @VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@</span>
|
||||
<span id="sfml">SFML @PROJECT_VERSION@</span>
|
||||
</div>
|
||||
</div>
|
||||
<div id="content">
|
||||
|
@ -6,5 +6,5 @@ includedir=${prefix}/include
|
||||
Name: SFML-all
|
||||
Description: The Simple and Fast Multimedia Library, all modules.
|
||||
URL: http://www.sfml-dev.org
|
||||
Version: @VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@
|
||||
Version: @PROJECT_VERSION@
|
||||
Requires: sfml-system, sfml-window, sfml-graphics, sfml-audio, sfml-network
|
||||
|
@ -6,7 +6,7 @@ includedir=${prefix}/include
|
||||
Name: SFML-audio
|
||||
Description: The Simple and Fast Multimedia Library, audio module.
|
||||
URL: http://www.sfml-dev.org
|
||||
Version: @VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@
|
||||
Version: @PROJECT_VERSION@
|
||||
Requires: sfml-system
|
||||
Requires.private: openal, vorbisenc, vorbisfile, vorbis, ogg, flac
|
||||
Libs: -L${libdir} -lsfml-audio
|
||||
|
@ -6,7 +6,7 @@ includedir=${prefix}/include
|
||||
Name: SFML-graphics
|
||||
Description: The Simple and Fast Multimedia Library, graphics module.
|
||||
URL: http://www.sfml-dev.org
|
||||
Version: @VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@
|
||||
Version: @PROJECT_VERSION@
|
||||
Requires: sfml-window
|
||||
Requires.private: sfml-system, freetype2
|
||||
Libs: -L${libdir} -lsfml-graphics
|
||||
|
@ -6,7 +6,7 @@ includedir=${prefix}/include
|
||||
Name: SFML-network
|
||||
Description: The Simple and Fast Multimedia Library, network module.
|
||||
URL: http://www.sfml-dev.org
|
||||
Version: @VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@
|
||||
Version: @PROJECT_VERSION@
|
||||
Requires: sfml-system
|
||||
Libs: -L${libdir} -lsfml-network
|
||||
Cflags: -I${includedir}
|
||||
|
@ -6,6 +6,6 @@ includedir=${prefix}/include
|
||||
Name: SFML-system
|
||||
Description: The Simple and Fast Multimedia Library, system module.
|
||||
URL: http://www.sfml-dev.org
|
||||
Version: @VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@
|
||||
Version: @PROJECT_VERSION@
|
||||
Libs: -L${libdir} -lsfml-system
|
||||
Cflags: -I${includedir}
|
||||
|
@ -6,7 +6,7 @@ includedir=${prefix}/include
|
||||
Name: SFML-window
|
||||
Description: The Simple and Fast Multimedia Library, window module.
|
||||
URL: http://www.sfml-dev.org
|
||||
Version: @VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@
|
||||
Version: @PROJECT_VERSION@
|
||||
Requires: sfml-system
|
||||
Libs: -L${libdir} -lsfml-window
|
||||
# gl may not be in pkg-config
|
||||
|
@ -5,11 +5,11 @@
|
||||
#define VER_FILEDESCRIPTION_STR "SFML @RC_MODULE_NAME@ Module\0"
|
||||
#define VER_PRODUCTNAME_STR "Simple and Fast Multimedia Library\0"
|
||||
|
||||
#define VER_FILEVERSION @VERSION_MAJOR@,@VERSION_MINOR@,@VERSION_PATCH@,0
|
||||
#define VER_FILEVERSION_STR "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@@RC_VERSION_SUFFIX@\0"
|
||||
#define VER_FILEVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,0
|
||||
#define VER_FILEVERSION_STR "@PROJECT_VERSION@@RC_VERSION_SUFFIX@\0"
|
||||
|
||||
#define VER_PRODUCTVERSION @VERSION_MAJOR@,@VERSION_MINOR@,@VERSION_PATCH@,0
|
||||
#define VER_PRODUCTVERSION_STR "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@@RC_VERSION_SUFFIX@\0"
|
||||
#define VER_PRODUCTVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,0
|
||||
#define VER_PRODUCTVERSION_STR "@PROJECT_VERSION@@RC_VERSION_SUFFIX@\0"
|
||||
|
||||
#ifndef DEBUG
|
||||
#define VER_INTERNALNAME_STR "@RC_TARGET_NAME@@RC_TARGET_FILE_NAME_SUFFIX@\0"
|
||||
|
Loading…
Reference in New Issue
Block a user