mirror of
https://github.com/SFML/CSFML.git
synced 2026-10-25 05:03:36 +01:00
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3666ab8f3b | ||
|
|
317f58fa31 | ||
|
|
1d05e82f25 | ||
|
|
c5a37aed84 |
No files matched your search
+65
-31
@@ -11,40 +11,74 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
platform:
|
platform:
|
||||||
- { name: Windows VS2017, os: windows-2016 }
|
- {
|
||||||
- { name: Windows VS2019, os: windows-latest }
|
name: Windows VS2019,
|
||||||
- { name: Linux GCC, os: ubuntu-latest }
|
os: windows-2019,
|
||||||
- { name: Linux Clang, os: ubuntu-latest, flags: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ }
|
sfml-flags: -DBUILD_SHARED_LIBS=FALSE -DSFML_USE_STATIC_STD_LIBS=TRUE,
|
||||||
- { name: MacOS XCode, os: macos-latest, flags: -DSFML_BUILD_FRAMEWORKS=FALSE, prefix: sudo }
|
csfml-flags: -DCSFML_LINK_SFML_STATICALLY=TRUE -DSTATIC_STD_LIBS=TRUE,
|
||||||
|
}
|
||||||
|
- {
|
||||||
|
name: Windows VS2022,
|
||||||
|
os: windows-2022,
|
||||||
|
sfml-flags: -DBUILD_SHARED_LIBS=FALSE -DSFML_USE_STATIC_STD_LIBS=TRUE,
|
||||||
|
csfml-flags: -DCSFML_LINK_SFML_STATICALLY=TRUE -DSTATIC_STD_LIBS=TRUE,
|
||||||
|
}
|
||||||
|
- {
|
||||||
|
name: Linux GCC,
|
||||||
|
os: ubuntu-latest,
|
||||||
|
sfml-flags: -DBUILD_SHARED_LIBS=TRUE -DSFML_USE_STATIC_STD_LIBS=FALSE,
|
||||||
|
csfml-flags: -DCSFML_LINK_SFML_STATICALLY=FALSE -DSTATIC_STD_LIBS=FALSE,
|
||||||
|
}
|
||||||
|
- {
|
||||||
|
name: Linux Clang,
|
||||||
|
os: ubuntu-latest,
|
||||||
|
flags: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++,
|
||||||
|
sfml-flags: -DBUILD_SHARED_LIBS=TRUE -DSFML_USE_STATIC_STD_LIBS=FALSE,
|
||||||
|
csfml-flags: -DCSFML_LINK_SFML_STATICALLY=FALSE -DSTATIC_STD_LIBS=FALSE,
|
||||||
|
}
|
||||||
|
- {
|
||||||
|
name: MacOS XCode,
|
||||||
|
os: macos-latest,
|
||||||
|
prefix: sudo,
|
||||||
|
flags: -DSFML_BUILD_FRAMEWORKS=FALSE,
|
||||||
|
sfml-flags: -DBUILD_SHARED_LIBS=TRUE -DSFML_USE_STATIC_STD_LIBS=FALSE,
|
||||||
|
csfml-flags: -DCSFML_LINK_SFML_STATICALLY=FALSE -DSTATIC_STD_LIBS=FALSE,
|
||||||
|
}
|
||||||
steps:
|
steps:
|
||||||
- name: Install Linux Dependencies
|
- name: Install Linux Dependencies
|
||||||
if: runner.os == 'Linux'
|
if: runner.os == 'Linux'
|
||||||
run: sudo apt-get update && sudo apt-get install libxrandr-dev libxcursor-dev libudev-dev libopenal-dev libflac-dev libvorbis-dev libgl1-mesa-dev libegl1-mesa-dev
|
run: sudo apt-get update && sudo apt-get install libxrandr-dev libxcursor-dev libudev-dev libopenal-dev libflac-dev libvorbis-dev libgl1-mesa-dev libegl1-mesa-dev
|
||||||
|
|
||||||
- name: Checkout SFML
|
- name: Checkout SFML
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
repository: SFML/SFML
|
repository: SFML/SFML
|
||||||
ref: 2.5.1
|
ref: 2.5.1
|
||||||
path: SFML
|
path: SFML
|
||||||
|
|
||||||
- name: Configure SFML CMake
|
- name: Configure SFML CMake
|
||||||
shell: bash
|
shell: bash
|
||||||
run: cmake -S $GITHUB_WORKSPACE/SFML -B $GITHUB_WORKSPACE/SFML/build -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/SFML/install -DBUILD_SHARED_LIBS=TRUE -DSFML_BUILD_EXAMPLES=FALSE -DSFML_BUILD_TEST_SUITE=FALSE -DCMAKE_VERBOSE_MAKEFILE=ON ${{matrix.platform.flags}}
|
run: cmake -S $GITHUB_WORKSPACE/SFML -B $GITHUB_WORKSPACE/SFML/build -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/SFML/install -DBUILD_SHARED_LIBS=FALSE -DSFML_BUILD_EXAMPLES=FALSE -DSFML_BUILD_TEST_SUITE=FALSE -DCMAKE_VERBOSE_MAKEFILE=ON ${{matrix.platform.flags}} ${{matrix.platform.sfml-flags}}
|
||||||
|
|
||||||
- name: Build SFML
|
|
||||||
shell: bash
|
|
||||||
run: ${{matrix.platform.prefix}} cmake --build $GITHUB_WORKSPACE/SFML/build --config Release --target install
|
|
||||||
|
|
||||||
- name: Checkout CSFML
|
- name: Build SFML
|
||||||
uses: actions/checkout@v2
|
shell: bash
|
||||||
with:
|
run: ${{matrix.platform.prefix}} cmake --build $GITHUB_WORKSPACE/SFML/build --config Release --target install
|
||||||
path: CSFML
|
|
||||||
|
|
||||||
- name: Configure CSFML CMake
|
- name: Checkout CSFML
|
||||||
shell: bash
|
uses: actions/checkout@v3
|
||||||
run: cmake -S $GITHUB_WORKSPACE/CSFML -B $GITHUB_WORKSPACE/CSFML/build -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/CSFML/install -DBUILD_SHARED_LIBS=TRUE -DCSFML_LINK_SFML_STATICALLY=FALSE -DSFML_DIR=$GITHUB_WORKSPACE/SFML/install/lib/cmake/SFML -DCMAKE_VERBOSE_MAKEFILE=ON ${{matrix.platform.flags}}
|
with:
|
||||||
|
path: CSFML
|
||||||
|
|
||||||
- name: Build CSFML
|
- name: Configure CSFML CMake
|
||||||
shell: bash
|
shell: bash
|
||||||
run: cmake --build $GITHUB_WORKSPACE/CSFML/build --config Release --target install
|
run: cmake -S $GITHUB_WORKSPACE/CSFML -B $GITHUB_WORKSPACE/CSFML/build -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/CSFML/install -DBUILD_SHARED_LIBS=TRUE -DSFML_DIR=$GITHUB_WORKSPACE/SFML/install/lib/cmake/SFML -DCMAKE_VERBOSE_MAKEFILE=ON ${{matrix.platform.flags}} ${{matrix.platform.csfml-flags}}
|
||||||
|
|
||||||
|
- name: Build CSFML
|
||||||
|
shell: bash
|
||||||
|
run: cmake --build $GITHUB_WORKSPACE/CSFML/build --config Release --target install
|
||||||
|
|
||||||
|
- name: Upload CSFML Artefact
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: CSFML - ${{ matrix.platform.name }}
|
||||||
|
path: ${{ github.workspace }}/CSFML/install
|
||||||
+2
-2
@@ -72,5 +72,5 @@ install(DIRECTORY include
|
|||||||
DESTINATION .
|
DESTINATION .
|
||||||
COMPONENT devel
|
COMPONENT devel
|
||||||
PATTERN ".svn" EXCLUDE)
|
PATTERN ".svn" EXCLUDE)
|
||||||
install(FILES license.txt DESTINATION ${INSTALL_MISC_DIR})
|
install(FILES license.md DESTINATION ${INSTALL_MISC_DIR})
|
||||||
install(FILES readme.txt DESTINATION ${INSTALL_MISC_DIR})
|
install(FILES readme.md DESTINATION ${INSTALL_MISC_DIR})
|
||||||
+15
@@ -0,0 +1,15 @@
|
|||||||
|
# CSFML
|
||||||
|
|
||||||
|
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 liable for any damages arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
||||||
|
## External libraries used by CSFML
|
||||||
|
|
||||||
|
* _SFML_ is under the zlib/png license
|
||||||
-31
@@ -1,31 +0,0 @@
|
|||||||
CSFML
|
|
||||||
-----
|
|
||||||
|
|
||||||
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
|
|
||||||
liable for any damages arising from the use of this software.
|
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute
|
|
||||||
it freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented;
|
|
||||||
you must not claim that you wrote the original software.
|
|
||||||
If you use this software in a product, an acknowledgment
|
|
||||||
in the product documentation would be appreciated but
|
|
||||||
is not required.
|
|
||||||
|
|
||||||
2. Altered source versions must be plainly marked as such,
|
|
||||||
and must not be misrepresented as being the original software.
|
|
||||||
|
|
||||||
3. This notice may not be removed or altered from any
|
|
||||||
source distribution.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
External libraries used by CSFML
|
|
||||||
--------------------------------
|
|
||||||
|
|
||||||
* SFML is under the zlib/png license
|
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
[](https://www.sfml-dev.org)
|
||||||
|
|
||||||
|
# CSFML - Simple and Fast Multimedia Library for C
|
||||||
|
|
||||||
|
SFML is a simple, fast, cross-platform and object-oriented multimedia API. It provides access to windowing, graphics, audio and network. It is originally written in C++, and this project is its official binding for the C language.
|
||||||
|
|
||||||
|
## Authors
|
||||||
|
|
||||||
|
- Laurent Gomila - main developer (laurent@sfml-dev.org)
|
||||||
|
- Lukas Dürrenberger - active maintainer (eXpl0it3r@sfml-dev.org)
|
||||||
|
- Zachariah Brown (contact@zbrown.net)
|
||||||
|
|
||||||
|
## Download
|
||||||
|
|
||||||
|
You can get the latest official release on [SFML website](https://www.sfml-dev.org/download/csfml). You can also get the current development version from the [Git repository](https://github.com/SFML/CSFML).
|
||||||
|
|
||||||
|
## Learn
|
||||||
|
|
||||||
|
There is no tutorial for CSFML, but since it's a binding you can use the C++ resources:
|
||||||
|
|
||||||
|
* The [official tutorials](https://www.sfml-dev.org/tutorials/)
|
||||||
|
* The [online API documentation](https://www.sfml-dev.org/documentation/)
|
||||||
|
* The [community wiki](https://github.com/SFML/SFML/wiki/)
|
||||||
|
* The [community forum](https://en.sfml-dev.org/forums/) (or [French](https://fr.sfml-dev.org/forums/)
|
||||||
|
|
||||||
|
Of course, you can also find the CSFML API documentation in the SDK.
|
||||||
|
|
||||||
|
## Building
|
||||||
|
|
||||||
|
Set `SFML_DIR` to a directory containing the `SFMLConfig.cmake` file, usually located at `lib/cmake/SFML`.
|
||||||
|
|
||||||
|
## Contribute
|
||||||
|
|
||||||
|
SFML and CSFML are open-source projects, and they need your help to go on growing and improving. Don't hesitate to post suggestions or bug reports on [the forum](https://en.sfml-dev.org/forums/), or post new bugs/features requests on the [issue tracker](https://github.com/SFML/CSFML/issues/). You can even fork the project on GitHub, maintain your own version and send us pull requests periodically to merge your work.
|
||||||
-42
@@ -1,42 +0,0 @@
|
|||||||
CSFML - Simple and Fast Multimedia Library for C
|
|
||||||
================================================
|
|
||||||
|
|
||||||
SFML is a simple, fast, cross-platform and object-oriented multimedia API. It provides access to windowing,
|
|
||||||
graphics, audio and network.
|
|
||||||
It is originally written in C++, and this project is its official binding for the C language.
|
|
||||||
|
|
||||||
Authors
|
|
||||||
-------
|
|
||||||
|
|
||||||
Laurent Gomila - main developer (laurent@sfml-dev.org)
|
|
||||||
Zachariah Brown - active maintainer (contact@zbrown.net)
|
|
||||||
|
|
||||||
Download
|
|
||||||
--------
|
|
||||||
|
|
||||||
You can get the latest official release on SFML website (http://www.sfml-dev.org/download/csfml).
|
|
||||||
You can also get the current development version from the git repository (https://github.com/SFML/CSFML).
|
|
||||||
|
|
||||||
Learn
|
|
||||||
-----
|
|
||||||
|
|
||||||
There is no tutorial for CSFML, but since it's a binding you can use the C++ resources:
|
|
||||||
* The official tutorials (http://www.sfml-dev.org/tutorials/)
|
|
||||||
* The online API documentation (http://www.sfml-dev.org/documentation/)
|
|
||||||
* The community wiki (https://github.com/SFML/SFML/wiki/)
|
|
||||||
* The community forum (http://en.sfml-dev.org/forums/) (or http://fr.sfml-dev.org/forums/ for French people)
|
|
||||||
|
|
||||||
Of course, you can also find the CSFML API documentation in the SDK.
|
|
||||||
|
|
||||||
Building
|
|
||||||
--------
|
|
||||||
|
|
||||||
The FindSFML.cmake script required by CMake to build CSFML, is located in SFML's cmake/Modules/ directory.
|
|
||||||
|
|
||||||
Contribute
|
|
||||||
----------
|
|
||||||
|
|
||||||
SFML and CSFML are open-source projects, and they need your help to go on growing and improving.
|
|
||||||
Don't hesitate to post suggestions or bug reports on the forum (http://en.sfml-dev.org/forums/),
|
|
||||||
or post new bugs/features requests on the task tracker (https://github.com/SFML/CSFML/issues/).
|
|
||||||
You can even fork the project on GitHub, maintain your own version and send us pull requests periodically to merge your work.
|
|
||||||
@@ -37,8 +37,8 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
struct sfMusic
|
struct sfMusic
|
||||||
{
|
{
|
||||||
sf::Music This;
|
|
||||||
CallbackStream Stream;
|
CallbackStream Stream;
|
||||||
|
sf::Music This;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,609 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
VERSION="2.5.1"
|
||||||
|
VERSION_C="2.5.1"
|
||||||
|
# BUILD_CSFML=FALSE
|
||||||
|
BUILD_CSFML=TRUE
|
||||||
|
BUILD_SFML=FALSE
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
###
|
||||||
|
### Create packages for SFML $VERSION on OS X
|
||||||
|
###
|
||||||
|
### Author: Marco Antognini <antognini.marco@gmail.com>
|
||||||
|
### Date: 15/11/2014
|
||||||
|
###
|
||||||
|
|
||||||
|
##
|
||||||
|
## SETTINGS
|
||||||
|
##
|
||||||
|
## Edit $VERSION & $VERSION_C above
|
||||||
|
##
|
||||||
|
|
||||||
|
sfml_giturl='https://github.com/SFML/SFML.git'
|
||||||
|
csfml_giturl='https://github.com/SFML/CSFML.git'
|
||||||
|
|
||||||
|
gittag="$VERSION"
|
||||||
|
gittag_c="$VERSION_C"
|
||||||
|
|
||||||
|
topdir=$(pwd)
|
||||||
|
tmpdir="$topdir/tmp/"
|
||||||
|
|
||||||
|
codedir="$tmpdir/code/"
|
||||||
|
cmakedir="$tmpdir/cmake/"
|
||||||
|
builddir="$tmpdir/build/"
|
||||||
|
installdir="$tmpdir/install/"
|
||||||
|
|
||||||
|
sfml_package_source_zip="$topdir/SFML-$gittag-sources.zip"
|
||||||
|
sfml_source_archive_url="https://github.com/SFML/SFML/archive/$gittag.zip"
|
||||||
|
|
||||||
|
sfml_package1070name="SFML-$gittag-macos-clang"
|
||||||
|
sfml_package1070="$topdir/$sfml_package1070name/"
|
||||||
|
sfml_archive1070="$sfml_package1070name.tar.gz"
|
||||||
|
|
||||||
|
csfml_package1070name="CSFML-$gittag_c-macos-clang"
|
||||||
|
csfml_package1070="$topdir/$csfml_package1070name/"
|
||||||
|
csfml_archive1070="$csfml_package1070name.tar.gz"
|
||||||
|
|
||||||
|
SDK1070="/Developer/SDKs/MacOSX10.7.sdk"
|
||||||
|
|
||||||
|
##
|
||||||
|
## HELPER FUNCTIONS
|
||||||
|
##
|
||||||
|
|
||||||
|
## Echoes to stderr, and die
|
||||||
|
error () # $* message to display
|
||||||
|
{
|
||||||
|
echo "$@" 1>&2
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
|
||||||
|
## Check that the number of parameters is correct, or die
|
||||||
|
param_check () # $1 should be $# on call site,
|
||||||
|
# $2 the number of required params,
|
||||||
|
# $3 an id for the error message
|
||||||
|
{
|
||||||
|
if [ $# -ne 3 ]
|
||||||
|
then
|
||||||
|
error "Internal error in param_error: the number of parameters is incorrect"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $1 -ne $2 ]
|
||||||
|
then
|
||||||
|
error "Internal error in $3: the number of parameters is incorrect"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
## Check that the number of parameters is enough, or die
|
||||||
|
param_check_ge () # $1 should be $# on call site,
|
||||||
|
# $2 the minimal number of params,
|
||||||
|
# $3 an id for the error message
|
||||||
|
{
|
||||||
|
param_check $# 3 "param_check_ge"
|
||||||
|
|
||||||
|
if [ $1 -lt $2 ]
|
||||||
|
then
|
||||||
|
error "Internal error in $3: the number of parameters is not enough"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
## Assert $1 is true, or die
|
||||||
|
assert () # $1: boolean, $2: an error message
|
||||||
|
{
|
||||||
|
param_check $# 2 "assert"
|
||||||
|
|
||||||
|
if [ $1 -ne 0 ]
|
||||||
|
then
|
||||||
|
error "$2"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
## Create directory, or die
|
||||||
|
# === mkdir -p $1
|
||||||
|
create_dir () # $1: path
|
||||||
|
{
|
||||||
|
param_check $# 1 "create_dir"
|
||||||
|
mkdir -p "$1"
|
||||||
|
assert $? "Couldn't create $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
## Destroy and create directory, or die
|
||||||
|
re_create_dir () # $1: path
|
||||||
|
{
|
||||||
|
param_check $# 1 "re_create_dir"
|
||||||
|
destroy "$1"
|
||||||
|
create_dir "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
## Destroy directory, or die
|
||||||
|
# === rm -fr $1
|
||||||
|
destroy () # $1: path
|
||||||
|
{
|
||||||
|
param_check $# 1 "destroy"
|
||||||
|
rm -fr "$1"
|
||||||
|
assert $? "Couldn't destroy $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
## [with root access] Destroy directory, or die
|
||||||
|
# === rm -fr $1
|
||||||
|
sudo_destroy () # $1: path
|
||||||
|
{
|
||||||
|
param_check $# 1 "sudo_destroy"
|
||||||
|
echo "sudo_destroy need root password for deleting $1"
|
||||||
|
sudo rm -fr "$1"
|
||||||
|
assert $? "Couldn't destroy $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
## Destroy all paths, or die
|
||||||
|
destroy_all () # $1...N: paths
|
||||||
|
{
|
||||||
|
param_check_ge $# 1 "destroy_all"
|
||||||
|
|
||||||
|
for path in "$@"
|
||||||
|
do
|
||||||
|
destroy "$path"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
## [with root access] Destroy all paths, or die
|
||||||
|
sudo_destroy_all () # $1...N: paths
|
||||||
|
{
|
||||||
|
param_check_ge $# 1 "sudo_destroy_all"
|
||||||
|
|
||||||
|
for path in "$@"
|
||||||
|
do
|
||||||
|
sudo_destroy "$path"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
## Copy files/directories, recursively, or die
|
||||||
|
copy () # $1...N: src, $N+1: dest
|
||||||
|
{
|
||||||
|
param_check_ge $# 2 "copy"
|
||||||
|
cp -R "$@"
|
||||||
|
assert $? "Couldn't copy $1 to $2"
|
||||||
|
}
|
||||||
|
|
||||||
|
## Go to dir with pushd, or die
|
||||||
|
push_pwd () # $1: path
|
||||||
|
{
|
||||||
|
param_check $# 1 "push_pwd"
|
||||||
|
pushd "$1"
|
||||||
|
assert $? "Couldn't go to $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
## Go back, or die
|
||||||
|
pop_pwd ()
|
||||||
|
{
|
||||||
|
param_check $# 0 "pop_pwd"
|
||||||
|
popd
|
||||||
|
assert $? "Couldn't go back"
|
||||||
|
}
|
||||||
|
|
||||||
|
## Create a .tar.gz archive, or die
|
||||||
|
archive () # $1: src dir, $2: archive name
|
||||||
|
{
|
||||||
|
param_check $# 2 "archive"
|
||||||
|
|
||||||
|
push_pwd "$1/.."
|
||||||
|
|
||||||
|
src=$(basename "$1")
|
||||||
|
tar -zcvf "$2" "$src"
|
||||||
|
assert $? "Zip failed for $2"
|
||||||
|
|
||||||
|
pop_pwd
|
||||||
|
}
|
||||||
|
|
||||||
|
## Build SFML with CMake and Make, or die
|
||||||
|
build_sfml () # $1: 'clang' => clang & libc++
|
||||||
|
# $2: 'frameworks'/'dylibs'
|
||||||
|
# $3: 'doc'/'no doc'
|
||||||
|
# $4: 'examples'/'no examples'
|
||||||
|
# $5: 'templates'/'no templates'
|
||||||
|
# $6: '10.7 SDK'
|
||||||
|
{
|
||||||
|
param_check $# 6 "build_sfml"
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
'clang')
|
||||||
|
cxx="clang++"
|
||||||
|
cc="clang"
|
||||||
|
cxx_flags="-stdlib=libc++"
|
||||||
|
cc_flags="-stdlib=libc++"
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
error "Unknown compiler for $1 in create_makefile"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
case "$2" in
|
||||||
|
'frameworks')
|
||||||
|
frameworks="TRUE"
|
||||||
|
installdir_adapted="$installdir/Library/Frameworks"
|
||||||
|
;;
|
||||||
|
'dylibs')
|
||||||
|
frameworks="FALSE"
|
||||||
|
installdir_adapted="$installdir/usr/local"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
error "Unknown option for $2 in create_makefile"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
case "$3" in
|
||||||
|
'doc')
|
||||||
|
doc="TRUE"
|
||||||
|
;;
|
||||||
|
'no doc')
|
||||||
|
doc="FALSE"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
error "Unknown option for $3 in create_makefile"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
case "$4" in
|
||||||
|
'examples')
|
||||||
|
examples="TRUE"
|
||||||
|
makeopts=""
|
||||||
|
# NB: cannot use -j8 here because it bugs with cocoa example...
|
||||||
|
;;
|
||||||
|
'no examples')
|
||||||
|
examples="FALSE"
|
||||||
|
makeopts="-j8"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
error "Unknown option for $4 in create_makefile"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
case "$5" in
|
||||||
|
'templates')
|
||||||
|
templates="TRUE"
|
||||||
|
;;
|
||||||
|
'no templates')
|
||||||
|
templates="FALSE"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
error "Unknown option for $5 in create_makefile"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
case "$6" in
|
||||||
|
'10.7 SDK')
|
||||||
|
target="10.7"
|
||||||
|
sdk="$SDK1070"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
error "Unknown option for $6 in create_makefile"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
re_create_dir "$cmakedir"
|
||||||
|
push_pwd "$cmakedir"
|
||||||
|
|
||||||
|
cmake -G "Unix Makefiles" \
|
||||||
|
-D "BUILD_SHARED_LIBS:BOOL=TRUE" \
|
||||||
|
-D "CMAKE_BUILD_TYPE:STRING=Release" \
|
||||||
|
-D "CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/$cxx" \
|
||||||
|
-D "CMAKE_CXX_FLAGS:STRING=$cxx_flags" \
|
||||||
|
-D "CMAKE_C_COMPILER:FILEPATH=/usr/bin/$cc" \
|
||||||
|
-D "CMAKE_C_FLAGS:STRING=$cc_flags" \
|
||||||
|
-D "CMAKE_INSTALL_PREFIX:PATH=$installdir_adapted" \
|
||||||
|
-D "SFML_DEPENDENCIES_INSTALL_PREFIX:STRING=$installdir/Library/Frameworks" \
|
||||||
|
-D "SFML_MISC_INSTALL_PREFIX:STRING=$installdir/usr/local/share/SFML" \
|
||||||
|
-D "CMAKE_OSX_ARCHITECTURES:STRING=x86_64" \
|
||||||
|
-D "CMAKE_OSX_DEPLOYMENT_TARGET:STRING=$target" \
|
||||||
|
-D "CMAKE_OSX_SYSROOT:STRING=$sdk" \
|
||||||
|
-D "SFML_BUILD_DOC:BOOL=$doc" \
|
||||||
|
-D "SFML_BUILD_EXAMPLES:BOOL=$examples" \
|
||||||
|
-D "SFML_BUILD_FRAMEWORKS:BOOL=$frameworks" \
|
||||||
|
-D "SFML_INSTALL_XCODE_TEMPLATES:BOOL=$templates" \
|
||||||
|
"$codedir"
|
||||||
|
assert $? "CMake failed"
|
||||||
|
|
||||||
|
destroy "$installdir"
|
||||||
|
|
||||||
|
make clean && make $makeopts && make install
|
||||||
|
assert $? "Make failed"
|
||||||
|
|
||||||
|
pop_pwd
|
||||||
|
}
|
||||||
|
|
||||||
|
## Build SFML with CMake and Make, or die
|
||||||
|
build_csfml () # $1: 'clang' => clang & libc++
|
||||||
|
# $2: 'doc'/'no doc'
|
||||||
|
# $3: '10.7 SDK'
|
||||||
|
{
|
||||||
|
param_check $# 3 "build_csfml"
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
'clang')
|
||||||
|
cxx="clang++"
|
||||||
|
cc="clang"
|
||||||
|
cxx_flags="-stdlib=libc++"
|
||||||
|
cc_flags="-stdlib=libc++"
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
error "Unknown compiler for $1 in create_makefile"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
case "$2" in
|
||||||
|
'doc')
|
||||||
|
doc="TRUE"
|
||||||
|
;;
|
||||||
|
'no doc')
|
||||||
|
doc="FALSE"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
error "Unknown option for $2 in create_makefile"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
case "$3" in
|
||||||
|
'10.7 SDK')
|
||||||
|
target="10.7"
|
||||||
|
sdk="$SDK1070"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
error "Unknown option for $3 in create_makefile"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
makeopts="-j8"
|
||||||
|
|
||||||
|
re_create_dir "$cmakedir"
|
||||||
|
push_pwd "$cmakedir"
|
||||||
|
|
||||||
|
cmake -G "Unix Makefiles" \
|
||||||
|
-D "BUILD_SHARED_LIBS:BOOL=TRUE" \
|
||||||
|
-D "CMAKE_BUILD_TYPE:STRING=Release" \
|
||||||
|
-D "CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/$cxx" \
|
||||||
|
-D "CMAKE_CXX_FLAGS:STRING=$cxx_flags" \
|
||||||
|
-D "CMAKE_C_COMPILER:FILEPATH=/usr/bin/$cc" \
|
||||||
|
-D "CMAKE_C_FLAGS:STRING=$cc_flags" \
|
||||||
|
-D "CMAKE_INSTALL_PREFIX:PATH=$installdir/usr/local" \
|
||||||
|
-D "CMAKE_OSX_ARCHITECTURES:STRING=x86_64" \
|
||||||
|
-D "CMAKE_OSX_DEPLOYMENT_TARGET:STRING=$target" \
|
||||||
|
-D "CMAKE_OSX_SYSROOT:STRING=$sdk" \
|
||||||
|
-D "BUILD_DOC:BOOL=$doc" \
|
||||||
|
-D "SFML_DIR:PATH=$sfml_package1070/Frameworks/SFML.framework/Versions/$gittag/Resources/CMake" \
|
||||||
|
"$codedir"
|
||||||
|
assert $? "CMake failed"
|
||||||
|
|
||||||
|
destroy "$installdir"
|
||||||
|
|
||||||
|
make clean && make $makeopts && make install
|
||||||
|
assert $? "Make failed"
|
||||||
|
|
||||||
|
pop_pwd
|
||||||
|
}
|
||||||
|
|
||||||
|
## Install a package (dylibs only) to compile CSFML later on, or die
|
||||||
|
minimal_install_package () # $1: path to package
|
||||||
|
{
|
||||||
|
param_check $# 1 "install_package"
|
||||||
|
|
||||||
|
push_pwd "$1"
|
||||||
|
|
||||||
|
create_dir "/usr/local/share/SFML/cmake"
|
||||||
|
# copy "cmake/Modules/FindSFML.cmake" "/usr/local/share/cmake/Modules/"
|
||||||
|
copy "lib/" "/usr/local/lib/"
|
||||||
|
copy "include/" "/usr/local/include/"
|
||||||
|
|
||||||
|
pop_pwd
|
||||||
|
}
|
||||||
|
|
||||||
|
## Git clone, or die
|
||||||
|
clone () # $1: url, $2: dest, $3: branch or tag (also works with sha, but less efficiently)
|
||||||
|
{
|
||||||
|
param_check $# 3 "clone"
|
||||||
|
|
||||||
|
git clone "$1" --branch "$3" "$2" --depth 1 || git clone "$1" "$2" && git -C "$2" checkout "$3"
|
||||||
|
assert $? "Cannot download the source code from $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
## Remove anything related to SFML
|
||||||
|
wipe_sfml ()
|
||||||
|
{
|
||||||
|
# Remove SFML from /usr/local
|
||||||
|
destroy_all "/usr/local/include/SFML" \
|
||||||
|
"/usr/local/lib/"libsfml-* \
|
||||||
|
"/usr/local/share/SFML"
|
||||||
|
|
||||||
|
# Remove SFML from /Library
|
||||||
|
sudo_destroy_all "/Library/Frameworks/"sfml-* \
|
||||||
|
"/Library/Frameworks/SFML.framework"
|
||||||
|
|
||||||
|
destroy_all "/Library/Developer/Xcode/Templates/SFML"
|
||||||
|
}
|
||||||
|
|
||||||
|
## Remove anything related to CSFML
|
||||||
|
wipe_csfml ()
|
||||||
|
{
|
||||||
|
# Remove CSFML from /usr/local (that's it)
|
||||||
|
destroy_all "/usr/local/include/CSFML" \
|
||||||
|
"/usr/local/lib/"libcsfml-* \
|
||||||
|
"/usr/local/share/CSFML"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##
|
||||||
|
## INITIALIZE
|
||||||
|
##
|
||||||
|
|
||||||
|
|
||||||
|
## Clean up before doing anything
|
||||||
|
|
||||||
|
wipe_sfml
|
||||||
|
wipe_csfml
|
||||||
|
|
||||||
|
destroy "$sfml_package_source_zip"
|
||||||
|
destroy_all "$sfml_archive1070" "$sfml_package1070"
|
||||||
|
destroy_all "$csfml_archive1070" "$csfml_package1070"
|
||||||
|
destroy "$tmpdir"
|
||||||
|
|
||||||
|
|
||||||
|
##
|
||||||
|
## CREATE SOURCE ARCHIVE
|
||||||
|
##
|
||||||
|
# we need to do it on a Unix compatible system to keep symlinks valid in frameworks extlibs
|
||||||
|
|
||||||
|
wget -O "$sfml_package_source_zip" "$sfml_source_archive_url"
|
||||||
|
assert $? "Couldn't download the source archive"
|
||||||
|
zip -d "$sfml_package_source_zip" "SFML-$gittag/.gitattributes"
|
||||||
|
assert $? "Couldn't remove extra files from source archive"
|
||||||
|
|
||||||
|
|
||||||
|
##
|
||||||
|
## DOWNLOAD SFML
|
||||||
|
##
|
||||||
|
|
||||||
|
|
||||||
|
## First, download the code from github
|
||||||
|
|
||||||
|
destroy "$codedir"
|
||||||
|
clone "$sfml_giturl" "$codedir" "$gittag"
|
||||||
|
|
||||||
|
##
|
||||||
|
## BUILD SFML FOR 1070
|
||||||
|
##
|
||||||
|
|
||||||
|
|
||||||
|
# Now configure CMake for 10.7, 64bits, clang & libc++, doc, example, templates, FRAMEWORKS
|
||||||
|
# and build SFML !
|
||||||
|
|
||||||
|
build_sfml 'clang' 'frameworks' 'doc' 'examples' 'templates' '10.7 SDK'
|
||||||
|
|
||||||
|
|
||||||
|
## Copy the results to the package dir
|
||||||
|
|
||||||
|
re_create_dir "$sfml_package1070"
|
||||||
|
|
||||||
|
copy "$installdir/usr/local/share/SFML/" \
|
||||||
|
"$sfml_package1070/"
|
||||||
|
|
||||||
|
create_dir "$sfml_package1070/extlibs/"
|
||||||
|
copy "$installdir/Library/Frameworks/FLAC.framework" \
|
||||||
|
"$installdir/Library/Frameworks/freetype.framework" \
|
||||||
|
"$installdir/Library/Frameworks/ogg.framework" \
|
||||||
|
"$installdir/Library/Frameworks/OpenAL.framework" \
|
||||||
|
"$installdir/Library/Frameworks/vorbis.framework" \
|
||||||
|
"$installdir/Library/Frameworks/vorbisenc.framework" \
|
||||||
|
"$installdir/Library/Frameworks/vorbisfile.framework" \
|
||||||
|
"$sfml_package1070/extlibs/"
|
||||||
|
|
||||||
|
create_dir "$sfml_package1070/Frameworks/"
|
||||||
|
copy "$installdir/Library/Frameworks/"sfml-* \
|
||||||
|
"$installdir/Library/Frameworks/SFML.framework" \
|
||||||
|
"$sfml_package1070/Frameworks/"
|
||||||
|
|
||||||
|
create_dir "$sfml_package1070/templates/"
|
||||||
|
copy "/Library/Developer/Xcode/Templates/SFML" \
|
||||||
|
"$sfml_package1070/templates/"
|
||||||
|
|
||||||
|
|
||||||
|
## Now configure CMake for 10.7, 64bits, clang & libc++, DYLIBS
|
||||||
|
|
||||||
|
build_sfml 'clang' 'dylibs' 'no doc' 'no examples' 'no templates' '10.7 SDK'
|
||||||
|
|
||||||
|
|
||||||
|
## Copy the results to the package dir
|
||||||
|
|
||||||
|
create_dir "$sfml_package1070/include/"
|
||||||
|
copy "$installdir/usr/local/include/SFML" \
|
||||||
|
"$sfml_package1070/include/"
|
||||||
|
|
||||||
|
create_dir "$sfml_package1070/lib/"
|
||||||
|
copy "$installdir/usr/local/lib/"libsfml-* \
|
||||||
|
"$sfml_package1070/lib/"
|
||||||
|
|
||||||
|
copy "$codedir/changelog.md" \
|
||||||
|
"$sfml_package1070/"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Clean up some files
|
||||||
|
|
||||||
|
find "$sfml_package1070" -regex '.*/\.DS_Store' -delete
|
||||||
|
assert $? "Find failed while removing extra files"
|
||||||
|
find "$sfml_package1070" -regex '.*/*\.swp' -delete
|
||||||
|
assert $? "Find failed while removing extra files"
|
||||||
|
find "$sfml_package1070" -regex '.*/*~' -delete
|
||||||
|
assert $? "Find failed while removing extra files"
|
||||||
|
|
||||||
|
|
||||||
|
## Apply patch for templates to fix paths
|
||||||
|
|
||||||
|
curl -fsSl "template.2.5.0.patch" | patch "$sfml_package1070/templates/SFML/SFML App.xctemplate/TemplateInfo.plist" --no-backup-if-mismatch
|
||||||
|
assert $? "Couldn't apply patch on templates"
|
||||||
|
|
||||||
|
|
||||||
|
## And create archives
|
||||||
|
|
||||||
|
destroy "$tmpdir"
|
||||||
|
|
||||||
|
archive "$sfml_package1070" "$sfml_archive1070"
|
||||||
|
|
||||||
|
if [ $BUILD_CSFML != "TRUE" ]
|
||||||
|
then
|
||||||
|
echo "I'M NOT BUILDING CSFML!"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
##
|
||||||
|
## DOWNLOAD CSFML
|
||||||
|
##
|
||||||
|
|
||||||
|
destroy "$codedir"
|
||||||
|
clone "$csfml_giturl" "$codedir" "$gittag_c"
|
||||||
|
|
||||||
|
|
||||||
|
##
|
||||||
|
## BUILD CSFML FOR 1070
|
||||||
|
##
|
||||||
|
|
||||||
|
wipe_sfml
|
||||||
|
minimal_install_package "$sfml_package1070"
|
||||||
|
|
||||||
|
build_csfml 'clang' 'doc' '10.7 SDK'
|
||||||
|
|
||||||
|
create_dir "$csfml_package1070/include/"
|
||||||
|
copy "$installdir/usr/local/include/SFML" \
|
||||||
|
"$csfml_package1070/include/"
|
||||||
|
|
||||||
|
create_dir "$csfml_package1070/lib/"
|
||||||
|
copy "$installdir/usr/local/lib/"libcsfml-* \
|
||||||
|
"$csfml_package1070/lib/"
|
||||||
|
|
||||||
|
copy "$installdir/usr/local/share/CSFML/" \
|
||||||
|
"$csfml_package1070/"
|
||||||
|
|
||||||
|
|
||||||
|
##
|
||||||
|
## CLEAN UP & ARCHIVE
|
||||||
|
##
|
||||||
|
|
||||||
|
find "$csfml_package1070" -regex '.*/\.DS_Store' -delete
|
||||||
|
assert $? "Find failed while removing extra files"
|
||||||
|
find "$csfml_package1070" -regex '.*/*\.swp' -delete
|
||||||
|
assert $? "Find failed while removing extra files"
|
||||||
|
find "$csfml_package1070" -regex '.*/*~' -delete
|
||||||
|
assert $? "Find failed while removing extra files"
|
||||||
|
|
||||||
|
## Clean up temporary directories
|
||||||
|
## And create archives
|
||||||
|
|
||||||
|
destroy "$tmpdir"
|
||||||
|
|
||||||
|
archive "$csfml_package1070" "$csfml_archive1070"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### End Of Script
|
||||||
|
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
Param(
|
||||||
|
[Parameter(Mandatory, Position = 0)]
|
||||||
|
[string]$architecture
|
||||||
|
)
|
||||||
|
|
||||||
|
Function Convert-DLL([string]$name)
|
||||||
|
{
|
||||||
|
& gendef.exe "..\..\bin\$name-2.dll"
|
||||||
|
& dlltool.exe -d "$name-2.def" -D "..\..\bin\$name-2.dll" -l "lib$name.a"
|
||||||
|
del "$name-2.def"
|
||||||
|
}
|
||||||
|
|
||||||
|
Function Create-ImportLib([string]$architecture)
|
||||||
|
{
|
||||||
|
New-Item -ItemType "directory" -Path "lib\gcc"
|
||||||
|
New-Item -ItemType "directory" -Path "lib\msvc"
|
||||||
|
Move-Item -Path "lib\*.lib" -Destination "lib\msvc"
|
||||||
|
|
||||||
|
$patharch = If($architecture -eq "x64") { "64" } Else { "32" }
|
||||||
|
|
||||||
|
$oldpath = $env:Path
|
||||||
|
$env:Path += ";C:\tools\mingw$patharch\bin\"
|
||||||
|
|
||||||
|
Push-Location "lib\gcc"
|
||||||
|
Convert-DLL("csfml-graphics")
|
||||||
|
Convert-DLL("csfml-window")
|
||||||
|
Convert-DLL("csfml-audio")
|
||||||
|
Convert-DLL("csfml-network")
|
||||||
|
Convert-DLL("csfml-system")
|
||||||
|
Pop-Location
|
||||||
|
|
||||||
|
$env:Path = $oldpath
|
||||||
|
}
|
||||||
|
|
||||||
|
Create-ImportLib $architecture
|
||||||
@@ -42,7 +42,7 @@ echo "Please note that all SFML dependencies must be installed and available to
|
|||||||
|
|
||||||
RID="$1"
|
RID="$1"
|
||||||
|
|
||||||
SFMLBranch="2.5.x" # The branch or tag of the SFML repository to be cloned
|
SFMLBranch="2.5.1" # The branch or tag of the SFML repository to be cloned
|
||||||
CSFMLDir="$(realpath "$(git rev-parse --show-toplevel)")" # The directory of the source code of CSFML
|
CSFMLDir="$(realpath "$(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
|
OutDir="./CSFML/runtimes/$RID/native" # The base directory of all CSFML modules, used to copy the final libraries
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ Write-Output "Building $RID"
|
|||||||
Write-Output "Using $Generator as the cmake generator"
|
Write-Output "Using $Generator as the cmake generator"
|
||||||
Write-Output "Using architecture $Architecture"
|
Write-Output "Using architecture $Architecture"
|
||||||
|
|
||||||
$SFMLBranch = "2.5.x" # The branch or tag of the SFML repository to be cloned
|
$SFMLBranch = "2.5.1" # The branch or tag of the SFML repository to be cloned
|
||||||
$CSFMLDir = (Get-Item (git rev-parse --show-toplevel)).FullName # The directory of the source code of CSFML
|
$CSFMLDir = (Get-Item (git rev-parse --show-toplevel)).FullName # The directory of the source code of CSFML
|
||||||
|
|
||||||
$OutDir = "./CSFML/runtimes/$RID/native" # The directory of all CSFML modules, used to copy the final dlls
|
$OutDir = "./CSFML/runtimes/$RID/native" # The directory of all CSFML modules, used to copy the final dlls
|
||||||
|
|||||||
Reference in new issue
Block a user