Commit 79d9e1bd authored by Rye Mutt's avatar Rye Mutt 🍞
Browse files

Fix windows build

parent f7cedd3d
Pipeline #1246 failed with stages
in 35 seconds
*.tar.*
discord-rpc/build/
discord-rpc/builds/
stage/
......@@ -5,6 +5,6 @@ include:
variables:
BUILD_COMMON: 0
BUILD_WINDOWS: 0
BUILD_WINDOWS64: 0
BUILD_WINDOWS64: 1
BUILD_LINUX64: 1
BUILD_MACOS: 0
......@@ -15,7 +15,7 @@
<string>discord_rpc</string>
<key>platforms</key>
<map>
<key>linux64</key>
<key>common</key>
<map>
<key>build_directory</key>
<string>stage</string>
......@@ -25,15 +25,14 @@
<map>
<key>build</key>
<map>
<key>arguments</key>
<key>command</key>
<string>bash</string>
<key>options</key>
<array>
<string>-c</string>
<string>../build-cmd.sh</string>
</array>
<key>command</key>
<string>sh</string>
</map>
<key>default</key>
<string>True</string>
<key>name</key>
<string>default</string>
</map>
......@@ -42,12 +41,77 @@
<array>
<string>include/discord_rpc/discord_register.h</string>
<string>include/discord_rpc/discord_rpc.h</string>
<string>lib/release/libdiscord-rpc.a</string>
<string>LICENSES/discord_rpc.txt</string>
<string>VERSION.txt</string>
</array>
<key>name</key>
<string>linux64</string>
<string>common</string>
</map>
<key>darwin</key>
<map>
<key>configurations</key>
<map>
<key>default</key>
<map>
<key>build</key>
<map>
</map>
<key>default</key>
<string>true</string>
<key>name</key>
<string>default</string>
</map>
</map>
<key>manifest</key>
<array>
<string>lib/release/*.a</string>
</array>
<key>name</key>
<string>darwin</string>
</map>
<key>linux</key>
<map>
<key>configurations</key>
<map>
<key>default</key>
<map>
<key>build</key>
<map>
</map>
<key>default</key>
<string>true</string>
<key>name</key>
<string>default</string>
</map>
</map>
<key>manifest</key>
<array>
<string>lib/release/libdiscord-rpc.a</string>
</array>
<key>name</key>
<string>linux</string>
</map>
<key>windows</key>
<map>
<key>configurations</key>
<map>
<key>default</key>
<map>
<key>build</key>
<map>
</map>
<key>default</key>
<string>true</string>
<key>name</key>
<string>default</string>
</map>
</map>
<key>manifest</key>
<array>
<string>lib/debug/*.*</string>
<string>lib/release/*.*</string>
</array>
<key>name</key>
<string>windows</string>
</map>
</map>
<key>version_file</key>
......
......@@ -7,7 +7,7 @@ exec 4>&1; export BASH_XTRACEFD=4; set -x
# make errors fatal
set -e
# complain about unset env variables
# set -u
set -u
PROJECT=discord_rpc
......@@ -32,24 +32,36 @@ source_environment_tempfile="$stage/source_environment.sh"
"$autobuild" source_environment > "$source_environment_tempfile"
. "$source_environment_tempfile"
echo "3.4.0" > VERSION.txt
echo "3.4.0" > "$stage/VERSION.txt"
mkdir -p "$stage/include/discord_rpc"
pushd "$SOURCE_DIR"
case "$AUTOBUILD_PLATFORM" in
windows*)
load_vsvars
packages="$(cygpath -m "$stage/packages")"
if [ "$AUTOBUILD_ADDRSIZE" = 32 ]
then
echo "32bit builds not supported!"
exit 1
else
echo "64bit build not implemented yet"
exit 1
targetarch=x64
mkdir -p "$stage/lib/debug"
mkdir -p "$stage/lib/release"
mkdir -p "build"
pushd "build"
# Invoke cmake and use as official build
cmake -G "$AUTOBUILD_WIN_CMAKE_GEN" -A "$AUTOBUILD_WIN_VSPLATFORM" -T host="$AUTOBUILD_WIN_VSHOST" .. -DBUILD_SHARED_LIBS=OFF -DBUILD_EXAMPLES=OFF -DUSE_STATIC_CRT=OFF
cmake --build . --config Debug
cmake --build . --config Release
# conditionally run unit tests
if [ "${DISABLE_UNIT_TESTS:-0}" = "0" ]; then
ctest -C Debug
ctest -C Release
fi
cp -a "src/Debug/discord-rpc.lib" "$stage/lib/debug/discord-rpc.lib"
cp -a "src/Release/discord-rpc.lib" "$stage/lib/release/discord-rpc.lib"
popd
;;
darwin*)
......@@ -93,14 +105,14 @@ pushd "$SOURCE_DIR"
LDFLAGS="-L$stage/packages/lib/release/"
./build.py --clean
mkdir -p $stage/include
cp -r builds/install/linux-static/include $stage/include/${PROJECT}
mkdir -p $stage/lib
cp -r builds/install/linux-static/lib/* $stage/lib/release
;;
esac
cp -a "include/discord_rpc.h" "$stage/include/discord_rpc"
cp -a "include/discord_register.h" "$stage/include/discord_rpc"
mkdir -p "$stage/LICENSES"
cp "LICENSE" "$stage/LICENSES/${PROJECT}.txt"
cp ../VERSION.txt "$stage/"
popd
......@@ -41,7 +41,7 @@ if(WIN32)
string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
endforeach()
endif(USE_STATIC_CRT)
target_compile_options(discord-rpc PRIVATE /EHsc
target_compile_options(discord-rpc PRIVATE /EHsc /Z7
/Wall
/wd4100 # unreferenced formal parameter
/wd4514 # unreferenced inline
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment