This repository has been archived by the owner on Apr 2, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for building Linux binaries in the SDK (#2)
* Add scripts to build 32-bit and 64-bit Linux * Add OpenSSL search to toolchain files * Fix up OpenSSL search * Update toolchain files again * Set linker flags as well * Try setting cache instead * Finalise build config * Copy across Steam libraries as necessary * Fix up file copy for Windows/macOS * Add tests for platforms / update test code * Update CMakeLists.txt to copy out curl files for testing * Fix up TEST PASS count * Fix distribution logic * v2 * Prevent multiple poll / changelog on SCM * Replace nil with "none" because require return values are weird * Don't support client connect on 32-bit macOS for Steam API
- Loading branch information
Showing
10 changed files
with
210 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
set -x | ||
|
||
cd "$(dirname "$0")" | ||
ROOT=$(pwd) | ||
cd $ROOT | ||
|
||
sed -i -e 's/add_subdirectory\(docs\)/#add_subdirectory\(docs\)/g' curl/CMakeLists.txt | ||
|
||
# Builds are faster if we don't clear the CMake cache. | ||
SHASUM=$(shasum CMakeLists.txt | awk '{print $1}') | ||
VERSION=v2 | ||
|
||
if [ ! -d buildlinux32_${SHASUM}_${VERSION} ]; then | ||
mkdir buildlinux32_${SHASUM}_${VERSION} | ||
fi | ||
cd buildlinux32_${SHASUM}_${VERSION} | ||
cmake -G "Unix Makefiles" -D CMAKE_BUILD_TYPE=Release -D CMAKE_TOOLCHAIN_FILE=../toolchain/Linux-i386.cmake .. | ||
make | ||
|
||
cd $ROOT | ||
|
||
if [ ! -d buildlinux64_${SHASUM}_${VERSION} ]; then | ||
mkdir buildlinux64_${SHASUM}_${VERSION} | ||
fi | ||
cd buildlinux64_${SHASUM}_${VERSION} | ||
cmake -G "Unix Makefiles" -D CMAKE_BUILD_TYPE=Release -D CMAKE_TOOLCHAIN_FILE=../toolchain/Linux-x86_64.cmake .. | ||
make | ||
|
||
echo "Testing 32-bit binaries..." | ||
cd $ROOT/buildlinux32_${SHASUM}_${VERSION}/Release | ||
./HiveMP.SteamTest-exe | tee result.txt | ||
if [ "$(cat result.txt | grep -c "TEST PASS")" != "2" ]; then | ||
echo "Test failed!" | ||
exit 1 | ||
fi | ||
|
||
echo "Testing 64-bit binaries..." | ||
cd $ROOT/buildlinux64_${SHASUM}_${VERSION}/Release | ||
./HiveMP.SteamTest-exe | tee result.txt | ||
if [ "$(cat result.txt | grep -c "TEST PASS")" != "2" ]; then | ||
echo "Test failed!" | ||
exit 1 | ||
fi | ||
|
||
cd $ROOT | ||
|
||
echo "Creating distribution structure..." | ||
if [ -d dist ]; then | ||
rm -Rf dist | ||
fi | ||
mkdir -pv dist/sdk/Linux32 | ||
mkdir -pv dist/sdk/Linux64 | ||
cp buildlinux32_${SHASUM}_${VERSION}/Release/*.so dist/sdk/Linux32/ | ||
cp buildlinux64_${SHASUM}_${VERSION}/Release/*.so dist/sdk/Linux64/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
set(CMAKE_C_FLAGS "-m32" CACHE STRING "" FORCE) | ||
set(CMAKE_CXX_FLAGS "-m32" CACHE STRING "" FORCE) | ||
set(CMAKE_SHARED_LINKER_FLAGS "-m32" CACHE STRING "" FORCE) | ||
set(CMAKE_STATIC_LINKER_FLAGS "-m32" CACHE STRING "" FORCE) | ||
set(CMAKE_EXE_LINKER_FLAGS "-m32" CACHE STRING "" FORCE) | ||
|
||
set(OPENSSL_INCLUDE_DIR /usr/include/i386-linux-gnu) | ||
set(OPENSSL_ROOT_DIR "/usr/lib/i386-linux-gnu" CACHE STRING "" FORCE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
set(CMAKE_C_FLAGS "-m64" CACHE STRING "" FORCE) | ||
set(CMAKE_CXX_FLAGS "-m64" CACHE STRING "" FORCE) | ||
set(CMAKE_SHARED_LINKER_FLAGS "-m64" CACHE STRING "" FORCE) | ||
set(CMAKE_STATIC_LINKER_FLAGS "-m64" CACHE STRING "" FORCE) | ||
set(CMAKE_EXE_LINKER_FLAGS "-m64" CACHE STRING "" FORCE) | ||
|
||
set(OPENSSL_INCLUDE_DIR /usr/include/x86_64-linux-gnu) | ||
set(OPENSSL_ROOT_DIR "/usr/lib/x86_64-linux-gnu" CACHE STRING "" FORCE) |