mirror of
https://github.com/SFML/CSFML.git
synced 2026-10-24 13:53:36 +02:00
Update CSFML version to 2.5.1
- Add macOS build script - Update existing nuget build script
This commit is contained in:
1 parent
76671cf453
commit
f84ff413a1
8 files changed
+208
-12
No files matched your search
+1
-1
@@ -22,7 +22,7 @@ include(${CMAKE_SOURCE_DIR}/cmake/Config.cmake)
|
||||
# setup version numbers
|
||||
set(VERSION_MAJOR 2)
|
||||
set(VERSION_MINOR 5)
|
||||
set(VERSION_PATCH 0)
|
||||
set(VERSION_PATCH 1)
|
||||
|
||||
# add the CSFML header path
|
||||
include_directories(${CMAKE_SOURCE_DIR}/include)
|
||||
|
||||
@@ -64,6 +64,12 @@ elseif(MSVC)
|
||||
set(SFML_MSVC_VERSION 11)
|
||||
elseif(MSVC_VERSION EQUAL 1800)
|
||||
set(SFML_MSVC_VERSION 12)
|
||||
elseif(MSVC_VERSION EQUAL 1900)
|
||||
set(SFML_MSVC_VERSION 14)
|
||||
elseif(MSVC_VERSION LESS_EQUAL 1919)
|
||||
set(SFML_MSVC_VERSION 15)
|
||||
elseif(MSVC_VERSION LESS_EQUAL 1929)
|
||||
set(SFML_MSVC_VERSION 16)
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "Unsupported compiler")
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
#define CSFML_VERSION_MAJOR 2
|
||||
#define CSFML_VERSION_MINOR 5
|
||||
#define CSFML_VERSION_PATCH 0
|
||||
#define CSFML_VERSION_PATCH 1
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
CSFML
|
||||
-----
|
||||
|
||||
CSFML - Copyright (C) 2007-2018 Laurent Gomila - laurent@sfml-dev.org
|
||||
CSFML - Copyright (C) 2007-2021 Laurent Gomila - laurent@sfml-dev.org
|
||||
|
||||
This software is provided 'as-is', without any express or
|
||||
implied warranty. In no event will the authors be held
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<!-- Workaround to remove the NETStandard.Library NuGet reference without breaking everything -->
|
||||
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
|
||||
|
||||
<Version>2.5.0</Version>
|
||||
<Version>2.5.1</Version>
|
||||
<Authors>Laurent Gomila</Authors>
|
||||
<PackageTags>sfml csfml</PackageTags>
|
||||
<Copyright>Copyright © Laurent Gomila</Copyright>
|
||||
@@ -22,10 +22,10 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05" PrivateAssets="all" />
|
||||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="all" />
|
||||
|
||||
<!-- Workaround to remove the NETStandard.Library NuGet reference without breaking everything -->
|
||||
<PackageReference Include="NETStandard.Library" Version="[1.6.0,)" PrivateAssets="all" />
|
||||
<PackageReference Include="NETStandard.Library" Version="1.6.1" PrivateAssets="all" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
|
||||
@@ -12,12 +12,19 @@ All build scripts follow the same routine:
|
||||
|
||||
* `build.win.ps1`
|
||||
* A [PowerShell](https://github.com/PowerShell/PowerShell) script to build Windows native libraries. By default, both `win-x86` and `win-x64` are built. To build only one specific Runtime Identifier, pass it to the script as a parameter (`./build.win.ps1 win-x64`)
|
||||
You must have Visual Studio 2017, cmake, and the Windows SDK 8.1 installed to run this script.
|
||||
You must have Visual Studio 2019, cmake, and the Windows SDK 10 installed to run this script.
|
||||
|
||||
* `build.linux.sh`
|
||||
* A [Bash](https://www.gnu.org/software/bash/) script to build libraries for a generic Linux distribution. The [Runtime Identifier](https://docs.microsoft.com/en-us/dotnet/core/rid-catalog) of the linux distribution must be specified as a parameter to the script.
|
||||
This generic script doesn't install any of its dependencies. As such, you must have cmake and make installed, as well as all [SFML Dependencies](https://www.sfml-dev.org/tutorials/2.5/compile-with-cmake.php#installing-dependencies) available to cmake.
|
||||
|
||||
* `build.macos.sh`
|
||||
* A [Bash](https://www.gnu.org/software/bash/) script to build libraries for macOS. The [Runtime Identifier](https://docs.microsoft.com/en-us/dotnet/core/rid-catalog#macos-rids) of the macOS distribution must be specified as parameter to the script.
|
||||
Currently supported RIDs are:
|
||||
* osx.10.15-x64
|
||||
* osx.11.0-x64
|
||||
* osx.11.0-arm64 (requires SFML 2.6)
|
||||
|
||||
* `build.docker.sh`, `build.docker.ps1`
|
||||
* A script to build the native libraries for a Linux distribution in a Docker container. If no RID is specified as a parameter, all supported RIDs will be built. Currently, the supported RIDs are:
|
||||
* `alpine-x64`
|
||||
|
||||
@@ -0,0 +1,183 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Automatically exit on error
|
||||
set -e
|
||||
|
||||
# ========================= #
|
||||
# PRELUDE: A note on rpaths #
|
||||
# ========================= #
|
||||
|
||||
# Unlike Windows, macOS doesn't search the current directory by default when searching for shared libraries (.dylib)
|
||||
# It only searches the system default directories (usually /lib and /usr/lib) and the paths in LD_LIBRARY_PATH
|
||||
|
||||
# The .NET Runtime will find the CSFML library in its NuGet packages just fine, but that library will then request
|
||||
# the OS for libsfml-(module).dylib, and the .NET Runtime will have no say in how that SFML library is found.
|
||||
|
||||
# Without SFML installed globally on the system, this will fail, causing the loading of CSFML to fail, causing the
|
||||
# .NET Runtime to think the CSFML library doesn't exist or is invalid.
|
||||
|
||||
# And so, we need to set the rpath of the CSFML library.
|
||||
# The rpath is a special value embedded straight into a library that specifies to the OS a list of folders where
|
||||
# other libraries that it references may be found.
|
||||
# $ORIGIN, a kind-of environment variable, can be used in rpath to point to the folder where the library currently is.
|
||||
# To let the OS know that we intend to use $ORIGIN, we need to add the ORIGIN flag to our ELF with the -z origin
|
||||
# gcc linker option
|
||||
|
||||
# Since CSFML and SFML will always be deployed on the same folder by NuGet, we just need to add an rpath to CSFML
|
||||
# that points to $ORIGIN, causing the OS to search the current folder for SFML, without interference from .NET
|
||||
|
||||
# We also add the same rpath to SFML itself for future-proofing, in case we ever decide to ship some Linux SFML
|
||||
# dependencies on the Native package.
|
||||
|
||||
# You may need to `brew install coreutils` first for grealpath
|
||||
# See supported RID at https://docs.microsoft.com/en-us/dotnet/core/rid-catalog
|
||||
|
||||
# =================================================== #
|
||||
# STEP 1: Setup all variables needed during the build #
|
||||
# =================================================== #
|
||||
|
||||
if [[ -z "$1" ]]; then
|
||||
echo "Please specify the platform Runtime Identifier as an argument to this script"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Please note that all SFML dependencies must be installed and available to cmake. SFML does not ship with its linux dependencies."
|
||||
|
||||
RID="$1"
|
||||
|
||||
SFMLBranch="2.5.x" # The branch or tag of the SFML repository to be cloned
|
||||
CSFMLDir="$(grealpath "$(git rev-parse --show-toplevel)")" # The directory of the source code of CSFML
|
||||
|
||||
OutDir="./CSFML/runtimes/$RID/native" # The base directory of all CSFML modules, used to copy the final libraries
|
||||
mkdir -p "$OutDir"
|
||||
OutDir="$(grealpath "$OutDir")"
|
||||
|
||||
echo "Building $RID"
|
||||
|
||||
mkdir -p "Build"
|
||||
pushd "Build"
|
||||
|
||||
# ================== #
|
||||
# STEP 2: Clone SFML #
|
||||
# ================== #
|
||||
|
||||
if [[ ! -d "SFML/.git" ]]; then
|
||||
echo "Cloning SFML"
|
||||
rm -rf "SFML"
|
||||
git clone --branch "$SFMLBranch" --depth 1 "git://github.com/SFML/SFML.git" "SFML"
|
||||
fi
|
||||
|
||||
SFMLDir="$(grealpath SFML)"
|
||||
|
||||
# ================== #
|
||||
# STEP 3: Build SFML #
|
||||
# ================== #
|
||||
|
||||
rm -rf "$RID"
|
||||
mkdir -p "$RID"
|
||||
pushd "$RID"
|
||||
|
||||
echo "Building SFML"
|
||||
mkdir -p SFML
|
||||
pushd SFML
|
||||
|
||||
SFMLBuiltDir="$(grealpath .)" # The directory where SFML was built to. Used later to direct cmake when building CSFML
|
||||
|
||||
mkdir -p lib
|
||||
# The directory that contains the final SFML libraries
|
||||
# Since linux libraries don't support static linking from a shared library, this is used to copy the
|
||||
# SFML shared libraries together with the CSFML shared libraries into SFML.Net
|
||||
SFMLLibDir="$(grealpath lib)"
|
||||
|
||||
if [ $RID == "osx.10.15-x64" ]; then
|
||||
ARCHITECTURE="x86_64"
|
||||
TARGET="10.15"
|
||||
SYSROOT="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/"
|
||||
elif [ $RID == "osx.11.0-x64" ]; then
|
||||
ARCHITECTURE="x86_64"
|
||||
TARGET="11.0"
|
||||
SYSROOT="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/"
|
||||
elif [ $RID == "osx.11.0-arm64" ]; then
|
||||
ARCHITECTURE="arm64"
|
||||
TARGET="11.0"
|
||||
SYSROOT="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/"
|
||||
|
||||
echo "Note: arm64 is only supported with SFML 2.6"
|
||||
else
|
||||
echo "Unsupported RID provided. Use 'osx.10.15-x64', 'osx.11.0-x64' or 'osx.11.0-arm64'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cmake -E env \
|
||||
cmake -G "Unix Makefiles" \
|
||||
-D 'BUILD_SHARED_LIBS=ON' \
|
||||
-D 'CMAKE_BUILD_TYPE=Release' \
|
||||
-D "CMAKE_OSX_ARCHITECTURES=$ARCHITECTURE" \
|
||||
-D "CMAKE_OSX_DEPLOYMENT_TARGET=$TARGET" \
|
||||
-D "CMAKE_OSX_SYSROOT=$SYSROOT" \
|
||||
-D "CMAKE_LIBRARY_OUTPUT_DIRECTORY=$SFMLLibDir" \
|
||||
-D 'CMAKE_BUILD_WITH_INSTALL_RPATH=ON' \
|
||||
-D 'CMAKE_INSTALL_RPATH=@executable_path' \
|
||||
"$SFMLDir"
|
||||
|
||||
cmake --build . --config Release
|
||||
|
||||
popd # Pop SFML
|
||||
|
||||
# =================== #
|
||||
# STEP 4: Build CSFML #
|
||||
# =================== #
|
||||
|
||||
echo "Building CSFML using SFML at $SFMLBuiltDir"
|
||||
mkdir -p CSFML
|
||||
pushd CSFML
|
||||
|
||||
mkdir -p lib
|
||||
CSFMLLibDir="$(realpath lib)" # The directory that contains the final CSFML libraries. Used to copy the result into SFML.Net
|
||||
|
||||
cmake -E env \
|
||||
cmake -G "Unix Makefiles" \
|
||||
-D "SFML_DIR=$SFMLBuiltDir" \
|
||||
-D 'BUILD_SHARED_LIBS=ON' \
|
||||
-D 'CMAKE_BUILD_TYPE=Release' \
|
||||
-D "CMAKE_OSX_ARCHITECTURES=$ARCHITECTURE" \
|
||||
-D "CMAKE_OSX_DEPLOYMENT_TARGET=$TARGET" \
|
||||
-D "CMAKE_OSX_SYSROOT=$SYSROOT" \
|
||||
-D "CMAKE_LIBRARY_OUTPUT_DIRECTORY=$CSFMLLibDir" \
|
||||
-D 'CMAKE_BUILD_WITH_INSTALL_RPATH=ON' \
|
||||
-D 'CMAKE_INSTALL_RPATH=@executable_path' \
|
||||
"$CSFMLDir"
|
||||
cmake --build . --config Release
|
||||
|
||||
# ======================================== #
|
||||
# STEP 5: Copy result to the NuGet folders #
|
||||
# ======================================== #
|
||||
|
||||
# Copies one SFML and CSFML module into the NuGet package
|
||||
# The module name must be passed to this function as an argument, in lowercase
|
||||
# This function then copies $SFMLLibDir/libsfml-(module).so and
|
||||
# $CSFMLLibDir/libcsfml-(module).so into $OutDir
|
||||
copymodule()
|
||||
{
|
||||
MODULE="$1"
|
||||
|
||||
mkdir -p "$OutDir"
|
||||
|
||||
# Note the wildcard at the end of the first argument
|
||||
# We are copying every versioned file here, not just the .dylib
|
||||
# (libsfml-audio.dylib, libsfml-audio.2.dylib, libsfml-audio.2.5.dylib, etc)
|
||||
# This is needed because of the way macOS searches for libraries based
|
||||
# one their SONAME
|
||||
cp "$SFMLLibDir/libsfml-$MODULE."* "$OutDir"
|
||||
|
||||
cp "$CSFMLLibDir/libcsfml-$MODULE."* "$OutDir"
|
||||
}
|
||||
|
||||
copymodule audio
|
||||
copymodule graphics
|
||||
copymodule system
|
||||
copymodule window
|
||||
|
||||
popd # Pop CSFML
|
||||
popd # Pop $RID
|
||||
popd # Pop Build
|
||||
@@ -16,7 +16,7 @@ if (-not $RID) {
|
||||
exit
|
||||
}
|
||||
|
||||
$Generator = 'Visual Studio 15 2017'
|
||||
$Generator = 'Visual Studio 16 2019'
|
||||
|
||||
switch ($RID) {
|
||||
'win-x86' {
|
||||
@@ -194,10 +194,10 @@ function Copy-Module($module) {
|
||||
Copy-Item "$CSFMLLibDir/csfml-$module-2.dll" "$OutDir/csfml-$module.dll" -Force > $null
|
||||
}
|
||||
|
||||
Copy-Module 'Audio'
|
||||
Copy-Module 'Graphics'
|
||||
Copy-Module 'System'
|
||||
Copy-Module 'Window'
|
||||
Copy-Module 'audio'
|
||||
Copy-Module 'graphics'
|
||||
Copy-Module 'system'
|
||||
Copy-Module 'window'
|
||||
|
||||
Write-Output "Copying Audio module extra files"
|
||||
Copy-Item "$SFMLAudioExtras/*" "$OutDir"
|
||||
|
||||
Reference in new issue
Block a user