Add libultraship as submodule

This commit is contained in:
Waterdish
2023-10-19 15:19:36 -07:00
parent 16176052dc
commit e0b7cf3339
2083 changed files with 4 additions and 551423 deletions
+3
View File
@@ -0,0 +1,3 @@
[submodule "app/jni/src/libultraship"]
path = app/jni/src/libultraship
url = https://github.com/Waterdish/libultraship.git
-23
View File
@@ -1,23 +0,0 @@
IndentWidth: 4
Language: Cpp
UseTab: Never
ColumnLimit: 120
PointerAlignment: Left
BreakBeforeBraces: Attach
SpaceAfterCStyleCast: false
Cpp11BracedListStyle: false
IndentCaseLabels: true
BinPackArguments: true
BinPackParameters: true
AlignAfterOpenBracket: Align
AlignOperands: true
BreakBeforeTernaryOperators: true
BreakBeforeBinaryOperators: None
AllowShortBlocksOnASingleLine: true
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: false
AlignEscapedNewlines: Left
AlignTrailingComments: true
SortIncludes: false
-30
View File
@@ -1,30 +0,0 @@
Checks: '-*,readability-braces-around-statements,readability-inconsistent-declaration-parameter-name,readability-identifier-naming'
WarningsAsErrors: ''
HeaderFilterRegex: '(src|include)\/.*\.h$'
FormatStyle: 'file'
CheckOptions:
- { key: readability-identifier-naming.NamespaceCase, value: CamelCase }
- { key: readability-identifier-naming.ClassCase, value: CamelCase }
- { key: readability-identifier-naming.PrivateMemberPrefix, value: m }
- { key: readability-identifier-naming.ProtectedMemberPrefix, value: m }
- { key: readability-identifier-naming.PrivateMemberCase, value: CamelCase }
- { key: readability-identifier-naming.ProtectedMemberCase, value: CamelCase }
- { key: readability-identifier-naming.PublicMemberCase, value: CamelCase }
- { key: readability-identifier-naming.MemberCase, value: CamelCase }
- { key: readability-identifier-naming.StructCase, value: CamelCase }
#- { key: readability-identifier-naming.EnumCase, value: CamelCase }
#- { key: readability-identifier-naming.EnumConstantCase, value: UPPER_CASE }
- { key: readability-identifier-naming.VariableCase, value: CamelCase }
- { key: readability-identifier-naming.StaticVariableCase, value: CamelCase }
- { key: readability-identifier-naming.StaticVariablePrefix, value: s }
- { key: readability-identifier-naming.GlobalConstantCase, value: CamelCase }
- { key: readability-identifier-naming.GlobalConstantPrefix, value: g }
- { key: readability-identifier-naming.MethodCase, value: CamelCase }
- { key: readability-identifier-naming.FunctionCase, value: CamelCase }
- { key: readability-identifier-naming.VariableCase, value: camelBack }
- { key: readability-identifier-naming.LocalVariableCase, value: camelBack }
- { key: readability-identifier-naming.ParameterCase, value: camelBack }
# Require argument names to match exactly (instead of allowing a name to be a prefix/suffix of another)
# Note: 'true' is expected by clang-tidy 12+ but '1' is used for compatibility with older versions
- key: readability-inconsistent-declaration-parameter-name.Strict
value: 1
@@ -1,94 +0,0 @@
name: build-validation
on:
push:
branches:
- 'main'
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-macos:
runs-on: macos-12
steps:
- name: Install dependencies
run: |
brew install sdl2 libpng glew ninja
- uses: actions/checkout@v2
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ runner.os }}-ccache
- name: Build libultraship
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
cmake --no-warn-unused-cli -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=Release
cmake --build build-cmake --config Release --parallel 10
- name: Upload build
uses: actions/upload-artifact@v3
with:
name: soh-mac
path: build-cmake/src/*.a
if-no-files-found: error
build-linux:
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libsdl2-dev libpng-dev libglew-dev ninja-build
- uses: actions/checkout@v2
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ runner.os }}-ccache
- name: Install latest SDL
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
wget https://www.libsdl.org/release/SDL2-2.24.1.tar.gz
tar -xzf SDL2-2.24.1.tar.gz
cd SDL2-2.24.1
./configure
make -j 10
sudo make install
- name: Build libultraship
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
cmake --no-warn-unused-cli -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=Release
cmake --build build-cmake --config Release --parallel 10
env:
CC: gcc-10
CXX: g++-10
- name: Upload build
uses: actions/upload-artifact@v3
with:
name: soh-linux
path: build-cmake/src/*.a
if-no-files-found: error
build-windows:
runs-on: windows-latest
steps:
- name: Install dependencies
run: |
choco install ninja
Remove-Item -Path "C:\ProgramData\Chocolatey\bin\ccache.exe" -Force
- uses: actions/checkout@v2
- name: ccache
uses: dcvz/ccache-action@27b9f33213c0079872f064f6b6ba0233dfa16ba2
with:
key: ${{ runner.os }}-ccache
- 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 --build build-cmake --config Release --parallel 10
- name: Upload build
uses: actions/upload-artifact@v3
with:
name: soh-windows
path: build-cmake/src/**/*.lib
if-no-files-found: error
@@ -1,51 +0,0 @@
name: tidy-format-validation
on: [pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
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 ninja-build clang-tidy clang-format-12
- uses: actions/checkout@v3
with:
fetch-depth: 2
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ runner.os }}-ccache
- name: Run clang-format
run: |
find src include -name "*.cpp" -o -name "*.h" | sed 's| |\\ |g' | xargs clang-format-12 -i
git diff --exit-code
- name: Install latest SDL
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
wget https://www.libsdl.org/release/SDL2-2.24.1.tar.gz
tar -xzf SDL2-2.24.1.tar.gz
cd SDL2-2.24.1
./configure
make -j 10
sudo make install
- name: Prepare compile_commands.json
run: |
cmake -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
- name: Create results directory
run: |
mkdir clang-tidy-result
- name: Analyze
run: |
git diff -U0 HEAD^ -- 'src' 'include' ':!include/color.h' ':!include/libultra/*' ':!src/public/libultra/*' ':!src/graphic/Fast3D/*' ':!src/log/spd' | clang-tidy-diff -p1 -path build -export-fixes clang-tidy-result/fixes.yml
- name: Save PR metadata
run: |
echo ${{ github.event.number }} > clang-tidy-result/pr-id.txt
echo ${{ github.event.pull_request.head.repo.full_name }} > clang-tidy-result/pr-head-repo.txt
echo ${{ github.event.pull_request.head.ref }} > clang-tidy-result/pr-head-ref.txt
- uses: actions/upload-artifact@v2
with:
name: clang-tidy-result
path: clang-tidy-result/
@@ -1,74 +0,0 @@
name: tidy-result-publish
on:
workflow_run:
workflows: [ tidy-format-validation ]
types: [ completed ]
jobs:
clang-tidy-results:
# Trigger the job only if the previous (insecure) workflow completed successfully
if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-20.04
steps:
- name: Download analysis results
uses: actions/github-script@v3.1.0
with:
script: |
let artifacts = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
});
let matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "clang-tidy-result"
})[0];
let download = await github.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: "zip",
});
let fs = require("fs");
fs.writeFileSync("${{github.workspace}}/clang-tidy-result.zip", Buffer.from(download.data));
- name: Set environment variables
run: |
mkdir clang-tidy-result
unzip clang-tidy-result.zip -d clang-tidy-result
echo "pr_id=$(cat clang-tidy-result/pr-id.txt)" >> $GITHUB_ENV
echo "pr_head_repo=$(cat clang-tidy-result/pr-head-repo.txt)" >> $GITHUB_ENV
echo "pr_head_ref=$(cat clang-tidy-result/pr-head-ref.txt)" >> $GITHUB_ENV
- uses: actions/checkout@v2
with:
repository: ${{ env.pr_head_repo }}
ref: ${{ env.pr_head_ref }}
persist-credentials: false
- name: Redownload analysis results
uses: actions/github-script@v3.1.0
with:
script: |
let artifacts = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
});
let matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "clang-tidy-result"
})[0];
let download = await github.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: "zip",
});
let fs = require("fs");
fs.writeFileSync("${{github.workspace}}/clang-tidy-result.zip", Buffer.from(download.data));
- name: Extract analysis results
run: |
mkdir clang-tidy-result
unzip clang-tidy-result.zip -d clang-tidy-result
- name: Run clang-tidy-pr-comments action
uses: platisd/clang-tidy-pr-comments@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
clang_tidy_fixes: clang-tidy-result/fixes.yml
pull_request_id: ${{ env.pr_id }}
request_changes: true
-348
View File
@@ -1,348 +0,0 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
!libultraship/Lib/**
libultraship/DebugObj/*
build/
build-cmake/
libultraship.a
libultraship.lib
ZAPDUtils.lib
.DS_Store
.vscode/
.vs/
.idea/
cmake-build-**
-29
View File
@@ -1,29 +0,0 @@
cmake_minimum_required(VERSION 3.16.0)
option(NON_PORTABLE "Build a non-portable version" OFF)
project(libultraship LANGUAGES C CXX)
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
enable_language(OBJCXX)
set(CMAKE_OBJC_FLAGS "${CMAKE_OBJC_FLAGS} -fobjc-arc")
set(CMAKE_OBJCXX_FLAGS "${CMAKE_OBJCXX_FLAGS} -fobjc-arc")
endif()
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
include(cmake/Utils.cmake)
if (CMAKE_SYSTEM_NAME STREQUAL "Windows" AND USE_AUTO_VCPKG)
include(cmake/automate-vcpkg.cmake)
set(VCPKG_TRIPLET x64-windows-static)
set(VCPKG_TARGET_TRIPLET x64-windows-static)
vcpkg_bootstrap()
vcpkg_install_packages(zlib bzip2 sdl2 glew)
endif()
add_subdirectory("extern")
add_subdirectory("src")
-134
View File
@@ -1,134 +0,0 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or advances of
any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address,
without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
kenixwhisperwind@gmail.com.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series of
actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within the
community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.1, available at
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
[https://www.contributor-covenant.org/translations][translations].
[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations
-19
View File
@@ -1,19 +0,0 @@
# Preface
LUS accepts any and all contributions. You can interact with the project via PRs, issues, email (kenixwhisperwind@gmail.com), or [Discord](https://discord.gg/RQvdvavB).
# Code of Conduct
Please review and abide by our [code of conduct](https://github.com/Kenix3/libultraship/blob/main/CODE_OF_CONDUCT.md).
# Building
Please see the [readme](https://github.com/Kenix3/libultraship/blob/main/README.md) for building instructions.
# Pull Requests
## Procedures
Our CI system will automatically check your PR to ensure that it fits [formatting guidelines](https://github.com/Kenix3/libultraship/blob/main/.clang-format), [linter guidelines](https://github.com/Kenix3/libultraship/blob/main/.clang-tidy), and that the code builds. The submitter of a PR is required to ensure their PR passes all CI checks. The submitter of the PR is encouraged to address all PR review comments in a timely manner to ensure a timely merge of the PR.
### Troubleshooting CI Errors
#### tidy-format-validation
If the tidy-format-validation check fails, then you need to run clang-format. Below is a command that can be used on Linux. Most modern IDEs have a clang-format plugin that can be used. The [.clang-format file can be found here](https://github.com/Kenix3/libultraship/blob/main/.clang-format)
##### Running clang-format
```
find src include -name "*.cpp" -o -name "*.h" | sed 's| |\\ |g' | xargs clang-format-12 -i
```
-21
View File
@@ -1,21 +0,0 @@
MIT License
Copyright (c) 2022 kenix3 kenixwhisperwind@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-54
View File
@@ -1,54 +0,0 @@
# libultraship
libultraship (LUS) is a library meant to provide reimplementations of libultra (n64 sdk) functions that run on modern hardware.
LUS uses an asset loading system where data is stored separately from the executable in an archive file ending in `.otr`, which is an [`.mpq`](http://www.zezula.net/en/mpq/main.html) compatible file. This separation the data from the executable follows modern design practices and that it is more mod friendly. All one needs to do is supply a patch `.otr` and the system will automatically replace the data.
## Contributing
LUS accepts any and all contributions. You can interact with the project via PRs, issues, email (kenixwhisperwind@gmail.com), or [Discord](https://discord.gg/shipofharkinian).
Please see [CONTRIBUTING.md](https://github.com/Kenix3/libultraship/blob/main/CONTRIBUTING.md) file for more information.
## Versioning
We use semantic versioning. We have defined the API as: every C linkage function, variable, struct, class, public class method, or enum included from libultraship.h.
## Building on Linux/Mac
```
cmake -H. -Bbuild
cmake --build build
```
## Generating a Visual Studio `.sln` on Windows
```
# Visual Studio 2022
& 'C:\Program Files\CMake\bin\cmake' -DUSE_AUTO_VCPKG=true -S . -B "build/x64" -G "Visual Studio 17 2022" -T v142 -A x64
# Visual Studio 2019
& 'C:\Program Files\CMake\bin\cmake' -DUSE_AUTO_VCPKG=true -S . -B "build/x64" -G "Visual Studio 16 2019" -T v142 -A x64
```
## To build on Windows
```
& 'C:\Program Files\CMake\bin\cmake' --build .\build\x64
```
## Sponsors
Thankyou to JetBrains for providing their IDE [CLion](https://www.jetbrains.com/clion/) to me for free!
## License
LUS is licensed under the [MIT](https://github.com/Kenix3/libultraship/blob/main/LICENSE) license.
LUS makes use of the following third party libraries and resources:
- [Fast3D](https://github.com/Kenix3/libultraship/tree/main/src/graphic/Fast3D) (MIT) render display lists.
- [ImGui](https://github.com/ocornut/imgui) (MIT) display UI.
- [StormLib](https://github.com/ladislav-zezula/StormLib) (MIT) create and read `.mpq` compatible archive files.
- [StrHash64](https://github.com/Kenix3/libultraship/blob/main/extern/StrHash64/StrHash64.h) (MIT, zlib, BSD-3-Clause) provide crc64 implementation.
- [ZAPD](https://github.com/zeldaret/ZAPD) (MIT) asset utilities.
- [dr_libs](https://github.com/mackron/dr_libs) (MIT-0) mp3 and wav file conversion.
- [metal-cpp](https://github.com/bkaradzic/metal-cpp) (Apache 2.0) interface to the Apple Metal rendering backend.
- [nlohmann-json](https://github.com/nlohmann/json) (MIT) json parsing and saving.
- [spdlog](https://github.com/gabime/spdlog) (MIT) logging
- [stb](https://github.com/nothings/stb) (MIT) image conversion
- [thread-pool](https://github.com/bshoshany/thread-pool) (MIT) thread pool for the resource manager
- [tinyxml2](https://github.com/leethomason/tinyxml2) (zlib) parse XML files for resource loaders
- [zlib](https://github.com/madler/zlib) (zlib) compression used in StormLib
- [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.
@@ -1,65 +0,0 @@
################################################################################
# Command for variable_watch. This command issues error message, if a variable
# is changed. If variable PROPERTY_READER_GUARD_DISABLED is TRUE nothing happens
# variable_watch(<variable> property_reader_guard)
################################################################################
function(property_reader_guard VARIABLE ACCESS VALUE CURRENT_LIST_FILE STACK)
if("${PROPERTY_READER_GUARD_DISABLED}")
return()
endif()
if("${ACCESS}" STREQUAL "MODIFIED_ACCESS")
message(FATAL_ERROR
" Variable ${VARIABLE} is not supposed to be changed.\n"
" It is used only for reading target property ${VARIABLE}.\n"
" Use\n"
" set_target_properties(\"<target>\" PROPERTIES \"${VARIABLE}\" \"<value>\")\n"
" or\n"
" set_target_properties(\"<target>\" PROPERTIES \"${VARIABLE}_<CONFIG>\" \"<value>\")\n"
" instead.\n")
endif()
endfunction()
################################################################################
# Create variable <name> with generator expression that expands to value of
# target property <name>_<CONFIG>. If property is empty or not set then property
# <name> is used instead. Variable <name> has watcher property_reader_guard that
# doesn't allow to edit it.
# create_property_reader(<name>)
# Input:
# name - Name of watched property and output variable
################################################################################
function(create_property_reader NAME)
set(PROPERTY_READER_GUARD_DISABLED TRUE)
set(CONFIG_VALUE "$<TARGET_GENEX_EVAL:${PROPS_TARGET},$<TARGET_PROPERTY:${PROPS_TARGET},${NAME}_$<UPPER_CASE:$<CONFIG>>>>")
set(IS_CONFIG_VALUE_EMPTY "$<STREQUAL:${CONFIG_VALUE},>")
set(GENERAL_VALUE "$<TARGET_GENEX_EVAL:${PROPS_TARGET},$<TARGET_PROPERTY:${PROPS_TARGET},${NAME}>>")
set("${NAME}" "$<IF:${IS_CONFIG_VALUE_EMPTY},${GENERAL_VALUE},${CONFIG_VALUE}>" PARENT_SCOPE)
variable_watch("${NAME}" property_reader_guard)
endfunction()
################################################################################
# Set property $<name>_${PROPS_CONFIG_U} of ${PROPS_TARGET} to <value>
# set_config_specific_property(<name> <value>)
# Input:
# name - Prefix of property name
# value - New value
################################################################################
function(set_config_specific_property NAME VALUE)
set_target_properties("${PROPS_TARGET}" PROPERTIES "${NAME}_${PROPS_CONFIG_U}" "${VALUE}")
endfunction()
################################################################################
create_property_reader("TARGET_NAME")
create_property_reader("OUTPUT_DIRECTORY")
set_config_specific_property("TARGET_NAME" "${PROPS_TARGET}")
set_config_specific_property("OUTPUT_NAME" "${TARGET_NAME}")
set_config_specific_property("ARCHIVE_OUTPUT_NAME" "${TARGET_NAME}")
set_config_specific_property("LIBRARY_OUTPUT_NAME" "${TARGET_NAME}")
set_config_specific_property("RUNTIME_OUTPUT_NAME" "${TARGET_NAME}")
set_config_specific_property("ARCHIVE_OUTPUT_DIRECTORY" "${OUTPUT_DIRECTORY}")
set_config_specific_property("LIBRARY_OUTPUT_DIRECTORY" "${OUTPUT_DIRECTORY}")
set_config_specific_property("RUNTIME_OUTPUT_DIRECTORY" "${OUTPUT_DIRECTORY}")
@@ -1,12 +0,0 @@
include("${CMAKE_CURRENT_LIST_DIR}/Default.cmake")
set_config_specific_property("OUTPUT_DIRECTORY" "${CMAKE_SOURCE_DIR}$<$<NOT:$<STREQUAL:${CMAKE_VS_PLATFORM_NAME},Win32>>:/${CMAKE_VS_PLATFORM_NAME}>/${PROPS_CONFIG}")
if(MSVC)
create_property_reader("DEFAULT_CXX_EXCEPTION_HANDLING")
create_property_reader("DEFAULT_CXX_DEBUG_INFORMATION_FORMAT")
# set_target_properties("${PROPS_TARGET}" PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
set_config_specific_property("DEFAULT_CXX_EXCEPTION_HANDLING" "/EHsc")
set_config_specific_property("DEFAULT_CXX_DEBUG_INFORMATION_FORMAT" "/Zi")
endif()
@@ -1,123 +0,0 @@
# Check if the compiler-rt library file path exists.
# If found, cache the path in:
# COMPILER_RT_LIBRARY-<name>-<target>
# If err_flag is true OR path not found, emit a message and set:
# COMPILER_RT_LIBRARY-<name>-<target> to NOTFOUND
function(cache_compiler_rt_library err_flag name target library_file)
if(err_flag OR NOT EXISTS "${library_file}")
message(STATUS "Failed to find compiler-rt ${name} library for ${target}")
set(COMPILER_RT_LIBRARY_${name}_${target} "NOTFOUND" CACHE INTERNAL
"compiler-rt ${name} library for ${target}")
else()
message(STATUS "Found compiler-rt ${name} library: ${library_file}")
set(COMPILER_RT_LIBRARY_${name}_${target} "${library_file}" CACHE INTERNAL
"compiler-rt ${name} library for ${target}")
endif()
endfunction()
function(get_component_name name variable)
if(APPLE)
if(NOT name MATCHES "builtins.*")
set(component_name "${name}_")
endif()
if (CMAKE_OSX_SYSROOT MATCHES ".+MacOSX.+")
set(component_name "${component_name}osx")
elseif (CMAKE_OSX_SYSROOT MATCHES ".+iPhoneOS.+")
set(component_name "${component_name}ios")
elseif (CMAKE_OSX_SYSROOT MATCHES ".+iPhoneSimulator.+")
set(component_name "${component_name}iossim")
elseif (CMAKE_OSX_SYSROOT MATCHES ".+AppleTVOS.+")
set(component_name "${component_name}tvos")
elseif (CMAKE_OSX_SYSROOT MATCHES ".+AppleTVSimulator.+")
set(component_name "${component_name}tvossim")
elseif (CMAKE_OSX_SYSROOT MATCHES ".+WatchOS.+")
set(component_name "${component_name}watchos")
elseif (CMAKE_OSX_SYSROOT MATCHES ".+WatchSimulator.+")
set(component_name "${component_name}watchossim")
else()
message(WARNING "Unknown Apple SDK ${CMAKE_OSX_SYSROOT}, we don't know which compiler-rt library suffix to use.")
endif()
else()
set(component_name "${name}")
endif()
set(${variable} "${component_name}" PARENT_SCOPE)
endfunction()
# Find the path to compiler-rt library `name` (e.g. "builtins") for the
# specified `TARGET` (e.g. "x86_64-linux-gnu") and return it in `variable`.
# This calls cache_compiler_rt_library that caches the path to speed up
# repeated invocations with the same `name` and `target`.
function(find_compiler_rt_library name variable)
cmake_parse_arguments(ARG "" "TARGET;FLAGS" "" ${ARGN})
# While we can use compiler-rt runtimes with other compilers, we need to
# query the compiler for runtime location and thus we require Clang.
if(NOT CMAKE_CXX_COMPILER_ID MATCHES Clang)
set(${variable} "NOTFOUND" PARENT_SCOPE)
return()
endif()
set(target "${ARG_TARGET}")
if(NOT target AND CMAKE_CXX_COMPILER_TARGET)
set(target "${CMAKE_CXX_COMPILER_TARGET}")
endif()
if(NOT DEFINED COMPILER_RT_LIBRARY_builtins_${target})
# If the cache variable is not defined, invoke Clang and then
# set it with cache_compiler_rt_library.
set(clang_command ${CMAKE_CXX_COMPILER} "${ARG_FLAGS}")
if(target)
list(APPEND clang_command "--target=${target}")
endif()
get_property(cxx_flags CACHE CMAKE_CXX_FLAGS PROPERTY VALUE)
string(REPLACE " " ";" cxx_flags "${cxx_flags}")
list(APPEND clang_command ${cxx_flags})
set(cmd_prefix "")
if(MSVC AND ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
set(cmd_prefix "/clang:")
endif()
execute_process(
COMMAND ${clang_command} "${cmd_prefix}--rtlib=compiler-rt" "${cmd_prefix}-print-libgcc-file-name"
RESULT_VARIABLE had_error
OUTPUT_VARIABLE library_file
)
string(STRIP "${library_file}" library_file)
file(TO_CMAKE_PATH "${library_file}" library_file)
get_filename_component(dirname ${library_file} DIRECTORY)
if(APPLE)
execute_process(
COMMAND ${clang_command} "--print-resource-dir"
RESULT_VARIABLE had_error
OUTPUT_VARIABLE resource_dir
)
string(STRIP "${resource_dir}" resource_dir)
set(dirname "${resource_dir}/lib/darwin")
endif()
get_filename_component(basename ${library_file} NAME)
if(basename MATCHES ".*clang_rt\.([a-z0-9_\-]+)\.(a|lib)")
set(from_name ${CMAKE_MATCH_1})
get_component_name(${CMAKE_MATCH_1} to_name)
string(REPLACE "${from_name}" "${to_name}" basename "${basename}")
set(library_file "${dirname}/${basename}")
cache_compiler_rt_library(${had_error} builtins "${target}" "${library_file}")
endif()
endif()
if(NOT COMPILER_RT_LIBRARY_builtins_${target})
set(${variable} "NOTFOUND" PARENT_SCOPE)
return()
endif()
if(NOT DEFINED COMPILER_RT_LIBRARY_${name}_${target})
# Clang gives only the builtins library path. Other library paths are
# obtained by substituting "builtins" with ${name} in the builtins
# path and then checking if the resultant path exists. The result of
# this check is also cached by cache_compiler_rt_library.
set(library_file "${COMPILER_RT_LIBRARY_builtins_${target}}")
if(library_file MATCHES ".*clang_rt\.([a-z0-9_\-]+)\.(a|lib)")
set(from_name ${CMAKE_MATCH_0})
get_component_name(${name} to_name)
string(REPLACE "${from_name}" "${to_name}" library_file "${library_file}")
cache_compiler_rt_library(FALSE "${name}" "${target}" "${library_file}")
endif()
endif()
set(${variable} "${COMPILER_RT_LIBRARY_${name}_${target}}" PARENT_SCOPE)
endfunction()
-248
View File
@@ -1,248 +0,0 @@
# utils file for projects came from visual studio solution with cmake-converter.
################################################################################
# Wrap each token of the command with condition
################################################################################
cmake_policy(PUSH)
cmake_policy(SET CMP0054 NEW)
macro(prepare_commands)
unset(TOKEN_ROLE)
unset(COMMANDS)
foreach(TOKEN ${ARG_COMMANDS})
if("${TOKEN}" STREQUAL "COMMAND")
set(TOKEN_ROLE "KEYWORD")
elseif("${TOKEN_ROLE}" STREQUAL "KEYWORD")
set(TOKEN_ROLE "CONDITION")
elseif("${TOKEN_ROLE}" STREQUAL "CONDITION")
set(TOKEN_ROLE "COMMAND")
elseif("${TOKEN_ROLE}" STREQUAL "COMMAND")
set(TOKEN_ROLE "ARG")
endif()
if("${TOKEN_ROLE}" STREQUAL "KEYWORD")
list(APPEND COMMANDS "${TOKEN}")
elseif("${TOKEN_ROLE}" STREQUAL "CONDITION")
set(CONDITION ${TOKEN})
elseif("${TOKEN_ROLE}" STREQUAL "COMMAND")
list(APPEND COMMANDS "$<$<NOT:${CONDITION}>:${DUMMY}>$<${CONDITION}:${TOKEN}>")
elseif("${TOKEN_ROLE}" STREQUAL "ARG")
list(APPEND COMMANDS "$<${CONDITION}:${TOKEN}>")
endif()
endforeach()
endmacro()
cmake_policy(POP)
################################################################################
# Transform all the tokens to absolute paths
################################################################################
macro(prepare_output)
unset(OUTPUT)
foreach(TOKEN ${ARG_OUTPUT})
if(IS_ABSOLUTE ${TOKEN})
list(APPEND OUTPUT "${TOKEN}")
else()
list(APPEND OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/${TOKEN}")
endif()
endforeach()
endmacro()
################################################################################
# Parse add_custom_command_if args.
#
# Input:
# PRE_BUILD - Pre build event option
# PRE_LINK - Pre link event option
# POST_BUILD - Post build event option
# TARGET - Target
# OUTPUT - List of output files
# DEPENDS - List of files on which the command depends
# COMMANDS - List of commands(COMMAND condition1 commannd1 args1 COMMAND
# condition2 commannd2 args2 ...)
# Output:
# OUTPUT - Output files
# DEPENDS - Files on which the command depends
# COMMENT - Comment
# PRE_BUILD - TRUE/FALSE
# PRE_LINK - TRUE/FALSE
# POST_BUILD - TRUE/FALSE
# TARGET - Target name
# COMMANDS - Prepared commands(every token is wrapped in CONDITION)
# NAME - Unique name for custom target
# STEP - PRE_BUILD/PRE_LINK/POST_BUILD
################################################################################
function(add_custom_command_if_parse_arguments)
cmake_parse_arguments("ARG" "PRE_BUILD;PRE_LINK;POST_BUILD" "TARGET;COMMENT" "DEPENDS;OUTPUT;COMMANDS" ${ARGN})
if(WIN32)
set(DUMMY "cd.")
elseif(UNIX)
set(DUMMY "true")
endif()
prepare_commands()
prepare_output()
set(DEPENDS "${ARG_DEPENDS}")
set(COMMENT "${ARG_COMMENT}")
set(PRE_BUILD "${ARG_PRE_BUILD}")
set(PRE_LINK "${ARG_PRE_LINK}")
set(POST_BUILD "${ARG_POST_BUILD}")
set(TARGET "${ARG_TARGET}")
if(PRE_BUILD)
set(STEP "PRE_BUILD")
elseif(PRE_LINK)
set(STEP "PRE_LINK")
elseif(POST_BUILD)
set(STEP "POST_BUILD")
endif()
set(NAME "${TARGET}_${STEP}")
set(OUTPUT "${OUTPUT}" PARENT_SCOPE)
set(DEPENDS "${DEPENDS}" PARENT_SCOPE)
set(COMMENT "${COMMENT}" PARENT_SCOPE)
set(PRE_BUILD "${PRE_BUILD}" PARENT_SCOPE)
set(PRE_LINK "${PRE_LINK}" PARENT_SCOPE)
set(POST_BUILD "${POST_BUILD}" PARENT_SCOPE)
set(TARGET "${TARGET}" PARENT_SCOPE)
set(COMMANDS "${COMMANDS}" PARENT_SCOPE)
set(STEP "${STEP}" PARENT_SCOPE)
set(NAME "${NAME}" PARENT_SCOPE)
endfunction()
################################################################################
# Add conditional custom command
#
# Generating Files
# The first signature is for adding a custom command to produce an output:
# add_custom_command_if(
# <OUTPUT output1 [output2 ...]>
# <COMMANDS>
# <COMMAND condition command1 [args1...]>
# [COMMAND condition command2 [args2...]]
# [DEPENDS [depends...]]
# [COMMENT comment]
#
# Build Events
# add_custom_command_if(
# <TARGET target>
# <PRE_BUILD | PRE_LINK | POST_BUILD>
# <COMMAND condition command1 [args1...]>
# [COMMAND condition command2 [args2...]]
# [COMMENT comment]
#
# Input:
# output - Output files the command is expected to produce
# condition - Generator expression for wrapping the command
# command - Command-line(s) to execute at build time.
# args - Command`s args
# depends - Files on which the command depends
# comment - Display the given message before the commands are executed at
# build time.
# PRE_BUILD - Run before any other rules are executed within the target
# PRE_LINK - Run after sources have been compiled but before linking the
# binary
# POST_BUILD - Run after all other rules within the target have been
# executed
################################################################################
function(add_custom_command_if)
add_custom_command_if_parse_arguments(${ARGN})
if(OUTPUT AND TARGET)
message(FATAL_ERROR "Wrong syntax. A TARGET and OUTPUT can not both be specified.")
endif()
if(OUTPUT)
add_custom_command(OUTPUT ${OUTPUT}
${COMMANDS}
DEPENDS ${DEPENDS}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT ${COMMENT})
elseif(TARGET)
if(PRE_BUILD AND NOT ${CMAKE_GENERATOR} MATCHES "Visual Studio")
add_custom_target(
${NAME}
${COMMANDS}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT ${COMMENT})
add_dependencies(${TARGET} ${NAME})
else()
add_custom_command(
TARGET ${TARGET}
${STEP}
${COMMANDS}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT ${COMMENT})
endif()
else()
message(FATAL_ERROR "Wrong syntax. A TARGET or OUTPUT must be specified.")
endif()
endfunction()
################################################################################
# Use props file for a target and configs
# use_props(<target> <configs...> <props_file>)
# Inside <props_file> there are following variables:
# PROPS_TARGET - <target>
# PROPS_CONFIG - One of <configs...>
# PROPS_CONFIG_U - Uppercase PROPS_CONFIG
# Input:
# target - Target to apply props file
# configs - Build configurations to apply props file
# props_file - CMake script
################################################################################
macro(use_props TARGET CONFIGS PROPS_FILE)
set(PROPS_TARGET "${TARGET}")
foreach(PROPS_CONFIG ${CONFIGS})
string(TOUPPER "${PROPS_CONFIG}" PROPS_CONFIG_U)
get_filename_component(ABSOLUTE_PROPS_FILE "${PROPS_FILE}" ABSOLUTE BASE_DIR "${CMAKE_CURRENT_LIST_DIR}")
if(EXISTS "${ABSOLUTE_PROPS_FILE}")
include("${ABSOLUTE_PROPS_FILE}")
else()
message(WARNING "Corresponding cmake file from props \"${ABSOLUTE_PROPS_FILE}\" doesn't exist")
endif()
endforeach()
endmacro()
################################################################################
# Add compile options to source file
# source_file_compile_options(<source_file> [compile_options...])
# Input:
# source_file - Source file
# compile_options - Options to add to COMPILE_FLAGS property
################################################################################
function(source_file_compile_options SOURCE_FILE)
if("${ARGC}" LESS_EQUAL "1")
return()
endif()
get_source_file_property(COMPILE_OPTIONS "${SOURCE_FILE}" COMPILE_OPTIONS)
if(COMPILE_OPTIONS)
list(APPEND COMPILE_OPTIONS ${ARGN})
else()
set(COMPILE_OPTIONS "${ARGN}")
endif()
set_source_files_properties("${SOURCE_FILE}" PROPERTIES COMPILE_OPTIONS "${COMPILE_OPTIONS}")
endfunction()
################################################################################
# Default properties of visual studio projects
################################################################################
set(DEFAULT_CXX_PROPS "${CMAKE_CURRENT_LIST_DIR}/DefaultCXX.cmake")
function(get_linux_lsb_release_information)
find_program(LSB_RELEASE_EXEC lsb_release)
if(NOT LSB_RELEASE_EXEC)
message(FATAL_ERROR "Could not detect lsb_release executable, can not gather required information")
endif()
execute_process(COMMAND "${LSB_RELEASE_EXEC}" --short --id OUTPUT_VARIABLE LSB_RELEASE_ID_SHORT OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND "${LSB_RELEASE_EXEC}" --short --release OUTPUT_VARIABLE LSB_RELEASE_VERSION_SHORT OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND "${LSB_RELEASE_EXEC}" --short --codename OUTPUT_VARIABLE LSB_RELEASE_CODENAME_SHORT OUTPUT_STRIP_TRAILING_WHITESPACE)
set(LSB_RELEASE_ID_SHORT "${LSB_RELEASE_ID_SHORT}" PARENT_SCOPE)
set(LSB_RELEASE_VERSION_SHORT "${LSB_RELEASE_VERSION_SHORT}" PARENT_SCOPE)
set(LSB_RELEASE_CODENAME_SHORT "${LSB_RELEASE_CODENAME_SHORT}" PARENT_SCOPE)
endfunction()
@@ -1,191 +0,0 @@
#------------------------------------------------------------------------------------------------------------
#
# Automate-VCPKG by Andre Taulien
# ===============================
#
# Project Repository: https://github.com/REGoth-project/Automate-VCPKG
# License ..........: MIT, see end of file.
#
# Based on: https://github.com/sutambe/cpptruths/blob/vcpkg_cmake_blog/cpp0x/vcpkg_test/CMakeLists.txt
#
#
# While [Vcpkg](https://github.com/microsoft/vcpkg) on it's own is awesome, it does add
# a little bit of complexity to getting a project to build. Even more if the one trying
# to compile your application is not too fond of the commandline. Additionally, CMake
# commands tend to get rather long with the toolchain path.
#
# To keep things simple for new users who just want to get the project to build, this
# script offers a solution.
#
# Lets assume your main `CMakelists.txt` looks something like this:
#
# cmake_minimum_required (VERSION 3.12.0)
# project (MyProject)
#
# add_executable(MyExecutable main.c)
#
# To integrate Vcpkg into that `CMakelists.txt`, simple put the following lines before the
# call to `project(MyProject)`:
#
# include(cmake/automate-vcpkg.cmake)
#
# vcpkg_bootstrap()
# vcpkg_install_packages(libsquish physfs)
#
# The call to `vcpkg_bootstrap()` will clone the official Vcpkg repository and bootstrap it.
# If it detected an existing environment variable defining a valid `VCPKG_ROOT`, it will
# update the existing installation of Vcpkg.
#
# Arguments to `vcpkg_install_packages()` are the packages you want to install using Vcpkg.
#
# If you want to keep the possibility for users to chose their own copy of Vcpkg, you can
# simply not run the code snippet mentioned above, something like this will work:
#
# option(SKIP_AUTOMATE_VCPKG "When ON, you will need to built the packages
# required by MyProject on your own or supply your own vcpkg toolchain.")
#
# if (NOT SKIP_AUTOMATE_VCPKG)
# include(cmake/automate-vcpkg.cmake)
#
# vcpkg_bootstrap()
# vcpkg_install_packages(libsquish physfs)
# endif()
#
# Then, the user has to supply the packages on their own, be it through Vcpkg or manually
# specifying their locations.
#------------------------------------------------------------------------------------------------------------
cmake_minimum_required (VERSION 3.12)
if(WIN32)
set(VCPKG_FALLBACK_ROOT ${CMAKE_CURRENT_BINARY_DIR}/vcpkg CACHE STRING "vcpkg configuration directory to use if vcpkg was not installed on the system before")
else()
set(VCPKG_FALLBACK_ROOT ${CMAKE_CURRENT_BINARY_DIR}/.vcpkg CACHE STRING "vcpkg configuration directory to use if vcpkg was not installed on the system before")
endif()
# On Windows, Vcpkg defaults to x86, even on x64 systems. If we're
# doing a 64-bit build, we need to fix that.
if (WIN32)
# Since the compiler checks haven't run yet, we need to figure
# out the value of CMAKE_SIZEOF_VOID_P ourselfs
include(CheckTypeSize)
enable_language(C)
check_type_size("void*" SIZEOF_VOID_P BUILTIN_TYPES_ONLY)
if (SIZEOF_VOID_P EQUAL 8)
message(STATUS "Using Vcpkg triplet 'x64-windows'")
set(VCPKG_TRIPLET x64-windows)
endif()
endif()
if(NOT DEFINED VCPKG_ROOT)
if(NOT DEFINED ENV{VCPKG_ROOT})
set(VCPKG_ROOT ${VCPKG_FALLBACK_ROOT})
else()
set(VCPKG_ROOT $ENV{VCPKG_ROOT})
endif()
endif()
# Installs a new copy of Vcpkg or updates an existing one
macro(vcpkg_bootstrap)
_install_or_update_vcpkg()
# Find out whether the user supplied their own VCPKG toolchain file
if(NOT DEFINED ${CMAKE_TOOLCHAIN_FILE})
# We know this wasn't set before so we need point the toolchain file to the newly found VCPKG_ROOT
set(CMAKE_TOOLCHAIN_FILE ${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake CACHE STRING "")
# Just setting vcpkg.cmake as toolchain file does not seem to actually pull in the code
include(${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake)
set(AUTOMATE_VCPKG_USE_SYSTEM_VCPKG OFF)
else()
# VCPKG_ROOT has been defined by the toolchain file already
set(AUTOMATE_VCPKG_USE_SYSTEM_VCPKG ON)
endif()
message(STATUS "Automate VCPKG status:")
message(STATUS " VCPKG_ROOT.....: ${VCPKG_ROOT}")
message(STATUS " VCPKG_EXEC.....: ${VCPKG_EXEC}")
message(STATUS " VCPKG_BOOTSTRAP: ${VCPKG_BOOTSTRAP}")
endmacro()
macro(_install_or_update_vcpkg)
if(NOT EXISTS ${VCPKG_ROOT})
message(STATUS "Cloning vcpkg in ${VCPKG_ROOT}")
execute_process(COMMAND git clone https://github.com/Microsoft/vcpkg.git ${VCPKG_ROOT})
# If a reproducible build is desired (and potentially old libraries are # ok), uncomment the
# following line and pin the vcpkg repository to a specific githash.
# execute_process(COMMAND git checkout 745a0aea597771a580d0b0f4886ea1e3a94dbca6 WORKING_DIRECTORY ${VCPKG_ROOT})
else()
# The following command has no effect if the vcpkg repository is in a detached head state.
message(STATUS "Auto-updating vcpkg in ${VCPKG_ROOT}")
execute_process(COMMAND git pull WORKING_DIRECTORY ${VCPKG_ROOT})
endif()
if(NOT EXISTS ${VCPKG_ROOT}/README.md)
message(FATAL_ERROR "***** FATAL ERROR: Could not clone vcpkg *****")
endif()
if(WIN32)
set(VCPKG_EXEC ${VCPKG_ROOT}/vcpkg.exe)
set(VCPKG_BOOTSTRAP ${VCPKG_ROOT}/bootstrap-vcpkg.bat)
else()
set(VCPKG_EXEC ${VCPKG_ROOT}/vcpkg)
set(VCPKG_BOOTSTRAP ${VCPKG_ROOT}/bootstrap-vcpkg.sh)
endif()
if(NOT EXISTS ${VCPKG_EXEC})
message("Bootstrapping vcpkg in ${VCPKG_ROOT}")
execute_process(COMMAND ${VCPKG_BOOTSTRAP} WORKING_DIRECTORY ${VCPKG_ROOT})
endif()
if(NOT EXISTS ${VCPKG_EXEC})
message(FATAL_ERROR "***** FATAL ERROR: Could not bootstrap vcpkg *****")
endif()
endmacro()
# Installs the list of packages given as parameters using Vcpkg
macro(vcpkg_install_packages)
# Need the given list to be space-separated
#string (REPLACE ";" " " PACKAGES_LIST_STR "${ARGN}")
message(STATUS "Installing/Updating the following vcpkg-packages: ${PACKAGES_LIST_STR}")
if (VCPKG_TRIPLET)
set(ENV{VCPKG_DEFAULT_TRIPLET} "${VCPKG_TRIPLET}")
endif()
execute_process(
COMMAND ${VCPKG_EXEC} install ${ARGN}
WORKING_DIRECTORY ${VCPKG_ROOT}
)
endmacro()
# MIT License
#
# Copyright (c) 2019 REGoth-project
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
-142
View File
@@ -1,142 +0,0 @@
#find_package(OpenGL QUIET)
find_library(OPENGL_LIBRARY GLESv2)
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
find_package(SDL2 CONFIG REQUIRED)
else()
#find_package(SDL2 REQUIRED)
endif()
#=================== DrLibs ===================
set(DRLIBS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/dr_libs)
add_library(DrLibs INTERFACE)
target_include_directories(DrLibs INTERFACE ${DRLIBS_DIR})
#=================== Storm ===================
set(STORMLIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/StormLib)
add_subdirectory(${STORMLIB_DIR})
if((CMAKE_SYSTEM_NAME MATCHES "Windows") AND ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang"))
include(../cmake/HandleCompilerRT.cmake)
find_compiler_rt_library(builtins CLANG_RT_BUILTINS_LIBRARY)
get_filename_component(LIBDIR "${CLANG_RT_BUILTINS_LIBRARY}" DIRECTORY)
if(IS_DIRECTORY "${LIBDIR}")
target_link_libraries(storm ${CLANG_RT_BUILTINS_LIBRARY})
endif()
endif()
if (CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch")
target_compile_definitions(storm PRIVATE -D_POSIX_C_SOURCE=200809L)
endif()
#=================== ImGui ===================
set(IMGUI_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ImGui)
add_library(ImGui STATIC)
set_property(TARGET ImGui PROPERTY CXX_STANDARD 20)
target_sources(ImGui
PRIVATE
${IMGUI_DIR}/imgui_demo.cpp
${IMGUI_DIR}/imgui_draw.cpp
${IMGUI_DIR}/imgui_tables.cpp
${IMGUI_DIR}/imgui_widgets.cpp
${IMGUI_DIR}/imgui.cpp
)
if (CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch")
target_include_directories(ImGui PRIVATE ${DEVKITPRO}/portlibs/switch/include/)
endif()
if (NOT CMAKE_SYSTEM_NAME STREQUAL "CafeOS")
target_sources(ImGui
PRIVATE
${IMGUI_DIR}/backends/imgui_impl_opengl3.cpp
${IMGUI_DIR}/backends/imgui_impl_sdl2.cpp
)
endif()
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
target_sources(ImGui
PRIVATE
${IMGUI_DIR}/backends/imgui_impl_dx11.cpp
${IMGUI_DIR}/backends/imgui_impl_win32.cpp
)
elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
target_sources(ImGui
PRIVATE
${IMGUI_DIR}/backends/imgui_impl_metal.mm
)
elseif (CMAKE_SYSTEM_NAME STREQUAL "CafeOS")
target_sources(ImGui
PRIVATE
${IMGUI_DIR}/backends/wiiu/imgui_impl_wiiu.cpp
${IMGUI_DIR}/backends/wiiu/imgui_impl_gx2.cpp
)
endif()
target_include_directories(ImGui PUBLIC ${IMGUI_DIR} ${IMGUI_DIR}/backends PRIVATE ${SDL2_INCLUDE_DIRS})
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
target_include_directories(ImGui PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/metal-cpp)
target_compile_definitions(ImGui PUBLIC IMGUI_IMPL_METAL_CPP)
endif()
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
target_link_libraries(ImGui PUBLIC SDL2::SDL2 SDL2::SDL2main)
elseif (CMAKE_SYSTEM_NAME STREQUAL "CafeOS")
target_link_libraries(ImGui PUBLIC SDL2::SDL2-static)
else()
target_link_libraries(ImGui PUBLIC SDL2::SDL2)
endif()
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
find_package(GLEW REQUIRED)
target_link_libraries(ImGui PUBLIC opengl32 GLEW::GLEW)
elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
find_package(GLEW REQUIRED)
target_link_libraries(ImGui PUBLIC ${OPENGL_opengl_LIBRARY} GLEW::GLEW)
set_target_properties(ImGui PROPERTIES
XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES
)
elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
find_package(GLEW REQUIRED)
target_link_libraries(ImGui PUBLIC ${OPENGL_glx_LIBRARY} ${OPENGL_opengl_LIBRARY} GLEW::GLEW)
endif()
#=================== tinyxml2 ===================
set(TINYXML2_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tinyxml2)
add_library(tinyxml2 STATIC)
target_sources(tinyxml2 PRIVATE ${TINYXML2_DIR}/tinyxml2.cpp)
target_include_directories(tinyxml2 PUBLIC ${TINYXML2_DIR})
#=================== ZAPDUtils ===================
set(ZAPDUTILS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ZAPDUtils)
add_subdirectory(${ZAPDUTILS_DIR})
#=================== nlohmann-json ===================
set(JSON_BuildTests OFF CACHE INTERNAL "")
set(NLOHMANN_JSON_DIR ${CMAKE_CURRENT_SOURCE_DIR}/nlohmann-json)
add_subdirectory(${NLOHMANN_JSON_DIR})
#=================== StrHash64 ===================
set(STRHASH64_DIR ${CMAKE_CURRENT_SOURCE_DIR}/StrHash64)
add_library(StrHash64 STATIC)
target_sources(StrHash64 PRIVATE ${STRHASH64_DIR}/StrHash64.cpp)
target_include_directories(StrHash64 PUBLIC ${STRHASH64_DIR})
#=================== thread-pool ===================
set(THREADPOOL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thread-pool)
add_library(ThreadPool INTERFACE)
target_include_directories(ThreadPool INTERFACE ${THREADPOOL_DIR})
-28
View File
@@ -1,28 +0,0 @@
# See http://editorconfig.org to read about the EditorConfig format.
# - In theory automatically supported by VS2017+ and most common IDE or text editors.
# - In practice VS2019-VS2022 stills don't trim trailing whitespaces correctly :(
# - Suggest installing this to trim whitespaces:
# GitHub https://github.com/madskristensen/TrailingWhitespace
# VS2019 https://marketplace.visualstudio.com/items?itemName=MadsKristensen.TrailingWhitespaceVisualizer
# VS2022 https://marketplace.visualstudio.com/items?itemName=MadsKristensen.TrailingWhitespace64
# (in spite of its name doesn't only visualize but also trims)
# - Alternative for older VS2010 to VS2015: https://marketplace.visualstudio.com/items?itemName=EditorConfigTeam.EditorConfig
# top-most EditorConfig file
root = true
# Default settings:
# Use 4 spaces as indentation
[*]
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
[imstb_*]
indent_size = 3
trim_trailing_whitespace = false
[Makefile]
indent_style = tab
indent_size = 4

Some files were not shown because too many files have changed in this diff Show More