Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/build_linux.yml51
-rw-r--r--.github/workflows/build_macos.yml85
-rw-r--r--.github/workflows/build_windows.yml48
-rw-r--r--cmake/TargetArch.cmake53
-rw-r--r--source/CMakeLists.txt7
-rw-r--r--source/extern/CMakeLists.txt1
-rw-r--r--source/test/CMakeLists.txt3
-rw-r--r--source/vcpkg-configuration.json8
-rw-r--r--source/vcpkg.json11
9 files changed, 224 insertions, 43 deletions
diff --git a/.github/workflows/build_linux.yml b/.github/workflows/build_linux.yml
new file mode 100644
index 0000000..dd64b8f
--- /dev/null
+++ b/.github/workflows/build_linux.yml
@@ -0,0 +1,51 @@
+name: Ubuntu Linux
+
+on:
+ push:
+ branches:
+ - "*"
+ tags:
+ - "*"
+
+ pull_request:
+ branches:
+ - "*"
+
+jobs:
+ build:
+ name: OpenStarbound Linux x86_64
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ submodules: 'recursive'
+
+ - name: Install Packages
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y libgl1-mesa-dev mesa-common-dev libsdl2-dev libglew-dev libvorbis-dev libogg-dev libz3-dev libpng-dev libfreetype-dev libgtest-dev libgmock-dev ninja-build
+
+ - name: Configure Test Build
+ run: cmake -G "Ninja" -S "${{ github.workspace }}/source" -B "${{ github.workspace }}/cmake-build-debug" -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" -DCMAKE_VERBOSE_MAKEFILE=YES -DBUILD_TESTING=YES -DCMAKE_BUILD_TYPE=Debug
+
+ - name: Build Debug
+ run: cmake --build "${{ github.workspace }}/cmake-build-debug" --parallel
+
+ - name: Run Unit Tests
+ run: ctest --test-dir "${{ github.workspace }}/cmake-build-debug" -L 'NoAssets' --verbose
+
+ - name: Cleanup Test Build
+ run: rm -Rf "${{ github.workspace }}/cmake-build-debug" "${{ github.workspace }}/dist"
+
+ - name: Configure Release Build
+ run: cmake -G "Ninja" -S "${{ github.workspace }}/source" -B "${{ github.workspace }}/cmake-build-release" -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" -DCMAKE_VERBOSE_MAKEFILE=YES -DBUILD_TESTING=NO -DCMAKE_BUILD_TYPE=Release
+
+ - name: Build Release
+ run: cmake --build "${{ github.workspace }}/cmake-build-release" --parallel
+
+ - name: Upload Artifacts
+ uses: actions/upload-artifact@v4
+ with:
+ name: OpenStarbound-Dev-Linux-x86_64
+ path: dist/*
diff --git a/.github/workflows/build_macos.yml b/.github/workflows/build_macos.yml
new file mode 100644
index 0000000..f6031fe
--- /dev/null
+++ b/.github/workflows/build_macos.yml
@@ -0,0 +1,85 @@
+name: macOS
+
+on:
+ push:
+ branches:
+ - "*"
+ tags:
+ - "*"
+
+ pull_request:
+ branches:
+ - "*"
+
+jobs:
+ build-intel:
+ name: OpenStarbound macOS x86_64
+ runs-on: macos-13
+
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ submodules: 'recursive'
+
+ - name: Install Packages
+ run: brew install sdl2 glew libvorbis lzlib libpng freetype ninja
+
+ - name: Configure Test Build
+ run: cmake -G "Ninja" -S "${{ github.workspace }}/source" -B "${{ github.workspace }}/cmake-build-debug" -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" -DCMAKE_VERBOSE_MAKEFILE=YES -DBUILD_TESTING=YES -DCMAKE_BUILD_TYPE=Debug
+
+ - name: Build Debug
+ run: cmake --build "${{ github.workspace }}/cmake-build-debug" --parallel
+
+ - name: Run Unit Tests
+ run: ctest --test-dir "${{ github.workspace }}/cmake-build-debug" -L 'NoAssets' --verbose
+
+ - name: Cleanup Test Build
+ run: rm -Rf "${{ github.workspace }}/cmake-build-debug" "${{ github.workspace }}/dist"
+
+ - name: Configure Release Build
+ run: cmake -G "Ninja" -S "${{ github.workspace }}/source" -B "${{ github.workspace }}/cmake-build-release" -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" -DCMAKE_VERBOSE_MAKEFILE=YES -DBUILD_TESTING=NO -DCMAKE_BUILD_TYPE=Release
+
+ - name: Build Release
+ run: cmake --build "${{ github.workspace }}/cmake-build-release" --parallel
+
+ - name: Upload Artifacts
+ uses: actions/upload-artifact@v4
+ with:
+ name: OpenStarbound-Dev-macOS-Intel
+ path: dist/*
+
+ build-arm:
+ name: OpenStarbound macOS arm64
+ runs-on: macos-14
+
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ submodules: 'recursive'
+
+ - name: Install Packages
+ run: brew install sdl2 glew libvorbis lzlib libpng freetype ninja
+
+ - name: Configure Test Build
+ run: cmake -G "Ninja" -S "${{ github.workspace }}/source" -B "${{ github.workspace }}/cmake-build-debug" -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" -DCMAKE_VERBOSE_MAKEFILE=YES -DBUILD_TESTING=YES -DCMAKE_BUILD_TYPE=Debug
+
+ - name: Build Debug
+ run: cmake --build "${{ github.workspace }}/cmake-build-debug" --config "Debug" --parallel
+
+ - name: Run Unit Tests
+ run: ctest --test-dir "${{ github.workspace }}/cmake-build-debug" -L 'NoAssets' --verbose --build-config "Debug"
+
+ - name: Cleanup Test Build
+ run: rm -Rf "${{ github.workspace }}/cmake-build-debug" "${{ github.workspace }}/dist"
+
+ - name: Configure Release Build
+ run: cmake -G "Ninja" -S "${{ github.workspace }}/source" -B "${{ github.workspace }}/cmake-build-release" -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" -DCMAKE_VERBOSE_MAKEFILE=YES -DBUILD_TESTING=YES -DCMAKE_BUILD_TYPE=Release
+
+ - name: Build Release
+ run: cmake --build "${{ github.workspace }}/cmake-build-release" --parallel
+
+ - name: Upload Artifacts
+ uses: actions/upload-artifact@v4
+ with:
+ name: OpenStarbound-Dev-macOS-Silicon
+ path: dist/* \ No newline at end of file
diff --git a/.github/workflows/build_windows.yml b/.github/workflows/build_windows.yml
new file mode 100644
index 0000000..ad92d65
--- /dev/null
+++ b/.github/workflows/build_windows.yml
@@ -0,0 +1,48 @@
+name: Windows
+
+on:
+ push:
+ branches:
+ - "*"
+ tags:
+ - "*"
+
+ pull_request:
+ branches:
+ - "*"
+
+jobs:
+ build:
+ name: OpenStarbound Windows x86_64
+ runs-on: windows-latest
+
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ submodules: 'recursive'
+
+ - name: Configure Test Build
+ run: cmake -G "Visual Studio 17 2022" -A "X64" -S "${{ github.workspace }}/source" -B "${{ github.workspace }}/cmake-build-debug" -DCMAKE_TOOLCHAIN_FILE="${Env:VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-windows -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded$<$<CONFIG:Debug>:Debug>DLL" -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" -DCMAKE_VERBOSE_MAKEFILE=YES -DBUILD_TESTING=YES
+
+ - name: Build Debug
+ run: cmake --build "${{ github.workspace }}/cmake-build-debug" --config "Debug" --parallel
+
+ - name: Run Unit Tests
+ run: ctest --test-dir "${{ github.workspace }}/cmake-build-debug" -L 'NoAssets' --verbose --build-config "Debug"
+
+ - name: Cleanup Test Build
+ run: |
+ Remove-Item "${{ github.workspace }}\cmake-build-debug" -Recurse
+ Remove-Item "${{ github.workspace }}\dist" -Recurse
+
+ - name: Configure Release Build
+ run: cmake -G "Visual Studio 17 2022" -A "X64" -S "${{ github.workspace }}/source" -B "${{ github.workspace }}/cmake-build-release" -DCMAKE_TOOLCHAIN_FILE="${Env:VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-windows -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded$<$<CONFIG:Debug>:Debug>DLL" -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" -DCMAKE_VERBOSE_MAKEFILE=YES -DBUILD_TESTING=YES
+
+ - name: Build Release
+ run: cmake --build "${{ github.workspace }}/cmake-build-release" --config "Release" --parallel
+
+ - name: Upload Artifacts
+ uses: actions/upload-artifact@v4
+ with:
+ name: OpenStarbound-Dev-Windows-x64
+ path: dist/*
diff --git a/cmake/TargetArch.cmake b/cmake/TargetArch.cmake
index 3761e4d..2e204fd 100644
--- a/cmake/TargetArch.cmake
+++ b/cmake/TargetArch.cmake
@@ -28,71 +28,42 @@ set(archdetect_c_code "
#else
#error cmake_ARCH arm
#endif
+#elif defined(__arm64__)
+ #error cmake_ARCH arm64
#elif defined(__i386) || defined(__i386__) || defined(_M_IX86)
#error cmake_ARCH i386
#elif defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64)
#error cmake_ARCH x86_64
#elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64)
#error cmake_ARCH ia64
-#elif defined(__ppc__) || defined(__ppc) || defined(__powerpc__) \\
- || defined(_ARCH_COM) || defined(_ARCH_PWR) || defined(_ARCH_PPC) \\
- || defined(_M_MPPC) || defined(_M_PPC)
- #if defined(__ppc64__) || defined(__powerpc64__) || defined(__64BIT__)
- #error cmake_ARCH ppc64
- #else
- #error cmake_ARCH ppc
- #endif
#endif
#error cmake_ARCH unknown
")
-# Set ppc_support to TRUE before including this file or ppc and ppc64
-# will be treated as invalid architectures since they are no longer supported by Apple
-
function(target_architecture output_var)
- if(APPLE AND CMAKE_OSX_ARCHITECTURES)
- # On OS X we use CMAKE_OSX_ARCHITECTURES *if* it was set
- # First let's normalize the order of the values
-
- # Note that it's not possible to compile PowerPC applications if you are using
- # the OS X SDK version 10.6 or later - you'll need 10.4/10.5 for that, so we
- # disable it by default
- # See this page for more information:
- # http://stackoverflow.com/questions/5333490/how-can-we-restore-ppc-ppc64-as-well-as-full-10-4-10-5-sdk-support-to-xcode-4
-
- # Architecture defaults to i386 or ppc on OS X 10.5 and earlier, depending on the CPU type detected at runtime.
- # On OS X 10.6+ the default is x86_64 if the CPU supports it, i386 otherwise.
+ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_OSX_ARCHITECTURES)
+ # On macOS, we use CMAKE_OSX_ARCHITECTURES *if* it was set
+ # Apple currently only supports x86_64 and arm64 architectures to target Intel-based
+ # and Silicon-based Macs. Building as a universal binary will make each machine
+ # use the proper native code to run the resulting executable.
foreach(osx_arch ${CMAKE_OSX_ARCHITECTURES})
- if("${osx_arch}" STREQUAL "ppc" AND ppc_support)
- set(osx_arch_ppc TRUE)
- elseif("${osx_arch}" STREQUAL "i386")
- set(osx_arch_i386 TRUE)
- elseif("${osx_arch}" STREQUAL "x86_64")
+ if("${osx_arch}" STREQUAL "x86_64")
set(osx_arch_x86_64 TRUE)
- elseif("${osx_arch}" STREQUAL "ppc64" AND ppc_support)
- set(osx_arch_ppc64 TRUE)
+ elseif("${osx_arch}" STREQUAL "arm64")
+ set(osx_arch_arm64 TRUE)
else()
message(FATAL_ERROR "Invalid OS X arch name: ${osx_arch}")
endif()
endforeach()
- # Now add all the architectures in our normalized order
- if(osx_arch_ppc)
- list(APPEND ARCH ppc)
- endif()
-
- if(osx_arch_i386)
- list(APPEND ARCH i386)
- endif()
-
if(osx_arch_x86_64)
list(APPEND ARCH x86_64)
endif()
- if(osx_arch_ppc64)
- list(APPEND ARCH ppc64)
+ if(osx_arch_arm64)
+ list(APPEND ARCH arm64)
endif()
else()
file(WRITE "${CMAKE_BINARY_DIR}/arch.c" "${archdetect_c_code}")
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
index edd2aa9..5ef94ef 100644
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -513,8 +513,11 @@ SET (STAR_GAME_INCLUDES
ADD_SUBDIRECTORY (game)
# Googletest based tests
-ENABLE_TESTING()
-ADD_SUBDIRECTORY (test)
+OPTION (BUILD_TESTING "Build test projects" OFF)
+IF (BUILD_TESTING)
+ ENABLE_TESTING()
+ ADD_SUBDIRECTORY (test)
+ENDIF()
# Starbound stand-alone server.
ADD_SUBDIRECTORY (server)
diff --git a/source/extern/CMakeLists.txt b/source/extern/CMakeLists.txt
index bc57870..624b837 100644
--- a/source/extern/CMakeLists.txt
+++ b/source/extern/CMakeLists.txt
@@ -9,6 +9,7 @@ SET (OPUS_FLOAT_APPROX ON)
SET (OPUS_STACK_PROTECTOR OFF)
SET (OPUS_NONTHREADSAFE_PSEUDOSTACK OFF)
SET (OPUS_USE_ALLOCA ON)
+SET (BUILD_TESTING OFF) # Skip Opus tests, these won't build because the tests don't honor OPUS_FLOAT_APPROX.
ADD_SUBDIRECTORY (opus)
IF (OPUS_NONTHREADSAFE_PSEUDOSTACK)
diff --git a/source/test/CMakeLists.txt b/source/test/CMakeLists.txt
index fdbea13..9c32a4f 100644
--- a/source/test/CMakeLists.txt
+++ b/source/test/CMakeLists.txt
@@ -83,3 +83,6 @@ ADD_EXECUTABLE (game_tests
${star_game_tests_SOURCES})
TARGET_LINK_LIBRARIES (game_tests ${STAR_EXT_LIBS})
ADD_TEST (NAME game_tests WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/game_tests)
+
+SET_TESTS_PROPERTIES(core_tests PROPERTIES
+ LABELS "NoAssets")
diff --git a/source/vcpkg-configuration.json b/source/vcpkg-configuration.json
new file mode 100644
index 0000000..a11399f
--- /dev/null
+++ b/source/vcpkg-configuration.json
@@ -0,0 +1,8 @@
+{
+ "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg-configuration.schema.json",
+ "default-registry": {
+ "kind": "git",
+ "baseline": "638b1588be3a265a9c7ad5b212cef72a1cad336a",
+ "repository": "https://github.com/microsoft/vcpkg"
+ }
+} \ No newline at end of file
diff --git a/source/vcpkg.json b/source/vcpkg.json
new file mode 100644
index 0000000..7b396a2
--- /dev/null
+++ b/source/vcpkg.json
@@ -0,0 +1,11 @@
+{
+ "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
+ "dependencies": [
+ "glew",
+ "sdl2",
+ "libvorbis",
+ "zlib",
+ "freetype",
+ "libpng"
+ ]
+} \ No newline at end of file