Skip to content

Commit

Permalink
Finish merge
Browse files Browse the repository at this point in the history
  • Loading branch information
louist103 committed May 4, 2024
2 parents fe61e63 + 068ee3f commit 1ede93b
Show file tree
Hide file tree
Showing 2,127 changed files with 3,394 additions and 509,098 deletions.
1 change: 1 addition & 0 deletions .github/workflows/apt-deps.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
libsdl2-dev libpng-dev libglew-dev libzip-dev zipcmp zipmerge ziptool ninja-build nlohmann-json3-dev libtinyxml2-dev libspdlog-dev
1 change: 1 addition & 0 deletions .github/workflows/brew-deps.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sdl2 libpng glew ninja libzip nlohmann-json tinyxml2 spdlog
80 changes: 68 additions & 12 deletions .github/workflows/build-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@ jobs:
build-macos:
runs-on: macos-12
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
brew install sdl2 libpng glew ninja libzip
- uses: actions/checkout@v2
brew install $(cat .github/workflows/brew-deps.txt)
- name: ccache
uses: hendrikmuhs/[email protected]
uses: hendrikmuhs/[email protected].11
with:
key: ${{ runner.os }}-ccache
key: ${{ runner.os }}-mac-ccache-${{ github.ref }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-mac-ccache-${{ github.ref }}
${{ runner.os }}-mac-ccache-
- name: Build libultraship
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
Expand All @@ -28,18 +31,45 @@ jobs:
name: soh-mac
path: build-cmake/src/*.a
if-no-files-found: error
build-ios:
runs-on: macos-12
steps:
- uses: actions/checkout@v2
- name: Cache build folder
uses: actions/cache@v4
with:
save-always: true
key: ${{ runner.os }}-ios-build-${{ github.ref }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-ios-build-${{ github.ref }}
${{ runner.os }}-ios-build-
path: |
build-cmake
- name: Build libultraship
run: |
cmake --no-warn-unused-cli -H. -Bbuild-cmake -GXcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 -DCMAKE_BUILD_TYPE:STRING=Release
cmake --build build-cmake --config Release --parallel 10
- name: Upload build
uses: actions/upload-artifact@v3
with:
name: soh-ios
path: build-cmake/src/*/*.a
if-no-files-found: error
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libsdl2-dev libpng-dev libglew-dev libzip-dev zipcmp zipmerge ziptool ninja-build
- uses: actions/checkout@v2
sudo apt-get install -y $(cat .github/workflows/apt-deps.txt)
- name: ccache
uses: hendrikmuhs/[email protected]
uses: hendrikmuhs/[email protected].11
with:
key: ${{ runner.os }}-ccache
key: ${{ matrix.os }}-ccache-${{ github.ref }}-${{ github.sha }}
restore-keys: |
${{ matrix.os }}-ccache-${{ github.ref }}
${{ matrix.os }}-ccache-
- name: Install latest SDL
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
Expand All @@ -49,6 +79,17 @@ jobs:
./configure
make -j 10
sudo make install
- name: Install latest tinyxml2
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
wget https://github.com/leethomason/tinyxml2/archive/refs/tags/10.0.0.tar.gz
tar -xzf 10.0.0.tar.gz
cd tinyxml2-10.0.0
mkdir build
cd build
cmake ..
make
sudo make install
- name: Build libultraship
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
Expand All @@ -72,20 +113,35 @@ jobs:
Remove-Item -Path "C:\ProgramData\Chocolatey\bin\ccache.exe" -Force -ErrorAction SilentlyContinue
- uses: actions/checkout@v2
- name: ccache
uses: dcvz/ccache-action@27b9f33213c0079872f064f6b6ba0233dfa16ba2
uses: hendrikmuhs/ccache-action@v1.2.11
with:
key: ${{ runner.os }}-ccache
variant: sccache
key: ${{ runner.os }}-ccache-${{ github.ref }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-ccache-${{ github.ref }}
${{ runner.os }}-ccache-
- name: Cache build folder
uses: actions/cache@v4
with:
save-always: true
key: ${{ runner.os }}-build-${{ github.ref }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-build-${{ github.ref }}
${{ runner.os }}-build-
path: |
build-cmake
D:/a/vcpkg
- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1
- name: Build libultraship
env:
VCPKG_ROOT: D:/a/vcpkg
run: |
set $env:PATH="$env:USERPROFILE/.cargo/bin;$env:PATH"
cmake --no-warn-unused-cli -S. -Bbuild-cmake -GNinja -DCMAKE_MAKE_PROGRAM=ninja -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DUSE_AUTO_VCPKG=ON -DCMAKE_VS_PLATFORM_NAME=x64
cmake --no-warn-unused-cli -S. -Bbuild-cmake -GNinja -DCMAKE_MAKE_PROGRAM=ninja -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DUSE_AUTO_VCPKG=ON -DCMAKE_VS_PLATFORM_NAME=x64
cmake --build build-cmake --config Release --parallel 10
- name: Upload build
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: soh-windows
path: build-cmake/src/**/*.lib
Expand Down
19 changes: 15 additions & 4 deletions .github/workflows/tidy-format-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ jobs:
tidy-format:
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libsdl2-dev libpng-dev libglew-dev libzip-dev zipcmp zipmerge ziptool ninja-build clang-tidy clang-format-12
- uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y $(cat .github/workflows/apt-deps.txt) clang-tidy clang-format-12
- name: ccache
uses: hendrikmuhs/[email protected]
with:
Expand All @@ -31,6 +31,17 @@ jobs:
./configure
make -j 10
sudo make install
- name: Install latest tinyxml2
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
wget https://github.com/leethomason/tinyxml2/archive/refs/tags/10.0.0.tar.gz
tar -xzf 10.0.0.tar.gz
cd tinyxml2-10.0.0
mkdir build
cd build
cmake ..
make
sudo make install
- name: Prepare compile_commands.json
run: |
cmake -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
Expand Down
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -346,3 +346,22 @@ ZAPDUtils.lib
.vs/
.idea/
cmake-build-**
cmake_install.cmake
*.a
*.o
*.pc
*.vcxproj
*.sln
*.filters
*.stamp
*.depend
*.lib
*.tlog
*.recipe
src/install_config.h
# Removed jsonConfig and jsonConfigVersion
extern/nlohmann-json/*_jsonConfig*
*.pbxproj
*.xcworkspace
*.xcsettings
build*
53 changes: 40 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@ cmake_minimum_required(VERSION 3.24.0)

option(NON_PORTABLE "Build a non-portable version" OFF)

if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
option(SIGN_LIBRARY "Enable xcode signing" OFF)
option(BUNDLE_ID "Bundle ID for xcode signing" "com.example.libultraship")
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
endif()

project(libultraship LANGUAGES C CXX)
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")

if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR CMAKE_SYSTEM_NAME STREQUAL "iOS")
enable_language(OBJCXX)
set(CMAKE_OBJC_FLAGS "${CMAKE_OBJC_FLAGS} -fobjc-arc")
set(CMAKE_OBJCXX_FLAGS "${CMAKE_OBJCXX_FLAGS} -fobjc-arc")
Expand All @@ -14,22 +21,42 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
endif()

include(cmake/Utils.cmake)
set(ADDITIONAL_LIB_INCLUDES "")

# ========= Configuration Options =========
set(EXCLUDE_MPQ_SUPPORT FALSE CACHE BOOL "Exclude StormLib and MPQ archive support")
if(EXCLUDE_MPQ_SUPPORT)
add_compile_definitions(EXCLUDE_MPQ_SUPPORT)
endif()

# =========== Dependencies =============
include(cmake/dependencies/common.cmake)

if (CMAKE_SYSTEM_NAME STREQUAL "Android")
include(cmake/dependencies/android.cmake)
endif()

if (CMAKE_SYSTEM_NAME STREQUAL "Windows" AND USE_AUTO_VCPKG)
include(cmake/automate-vcpkg.cmake)
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
include(cmake/dependencies/mac.cmake)
endif()

if ("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
set(VCPKG_TRIPLET x86-windows-static)
set(VCPKG_TARGET_TRIPLET x86-windows-static)
elseif ("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
set(VCPKG_TRIPLET x64-windows-static)
set(VCPKG_TARGET_TRIPLET x64-windows-static)
endif()
if (CMAKE_SYSTEM_NAME STREQUAL "iOS")
include(cmake/dependencies/ios.cmake)
endif()

vcpkg_bootstrap()
vcpkg_install_packages(zlib bzip2 sdl2 glew libzip)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
include(cmake/dependencies/linux.cmake)
endif()

if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
include(cmake/dependencies/windows.cmake)
endif()

# === Platform Specific Configuration ===
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
include(cmake/ios-toolchain-populate.cmake)
endif()

# =========== Sources =============
add_subdirectory("extern")
add_subdirectory("src")

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,5 @@ LUS makes use of the following third party libraries and resources:
- [bzip2](https://github.com/libarchive/bzip2) (bzip2) compression used in StormLib
- [sdl2](https://github.com/libsdl-org/SDL) (zlib) window manager, controllers, and audio player
- [glew](https://github.com/nigels-com/glew) (modified BSD-3-Clause and MIT) OpenGL extension loading library.
- [libzip](https://github.com/nih-at/) (BSD-3-Clause) read `.zip` compatible archives
- [glob_match](https://github.com/torvalds/linux/blob/d1bd5fa07667fcc3e38996ec42aef98761f23039/lib/glob.c) (Dual MIT/GPL) Glob pattern matching.
48 changes: 48 additions & 0 deletions cmake/cvars.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
set(CVAR_VSYNC_ENABLED "gVsyncEnabled" CACHE STRING "")
set(CVAR_Z_FIGHTING_MODE "gZFightingMode" CACHE STRING "")
set(CVAR_NEW_FILE_DROPPED "gNewFileDropped" CACHE STRING "")
set(CVAR_DROPPED_FILE "gDroppedFile" CACHE STRING "")
set(CVAR_INTERNAL_RESOLUTION "gInternalResolution" CACHE STRING "")
set(CVAR_MSAA_VALUE "gMSAAValue" CACHE STRING "")
set(CVAR_SDL_WINDOWED_FULLSCREEN "gSdlWindowedFullscreen" CACHE STRING "")
set(CVAR_TEXTURE_FILTER "gTextureFilter" CACHE STRING "")
set(CVAR_IMGUI_CONTROLLER_NAV "gControlNav" CACHE STRING "")
set(CVAR_CONSOLE_WINDOW_OPEN "gConsoleEnabled" CACHE STRING "")
set(CVAR_CONTROLLER_CONFIGURATION_WINDOW_OPEN "gControllerConfigurationEnabled" CACHE STRING "")
set(CVAR_CONTROLLER_DISCONNECTED_WINDOW_OPEN "gControllerDisconnectedWindowEnabled" CACHE STRING "")
set(CVAR_CONTROLLER_REORDERING_WINDOW_OPEN "gControllerReorderingWindowEnabled" CACHE STRING "")
set(CVAR_GFX_DEBUGGER_WINDOW_OPEN "gGfxDebuggerEnabled" CACHE STRING "")
set(CVAR_STATS_WINDOW_OPEN "gStatsEnabled" CACHE STRING "")
set(CVAR_ENABLE_MULTI_VIEWPORTS "gEnableMultiViewports" CACHE STRING "")
set(CVAR_LOW_RES_MODE "gLowResMode" CACHE STRING "")
set(CVAR_SIMULATED_INPUT_LAG "gSimulatedInputLag" CACHE STRING "")
set(CVAR_ALT_ASSETS "gAltAssets" CACHE STRING "")
set(CVAR_GAME_OVERLAY_FONT "gOverlayFont" CACHE STRING "")
set(CVAR_MENU_BAR_OPEN "gOpenMenuBar" CACHE STRING "")
set(CVAR_PREFIX_CONTROLLERS "gControllers" CACHE STRING "")
set(CVAR_PREFIX_ADVANCED_RESOLUTION "gAdvancedResolution" CACHE STRING "")
add_compile_definitions(
CVAR_VSYNC_ENABLED="${CVAR_VSYNC_ENABLED}"
CVAR_Z_FIGHTING_MODE="${CVAR_Z_FIGHTING_MODE}"
CVAR_NEW_FILE_DROPPED="${CVAR_NEW_FILE_DROPPED}"
CVAR_DROPPED_FILE="${CVAR_DROPPED_FILE}"
CVAR_INTERNAL_RESOLUTION="${CVAR_INTERNAL_RESOLUTION}"
CVAR_MSAA_VALUE="${CVAR_MSAA_VALUE}"
CVAR_SDL_WINDOWED_FULLSCREEN="${CVAR_SDL_WINDOWED_FULLSCREEN}"
CVAR_TEXTURE_FILTER="${CVAR_TEXTURE_FILTER}"
CVAR_IMGUI_CONTROLLER_NAV="${CVAR_IMGUI_CONTROLLER_NAV}"
CVAR_CONSOLE_WINDOW_OPEN="${CVAR_CONSOLE_WINDOW_OPEN}"
CVAR_CONTROLLER_CONFIGURATION_WINDOW_OPEN="${CVAR_CONTROLLER_CONFIGURATION_WINDOW_OPEN}"
CVAR_CONTROLLER_DISCONNECTED_WINDOW_OPEN="${CVAR_CONTROLLER_DISCONNECTED_WINDOW_OPEN}"
CVAR_CONTROLLER_REORDERING_WINDOW_OPEN="${CVAR_CONTROLLER_REORDERING_WINDOW_OPEN}"
CVAR_GFX_DEBUGGER_WINDOW_OPEN="${CVAR_GFX_DEBUGGER_WINDOW_OPEN}"
CVAR_STATS_WINDOW_OPEN="${CVAR_STATS_WINDOW_OPEN}"
CVAR_ENABLE_MULTI_VIEWPORTS="${CVAR_ENABLE_MULTI_VIEWPORTS}"
CVAR_LOW_RES_MODE="${CVAR_LOW_RES_MODE}"
CVAR_SIMULATED_INPUT_LAG="${CVAR_SIMULATED_INPUT_LAG}"
CVAR_ALT_ASSETS="${CVAR_ALT_ASSETS}"
CVAR_GAME_OVERLAY_FONT="${CVAR_GAME_OVERLAY_FONT}"
CVAR_MENU_BAR_OPEN="${CVAR_MENU_BAR_OPEN}"
CVAR_PREFIX_CONTROLLERS="${CVAR_PREFIX_CONTROLLERS}"
CVAR_PREFIX_ADVANCED_RESOLUTION="${CVAR_PREFIX_ADVANCED_RESOLUTION}"
)
14 changes: 14 additions & 0 deletions cmake/dependencies/android.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
find_package(SDL2 QUIET)
if (NOT ${SDL2_FOUND})
include(FetchContent)
FetchContent_Declare(
SDL2
GIT_REPOSITORY https://github.com/libsdl-org/SDL.git
GIT_TAG release-2.28.1
)
message("SDL2 not found. Downloading now...")
FetchContent_MakeAvailable(SDL2)
message("SDL2 downloaded to " ${FETCHCONTENT_BASE_DIR}/sdl2-src)
endif()

target_link_libraries(ImGui PUBLIC SDL2::SDL2)
Loading

0 comments on commit 1ede93b

Please sign in to comment.