From 5c5b36c3842c782f9d1c9f48211c5ac91a4169c2 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 25 Apr 2022 15:45:50 +0200 Subject: [PATCH] Add Win64 build --- .github/workflows/build.yml | 6 +++--- .github/workflows/snapshot.yml | 11 +++++++---- BUILDING.md | 20 +++++++++++++++++--- README.md | 8 ++++---- deps/dragonnet | 2 +- snapshot.sh | 13 ++++++++----- src/CMakeLists.txt | 4 +++- src/{mingw.cmake => win32.cmake} | 0 src/win64.cmake | 4 ++++ upload.sh | 5 +++-- 10 files changed, 50 insertions(+), 23 deletions(-) rename src/{mingw.cmake => win32.cmake} (100%) create mode 100644 src/win64.cmake diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 574ae31..a4f887e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,9 +11,9 @@ jobs: - name: Install deps run: | sudo apt-get update - sudo apt-get install -y build-essential cmake libgl1-mesa-dev libglfw3-dev libglew-dev libsqlite3-dev zlib1g-dev lua5.3 + sudo apt-get install -y build-essential cmake lua5.3 xorg-dev libgl-dev - name: Build run: | - cd src - cmake . + cmake -B build -S src + cd build make -j$(nproc) diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index 232947f..516822b 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -11,13 +11,16 @@ jobs: - name: Install deps run: | sudo apt-get update - sudo apt-get install -y build-essential cmake lua5.3 curl zip - - name: Build ubuntu snapshot + sudo apt-get install -y build-essential cmake lua5.3 xorg-dev libgl-dev mingw-w64 curl zip + - name: Build linux snapshot run: | ./snapshot.sh - - name: Build windows snapshot + - name: Build win32 snapshot run: | - ./snapshot.sh mingw + ./snapshot.sh win32 + - name: Build win64 snapshot + run: | + ./snapshot.sh win64 - name: Upload snapshots env: SECRET: ${{ secrets.ELIDRAGON_UPLOAD_TOKEN }} diff --git a/BUILDING.md b/BUILDING.md index 723d2b7..243eaea 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -1,7 +1,8 @@ # Building instructions ## Dependencies -To build anything you need Git, CMake, Lua, Bash and GCC. Make sure these dependencies are installed on your system. +You need Git, CMake, Lua, Bash and GCC. Make sure these dependencies are installed on your system. (on Debian based systems: `apt install git cmake build-essential`) + All other dependencies are included as submodules, compiled automatically and statically linked. Make sure to clone the repository recursively: @@ -9,6 +10,14 @@ Make sure to clone the repository recursively: git clone --recurse-submodules https://github.com/dragonblocks/dragonblocks_alpha.git ``` +## Client dependencies + +If you want to build the client, it is required to install the build dependencies for GLEW and GLFW (on X11/Debian based systems: `apt install xorg-dev libgl-dev`). + +Refer to: +- https://www.glfw.org/docs/3.3/compile.html +- http://glew.sourceforge.net/build.html + ## Building a debug build By default CMake will make a debug build if nothing else is specified. Simply use @@ -27,8 +36,13 @@ If you use a debug build, the singleplayer script should be invoked from the bui # Native snapshot ./snapshot.sh -# Crosscompiling for windows (requires i686-w64-mingw32-gcc-posix) -./snapshot.sh mingw +# Crosscompiling for windows + +# win32 (requires i686-w64-mingw32-gcc-posix) +./snapshot.sh win32 + +# win64 (requires x86_64-w64-mingw32-gcc-posix) +./snapshot.sh win64 ``` Creates snapshot zipfiles. diff --git a/README.md b/README.md index 581cf19..5a14615 100644 --- a/README.md +++ b/README.md @@ -9,12 +9,12 @@ Head to for snapshot and release ```sh # on posix -./dragonblocks_server "[
]:" -./dragonblocks_client "[
]:" +./dragonblocks_server "
:" +./dragonblocks_client "
:" # on windows -dragonblocks_server.exe "[
]:" -dragonblocks_client.exe "[
]:" +dragonblocks_server.exe "
:" +dragonblocks_client.exe "
:" ``` or alternatively: diff --git a/deps/dragonnet b/deps/dragonnet index 72fd472..356f2ea 160000 --- a/deps/dragonnet +++ b/deps/dragonnet @@ -1 +1 @@ -Subproject commit 72fd472f45d9589269d7786877dff8d45586c006 +Subproject commit 356f2ea3acb517cca7007556074aa0ed94b48876 diff --git a/snapshot.sh b/snapshot.sh index e99ab63..3aa8309 100755 --- a/snapshot.sh +++ b/snapshot.sh @@ -11,12 +11,14 @@ SNAPSHOT=dragonblocks_alpha-$VERSION TOOLCHAIN= DOTEXE= DOTSH=".sh" -if [[ "$1" == "mingw" ]]; then - BUILD=build-mingw - SNAPSHOT=dragonblocks_alpha-win64-$VERSION - TOOLCHAIN=mingw.cmake +FLAGS="-Ofast" +if [[ "$1" != "" ]]; then + BUILD=build-$1 + SNAPSHOT=dragonblocks_alpha-$1-$VERSION + TOOLCHAIN=$1.cmake DOTEXE=".exe" DOTSH=".bat" + FLAGS="$FLAGS -static" fi mkdir -p $BUILD @@ -24,7 +26,8 @@ mkdir -p $BUILD cmake -B $BUILD -S src \ -DCMAKE_BUILD_TYPE="Release" \ -DASSET_PATH="assets/" \ - -DCMAKE_C_FLAGS="-Ofast" \ + -DCMAKE_C_FLAGS="$FLAGS" \ + -DCMAKE_CXX_FLAGS="$FLAGS" \ -DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN" make --no-print-directory -C $BUILD -j$(nproc) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6c9838a..9aa405c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -15,11 +15,13 @@ endif() # Dependencies -cmake_policy(SET CMP0077 NEW) +set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) set(SKIP_INSTALL_ALL ON) set(BUILD_SHARED_LIBS OFF) + set(ZLIB_LIBRARY zlibstatic) +set(ZLIB_INCLUDE_DIR "${DEPS_DIR}/zlib") set(FT_DISABLE_ZLIB OFF) set(FT_DISABLE_BZIP2 ON) diff --git a/src/mingw.cmake b/src/win32.cmake similarity index 100% rename from src/mingw.cmake rename to src/win32.cmake diff --git a/src/win64.cmake b/src/win64.cmake new file mode 100644 index 0000000..9024694 --- /dev/null +++ b/src/win64.cmake @@ -0,0 +1,4 @@ +set(CMAKE_SYSTEM_NAME Windows) + +set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc-posix) +set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++-posix) diff --git a/upload.sh b/upload.sh index 214981b..9cb33a5 100755 --- a/upload.sh +++ b/upload.sh @@ -13,6 +13,7 @@ curl -f -i -X POST -H "Content-Type: multipart/form-data" \ -F "secret=$SECRET" \ -F "name=$VERSION" \ -F "is_release=$IS_RELEASE" \ - -F "ubuntu=@dragonblocks_alpha-$VERSION.zip" \ - -F "windows=@dragonblocks_alpha-win64-$VERSION.zip" \ + -F "linux=@dragonblocks_alpha-$VERSION.zip" \ + -F "win32=@dragonblocks_alpha-win32-$VERSION.zip" \ + -F "win64=@dragonblocks_alpha-win64-$VERSION.zip" \ https://elidragon.tk/dragonblocks_alpha/upload.php -- 2.44.0