Move to cmake across all platforms (#363)

This commit is contained in:
th-2021 2022-08-05 07:59:19 +02:00 committed by GitHub
parent 93d0d7443a
commit 1ebca42f46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
63 changed files with 5852 additions and 8906 deletions

19
.gitignore vendored
View File

@ -24,6 +24,10 @@ docs/doxygen/
*.map
*.dump
out.txt
*.sln
*.vcxproj
*.vcxproj.user
*.vcxproj.filters
# Tool artifacts
tools/mipspro7.2_compiler/
@ -423,3 +427,18 @@ xcuserdata/
!*.xcworkspace/contents.xcworkspacedata
/*.gcno
**/xcshareddata/WorkspaceSettings.xcsettings
# cmake
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps
*/extract_assets_cmake*
/build*

View File

@ -2,22 +2,62 @@
## Windows
1. Requires [Python](https://www.python.org/downloads/) >= 3.6.
2. Install [Visual Studio 2022 Community Edition](https://visualstudio.microsoft.com/vs/community/)
3. In the Visual Studio Installer, install `MSVC v142 - VS 2019 C++`.
4. Clone the Ship of Harkinian repository.
5. Place one or more [compatible](#compatible-roms) roms in the `OTRExporter` directory with namings of your choice.
6. Run `OTRExporter/OTRExporter.sln`.
7. Switch the solution to `Release x64`.
8. Build the solution.
9. Launching `OTRExporter/extract_assets.py` will generate an `oot.otr` archive file in `OTRExporter/oot.otr`.
10. Run `soh/soh.sln`
11. Switch the solution to `Release x86` or `Release x64`.
12. Build the solution.
13. Copy the `OTRExporter/oot.otr` archive file to `soh/Release`.
14. Launch `soh.exe`.
1. Requires Visual Studio 2022 Community Edition && `python3, cmake, git` (can be installed via chocolatey or manually)
2. Clone the Ship of Harkinian repository
3. Place one or more [compatible](#compatible-roms) roms in the `OTRExporter` directory with namings of your choice
_Note: Instructions assume using powershell_
```powershell
# Navigate to the Shipwright repo within powershell. ie: cd "C:\yourpath\Shipwright"
cd Shipwright
# Setup cmake project
& 'C:\Program Files\CMake\bin\cmake' -S . -B "build/x64" -G "Visual Studio 17 2022" -T v142 -A x64 # -DCMAKE_BUILD_TYPE:STRING=Release (if you're packaging)
# Extract assets & generate OTR (run this anytime you need to regenerate OTR)
& 'C:\Program Files\CMake\bin\cmake.exe' --build .\build\x64 --target ExtractAssets # --config Release (if you're packaging)
# Compile project
& 'C:\Program Files\CMake\bin\cmake.exe' --build .\build\x64 # --config Release (if you're packaging)
# Now you can run the executable in .\build\x64
# If you need to clean the project you can run
& 'C:\Program Files\CMake\bin\cmake.exe' --build .\build\x64 --target clean
```
### Developing SoH
With the cmake build system you have two options for working on the project:
#### Visual Studio
To develop using Visual Studio you only need to use cmake to generate the solution file:
```powershell
# Generates Ship.sln at the root directory
& 'C:\Program Files\CMake\bin\cmake' -S . -G "Visual Studio 17 2022" -T v142 -A x64
```
#### Visual Studio Code or another editor
To develop using Visual Studio Code or another editor you only need to open the repository in it.
To build you'll need to follow the instructions from the building section.
_Note: If you're using Visual Studio Code, the [cpack plugin](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools) makes it very easy to just press run and debug._
_Experimental: You can also use another build system entirely rathen than MSVC like [Ninja](https://ninja-build.org/) for possibly better performance._
### Generating the distributable
After compiling the project you can generate the distributable by running:
```powershell
# Go to build folder
cd "build/x64"
# Generate
& 'C:\Program Files\CMake\bin\cpack.exe' -G ZIP
```
## Linux
1. Requires `gcc, x11, curl, python3, sdl2, libpng, glew, ninja, cmake`
**Important: For maximum performance make sure you have ninja build tools installed!**
_Note: If you're using Visual Studio Code, the [cpack plugin](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools) makes it very easy to just press run and debug._
```bash
# Clone the repo
@ -25,41 +65,87 @@ git clone https://github.com/HarbourMasters/Shipwright.git
cd Shipwright
# Copy the baserom to the OTRExporter folder
cp <path to your ROM> OTRExporter
# Build the docker image
sudo docker build . -t soh
# Run the docker image with the working directory mounted to /soh
sudo docker run --rm -it -v $(pwd):/soh soh /bin/bash
# Generate Ninja project
cmake -H. -Bbuild-cmake -GNinja # -DCMAKE_BUILD_TYPE:STRING=Release (if you're packaging)
# Extract assets & generate OTR (run this anytime you need to regenerate OTR)
cmake --build build-cmake --target ExtractAssets
# Compile the project
cmake --build build-cmake # --config Release (if you're packaging)
# Now you can run the executable in ./build-cmake/soh/soh.elf
# To develop the project open the repository in VSCode (or your preferred editor)
# If you need to clean the project you can run
cmake --build build-cmake --target clean
```
Inside the Docker container:
### Generating a distributable
After compiling the project you can generate a distributable by running of the following:
```bash
cd soh
# Extract the assets/Compile the exporter/Run the exporter
make setup -j$(nproc) OPTFLAGS=-O2 DEBUG=0
# Compile the code
make -j $(nproc) OPTFLAGS=-O2 DEBUG=0
# Go to build folder
cd build-cmake
# Generate
cpack -G DEB
cpack -G ZIP
cpack -G External (creates appimage)
```
## macOS
1. Requires Xcode (or xcode-tools) && `sdl2, libpng, glew, ninja, cmake` (can be installed via homebrew, macports, etc)
**Important: For maximum performance make sure you have ninja build tools installed!**
_Note: If you're using Visual Studio Code, the [cpack plugin](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools) makes it very easy to just press run and debug._
1. Requires Xcode (or xcode-tools) && `sdl2, libpng, glew, cmake, pkgconfig, dylibbundler` (can be installed via homebrew, macports, etc)
```bash
# Clone the repo
git clone https://github.com/HarbourMasters/Shipwright.git
cd ShipWright
# Copy the baserom to the OTRExporter folder
cp <path to your ROM> OTRExporter
# Generate Ninja project
cmake -H. -Bbuild-cmake -GNinja # -DCMAKE_BUILD_TYPE:STRING=Release (if you're packaging)
# Extract assets & generate OTR (run this anytime you need to regenerate OTR)
cmake --build build-cmake --target ExtractAssets
# Compile the project
cmake --build build-cmake # --config Release (if you're packaging)
cd soh
# Extract the assets/Compile the exporter/Run the exporter
# -jX defines number of cores to use for compilation - lower or remove entirely if having issues
make setup -j8 DEBUG=0
# Compile the code (watch the -j parameter as above)
make -j8 DEBUG=0
# Create macOS app bundle
make appbundle
# Now you can run the executable in ./build-cmake/soh/soh-macos
# To develop the project open the repository in VSCode (or your preferred editor)
# If you need to clean the project you can run
cmake --build build-cmake --target clean
```
### Generating a distributable
After compiling the project you can generate a distributable by running of the following:
```bash
# Go to build folder
cd build-cmake
# Generate
cpack
```
## Switch
1. Requires that your build machine is setup with the tools necessary for your platform above
2. Requires that you have the switch build tools installed
3. Clone the Ship of Harkinian repository
4. Place one or more [compatible](#compatible-roms) roms in the `OTRExporter` directory with namings of your choice
```bash
cd Shipwright
# Setup cmake project for your host machine
cmake -H. -Bbuild-cmake -GNinja
# Extract assets & generate OTR (run this anytime you need to regenerate OTR)
cmake --build build-cmake --target ExtractAssets
# Setup cmake project for building for Switch
cmake -H. -Bbuild-switch -GNinja -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/Switch.cmake
# Build project and generate nro
cmake --build build-switch --target soh_nro
# Now you can run the executable in ./build-switch/soh/soh.nro
# To develop the project open the repository in VSCode (or your preferred editor)
```
9. Copy your OTR file to ~/Library/Application\ Support/com.shipofharkinian.soh
10. Launch soh app in the soh folder!
# Compatible Roms
```

65
CMake/Default.cmake Normal file
View File

@ -0,0 +1,65 @@
################################################################################
# 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}")

12
CMake/DefaultCXX.cmake Normal file
View File

@ -0,0 +1,12 @@
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()

30
CMake/Packaging-2.cmake Normal file
View File

@ -0,0 +1,30 @@
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
set(CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY 0)
set(CPACK_COMPONENTS_ALL "ship" "appimage")
if (NOT CPACK_GENERATOR STREQUAL "External")
list(REMOVE_ITEM CPACK_COMPONENTS_ALL "appimage")
endif()
if (CPACK_GENERATOR MATCHES "DEB|RPM")
# https://unix.stackexchange.com/a/11552/254512
set(CPACK_PACKAGING_INSTALL_PREFIX "/opt/ship/bin")#/${CMAKE_PROJECT_VERSION}")
set(CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY 0)
elseif (CPACK_GENERATOR MATCHES "ZIP")
set(CPACK_PACKAGING_INSTALL_PREFIX "")
endif()
if (CPACK_GENERATOR MATCHES "External")
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
SET(CPACK_MONOLITHIC_INSTALL 1)
set(CPACK_PACKAGING_INSTALL_PREFIX "/usr/bin")
endif()
if (CPACK_GENERATOR MATCHES "Bundle")
set(CPACK_BUNDLE_NAME "soh")
set(CPACK_BUNDLE_PLIST "../soh/macosx/Info.plist")
set(CPACK_BUNDLE_ICON "macosx/soh.icns")
set(CPACK_BUNDLE_STARTUP_COMMAND "../soh/macosx/soh-macos.sh")
set(CPACK_BUNDLE_APPLE_CERT_APP "-")
endif()

90
CMake/Packaging.cmake Normal file
View File

@ -0,0 +1,90 @@
# these are cache variables, so they could be overwritten with -D,
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}"
CACHE STRING "The resulting package name"
)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Simple C++ application"
CACHE STRING "Package description for the package metadata"
)
set(CPACK_PACKAGE_VENDOR "Some Company")
set(CPACK_VERBATIM_VARIABLES YES)
set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME})
SET(CPACK_OUTPUT_FILE_PREFIX "${CMAKE_SOURCE_DIR}/_packages")
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
set(CPACK_PACKAGE_CONTACT "YOUR@E-MAIL.net")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "YOUR NAME")
#set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md")
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(CPACK_SYSTEM_NAME ${LSB_RELEASE_CODENAME_SHORT})
# package name for deb
# if set, then instead of some-application-0.9.2-Linux.deb
# you'll get some-application_0.9.2_amd64.deb (note the underscores too)
#set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
execute_process(COMMAND dpkg --print-architecture OUTPUT_VARIABLE ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE)
set( CPACK_DEBIAN_FILE_NAME ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}-${ARCHITECTURE}.deb )
# if you want every group to have its own package,
# although the same happens if this is not sent (so it defaults to ONE_PER_GROUP)
# and CPACK_DEB_COMPONENT_INSTALL is set to YES
set(CPACK_COMPONENTS_GROUPING ALL_COMPONENTS_IN_ONE)#ONE_PER_GROUP)
# without this you won't be able to pack only specified component
set(CPACK_DEB_COMPONENT_INSTALL YES)
set(CPACK_EXTERNAL_ENABLE_STAGING YES)
set(CPACK_EXTERNAL_PACKAGE_SCRIPT "${PROJECT_BINARY_DIR}/appimage-generate.cmake")
file(GENERATE
OUTPUT "${PROJECT_BINARY_DIR}/appimage-generate.cmake"
CONTENT [[
include(CMakePrintHelpers)
cmake_print_variables(CPACK_TEMPORARY_DIRECTORY)
cmake_print_variables(CPACK_TOPLEVEL_DIRECTORY)
cmake_print_variables(CPACK_PACKAGE_DIRECTORY)
cmake_print_variables(CPACK_PACKAGE_FILE_NAME)
find_program(LINUXDEPLOY_EXECUTABLE
NAMES linuxdeploy linuxdeploy-x86_64.AppImage
PATHS ${CPACK_PACKAGE_DIRECTORY}/linuxdeploy)
if (NOT LINUXDEPLOY_EXECUTABLE)
message(STATUS "Downloading linuxdeploy")
set(LINUXDEPLOY_EXECUTABLE ${CPACK_PACKAGE_DIRECTORY}/linuxdeploy/linuxdeploy)
file(DOWNLOAD
https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
${LINUXDEPLOY_EXECUTABLE}
INACTIVITY_TIMEOUT 10
LOG ${CPACK_PACKAGE_DIRECTORY}/linuxdeploy/download.log
STATUS LINUXDEPLOY_DOWNLOAD)
execute_process(COMMAND chmod +x ${LINUXDEPLOY_EXECUTABLE} COMMAND_ECHO STDOUT)
endif()
execute_process(
COMMAND
${CMAKE_COMMAND} -E env
OUTPUT=${CPACK_PACKAGE_FILE_NAME}.appimage
VERSION=$<IF:$<BOOL:${CPACK_PACKAGE_VERSION}>,${CPACK_PACKAGE_VERSION},0.1.0>
${LINUXDEPLOY_EXECUTABLE}
--appimage-extract-and-run
--appdir=${CPACK_TEMPORARY_DIRECTORY}
--executable=$<TARGET_FILE:soh>
$<$<BOOL:$<TARGET_PROPERTY:soh,APPIMAGE_DESKTOP_FILE>>:--desktop-file=$<TARGET_PROPERTY:soh,APPIMAGE_DESKTOP_FILE>>
$<$<BOOL:$<TARGET_PROPERTY:soh,APPIMAGE_ICON_FILE>>:--icon-file=$<TARGET_PROPERTY:soh,APPIMAGE_ICON_FILE>>
--output=appimage
# --verbosity=2
)
]])
endif()
include(CPack)

248
CMake/Utils.cmake Normal file
View File

@ -0,0 +1,248 @@
# 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()

191
CMake/automate-vcpkg.cmake Normal file
View File

@ -0,0 +1,191 @@
#------------------------------------------------------------------------------------------------------------
#
# 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.

192
CMakeLists.txt Normal file
View File

@ -0,0 +1,192 @@
cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR)
set(CMAKE_SYSTEM_VERSION 10.0 CACHE STRING "" FORCE)
set(CMAKE_CXX_STANDARD 20 CACHE STRING "The C++ standard to use")
#set(CMAKE_C_STANDARD 11 CACHE STRING "The C standard to use") - issue with soh compile with MSVC
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(MACOSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version" FORCE)
endif()
project(Ship C CXX)
set(PROJECT_VERSION_MAJOR "3")
set(PROJECT_VERSION_MINOR "0")
set(PROJECT_VERSION_PATCH "0")
set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT soh)
add_compile_options($<$<CXX_COMPILER_ID:MSVC>:/MP>)
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
include(cmake/automate-vcpkg.cmake)
vcpkg_bootstrap()
vcpkg_install_packages(zlib bzip2 libpng)
endif()
################################################################################
# Set target arch type if empty. Visual studio solution generator provides it.
################################################################################
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
if(NOT CMAKE_VS_PLATFORM_NAME)
set(CMAKE_VS_PLATFORM_NAME "x64")
endif()
message("${CMAKE_VS_PLATFORM_NAME} architecture in use")
if(NOT ("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64"
OR "${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32"))
message(FATAL_ERROR "${CMAKE_VS_PLATFORM_NAME} arch is not supported!")
endif()
endif()
################################################################################
# Global configuration types
################################################################################
set(CMAKE_CONFIGURATION_TYPES
"Debug"
"Release"
CACHE STRING "" FORCE
)
if(NOT CMAKE_BUILD_TYPE )
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build." FORCE)
endif()
################################################################################
# Global compiler options
################################################################################
if(MSVC)
# remove default flags provided with CMake for MSVC
set(CMAKE_C_FLAGS "")
set(CMAKE_C_FLAGS_DEBUG "")
set(CMAKE_C_FLAGS_RELEASE "")
set(CMAKE_CXX_FLAGS "")
set(CMAKE_CXX_FLAGS_DEBUG "")
set(CMAKE_CXX_FLAGS_RELEASE "")
endif()
################################################################################
# Global linker options
################################################################################
if(MSVC)
# remove default flags provided with CMake for MSVC
set(CMAKE_EXE_LINKER_FLAGS "")
set(CMAKE_MODULE_LINKER_FLAGS "")
set(CMAKE_SHARED_LINKER_FLAGS "")
set(CMAKE_STATIC_LINKER_FLAGS "")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_STATIC_LINKER_FLAGS_DEBUG "${CMAKE_STATIC_LINKER_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS}")
endif()
################################################################################
# Common utils
################################################################################
include(CMake/Utils.cmake)
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
get_linux_lsb_release_information()
message(STATUS "Linux ${LSB_RELEASE_ID_SHORT} ${LSB_RELEASE_VERSION_SHORT} ${LSB_RELEASE_CODENAME_SHORT}")
else()
message(STATUS ${CMAKE_SYSTEM_NAME})
endif()
################################################################################
# Additional Global Settings(add specific info there)
################################################################################
include(CMake/GlobalSettingsInclude.cmake OPTIONAL)
################################################################################
# Use solution folders feature
################################################################################
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
################################################################################
# Sub-projects
################################################################################
add_subdirectory(libultraship/libultraship ${CMAKE_BINARY_DIR}/libultraship)
add_subdirectory(ZAPDTR/ZAPD ${CMAKE_BINARY_DIR}/ZAPD)
add_subdirectory(ZAPDTR/ZAPDUtils ${CMAKE_BINARY_DIR}/ZAPDUtils)
add_subdirectory(OTRExporter)
add_subdirectory(soh)
if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin|NintendoSwitch")
add_subdirectory(OTRGui)
endif()
set_property(TARGET soh PROPERTY APPIMAGE_DESKTOP_FILE_TERMINAL YES)
set_property(TARGET soh PROPERTY APPIMAGE_DESKTOP_FILE "${CMAKE_SOURCE_DIR}/scripts/linux/appimage/soh.desktop")
set_property(TARGET soh PROPERTY APPIMAGE_ICON_FILE "${CMAKE_BINARY_DIR}/sohIcon.png")
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
INSTALL(PROGRAMS "${CMAKE_SOURCE_DIR}/scripts/linux/appimage/soh.sh" DESTINATION . COMPONENT appimage)
endif()
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/OTRExporter/extract_assets.py filedata)
string(REGEX REPLACE "../ZAPDTR/ZAPD.out" "${CMAKE_BINARY_DIR}/ZAPD/ZAPD.out" filedata "${filedata}")
string(REGEX REPLACE "x64" "..\\\\\\\\x64" filedata "${filedata}")
string(REGEX REPLACE "Release" "${CMAKE_BUILD_TYPE}" filedata "${filedata}")
file(WRITE "${CMAKE_CURRENT_SOURCE_DIR}/OTRExporter/extract_assets_cmake2.py" "${filedata}")
file(CHMOD "${CMAKE_CURRENT_SOURCE_DIR}/OTRExporter/extract_assets_cmake2.py" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
find_package(Python3 COMPONENTS Interpreter)
add_custom_target(
ExtractAssets
COMMAND ${CMAKE_COMMAND} -E rm -f oot.otr
COMMAND ${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/OTRExporter/extract_assets_cmake2.py
COMMAND ${CMAKE_COMMAND} -E copy oot.otr ${CMAKE_SOURCE_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/OTRExporter
COMMENT "Running asset extraction..."
DEPENDS ZAPD
)
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
find_package(ImageMagick COMPONENTS convert)
if (ImageMagick_FOUND)
execute_process (
COMMAND ${ImageMagick_convert_EXECUTABLE} soh/macosx/sohIcon.png -resize 512x512 ${CMAKE_BINARY_DIR}/sohIcon.png
OUTPUT_VARIABLE outVar
)
endif()
endif()
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
add_custom_target(CreateOSXIcons
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/macosx/soh.iconset
COMMAND sips -z 16 16 soh/macosx/sohIcon.png --out ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_16x16.png
COMMAND sips -z 32 32 soh/macosx/sohIcon.png --out ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_16x16@2x.png
COMMAND sips -z 32 32 soh/macosx/sohIcon.png --out ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_32x32.png
COMMAND sips -z 64 64 soh/macosx/sohIcon.png --out ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_32x32@2x.png
COMMAND sips -z 128 128 soh/macosx/sohIcon.png --out ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_128x128.png
COMMAND sips -z 256 256 soh/macosx/sohIcon.png --out ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_128x128@2x.png
COMMAND sips -z 256 256 soh/macosx/sohIcon.png --out ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_256x256.png
COMMAND sips -z 512 512 soh/macosx/sohIcon.png --out ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_256x256@2x.png
COMMAND sips -z 512 512 soh/macosx/sohIcon.png --out ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_512x512.png
COMMAND cp soh/macosx/sohIcon.png ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_512x512@2x.png
COMMAND iconutil -c icns -o ${CMAKE_BINARY_DIR}/macosx/soh.icns ${CMAKE_BINARY_DIR}/macosx/soh.iconset
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMENT "Creating OSX icons ..."
)
add_dependencies(soh CreateOSXIcons)
endif()
if(CMAKE_SYSTEM_NAME MATCHES "Windows|NintendoSwitch")
INSTALL(FILES ${CMAKE_SOURCE_DIR}/README.md DESTINATION . COMPONENT ship RENAME readme.txt )
endif()
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(CPACK_GENERATOR "External")
elseif(CMAKE_SYSTEM_NAME MATCHES "Windows|NintendoSwitch")
set(CPACK_GENERATOR "ZIP")
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
set(CPACK_GENERATOR "Bundle")
endif()
set(CPACK_PROJECT_CONFIG_FILE ${CMAKE_SOURCE_DIR}/CMake/Packaging-2.cmake)
include(CMake/Packaging.cmake)

View File

@ -5,49 +5,57 @@ ARG DEBIAN_FRONTEND=noninteractive
ENV GCCVER=10
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y \
binutils \
gcc-${GCCVER} \
g++-${GCCVER} \
p7zip-full \
python3 \
make \
cmake \
curl \
git \
lld \
wget \
libglew-dev \
libsdl2-dev \
zlib1g-dev \
libbz2-dev \
libpng-dev \
libgles2-mesa-dev && \
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCCVER} 10 && \
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${GCCVER} 10
apt-get upgrade -y && \
apt-get install -y \
binutils \
gcc-${GCCVER} \
g++-${GCCVER} \
patchelf \
p7zip-full \
python3 \
cmake \
make \
curl \
git \
lld \
libsdl2-dev \
zlib1g-dev \
libbz2-dev \
libpng-dev \
libgles2-mesa-dev \
wget \
gpg \
imagemagick \
ninja-build && \
apt-get install -y software-properties-common && \
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null && \
apt-add-repository "deb https://apt.kitware.com/ubuntu/ focal main" && \
apt-get update && \
apt-get upgrade -y && \
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCCVER} 10 && \
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${GCCVER} 10
RUN git clone https://github.com/Perlmint/glew-cmake.git && \
cmake glew-cmake && \
make -j$(nproc) && \
make install
cmake glew-cmake && \
make -j$(nproc) && \
make install
ENV SDL2VER=2.0.22
RUN curl -sLO https://libsdl.org/release/SDL2-${SDL2VER}.tar.gz && \
tar -xzf SDL2-${SDL2VER}.tar.gz && \
cd SDL2-${SDL2VER} && \
./configure --build=x86_64-linux-gnu && \
make -j$(nproc) && make install && \
rm ../SDL2-${SDL2VER}.tar.gz
tar -xzf SDL2-${SDL2VER}.tar.gz && \
cd SDL2-${SDL2VER} && \
./configure --build=x86_64-linux-gnu && \
make -j$(nproc) && make install && \
rm ../SDL2-${SDL2VER}.tar.gz
RUN \
ln -sf /proc/self/mounts /etc/mtab && \
mkdir -p /usr/local/share/keyring/ && \
wget -O /usr/local/share/keyring/devkitpro-pub.gpg https://apt.devkitpro.org/devkitpro-pub.gpg && \
echo "deb [signed-by=/usr/local/share/keyring/devkitpro-pub.gpg] https://apt.devkitpro.org stable main" > /etc/apt/sources.list.d/devkitpro.list && \
apt-get update -y && \
apt-get install -y devkitpro-pacman && \
yes | dkp-pacman -Syu switch-dev switch-portlibs --noconfirm
ln -sf /proc/self/mounts /etc/mtab && \
mkdir -p /usr/local/share/keyring/ && \
wget -O /usr/local/share/keyring/devkitpro-pub.gpg https://apt.devkitpro.org/devkitpro-pub.gpg && \
echo "deb [signed-by=/usr/local/share/keyring/devkitpro-pub.gpg] https://apt.devkitpro.org stable main" > /etc/apt/sources.list.d/devkitpro.list && \
apt-get update -y && \
apt-get install -y devkitpro-pacman && \
yes | dkp-pacman -Syu switch-dev switch-portlibs --noconfirm
ENV DEVKITPRO=/opt/devkitpro
ENV DEVKITARM=/opt/devkitpro/devkitARM

79
Jenkinsfile vendored
View File

@ -15,13 +15,10 @@ pipeline {
timeout(time: 20)
}
environment {
MSBUILD='C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Msbuild\\Current\\Bin\\msbuild.exe'
CONFIG='Release'
OTRPLATFORM='x64'
PLATFORM='x64'
ZIP='C:\\Program Files\\7-Zip\\7z.exe'
PYTHON='C:\\Users\\jenkins\\AppData\\Local\\Programs\\Python\\Python310\\python.exe'
CMAKE='C:\\Program Files\\CMake\\bin\\cmake.exe'
CPACK='C:\\Program Files\\CMake\\bin\\cpack.exe'
TOOLSET='v142'
}
agent {
@ -38,36 +35,19 @@ pipeline {
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
bat """
"${env.MSBUILD}" ".\\OTRExporter\\OTRExporter.sln" -t:build -p:Configuration=${env.CONFIG};Platform=${env.OTRPLATFORM};PlatformToolset=${env.TOOLSET};RestorePackagesConfig=true /restore /nodeReuse:false /m
xcopy "..\\..\\ZELOOTD.z64" "OTRExporter\\"
cd "OTRExporter"
"${env.PYTHON}" ".\\extract_assets.py"
cd "..\\"
"${env.MSBUILD}" ".\\soh\\soh.sln" -t:build -p:Configuration=${env.CONFIG};Platform=${env.PLATFORM};PlatformToolset=${env.TOOLSET} /nodeReuse:false /m
cd OTRGui
mkdir build
cd build
"${env.CMAKE}" ..
"${env.CMAKE}" --build . --config Release
"${env.CMAKE}" -S . -B "build\\${env.PLATFORM}" -G "Visual Studio 17 2022" -T ${env.TOOLSET} -A ${env.PLATFORM} -D Python_EXECUTABLE=${env.PYTHON} -D CMAKE_BUILD_TYPE:STRING=Release
"${env.CMAKE}" --build ".\\build\\${env.PLATFORM}" --target ExtractAssets --config Release
"${env.CMAKE}" --build ".\\build\\${env.PLATFORM}" --config Release
cd ".\\build\\${env.PLATFORM}"
"${env.CPACK}" -G ZIP
cd "..\\..\\"
move "soh\\x64\\Release\\soh.exe" ".\\"
move "OTRGui\\build\\assets" ".\\"
move ".\\OTRExporter\\x64\\Release\\ZAPD.exe" ".\\assets\\extractor\\"
move ".\\OTRGui\\build\\Release\\OTRGui.exe" ".\\"
rename README.md readme.txt
"${env.ZIP}" a soh.7z soh.exe OTRGui.exe assets readme.txt
move "_packages\\*.zip" "soh.zip"
"""
archiveArtifacts artifacts: 'soh.7z', followSymlinks: false, onlyIfSuccessful: true
archiveArtifacts artifacts: 'soh.zip', followSymlinks: false, onlyIfSuccessful: true
}
}
post {
@ -97,18 +77,12 @@ pipeline {
cp ../../ZELOOTD.z64 OTRExporter/baserom_non_mq.z64
docker build . -t soh
docker run --name sohcont -dit --rm -v $(pwd):/soh soh /bin/bash
docker exec sohcont scripts/linux/build.sh
docker exec sohcont scripts/linux/appimage/build.sh
mkdir build
mv soh/soh.elf build/
mv OTRGui/build/OTRGui build/
mv OTRGui/build/assets build/
mv ZAPDTR/ZAPD.out build/assets/extractor/
mv README.md readme.txt
docker exec sohcont scripts/linux/build-appimage.sh
7z a soh-linux.7z SOH-Linux.AppImage readme.txt
mv build-cmake/*.appimage soh.appimage
7z a soh-linux.7z soh.appimage readme.txt
'''
}
@ -125,11 +99,6 @@ pipeline {
agent {
label "SoH-Mac-Builders"
}
environment {
CC = 'clang -arch arm64 -arch x86_64'
CXX = 'clang++ -arch arm64 -arch x86_64'
MACOSX_DEPLOYMENT_TARGET = 10.15
}
steps {
checkout([
$class: 'GitSCM',
@ -141,15 +110,19 @@ pipeline {
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
sh '''
cp ../../ZELOOTD.z64 OTRExporter/baserom_non_mq.z64
cd soh
make setup -j$(sysctl -n hw.physicalcpu) OPTFLAGS=-O2 DEBUG=0 LD="ld"
make -j$(sysctl -n hw.physicalcpu) DEBUG=0 OPTFLAGS=-O2 LD="ld"
make appbundle
mv ../README.md readme.txt
7z a soh-mac.7z soh.app readme.txt
cmake --no-warn-unused-cli -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"
cmake --build build-cmake --target ExtractAssets --
cmake --build build-cmake --config Release --
(cd build-cmake && cpack)
mv README.md readme.txt
mv _packages/*.dmg SoH.dmg
7z a soh-mac.7z SoH.dmg readme.txt
'''
}
archiveArtifacts artifacts: 'soh/soh-mac.7z', followSymlinks: false, onlyIfSuccessful: true
archiveArtifacts artifacts: 'soh-mac.7z', followSymlinks: false, onlyIfSuccessful: true
}
post {
always {
@ -180,7 +153,7 @@ pipeline {
docker run --name sohcont -dit --rm -v $(pwd):/soh sohswitch /bin/bash
docker exec sohcont scripts/switch/build.sh
mv soh/soh.nro .
mv build-switch/soh/*.nro soh.nro
mv README.md readme.txt
7z a soh-switch.7z soh.nro readme.txt

View File

@ -1,36 +0,0 @@
#-------------------------------------------------------------------------------
.SUFFIXES:
#-------------------------------------------------------------------------------
export SOH_TOP_DIR := $(CURDIR)
.PHONY: all clean ZAPDUtils libultraship soh StormLib
all: soh
@echo "Done!"
ZAPDUtils:
@echo "Building $@..."
@$(MAKE) --no-print-directory -C $(CURDIR)/ZAPDTR/ZAPDUtils -f $(CURDIR)/ZAPDTR/ZAPDUtils/Makefile.switch
StormLib:
@echo "Building $@..."
LDFLAGS="" ${DEVKITPRO}/portlibs/switch/bin/aarch64-none-elf-cmake -DCMAKE_TOOLCHAIN_FILE=${DEVKITPRO}/cmake/Switch.cmake -DCMAKE_BUILD_TYPE=Release -B $(CURDIR)/StormLib/nxbuild -S $(CURDIR)/StormLib
@$(MAKE) --no-print-directory -C $(CURDIR)/StormLib/nxbuild -f $(CURDIR)/StormLib/nxbuild/Makefile
libultraship: StormLib ZAPDUtils
@echo "Building $@..."
@$(MAKE) --no-print-directory -C $(CURDIR)/libultraship -f $(CURDIR)/libultraship/Makefile.switch
soh: libultraship
@echo "Building $@..."
@$(MAKE) --no-print-directory -C $(CURDIR)/soh -f $(CURDIR)/soh/Makefile.switch
otr:
@echo "Building $@..."
@$(MAKE) --no-print-directory -C $(CURDIR)/soh -f $(CURDIR)/soh/Makefile setup
clean:
@$(MAKE) --no-print-directory -C $(CURDIR)/ZAPDTR/ZAPDUtils -f $(CURDIR)/ZAPDTR/ZAPDUtils/Makefile.switch clean
@$(MAKE) --no-print-directory -C $(CURDIR)/libultraship -f $(CURDIR)/libultraship/Makefile.switch clean
@$(MAKE) --no-print-directory -C $(CURDIR)/soh -f $(CURDIR)/soh/Makefile.switch clean

View File

@ -0,0 +1,65 @@
################################################################################
# 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}")

View File

@ -0,0 +1,12 @@
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()

View File

@ -0,0 +1,233 @@
# 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")

102
OTRExporter/CMakeLists.txt Normal file
View File

@ -0,0 +1,102 @@
cmake_minimum_required(VERSION 3.16.0 FATAL_ERROR)
set(CMAKE_SYSTEM_VERSION 10.0 CACHE STRING "" FORCE)
set(CMAKE_CXX_STANDARD 20 CACHE STRING "The C++ standard to use")
#set(CMAKE_C_STANDARD 11 CACHE STRING "The C standard to use")
set(CMAKE_C_STANDARD 11)
project(OTRExporter C CXX)
################################################################################
# Set target arch type if empty. Visual studio solution generator provides it.
################################################################################
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
if(NOT CMAKE_VS_PLATFORM_NAME)
set(CMAKE_VS_PLATFORM_NAME "x64")
endif()
message("${CMAKE_VS_PLATFORM_NAME} architecture in use")
if(NOT ("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64"
OR "${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32"))
message(FATAL_ERROR "${CMAKE_VS_PLATFORM_NAME} arch is not supported!")
endif()
endif()
################################################################################
# Global configuration types
################################################################################
set(CMAKE_CONFIGURATION_TYPES
"Debug"
"Release"
CACHE STRING "" FORCE
)
################################################################################
# Global compiler options
################################################################################
if(MSVC)
# remove default flags provided with CMake for MSVC
set(CMAKE_C_FLAGS "")
set(CMAKE_C_FLAGS_DEBUG "")
set(CMAKE_C_FLAGS_RELEASE "")
set(CMAKE_CXX_FLAGS "")
set(CMAKE_CXX_FLAGS_DEBUG "")
set(CMAKE_CXX_FLAGS_RELEASE "")
endif()
################################################################################
# Global linker options
################################################################################
if(MSVC)
# remove default flags provided with CMake for MSVC
set(CMAKE_EXE_LINKER_FLAGS "")
set(CMAKE_MODULE_LINKER_FLAGS "")
set(CMAKE_SHARED_LINKER_FLAGS "")
set(CMAKE_STATIC_LINKER_FLAGS "")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_STATIC_LINKER_FLAGS_DEBUG "${CMAKE_STATIC_LINKER_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS}")
endif()
################################################################################
# Common utils
################################################################################
include(CMake/Utils.cmake)
################################################################################
# Additional Global Settings(add specific info there)
################################################################################
include(CMake/GlobalSettingsInclude.cmake OPTIONAL)
################################################################################
# Use solution folders feature
################################################################################
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
################################################################################
# Sub-projects
################################################################################
if (NOT TARGET libultraship)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship ${CMAKE_BINARY_DIR}/libultraship)
endif()
if (NOT TARGET ZAPD)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../ZAPDTR/ZAPD ${CMAKE_BINARY_DIR}/ZAPD)
endif()
if (NOT TARGET ZAPDUtils)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../ZAPDTR/ZAPDUtils ${CMAKE_BINARY_DIR}/ZAPDUtils)
endif()
add_subdirectory(OTRExporter)
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/extract_assets.py filedata)
string(REGEX REPLACE "../ZAPDTR/ZAPD.out" "${CMAKE_BINARY_DIR}/ZAPD/ZAPD.out" filedata "${filedata}")
file(WRITE "${CMAKE_CURRENT_SOURCE_DIR}/extract_assets_cmake.py" "${filedata}")
file(CHMOD "${CMAKE_CURRENT_SOURCE_DIR}/extract_assets_cmake.py" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)

View File

@ -1,79 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30320.27
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OTRExporter", "OTRExporter\OTRExporter.vcxproj", "{A6103FD3-0709-4FC7-B066-1A6E056D6306}"
ProjectSection(ProjectDependencies) = postProject
{6DA9B521-65B7-41E2-8F8A-F0451CC18ED8} = {6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libultraship", "..\libultraship\libultraship\libultraship.vcxproj", "{6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZAPD", "..\ZAPDTR\ZAPD\ZAPD.vcxproj", "{B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}"
ProjectSection(ProjectDependencies) = postProject
{78424708-1F6E-4D4B-920C-FB6D26847055} = {78424708-1F6E-4D4B-920C-FB6D26847055}
{6DA9B521-65B7-41E2-8F8A-F0451CC18ED8} = {6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}
{A2E01C3E-D647-45D1-9788-043DEBC1A908} = {A2E01C3E-D647-45D1-9788-043DEBC1A908}
{A6103FD3-0709-4FC7-B066-1A6E056D6306} = {A6103FD3-0709-4FC7-B066-1A6E056D6306}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZAPDUtils", "..\ZAPDTR\ZAPDUtils\ZAPDUtils.vcxproj", "{A2E01C3E-D647-45D1-9788-043DEBC1A908}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StormLib", "..\StormLib\StormLib_vs19.vcxproj", "{78424708-1F6E-4D4B-920C-FB6D26847055}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A6103FD3-0709-4FC7-B066-1A6E056D6306}.Debug|x64.ActiveCfg = Debug|x64
{A6103FD3-0709-4FC7-B066-1A6E056D6306}.Debug|x64.Build.0 = Debug|x64
{A6103FD3-0709-4FC7-B066-1A6E056D6306}.Debug|x86.ActiveCfg = Debug|Win32
{A6103FD3-0709-4FC7-B066-1A6E056D6306}.Debug|x86.Build.0 = Debug|Win32
{A6103FD3-0709-4FC7-B066-1A6E056D6306}.Release|x64.ActiveCfg = Release|x64
{A6103FD3-0709-4FC7-B066-1A6E056D6306}.Release|x64.Build.0 = Release|x64
{A6103FD3-0709-4FC7-B066-1A6E056D6306}.Release|x86.ActiveCfg = Release|Win32
{A6103FD3-0709-4FC7-B066-1A6E056D6306}.Release|x86.Build.0 = Release|Win32
{6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Debug|x64.ActiveCfg = Debug|x64
{6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Debug|x64.Build.0 = Debug|x64
{6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Debug|x86.ActiveCfg = Debug|Win32
{6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Debug|x86.Build.0 = Debug|Win32
{6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Release|x64.ActiveCfg = Release|x64
{6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Release|x64.Build.0 = Release|x64
{6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Release|x86.ActiveCfg = Release|Win32
{6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Release|x86.Build.0 = Release|Win32
{B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Debug|x64.ActiveCfg = Debug|x64
{B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Debug|x64.Build.0 = Debug|x64
{B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Debug|x86.ActiveCfg = Debug|Win32
{B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Debug|x86.Build.0 = Debug|Win32
{B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Release|x64.ActiveCfg = Release|x64
{B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Release|x64.Build.0 = Release|x64
{B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Release|x86.ActiveCfg = Release|Win32
{B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Release|x86.Build.0 = Release|Win32
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x64.ActiveCfg = Debug|x64
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x64.Build.0 = Debug|x64
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x86.ActiveCfg = Debug|Win32
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x86.Build.0 = Debug|Win32
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x64.ActiveCfg = Release|x64
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x64.Build.0 = Release|x64
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x86.ActiveCfg = Release|Win32
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x86.Build.0 = Release|Win32
{78424708-1F6E-4D4B-920C-FB6D26847055}.Debug|x64.ActiveCfg = DebugUS|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.Debug|x64.Build.0 = DebugUS|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.Debug|x86.ActiveCfg = DebugAD|Win32
{78424708-1F6E-4D4B-920C-FB6D26847055}.Debug|x86.Build.0 = DebugAD|Win32
{78424708-1F6E-4D4B-920C-FB6D26847055}.Release|x64.ActiveCfg = ReleaseUS|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.Release|x64.Build.0 = ReleaseUS|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.Release|x86.ActiveCfg = ReleaseAS|Win32
{78424708-1F6E-4D4B-920C-FB6D26847055}.Release|x86.Build.0 = ReleaseAS|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {DCE19FF1-37C0-49CD-915A-DD695E15F00B}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,249 @@
set(PROJECT_NAME OTRExporter)
################################################################################
# Source groups
################################################################################
set(Header_Files
"AnimationExporter.h"
"ArrayExporter.h"
"AudioExporter.h"
"BackgroundExporter.h"
"BlobExporter.h"
"CollisionExporter.h"
"command_macros_base.h"
"CutsceneExporter.h"
"DisplayListExporter.h"
"Exporter.h"
"Main.h"
"MtxExporter.h"
"PathExporter.h"
"PlayerAnimationExporter.h"
"RoomExporter.h"
"SkeletonExporter.h"
"SkeletonLimbExporter.h"
"TextExporter.h"
"TextureExporter.h"
"VersionInfo.h"
"VtxExporter.h"
"z64cutscene.h"
"z64cutscene_commands.h"
)
source_group("Header Files" FILES ${Header_Files})
set(Source_Files
"AnimationExporter.cpp"
"ArrayExporter.cpp"
"AudioExporter.cpp"
"BackgroundExporter.cpp"
"BlobExporter.cpp"
"CollisionExporter.cpp"
"CutsceneExporter.cpp"
"DisplayListExporter.cpp"
"Exporter.cpp"
"Main.cpp"
"MtxExporter.cpp"
"PathExporter.cpp"
"PlayerAnimationExporter.cpp"
"RoomExporter.cpp"
"SkeletonExporter.cpp"
"SkeletonLimbExporter.cpp"
"TextExporter.cpp"
"TextureExporter.cpp"
"VersionInfo.cpp"
"VtxExporter.cpp"
)
source_group("Source Files" FILES ${Source_Files})
set(ALL_FILES
${Header_Files}
${Source_Files}
)
################################################################################
# Target
################################################################################
add_library(${PROJECT_NAME} STATIC ${ALL_FILES})
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
use_props(${PROJECT_NAME} "${CMAKE_CONFIGURATION_TYPES}" "${DEFAULT_CXX_PROPS}")
endif()
set(ROOT_NAMESPACE OTRExporter)
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
set_target_properties(${PROJECT_NAME} PROPERTIES
VS_GLOBAL_KEYWORD "Win32Proj"
)
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
set_target_properties(${PROJECT_NAME} PROPERTIES
INTERPROCEDURAL_OPTIMIZATION_RELEASE "TRUE"
)
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x86")
set_target_properties(${PROJECT_NAME} PROPERTIES
INTERPROCEDURAL_OPTIMIZATION_RELEASE "TRUE"
)
endif()
endif()
################################################################################
# MSVC runtime library
################################################################################
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
get_property(MSVC_RUNTIME_LIBRARY_DEFAULT TARGET ${PROJECT_NAME} PROPERTY MSVC_RUNTIME_LIBRARY)
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
string(CONCAT "MSVC_RUNTIME_LIBRARY_STR"
$<$<CONFIG:Debug>:
MultiThreadedDebug
>
$<$<CONFIG:Release>:
MultiThreaded
>
$<$<NOT:$<OR:$<CONFIG:Debug>,$<CONFIG:Release>>>:${MSVC_RUNTIME_LIBRARY_DEFAULT}>
)
endif()
set_target_properties(${PROJECT_NAME} PROPERTIES MSVC_RUNTIME_LIBRARY ${MSVC_RUNTIME_LIBRARY_STR})
endif()
################################################################################
# Compile definitions
################################################################################
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
target_compile_definitions(${PROJECT_NAME} PRIVATE
"$<$<CONFIG:Debug>:"
"_DEBUG"
">"
"$<$<CONFIG:Release>:"
"NDEBUG"
">"
"_CONSOLE;"
"_CRT_SECURE_NO_WARNINGS;"
"UNICODE;"
"_UNICODE"
STORMLIB_NO_AUTO_LINK
)
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x86")
target_compile_definitions(${PROJECT_NAME} PRIVATE
"$<$<CONFIG:Debug>:"
"_DEBUG;"
"_CRT_SECURE_NO_WARNINGS"
">"
"$<$<CONFIG:Release>:"
"NDEBUG"
">"
"WIN32;"
"_CONSOLE;"
"UNICODE;"
"_UNICODE"
STORMLIB_NO_AUTO_LINK
)
endif()
endif()
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU|Clang|AppleClang")
target_compile_definitions(${PROJECT_NAME} PRIVATE
"$<$<CONFIG:Debug>:"
"_DEBUG"
">"
"$<$<CONFIG:Release>:"
"NDEBUG"
">"
"_CONSOLE;"
"_CRT_SECURE_NO_WARNINGS;"
"UNICODE;"
"_UNICODE"
)
endif()
################################################################################
# Compile and link options
################################################################################
target_include_directories(${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/../../ZAPDTR/ZAPD/
${CMAKE_CURRENT_SOURCE_DIR}/../../ZAPDTR/ZAPDUtils
${CMAKE_CURRENT_SOURCE_DIR}/../../ZAPDTR/lib/tinyxml2
${CMAKE_CURRENT_SOURCE_DIR}/../../libultraship/libultraship
${CMAKE_CURRENT_SOURCE_DIR}/../../libultraship/libultraship/Lib/spdlog/include
${CMAKE_CURRENT_SOURCE_DIR}/../../libultraship/libultraship/Lib/Fast3D/U64
${CMAKE_CURRENT_SOURCE_DIR}/../../StormLib/src
.
)
if(MSVC)
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
target_compile_options(${PROJECT_NAME} PRIVATE
$<$<CONFIG:Release>:
/Oi;
/Gy
>
/permissive-;
/sdl;
/W3;
${DEFAULT_CXX_DEBUG_INFORMATION_FORMAT};
${DEFAULT_CXX_EXCEPTION_HANDLING}
)
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x86")
target_compile_options(${PROJECT_NAME} PRIVATE
$<$<CONFIG:Release>:
/Oi;
/Gy
>
/permissive-;
/sdl;
/W3;
${DEFAULT_CXX_DEBUG_INFORMATION_FORMAT};
${DEFAULT_CXX_EXCEPTION_HANDLING}
)
endif()
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
target_link_options(${PROJECT_NAME} PRIVATE
$<$<CONFIG:Release>:
/OPT:REF;
/OPT:ICF
>
/SUBSYSTEM:CONSOLE
)
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x86")
target_link_options(${PROJECT_NAME} PRIVATE
$<$<CONFIG:Release>:
/DEBUG;
/OPT:REF;
/OPT:ICF;
/INCREMENTAL:NO
>
/SUBSYSTEM:CONSOLE
)
endif()
endif()
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU|Clang|AppleClang")
target_compile_options(${PROJECT_NAME} PRIVATE
-Wall -Wextra -Wno-error
-Wno-unused-parameter
-Wno-unused-function
-Wno-unused-variable
-Wno-missing-field-initializers
-Wno-parentheses
-Wno-narrowing
$<$<COMPILE_LANGUAGE:CXX>:-Wno-deprecated-enum-enum-conversion>
)
endif()
################################################################################
# Dependencies
################################################################################
add_dependencies(${PROJECT_NAME}
libultraship
)
# Link with other targets.
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
set(ADDITIONAL_LIBRARY_DEPENDENCIES
"$<$<CONFIG:Debug>:"
"ZAPDUtils;"
"OTRLib"
">"
)
endif()
endif()
target_link_libraries(${PROJECT_NAME} PUBLIC "${ADDITIONAL_LIBRARY_DEPENDENCIES}")

View File

@ -1,72 +0,0 @@
# Only used for standalone compilation, usually inherits these from the main makefile
CXX ?= g++
AR := ar
FORMAT := clang-format-11
ASAN ?= 0
DEBUG ?= 1
OPTFLAGS ?= -O0
LTO ?= 0
WARN := -Wall -Wextra -Werror \
-Wno-unused-parameter \
-Wno-unused-function \
-Wno-unused-variable \
-Wno-error=multichar
CXXFLAGS := $(WARN) -std=c++17
CPPFLAGS := -MMD
ifneq ($(DEBUG),0)
CXXFLAGS += -g
endif
ifneq ($(ASAN),0)
CXXFLAGS += -fsanitize=address
endif
ifneq ($(LTO),0)
CXXFLAGS += -flto
endif
SRC_DIRS := $(shell find . -type d -not -path "*build*")
CXX_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.cpp))
H_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.h))
O_FILES := $(CXX_FILES:%.cpp=build/%.o)
D_FILES := $(O_FILES:%.o=%.d)
LIB := OTRExporter.a
INC_DIRS := $(addprefix -I, \
../../ZAPDTR/ZAPD \
../../ZAPDTR/lib/tinyxml2 \
../../ZAPDTR/lib/libgfxd \
../../ZAPDTR/ZAPDUtils \
../../libultraship/libultraship \
../../libultraship/libultraship/Lib/spdlog/include \
../../libultraship/libultraship/Lib/Fast3D/U64 \
../../StormLib/src \
)
# create build directories
$(shell mkdir -p $(SRC_DIRS:%=build/%))
all: $(LIB)
clean:
rm -rf build $(LIB)
format:
$(FORMAT) -i $(CXX_FILES) $(H_FILES)
.PHONY: all clean format
build/%.o: %.cpp
$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(OPTFLAGS) $(INC_DIRS) -c $< -o $@
$(LIB): $(O_FILES)
$(AR) rcs $@ $^
-include $(D_FILES)

View File

@ -1,216 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClInclude Include="ArrayExporter.h" />
<ClInclude Include="AudioExporter.h" />
<ClInclude Include="BackgroundExporter.h" />
<ClInclude Include="BlobExporter.h" />
<ClInclude Include="CollisionExporter.h" />
<ClInclude Include="command_macros_base.h" />
<ClInclude Include="CutsceneExporter.h" />
<ClInclude Include="DisplayListExporter.h" />
<ClInclude Include="AnimationExporter.h" />
<ClInclude Include="Main.h" />
<ClInclude Include="Exporter.h" />
<ClInclude Include="MtxExporter.h" />
<ClInclude Include="SkeletonExporter.h" />
<ClInclude Include="SkeletonLimbExporter.h" />
<ClInclude Include="PathExporter.h" />
<ClInclude Include="PlayerAnimationExporter.h" />
<ClInclude Include="RoomExporter.h" />
<ClInclude Include="TextExporter.h" />
<ClInclude Include="TextureExporter.h" />
<ClInclude Include="VersionInfo.h" />
<ClInclude Include="VtxExporter.h" />
<ClInclude Include="z64cutscene.h" />
<ClInclude Include="z64cutscene_commands.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="ArrayExporter.cpp" />
<ClCompile Include="AudioExporter.cpp" />
<ClCompile Include="BackgroundExporter.cpp" />
<ClCompile Include="BlobExporter.cpp" />
<ClCompile Include="CollisionExporter.cpp" />
<ClCompile Include="CutsceneExporter.cpp" />
<ClCompile Include="DisplayListExporter.cpp" />
<ClCompile Include="AnimationExporter.cpp" />
<ClCompile Include="Main.cpp" />
<ClCompile Include="Exporter.cpp" />
<ClCompile Include="MtxExporter.cpp" />
<ClCompile Include="SkeletonExporter.cpp" />
<ClCompile Include="SkeletonLimbExporter.cpp" />
<ClCompile Include="PathExporter.cpp" />
<ClCompile Include="PlayerAnimationExporter.cpp" />
<ClCompile Include="RoomExporter.cpp" />
<ClCompile Include="TextExporter.cpp" />
<ClCompile Include="TextureExporter.cpp" />
<ClCompile Include="VersionInfo.cpp" />
<ClCompile Include="VtxExporter.cpp" />
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{a6103fd3-0709-4fc7-b066-1a6e056d6306}</ProjectGuid>
<RootNamespace>OTRExporter</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(SolutionDir)otrlib;$(SolutionDir)\ZAPD\ZAPD\;$(SolutionDir)\ZAPD\lib\tinyxml2;$(SolutionDir)\ZAPD\lib\libgfxd;$(SolutionDir)\ZAPD\lib\elfio;$(SolutionDir)\ZAPD\lib\assimp\include;$(SolutionDir)\ZAPD\lib\stb;$(ProjectDir);$(IncludePath)</IncludePath>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules />
<CodeAnalysisRuleAssemblies />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules />
<CodeAnalysisRuleAssemblies />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(ProjectDir)..\..\ZAPDTR\ZAPD;$(ProjectDir)..\..\ZAPDTR\lib\tinyxml2;$(ProjectDir)..\..\ZAPDTR\lib\libgfxd;$(ProjectDir)..\..\ZAPDTR\ZAPDUtils;$(ProjectDir)..\..\libultraship\libultraship;$(ProjectDir)..\..\libultraship\libultraship\lib\spdlog\include;$(ProjectDir)..\..\libultraship\libultraship\Lib\Fast3D\U64;$(ProjectDir)..\..\StormLib\src\;$(IncludePath)</IncludePath>
<LibraryPath>$(ProjectDir)..\..\libultraship\libultraship;$(LibraryPath)</LibraryPath>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules />
<CodeAnalysisRuleAssemblies />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(ProjectDir)..\..\ZAPDTR\ZAPD;$(ProjectDir)..\..\ZAPDTR\lib\tinyxml2;$(ProjectDir)..\..\ZAPDTR\lib\libgfxd;$(ProjectDir)..\..\ZAPDTR\ZAPDUtils;$(ProjectDir)..\..\libultraship\libultraship;$(ProjectDir)..\..\libultraship\libultraship\lib\spdlog\include;$(ProjectDir)..\..\libultraship\libultraship\Lib\Fast3D\U64;$(ProjectDir)..\..\StormLib\src\;$(IncludePath)</IncludePath>
<LibraryPath>$(ProjectDir)..\..\libultraship\libultraship;$(LibraryPath)</LibraryPath>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules />
<CodeAnalysisRuleAssemblies />
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>ZAPDUtils.lib;OTRLib.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -1,150 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="CollisionExporter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="RoomExporter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="TextureExporter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="DisplayListExporter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Main.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="PlayerAnimationExporter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="BackgroundExporter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="VtxExporter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ArrayExporter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Exporter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="AnimationExporter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="CutsceneExporter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="z64cutscene.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="z64cutscene_commands.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="command_macros_base.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="PathExporter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="SkeletonExporter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="SkeletonLimbExporter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="TextExporter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="BlobExporter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="MtxExporter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="VersionInfo.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="AudioExporter.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="CollisionExporter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="RoomExporter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="TextureExporter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="DisplayListExporter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="PlayerAnimationExporter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="SkeletonExporter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="SkeletonLimbExporter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="BackgroundExporter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="VtxExporter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ArrayExporter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Exporter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="AnimationExporter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="CutsceneExporter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="PathExporter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="TextExporter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="BlobExporter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="MtxExporter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="VersionInfo.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="AudioExporter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -0,0 +1,65 @@
################################################################################
# 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}")

View File

@ -0,0 +1,12 @@
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()

234
OTRGui/CMake/Utils.cmake Normal file
View File

@ -0,0 +1,234 @@
# 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")
set(DEFAULT_Fortran_PROPS "${CMAKE_CURRENT_LIST_DIR}/DefaultFortran.cmake")

View File

@ -3,27 +3,61 @@ project(OTRGui)
set(PLATFORM "Desktop")
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/build)
#set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/build)
set(APP_ICON_RESOURCE_WINDOWS ${CMAKE_CURRENT_SOURCE_DIR}/appicon.rc)
add_subdirectory(libs/raylib)
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(OpenGL_GL_PREFERENCE "GLVND")
endif()
include(CMake/Utils.cmake)
add_subdirectory(libs/raylib EXCLUDE_FROM_ALL)
include_directories(src)
include_directories(src/game)
include_directories(include)
include_external_msproject(ZAPD ../../ZAPDTR/ZAPD/ZAPD.vcproj)
include_external_msproject(ZAPDUtils ../../ZAPDTR/ZAPDUtils/ZAPDUtils.vcproj)
include_external_msproject(libultraship ../../libultraship/libultraship/libultraship.vcproj)
include_external_msproject(OTRExporter ../../OTRExporter/OTRExporter/OTRExporter.vcproj)
if (NOT TARGET libultraship)
add_subdirectory(../libultraship/libultraship ${CMAKE_BINARY_DIR}/libultraship)
endif()
if (NOT TARGET ZAPD)
add_subdirectory(../ZAPDTR/ZAPD ${CMAKE_BINARY_DIR}/ZAPD)
endif()
if (NOT TARGET ZAPDUtils)
add_subdirectory(../ZAPDTR/ZAPDUtils ${CMAKE_BINARY_DIR}/ZAPDUtils)
endif()
if (NOT TARGET OTRExporter)
add_subdirectory(../OTRExporter/OTRExporter ${CMAKE_BINARY_DIR}/OTRExporter)
endif()
if (NOT TARGET storm)
add_subdirectory(../StormLib ${CMAKE_BINARY_DIR}/StormLib)
endif()
file(GLOB_RECURSE HEADERS src/*.h)
file(GLOB_RECURSE SOURCES src/*.cpp)
file(GLOB_RECURSE C_SOURCES src/*.c)
add_executable(${PROJECT_NAME} ${SOURCES} ${C_SOURCES} ${HEADERS} ${APP_ICON_RESOURCE_WINDOWS})
add_custom_command(TARGET ${PROJECT_NAME} PRE_BUILD COMMAND ${CMAKE_COMMAND} -Dsrc_dir="${CMAKE_SOURCE_DIR}/assets" -Ddst_dir="${CMAKE_CURRENT_BINARY_DIR}/assets" -P "${CMAKE_CURRENT_SOURCE_DIR}/Overwrite.cmake")
add_custom_command(TARGET ${PROJECT_NAME} PRE_BUILD COMMAND ${CMAKE_COMMAND} -Dsrc_dir="${CMAKE_SOURCE_DIR}/../OTRExporter/assets" -Ddst_dir="${CMAKE_CURRENT_BINARY_DIR}/assets/game" -P "${CMAKE_CURRENT_SOURCE_DIR}/Overwrite.cmake")
add_custom_command(TARGET ${PROJECT_NAME} PRE_BUILD COMMAND ${CMAKE_COMMAND} -Dsrc_dir="${CMAKE_SOURCE_DIR}/../soh/assets/xml" -Ddst_dir="${CMAKE_CURRENT_BINARY_DIR}/assets/extractor/xmls" -P "${CMAKE_CURRENT_SOURCE_DIR}/Overwrite.cmake")
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
use_props(${PROJECT_NAME} "${CMAKE_CONFIGURATION_TYPES}" "${DEFAULT_CXX_PROPS}")
endif()
add_custom_target(Assets ALL
COMMAND ${CMAKE_COMMAND} -Dsrc_dir="${CMAKE_CURRENT_SOURCE_DIR}/assets" -Ddst_dir="${CMAKE_CURRENT_BINARY_DIR}/assets" -P "${CMAKE_CURRENT_SOURCE_DIR}/Overwrite.cmake"
COMMAND ${CMAKE_COMMAND} -Dsrc_dir="${CMAKE_CURRENT_SOURCE_DIR}/../OTRExporter/assets" -Ddst_dir="${CMAKE_CURRENT_BINARY_DIR}/assets/game" -P "${CMAKE_CURRENT_SOURCE_DIR}/Overwrite.cmake"
COMMAND ${CMAKE_COMMAND} -Dsrc_dir="${CMAKE_CURRENT_SOURCE_DIR}/../soh/assets/xml" -Ddst_dir="${CMAKE_CURRENT_BINARY_DIR}/assets/extractor/xmls" -P "${CMAKE_CURRENT_SOURCE_DIR}/Overwrite.cmake"
)
add_dependencies(OTRGui Assets)
target_link_libraries(${PROJECT_NAME} PUBLIC raylib)
INSTALL(TARGETS OTRGui DESTINATION . COMPONENT ship)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/assets
DESTINATION .
COMPONENT ship
)
INSTALL(TARGETS ZAPD DESTINATION assets/extractor COMPONENT ship)

View File

@ -1,10 +1,15 @@
file(GLOB_RECURSE _file_list RELATIVE "${src_dir}" "${src_dir}/*")
include(CMakePrintHelpers)
string(REPLACE "\\ " " " sources_dir "${src_dir}")
string(REPLACE "\\ " " " destination_dir "${dst_dir}")
file(GLOB_RECURSE _file_list RELATIVE "${sources_dir}" "${sources_dir}/*")
foreach( each_file ${_file_list} )
set(destinationfile "${dst_dir}/${each_file}")
set(sourcefile "${src_dir}/${each_file}")
set(destinationfile "${destination_dir}/${each_file}")
set(sourcefile "${sources_dir}/${each_file}")
if(NOT EXISTS ${destinationfile} OR ${sourcefile} IS_NEWER_THAN ${destinationfile})
get_filename_component(destinationdir ${destinationfile} DIRECTORY)
file(COPY ${sourcefile} DESTINATION ${destinationdir})
endif()
endforeach(each_file)
endforeach(each_file)

View File

@ -1,8 +1,9 @@
project(StormLib)
set(PROJECT_NAME StormLib)
#project(StormLib)
cmake_minimum_required(VERSION 3.10)
set(LIBRARY_NAME storm)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@ -15,6 +16,13 @@ option(STORM_BUILD_TESTS
# "BUILD_TESTING" OFF # Stay coherent with CTest variables
)
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(Source_Files__Windows
src/lzma/C/LzFindMt.c
src/lzma/C/Threads.c
)
endif()
set(SRC_FILES
src/adpcm/adpcm.cpp
src/huffman/huff.cpp
@ -46,6 +54,7 @@ set(SRC_FILES
src/SFileVerify.cpp
src/libtomcrypt/src/pk/rsa/rsa_verify_simple.c
src/libtomcrypt/src/misc/crypt_libc.c
${Source_Files__Windows}
)
if(MSVC)
@ -333,6 +342,76 @@ if(WIN32)
set_target_properties(${LIBRARY_NAME} PROPERTIES OUTPUT_NAME "StormLib")
endif()
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
use_props(${LIBRARY_NAME} "${CMAKE_CONFIGURATION_TYPES}" "${DEFAULT_CXX_PROPS}")
endif()
################################################################################
# Compile definitions
################################################################################
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
target_compile_definitions(${LIBRARY_NAME} PRIVATE
"$<$<CONFIG:Debug>:"
"_DEBUG;"
"_CRT_SECURE_NO_WARNINGS;"
">"
"$<$<CONFIG:Release>:"
"NDEBUG"
">"
WIN32
_LIB
"UNICODE;"
"_UNICODE"
)
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
target_compile_definitions(${LIBRARY_NAME} PRIVATE
"$<$<CONFIG:Debug>:"
"_DEBUG;"
"_CRT_SECURE_NO_WARNINGS;"
">"
"$<$<CONFIG:Release>:"
"NDEBUG;"
">"
"WIN32;"
_LIB
"UNICODE;"
"_UNICODE"
)
endif()
endif()
################################################################################
# MSVC runtime library
################################################################################
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
get_property(MSVC_RUNTIME_LIBRARY_DEFAULT TARGET ${LIBRARY_NAME} PROPERTY MSVC_RUNTIME_LIBRARY)
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
string(CONCAT "MSVC_RUNTIME_LIBRARY_STR"
$<$<CONFIG:Debug>:
MultiThreadedDebug
>
$<$<CONFIG:Release>:
MultiThreaded
>
$<$<NOT:$<OR:$<CONFIG:Debug>,$<CONFIG:Release>>>:${MSVC_RUNTIME_LIBRARY_DEFAULT}>
)
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
string(CONCAT "MSVC_RUNTIME_LIBRARY_STR"
$<$<CONFIG:Debug>:
MultiThreadedDebug
>
$<$<CONFIG:Release>:
MultiThreaded
>
$<$<NOT:$<OR:$<CONFIG:Debug>,$<CONFIG:Release>>>:${MSVC_RUNTIME_LIBRARY_DEFAULT}>
)
endif()
set_target_properties(${LIBRARY_NAME} PROPERTIES MSVC_RUNTIME_LIBRARY ${MSVC_RUNTIME_LIBRARY_STR})
endif()
target_link_libraries(${LIBRARY_NAME} ${LINK_LIBS})
target_compile_definitions(${LIBRARY_NAME} INTERFACE STORMLIB_NO_AUTO_LINK) #CMake will take care of the linking
target_include_directories(${LIBRARY_NAME} PUBLIC src/)

View File

@ -1,146 +0,0 @@
# use variables in submakes
export
OPTIMIZATION_ON ?= 1
ASAN ?= 0
DEPRECATION_ON ?= 1
DEBUG ?= 0
COPYCHECK_ARGS ?=
LLD ?= 0
WERROR ?= 0
UNAME := $(shell uname)
# Use clang++ if available, else use g++
ifeq ($(shell command -v clang++ >/dev/null 2>&1; echo $$?),0)
CXX ?= clang++
else
CXX ?= g++
endif
INC := -I ZAPD -I lib/elfio -I lib/libgfxd -I lib/tinyxml2 -I ZAPDUtils
CXXFLAGS := -fpic -std=c++17 -Wall -Wextra -fno-omit-frame-pointer
OPTFLAGS :=
ifneq ($(DEBUG),0)
OPTIMIZATION_ON = 0
CXXFLAGS += -g3 -DDEVELOPMENT -D_DEBUG
COPYCHECK_ARGS += --devel
DEPRECATION_ON = 0
endif
ifneq ($(WERROR),0)
CXXFLAGS += -Werror
endif
ifeq ($(OPTIMIZATION_ON),0)
OPTFLAGS := -O0
else
OPTFLAGS := -O2
endif
ifneq ($(ASAN),0)
CXXFLAGS += -fsanitize=address -fsanitize=pointer-compare -fsanitize=pointer-subtract -fsanitize=undefined
endif
ifneq ($(DEPRECATION_ON),0)
CXXFLAGS += -DDEPRECATION_ON
endif
# CXXFLAGS += -DTEXTURE_DEBUG
LDFLAGS := -Llib/libgfxd -L../libultraship -L../StormLib/build \
-pthread -lgfxd -lultraship ZAPDUtils/ZAPDUtils.a -lstorm -lbz2 -lm -ldl
LDFLAGS += $(shell pkg-config --libs glew libpng zlib) $(shell sdl2-config --libs)
INC += $(shell pkg-config --cflags libpng)
ifeq ($(UNAME), Darwin)
LDFLAGS += -framework OpenGL -framework Foundation
endif
ifeq ($(UNAME), Linux)
LDFLAGS += $(shell pkg-config --libs x11 libpulse)
endif
# Use LLD if available. Set LLD=0 to not use it
ifeq ($(shell command -v ld.lld >/dev/null 2>&1; echo $$?),0)
LLD := 1
endif
ifneq ($(LLD),0)
LDFLAGS += -fuse-ld=lld
endif
UNAMEM := $(shell uname -m)
ifeq ($(UNAME), Linux)
LDFLAGS += -Wl,-export-dynamic -lstdc++fs
EXPORTERS := -Wl,--whole-archive ../OTRExporter/OTRExporter/OTRExporter.a -Wl,--no-whole-archive
endif
ifeq ($(UNAME), Darwin)
EXPORTERS := -Wl,-force_load ../OTRExporter/OTRExporter/OTRExporter.a
endif
ZAPD_SRC_DIRS := $(shell find ZAPD -type d)
SRC_DIRS = $(ZAPD_SRC_DIRS) lib/tinyxml2
ZAPD_CPP_FILES := $(foreach dir,$(ZAPD_SRC_DIRS),$(wildcard $(dir)/*.cpp))
ZAPD_H_FILES := $(foreach dir,$(ZAPD_SRC_DIRS),$(wildcard $(dir)/*.h))
CPP_FILES += $(ZAPD_CPP_FILES) lib/tinyxml2/tinyxml2.cpp
O_FILES := $(foreach f,$(CPP_FILES:.cpp=.o),build/$f)
O_FILES += build/ZAPD/BuildInfo.o
# create build directories
$(shell mkdir -p $(foreach dir,$(SRC_DIRS),build/$(dir)))
# Main targets
all: ZAPD.out copycheck
build/ZAPD/BuildInfo.o:
python3 ZAPD/genbuildinfo.py $(COPYCHECK_ARGS)
$(CXX) $(CXXFLAGS) $(OPTFLAGS) $(INC) -c $(OUTPUT_OPTION) build/ZAPD/BuildInfo.cpp
copycheck: ZAPD.out
python3 copycheck.py
clean:
rm -rf build ZAPD.out
$(MAKE) -C lib/libgfxd clean
$(MAKE) -C ZAPDUtils clean
$(MAKE) -C ExporterTest clean
rm -rf ../StormLib/build
rebuild: clean all
format:
clang-format-11 -i $(ZAPD_CPP_FILES) $(ZAPD_H_FILES)
$(MAKE) -C ZAPDUtils format
$(MAKE) -C ExporterTest format
.PHONY: all build/ZAPD/BuildInfo.o copycheck clean rebuild format
build/%.o: %.cpp
$(CXX) $(CXXFLAGS) $(OPTFLAGS) $(INC) -c $(OUTPUT_OPTION) $<
# Submakes
lib/libgfxd/libgfxd.a:
$(MAKE) -C lib/libgfxd
.PHONY: StormLib
StormLib:
LDFLAGS="" cmake -B ../StormLib/build -S ../StormLib
$(MAKE) -C ../StormLib/build
.PHONY: ExporterTest
ExporterTest:
$(MAKE) -C ExporterTest
.PHONY: ZAPDUtils
ZAPDUtils:
$(MAKE) -C ZAPDUtils
# Linking
ZAPD.out: $(O_FILES) lib/libgfxd/libgfxd.a ExporterTest ZAPDUtils StormLib
$(CXX) $(CXXFLAGS) $(O_FILES) $(EXPORTERS) $(LDFLAGS) $(OUTPUT_OPTION)

486
ZAPDTR/ZAPD/CMakeLists.txt Normal file
View File

@ -0,0 +1,486 @@
set(PROJECT_NAME ZAPD)
set(CMAKE_CXX_STANDARD 20 CACHE STRING "The C++ standard to use")
#set(CMAKE_C_STANDARD 11 CACHE STRING "The C standard to use")
set(CMAKE_C_STANDARD 11)
################################################################################
# Source groups
################################################################################
set(Header_Files
"../lib/tinyxml2/tinyxml2.h"
"CRC32.h"
"Declaration.h"
"FileWorker.h"
"GameConfig.h"
"Globals.h"
"ImageBackend.h"
"OutputFormatter.h"
"WarningHandler.h"
)
source_group("Header Files" FILES ${Header_Files})
set(Header_Files__Libraries
"../../libultraship/libultraship/Lib/stb/stb_image.h"
"../../libultraship/libultraship/Lib/stb/stb_image_write.h"
"ctpl_stl.h"
)
source_group("Header Files\\Libraries" FILES ${Header_Files__Libraries})
set(Header_Files__Libraries__elfio
"../lib/elfio/elfio/elf_types.hpp"
"../lib/elfio/elfio/elfio.hpp"
"../lib/elfio/elfio/elfio_dump.hpp"
"../lib/elfio/elfio/elfio_dynamic.hpp"
"../lib/elfio/elfio/elfio_header.hpp"
"../lib/elfio/elfio/elfio_note.hpp"
"../lib/elfio/elfio/elfio_relocation.hpp"
"../lib/elfio/elfio/elfio_section.hpp"
"../lib/elfio/elfio/elfio_segment.hpp"
"../lib/elfio/elfio/elfio_strings.hpp"
"../lib/elfio/elfio/elfio_symbols.hpp"
"../lib/elfio/elfio/elfio_utils.hpp"
)
source_group("Header Files\\Libraries\\elfio" FILES ${Header_Files__Libraries__elfio})
set(Header_Files__Libraries__libgfxd
"../lib/libgfxd/gbi.h"
"../lib/libgfxd/gfxd.h"
"../lib/libgfxd/priv.h"
)
source_group("Header Files\\Libraries\\libgfxd" FILES ${Header_Files__Libraries__libgfxd})
set(Header_Files__Yaz0
"yaz0/readwrite.h"
"yaz0/yaz0.h"
)
source_group("Header Files\\Yaz0" FILES ${Header_Files__Yaz0})
set(Header_Files__Z64
"OtherStructs/SkinLimbStructs.h"
"Overlays/ZOverlay.h"
"ZAnimation.h"
"ZArray.h"
"ZAudio.h"
"ZBackground.h"
"ZBlob.h"
"ZCollision.h"
"ZCutscene.h"
"ZCutsceneMM.h"
"ZDisplayList.h"
"ZFile.h"
"ZLimb.h"
"ZMtx.h"
"ZPath.h"
"ZPlayerAnimationData.h"
"ZResource.h"
"ZRom.h"
"ZScalar.h"
"ZSkeleton.h"
"ZString.h"
"ZSymbol.h"
"ZText.h"
"ZTexture.h"
"ZTextureAnimation.h"
"ZVector.h"
"ZVtx.h"
)
source_group("Header Files\\Z64" FILES ${Header_Files__Z64})
set(Header_Files__Z64__ZRoom
"ZRoom/ZRoom.h"
"ZRoom/ZRoomCommand.h"
)
source_group("Header Files\\Z64\\ZRoom" FILES ${Header_Files__Z64__ZRoom})
set(Header_Files__Z64__ZRoom__Commands
"ZRoom/Commands/EndMarker.h"
"ZRoom/Commands/SetActorCutsceneList.h"
"ZRoom/Commands/SetActorList.h"
"ZRoom/Commands/SetAlternateHeaders.h"
"ZRoom/Commands/SetAnimatedMaterialList.h"
"ZRoom/Commands/SetCameraSettings.h"
"ZRoom/Commands/SetCollisionHeader.h"
"ZRoom/Commands/SetCsCamera.h"
"ZRoom/Commands/SetCutscenes.h"
"ZRoom/Commands/SetEchoSettings.h"
"ZRoom/Commands/SetEntranceList.h"
"ZRoom/Commands/SetExitList.h"
"ZRoom/Commands/SetLightingSettings.h"
"ZRoom/Commands/SetLightList.h"
"ZRoom/Commands/SetMesh.h"
"ZRoom/Commands/SetMinimapChests.h"
"ZRoom/Commands/SetMinimapList.h"
"ZRoom/Commands/SetObjectList.h"
"ZRoom/Commands/SetPathways.h"
"ZRoom/Commands/SetRoomBehavior.h"
"ZRoom/Commands/SetRoomList.h"
"ZRoom/Commands/SetSkyboxModifier.h"
"ZRoom/Commands/SetSkyboxSettings.h"
"ZRoom/Commands/SetSoundSettings.h"
"ZRoom/Commands/SetSpecialObjects.h"
"ZRoom/Commands/SetStartPositionList.h"
"ZRoom/Commands/SetTimeSettings.h"
"ZRoom/Commands/SetTransitionActorList.h"
"ZRoom/Commands/SetWind.h"
"ZRoom/Commands/SetWorldMapVisited.h"
"ZRoom/Commands/Unused09.h"
"ZRoom/Commands/Unused1D.h"
"ZRoom/Commands/ZRoomCommandUnk.h"
)
source_group("Header Files\\Z64\\ZRoom\\Commands" FILES ${Header_Files__Z64__ZRoom__Commands})
set(Resource_Files
"../../OTRExporter/CFG/SymbolMap_OoTMqDbg.txt"
)
source_group("Resource Files" FILES ${Resource_Files})
set(Source_Files
"Declaration.cpp"
"FileWorker.cpp"
"GameConfig.cpp"
"Globals.cpp"
"ImageBackend.cpp"
"Main.cpp"
"OutputFormatter.cpp"
"WarningHandler.cpp"
)
source_group("Source Files" FILES ${Source_Files})
set(Source_Files__Libraries__libgfxd
"../lib/libgfxd/gfxd.c"
"../lib/libgfxd/uc.c"
"../lib/libgfxd/uc_f3d.c"
"../lib/libgfxd/uc_f3db.c"
"../lib/libgfxd/uc_f3dex.c"
"../lib/libgfxd/uc_f3dex2.c"
"../lib/libgfxd/uc_f3dexb.c"
)
source_group("Source Files\\Libraries\\libgfxd" FILES ${Source_Files__Libraries__libgfxd})
set(Source_Files__Yaz0
"yaz0/yaz0.cpp"
)
source_group("Source Files\\Yaz0" FILES ${Source_Files__Yaz0})
set(Source_Files__Z64
"OtherStructs/SkinLimbStructs.cpp"
"Overlays/ZOverlay.cpp"
"ZAnimation.cpp"
"ZArray.cpp"
"ZAudio.cpp"
"ZAudioDecode.cpp"
"ZBackground.cpp"
"ZBlob.cpp"
"ZCollision.cpp"
"ZCutscene.cpp"
"ZCutsceneMM.cpp"
"ZDisplayList.cpp"
"ZFile.cpp"
"ZLimb.cpp"
"ZMtx.cpp"
"ZPath.cpp"
"ZPlayerAnimationData.cpp"
"ZResource.cpp"
"ZRom.cpp"
"ZScalar.cpp"
"ZSkeleton.cpp"
"ZString.cpp"
"ZSymbol.cpp"
"ZText.cpp"
"ZTexture.cpp"
"ZTextureAnimation.cpp"
"ZVector.cpp"
"ZVtx.cpp"
)
source_group("Source Files\\Z64" FILES ${Source_Files__Z64})
set(Source_Files__Z64__ZRoom
"ZRoom/ZRoom.cpp"
"ZRoom/ZRoomCommand.cpp"
)
source_group("Source Files\\Z64\\ZRoom" FILES ${Source_Files__Z64__ZRoom})
set(Source_Files__Z64__ZRoom__Commands
"ZRoom/Commands/EndMarker.cpp"
"ZRoom/Commands/SetActorCutsceneList.cpp"
"ZRoom/Commands/SetActorList.cpp"
"ZRoom/Commands/SetAlternateHeaders.cpp"
"ZRoom/Commands/SetAnimatedMaterialList.cpp"
"ZRoom/Commands/SetCameraSettings.cpp"
"ZRoom/Commands/SetCollisionHeader.cpp"
"ZRoom/Commands/SetCsCamera.cpp"
"ZRoom/Commands/SetCutscenes.cpp"
"ZRoom/Commands/SetEchoSettings.cpp"
"ZRoom/Commands/SetEntranceList.cpp"
"ZRoom/Commands/SetExitList.cpp"
"ZRoom/Commands/SetLightingSettings.cpp"
"ZRoom/Commands/SetLightList.cpp"
"ZRoom/Commands/SetMesh.cpp"
"ZRoom/Commands/SetMinimapChests.cpp"
"ZRoom/Commands/SetMinimapList.cpp"
"ZRoom/Commands/SetObjectList.cpp"
"ZRoom/Commands/SetPathways.cpp"
"ZRoom/Commands/SetRoomBehavior.cpp"
"ZRoom/Commands/SetRoomList.cpp"
"ZRoom/Commands/SetSkyboxModifier.cpp"
"ZRoom/Commands/SetSkyboxSettings.cpp"
"ZRoom/Commands/SetSoundSettings.cpp"
"ZRoom/Commands/SetSpecialObjects.cpp"
"ZRoom/Commands/SetStartPositionList.cpp"
"ZRoom/Commands/SetTimeSettings.cpp"
"ZRoom/Commands/SetTransitionActorList.cpp"
"ZRoom/Commands/SetWind.cpp"
"ZRoom/Commands/SetWorldMapVisited.cpp"
"ZRoom/Commands/Unused09.cpp"
"ZRoom/Commands/Unused1D.cpp"
"ZRoom/Commands/ZRoomCommandUnk.cpp"
)
source_group("Source Files\\Z64\\ZRoom\\Commands" FILES ${Source_Files__Z64__ZRoom__Commands})
set(ALL_FILES
${Header_Files}
${Header_Files__Libraries}
${Header_Files__Libraries__elfio}
${Header_Files__Libraries__libgfxd}
${Header_Files__Yaz0}
${Header_Files__Z64}
${Header_Files__Z64__ZRoom}
${Header_Files__Z64__ZRoom__Commands}
${Resource_Files}
${Source_Files}
${Source_Files__Libraries__libgfxd}
${Source_Files__Yaz0}
${Source_Files__Z64}
${Source_Files__Z64__ZRoom}
${Source_Files__Z64__ZRoom__Commands}
${any__any}
)
################################################################################
# Target
################################################################################
add_executable(${PROJECT_NAME} ${ALL_FILES})
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
use_props(${PROJECT_NAME} "${CMAKE_CONFIGURATION_TYPES}" "${DEFAULT_CXX_PROPS}")
endif()
################################################################################
# Includes for CMake from *.props
################################################################################
set(ROOT_NAMESPACE ZAPD)
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
set_target_properties(${PROJECT_NAME} PROPERTIES
INTERPROCEDURAL_OPTIMIZATION_RELEASE "TRUE"
)
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x86")
set_target_properties(${PROJECT_NAME} PROPERTIES
INTERPROCEDURAL_OPTIMIZATION_RELEASE "TRUE"
)
endif()
elseif (CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin")
set_target_properties(${PROJECT_NAME} PROPERTIES
OUTPUT_NAME "ZAPD.out"
)
endif()
################################################################################
# MSVC runtime library
################################################################################
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
get_property(MSVC_RUNTIME_LIBRARY_DEFAULT TARGET ${PROJECT_NAME} PROPERTY MSVC_RUNTIME_LIBRARY)
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
string(CONCAT "MSVC_RUNTIME_LIBRARY_STR"
$<$<CONFIG:Debug>:
MultiThreadedDebug
>
$<$<CONFIG:Release>:
MultiThreaded
>
$<$<NOT:$<OR:$<CONFIG:Debug>,$<CONFIG:Release>>>:${MSVC_RUNTIME_LIBRARY_DEFAULT}>
)
endif()
set_target_properties(${PROJECT_NAME} PROPERTIES MSVC_RUNTIME_LIBRARY ${MSVC_RUNTIME_LIBRARY_STR})
endif()
################################################################################
# Compile definitions
################################################################################
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
target_compile_definitions(${PROJECT_NAME} PRIVATE
"_CRT_SECURE_NO_WARNINGS;"
"_MBCS"
STORMLIB_NO_AUTO_LINK
)
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x86")
target_compile_definitions(${PROJECT_NAME} PRIVATE
"$<$<CONFIG:Debug>:"
"_CRT_SECURE_NO_WARNINGS"
">"
"_MBCS"
STORMLIB_NO_AUTO_LINK
)
endif()
endif()
################################################################################
# Compile and link options
################################################################################
find_package(PNG REQUIRED)
target_include_directories(${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/../../ZAPDTR/ZAPDUtils
${CMAKE_CURRENT_SOURCE_DIR}/../../ZAPDTR/lib/tinyxml2
${CMAKE_CURRENT_SOURCE_DIR}/../../ZAPDTR/lib/libgfxd
${PNG_PNG_INCLUDE_DIR}/
.
)
if(MSVC)
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
target_compile_options(${PROJECT_NAME} PRIVATE
$<$<CONFIG:Debug>:
/Od;
/RTC1
>
$<$<CONFIG:Release>:
/Oi;
/Gy
>
/permissive-;
/sdl;
/W3;
${DEFAULT_CXX_DEBUG_INFORMATION_FORMAT};
${DEFAULT_CXX_EXCEPTION_HANDLING}
)
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x86")
target_compile_options(${PROJECT_NAME} PRIVATE
$<$<CONFIG:Debug>:
/Od
>
$<$<CONFIG:Release>:
/O2;
/Oi;
/Gy
>
/permissive-;
/sdl;
/W3;
${DEFAULT_CXX_DEBUG_INFORMATION_FORMAT};
${DEFAULT_CXX_EXCEPTION_HANDLING}
)
endif()
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
target_link_options(${PROJECT_NAME} PRIVATE
$<$<CONFIG:Debug>:
/PROFILE
>
$<$<CONFIG:Release>:
/OPT:REF;
/OPT:ICF
>
/DEBUG:FULL
)
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x86")
target_link_options(${PROJECT_NAME} PRIVATE
$<$<CONFIG:Debug>:
/PROFILE
>
$<$<CONFIG:Release>:
/OPT:REF;
/OPT:ICF
>
/DEBUG:FULL
)
endif()
endif()
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU|Clang|AppleClang")
target_compile_options(${PROJECT_NAME} PRIVATE
-Wall -Wextra -Wno-error
-Wno-unused-parameter
-Wno-unused-function
-Wno-unused-variable
-Wno-missing-field-initializers
-Wno-parentheses
-Wno-narrowing
$<$<COMPILE_LANGUAGE:CXX>:-Wno-deprecated-enum-enum-conversion>
-pthread
)
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
target_link_options(${PROJECT_NAME} PRIVATE
-pthread
)
else()
target_link_options(${PROJECT_NAME} PRIVATE
-pthread
-Wl,-export-dynamic
)
endif()
endif()
################################################################################
# Dependencies
################################################################################
add_dependencies(${PROJECT_NAME}
OTRExporter
ZAPDUtils
libultraship
)
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
set(ADDITIONAL_LIBRARY_DEPENDENCIES
"ZAPDUtils;"
"-WHOLEARCHIVE:$<TARGET_LINKER_FILE_DIR:OTRExporter>/$<TARGET_LINKER_FILE_NAME:OTRExporter>"
"libultraship;"
storm
PNG::PNG
)
endif()
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
set(ADDITIONAL_LIBRARY_DEPENDENCIES
"ZAPDUtils;"
-Wl,-force_load $<TARGET_LINKER_FILE_DIR:OTRExporter>/$<TARGET_LINKER_FILE_NAME:OTRExporter>
"libultraship;"
PNG::PNG
${CMAKE_DL_LIBS}
Threads::Threads
)
elseif(CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch")
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
set(ADDITIONAL_LIBRARY_DEPENDENCIES
"ZAPDUtils;"
-Wl,--whole-archive $<TARGET_LINKER_FILE_DIR:OTRExporter>/$<TARGET_LINKER_FILE_NAME:OTRExporter> -Wl,--no-whole-archive
"libultraship;"
PNG::PNG
Threads::Threads
)
else()
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
set(ADDITIONAL_LIBRARY_DEPENDENCIES
"ZAPDUtils;"
-Wl,--whole-archive $<TARGET_LINKER_FILE_DIR:OTRExporter>/$<TARGET_LINKER_FILE_NAME:OTRExporter> -Wl,--no-whole-archive
"libultraship;"
PNG::PNG
${CMAKE_DL_LIBS}
Threads::Threads
)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch")
add_library(pathconf OBJECT pathconf.c)
target_link_libraries(${PROJECT_NAME} PRIVATE "${ADDITIONAL_LIBRARY_DEPENDENCIES}" $<TARGET_OBJECTS:pathconf> )
else()
target_link_libraries(${PROJECT_NAME} PRIVATE "${ADDITIONAL_LIBRARY_DEPENDENCIES}")
endif()

6
ZAPDTR/ZAPD/pathconf.c Normal file
View File

@ -0,0 +1,6 @@
#include <unistd.h>
long pathconf(const char *path, int name) {
return -1;
}

View File

@ -1,82 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30320.27
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZAPD", "ZAPD\ZAPD.vcxproj", "{B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ExporterExample", "ExporterTest\ExporterTest.vcxproj", "{65608EB0-1A47-45AD-AB66-192FB64C762C}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZAPDUtils", "ZAPDUtils\ZAPDUtils.vcxproj", "{A2E01C3E-D647-45D1-9788-043DEBC1A908}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
MinSizeRel|x64 = MinSizeRel|x64
MinSizeRel|x86 = MinSizeRel|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
RelWithDebInfo|x64 = RelWithDebInfo|x64
RelWithDebInfo|x86 = RelWithDebInfo|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Debug|x64.ActiveCfg = Debug|x64
{B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Debug|x64.Build.0 = Debug|x64
{B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Debug|x86.ActiveCfg = Debug|Win32
{B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Debug|x86.Build.0 = Debug|Win32
{B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.MinSizeRel|x64.ActiveCfg = Release|x64
{B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.MinSizeRel|x64.Build.0 = Release|x64
{B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.MinSizeRel|x86.ActiveCfg = Release|Win32
{B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.MinSizeRel|x86.Build.0 = Release|Win32
{B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Release|x64.ActiveCfg = Release|x64
{B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Release|x64.Build.0 = Release|x64
{B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Release|x86.ActiveCfg = Release|Win32
{B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Release|x86.Build.0 = Release|Win32
{B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.RelWithDebInfo|x64.ActiveCfg = Release|x64
{B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.RelWithDebInfo|x64.Build.0 = Release|x64
{B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.RelWithDebInfo|x86.ActiveCfg = Release|Win32
{B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.RelWithDebInfo|x86.Build.0 = Release|Win32
{65608EB0-1A47-45AD-AB66-192FB64C762C}.Debug|x64.ActiveCfg = Debug|x64
{65608EB0-1A47-45AD-AB66-192FB64C762C}.Debug|x64.Build.0 = Debug|x64
{65608EB0-1A47-45AD-AB66-192FB64C762C}.Debug|x86.ActiveCfg = Debug|Win32
{65608EB0-1A47-45AD-AB66-192FB64C762C}.Debug|x86.Build.0 = Debug|Win32
{65608EB0-1A47-45AD-AB66-192FB64C762C}.MinSizeRel|x64.ActiveCfg = Debug|x64
{65608EB0-1A47-45AD-AB66-192FB64C762C}.MinSizeRel|x64.Build.0 = Debug|x64
{65608EB0-1A47-45AD-AB66-192FB64C762C}.MinSizeRel|x86.ActiveCfg = Debug|Win32
{65608EB0-1A47-45AD-AB66-192FB64C762C}.MinSizeRel|x86.Build.0 = Debug|Win32
{65608EB0-1A47-45AD-AB66-192FB64C762C}.Release|x64.ActiveCfg = Release|x64
{65608EB0-1A47-45AD-AB66-192FB64C762C}.Release|x64.Build.0 = Release|x64
{65608EB0-1A47-45AD-AB66-192FB64C762C}.Release|x86.ActiveCfg = Release|Win32
{65608EB0-1A47-45AD-AB66-192FB64C762C}.Release|x86.Build.0 = Release|Win32
{65608EB0-1A47-45AD-AB66-192FB64C762C}.RelWithDebInfo|x64.ActiveCfg = Release|x64
{65608EB0-1A47-45AD-AB66-192FB64C762C}.RelWithDebInfo|x64.Build.0 = Release|x64
{65608EB0-1A47-45AD-AB66-192FB64C762C}.RelWithDebInfo|x86.ActiveCfg = Release|Win32
{65608EB0-1A47-45AD-AB66-192FB64C762C}.RelWithDebInfo|x86.Build.0 = Release|Win32
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x64.ActiveCfg = Debug|x64
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x64.Build.0 = Debug|x64
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x86.ActiveCfg = Debug|Win32
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x86.Build.0 = Debug|Win32
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.MinSizeRel|x64.ActiveCfg = Debug|x64
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.MinSizeRel|x64.Build.0 = Debug|x64
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.MinSizeRel|x86.ActiveCfg = Debug|Win32
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.MinSizeRel|x86.Build.0 = Debug|Win32
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x64.ActiveCfg = Release|x64
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x64.Build.0 = Release|x64
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x86.ActiveCfg = Release|Win32
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x86.Build.0 = Release|Win32
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.RelWithDebInfo|x64.ActiveCfg = Release|x64
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.RelWithDebInfo|x64.Build.0 = Release|x64
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.RelWithDebInfo|x86.ActiveCfg = Release|Win32
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.RelWithDebInfo|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C2E1CC72-7A50-3249-AFD5-DFF6FE25CDCA}
EndGlobalSection
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,218 @@
set(PROJECT_NAME ZAPDUtils)
################################################################################
# Source groups
################################################################################
set(Header_Files
"Color3b.h"
"StrHash.h"
"Vec2f.h"
"Vec3f.h"
"Vec3s.h"
)
source_group("Header Files" FILES ${Header_Files})
set(Header_Files__Utils
"Utils/BinaryReader.h"
"Utils/BinaryWriter.h"
"Utils/BitConverter.h"
"Utils/Directory.h"
"Utils/File.h"
"Utils/MemoryStream.h"
"Utils/Path.h"
"Utils/Stream.h"
"Utils/StringHelper.h"
)
source_group("Header Files\\Utils" FILES ${Header_Files__Utils})
set(Source_Files__Libraries
"../lib/tinyxml2/tinyxml2.cpp"
)
source_group("Source Files\\Libraries" FILES ${Source_Files__Libraries})
set(Source_Files__Utils
"Utils/BinaryReader.cpp"
"Utils/BinaryWriter.cpp"
"Utils/MemoryStream.cpp"
"Utils/StringHelper.cpp"
)
source_group("Source Files\\Utils" FILES ${Source_Files__Utils})
set(ALL_FILES
${Header_Files}
${Header_Files__Utils}
${Source_Files__Libraries}
${Source_Files__Utils}
)
################################################################################
# Target
################################################################################
add_library(${PROJECT_NAME} STATIC ${ALL_FILES})
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
use_props(${PROJECT_NAME} "${CMAKE_CONFIGURATION_TYPES}" "${DEFAULT_CXX_PROPS}")
endif()
set(ROOT_NAMESPACE ZAPDUtils)
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
set_target_properties(${PROJECT_NAME} PROPERTIES
VS_GLOBAL_KEYWORD "Win32Proj"
)
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
set_target_properties(${PROJECT_NAME} PROPERTIES
INTERPROCEDURAL_OPTIMIZATION_RELEASE "TRUE"
)
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
set_target_properties(${PROJECT_NAME} PROPERTIES
INTERPROCEDURAL_OPTIMIZATION_RELEASE "TRUE"
)
endif()
endif()
################################################################################
# MSVC runtime library
################################################################################
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
get_property(MSVC_RUNTIME_LIBRARY_DEFAULT TARGET ${PROJECT_NAME} PROPERTY MSVC_RUNTIME_LIBRARY)
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
string(CONCAT "MSVC_RUNTIME_LIBRARY_STR"
$<$<CONFIG:Debug>:
MultiThreadedDebug
>
$<$<CONFIG:Release>:
MultiThreaded
>
$<$<NOT:$<OR:$<CONFIG:Debug>,$<CONFIG:Release>>>:${MSVC_RUNTIME_LIBRARY_DEFAULT}>
)
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
string(CONCAT "MSVC_RUNTIME_LIBRARY_STR"
MultiThreaded
)
endif()
set_target_properties(${PROJECT_NAME} PROPERTIES MSVC_RUNTIME_LIBRARY ${MSVC_RUNTIME_LIBRARY_STR})
endif()
################################################################################
# Compile definitions
################################################################################
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
target_compile_definitions(${PROJECT_NAME} PRIVATE
"$<$<CONFIG:Debug>:"
"_DEBUG;"
"_MBCS"
">"
"$<$<CONFIG:Release>:"
"NDEBUG;"
"UNICODE;"
"_UNICODE"
">"
"_CONSOLE;"
"_CRT_SECURE_NO_WARNINGS"
STORMLIB_NO_AUTO_LINK
)
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
target_compile_definitions(${PROJECT_NAME} PRIVATE
"$<$<CONFIG:Debug>:"
"_DEBUG"
">"
"$<$<CONFIG:Release>:"
"NDEBUG"
">"
"WIN32;"
"_CONSOLE;"
"_CRT_SECURE_NO_WARNINGS;"
"UNICODE;"
"_UNICODE"
STORMLIB_NO_AUTO_LINK
)
endif()
endif()
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU|Clang|AppleClang")
target_compile_definitions(${PROJECT_NAME} PRIVATE
"$<$<CONFIG:Debug>:"
"_DEBUG"
">"
"$<$<CONFIG:Release>:"
"NDEBUG"
">"
"_CONSOLE;"
"_CRT_SECURE_NO_WARNINGS;"
"UNICODE;"
"_UNICODE"
)
endif()
################################################################################
# Compile and link options
################################################################################
if(MSVC)
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
target_compile_options(${PROJECT_NAME} PRIVATE
$<$<CONFIG:Release>:
/Oi;
/Gy
>
/permissive-;
/MP;
/sdl;
/W3;
${DEFAULT_CXX_DEBUG_INFORMATION_FORMAT};
${DEFAULT_CXX_EXCEPTION_HANDLING}
)
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
target_compile_options(${PROJECT_NAME} PRIVATE
$<$<CONFIG:Debug>:
/O2;
/Ot
>
$<$<CONFIG:Release>:
/Gy
>
/permissive-;
/MP;
/Oi;
/sdl;
/W3;
${DEFAULT_CXX_DEBUG_INFORMATION_FORMAT};
${DEFAULT_CXX_EXCEPTION_HANDLING}
)
endif()
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
target_link_options(${PROJECT_NAME} PRIVATE
$<$<CONFIG:Release>:
/OPT:REF;
/OPT:ICF
>
/SUBSYSTEM:CONSOLE
)
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
target_link_options(${PROJECT_NAME} PRIVATE
$<$<CONFIG:Release>:
/OPT:REF;
/OPT:ICF
>
/SUBSYSTEM:CONSOLE
)
endif()
endif()
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU|Clang|AppleClang")
target_compile_options(${PROJECT_NAME} PRIVATE
-Wall -Wextra -Wno-error
-Wno-unused-parameter
-Wno-unused-function
-Wno-unused-variable
-Wno-missing-field-initializers
-Wno-parentheses
-Wno-narrowing
$<$<COMPILE_LANGUAGE:CXX>:-Wno-deprecated-enum-enum-conversion>
)
endif()
################################################################################
# Dependencies
################################################################################
# Link with other targets.

View File

@ -1,29 +0,0 @@
# Only used for standalone compilation, usually inherits these from the main makefile
CXX ?= g++
CXXFLAGS ?= -Wall -Wextra -O2 -g -std=c++17
SRC_DIRS := $(shell find . -type d -not -path "*build*")
CPP_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.cpp))
H_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.h))
O_FILES := $(foreach f,$(CPP_FILES:.cpp=.o),build/$f)
LIB := ZAPDUtils.a
# create build directories
$(shell mkdir -p $(foreach dir,$(SRC_DIRS),build/$(dir)))
all: $(LIB)
clean:
rm -rf build $(LIB)
format:
clang-format-11 -i $(CPP_FILES) $(H_FILES)
.PHONY: all clean format
build/%.o: %.cpp
$(CXX) $(CXXFLAGS) $(OPTFLAGS) -c $(OUTPUT_OPTION) $<
$(LIB): $(O_FILES)
$(AR) rcs $@ $^

View File

@ -1,171 +0,0 @@
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITPRO)),)
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>/devkitpro")
endif
TOPDIR ?= $(CURDIR)
include $(DEVKITPRO)/libnx/switch_rules
#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# DATA is a list of directories containing data files
# INCLUDES is a list of directories containing header files
# ROMFS is the directory containing data to be added to RomFS, relative to the Makefile (Optional)
#
# NO_ICON: if set to anything, do not use icon.
# NO_NACP: if set to anything, no .nacp file is generated.
# APP_TITLE is the name of the app stored in the .nacp file (Optional)
# APP_AUTHOR is the author of the app stored in the .nacp file (Optional)
# APP_VERSION is the version of the app stored in the .nacp file (Optional)
# APP_TITLEID is the titleID of the app stored in the .nacp file (Optional)
# ICON is the filename of the icon (.jpg), relative to the project folder.
# If not set, it attempts to use one of the following (in this order):
# - <Project name>.jpg
# - icon.jpg
# - <libnx folder>/default_icon.jpg
#
# CONFIG_JSON is the filename of the NPDM config file (.json), relative to the project folder.
# If not set, it attempts to use one of the following (in this order):
# - <Project name>.json
# - config.json
# If a JSON file is provided or autodetected, an ExeFS PFS0 (.nsp) is built instead
# of a homebrew executable (.nro). This is intended to be used for sysmodules.
# NACP building is skipped as well.
#---------------------------------------------------------------------------------
TARGET := ZAPDUtils
BUILD := build
SOURCES := Utils
DATA :=
INCLUDES :=
#-------------------------------------------------------------------------------
# source files
#-------------------------------------------------------------------------------
SOURCEFILES_C :=
SOURCEFILES_CPP :=
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIE
CFLAGS := -g -Wall -O2 -ffunction-sections \
$(ARCH) $(DEFINES)
CFLAGS += $(INCLUDE) -D__SWITCH__
CXXFLAGS := $(CFLAGS) -fno-rtti -fexceptions -std=gnu++20
CFLAGS += -std=gnu11
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
LIBS := -lnx
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(PORTLIBS) $(LIBNX)
#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------
export OUTPUT := $(CURDIR)/lib/lib$(TARGET).a
export TOPDIR := $(CURDIR)
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
$(foreach dir,$(DATA),$(CURDIR)/$(dir)) \
$(foreach sf,$(SOURCEFILES_C),$(CURDIR)/$(dir $(sf))) \
$(foreach sf,$(SOURCEFILES_CPP),$(CURDIR)/$(dir $(sf)))
export DEPSDIR := $(CURDIR)/$(BUILD)
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) \
$(foreach f,$(SOURCEFILES_C),$(notdir $(f)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) \
$(foreach f,$(SOURCEFILES_CPP),$(notdir $(f)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
#---------------------------------------------------------------------------------
export LD := $(CC)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LD := $(CXX)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES)))
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/$(BUILD)
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
.PHONY: $(BUILD) clean all
#---------------------------------------------------------------------------------
all: $(BUILD)
lib:
@[ -d $@ ] || mkdir -p $@
$(BUILD) : lib
@[ -d $@ ] || mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.switch
#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -rf build lib
#---------------------------------------------------------------------------------
else
.PHONY: all
DEPENDS := $(OFILES:.o=.d)
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT) : $(OFILES)
$(OFILES_SRC) : $(HFILES)
$(OFILES_SRC) : $(HFILES_BIN)
#---------------------------------------------------------------------------------
# you need a rule like this for each extension you use as binary data
#---------------------------------------------------------------------------------
%.bin.o %_bin.h : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
-include $(DEPENDS)
#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------

View File

@ -1,149 +0,0 @@
# Only used for standalone compilation, usually inherits these from the main makefile
CXX ?= g++
CC ?= gcc
AR := ar
FORMAT := clang-format-11
UNAME := $(shell uname)
ASAN ?= 0
DEBUG ?= 1
OPTFLAGS ?= -O0
X11 ?= 0
LTO ?= 0
# flag to save whether the compiler being used is clang or gcc by checking CXX --version
CXX_IS_CLANG ?= $(shell $(CXX) --version | grep -c clang)
ifeq ($(CXX_IS_CLANG),1)
MXX := $(CXX)
else
MXX ?= clang++
endif
WARN := -Wall -Wextra -Werror \
-Wno-unused-variable \
-Wno-unused-parameter \
-Wno-unused-function \
-Wno-parentheses \
-Wno-narrowing \
-Wno-missing-field-initializers \
-Wno-error=multichar \
-Wno-delete-non-abstract-non-virtual-dtor \
-Wno-unused-private-field \
-Wno-deprecated-copy-with-user-provided-copy \
-Wno-deprecated-declarations \
-Wno-unknown-warning-option
CWARN :=
CXXWARN := -Wno-deprecated-enum-enum-conversion -Wno-deprecated-copy
ifneq ($(CXX_IS_CLANG),1)
WARN += -Wno-error=stringop-overflow
CXXWARN += -Wno-error=maybe-uninitialized
endif
CXXFLAGS := $(WARN) $(CXXWARN) -std=c++20 -D_GNU_SOURCE -DENABLE_OPENGL -DSPDLOG_ACTIVE_LEVEL=0
CFLAGS := $(WARN) $(CWARN) -std=c99 -D_GNU_SOURCE -DENABLE_OPENGL -DSPDLOG_ACTIVE_LEVEL=0
CPPFLAGS := -MMD $(shell pkg-config --cflags sdl2 glew)
MMFLAGS := -Wno-deprecated-declarations -ObjC++ -fobjc-weak -fobjc-arc
ifeq ($(X11), 1)
CXXFLAGS += -DX11_SUPPORTED
CFLAGS += -DX11_SUPPORTED
endif
# if not using clang, ask clang to use gcc standard library
ifneq ($(CXX_IS_CLANG),1)
STD_ISYSTEM=$(shell ${CXX} -xc++ -E -v - < /dev/null 2>&1 | grep "> search starts here" -A2 | tail -n 2 | head -n 1)
CXX_ISYSTEM=$(shell ${CXX} -xc++ -E -v - < /dev/null 2>&1 | grep "> search starts here" -A2 | tail -n 2 | tail -n 1)
MMFLAGS += -stdlib++-isystem ${STD_ISYSTEM} -cxx-isystem ${CXX_ISYSTEM}
endif
ifneq ($(DEBUG),0)
CXXFLAGS += -g -D_DEBUG
CFLAGS += -g -D_DEBUG
endif
ifneq ($(ASAN),0)
CXXFLAGS += -fsanitize=address
CFLAGS += -fsanitize=address
endif
ifneq ($(LTO),0)
CXXFLAGS += -flto
CFLAGS += -flto
endif
SRC_DIRS := $(shell find . -type d -not -path "*build*")
CXX_FILES := \
$(shell find libultraship/Factories -name "*.cpp") \
$(shell find libultraship/Lib/Fast3D -name "*.cpp") \
$(shell find libultraship -maxdepth 1 -name "*.cpp") \
$(shell find libultraship/Lib/ImGui -maxdepth 1 -name "*.cpp") \
$(shell find libultraship/Lib/Mercury -maxdepth 1 -name "*.cpp") \
libultraship/Lib/ImGui/backends/imgui_impl_opengl3.cpp \
libultraship/Lib/ImGui/backends/imgui_impl_sdl.cpp \
libultraship/Lib/StrHash64.cpp \
libultraship/Lib/tinyxml2/tinyxml2.cpp
C_FILES := \
libultraship/mixer.c \
libultraship/Lib/stb/stb_impl.c
MM_FILES := \
libultraship/OSXFolderManager.mm
FMT_FILES := $(shell find libultraship/ -type f \( -name "*.cpp" -o -name "*.h" \) -a -not -path "libultraship/Lib/*")
O_FILES := \
$(CXX_FILES:%.cpp=build/%.o) \
$(C_FILES:%.c=build/%.o)
ifeq ($(UNAME), Darwin) #APPLE
O_FILES += $(MM_FILES:%.mm=build/%.o)
endif
D_FILES := $(O_FILES:%.o=%.d)
LIB := libultraship.a
INC_DIRS := $(addprefix -I, \
../ZAPDTR/ZAPDUtils \
libultraship/Lib/Fast3D/U64 \
libultraship/Lib/spdlog \
libultraship/Lib/spdlog/include \
libultraship/Lib/ImGui \
libultraship/Lib/Mercury \
libultraship \
../StormLib/src \
)
# create build directories
$(shell mkdir -p $(SRC_DIRS:%=build/%))
all: $(LIB)
clean:
rm -rf build $(LIB)
format:
$(FORMAT) -i $(FMT_FILES)
.PHONY: all clean format
build/%.o: %.cpp
$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(OPTFLAGS) $(INC_DIRS) -c $< -o $@
build/%.o: %.c
$(CC) $(CFLAGS) $(CPPFLAGS) $(OPTFLAGS) $(INC_DIRS) -c $< -o $@
build/%.o: %.mm
$(MXX) $(MMFLAGS) $(CXXFLAGS) $(OPTFLAGS) $(INC_DIRS) -c $< -o $@
$(LIB): $(O_FILES)
$(AR) rcs $@ $^
-include $(D_FILES)

View File

@ -1,192 +0,0 @@
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITPRO)),)
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>/devkitpro")
endif
TOPDIR ?= $(CURDIR)
include $(DEVKITPRO)/libnx/switch_rules
#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# DATA is a list of directories containing data files
# INCLUDES is a list of directories containing header files
# ROMFS is the directory containing data to be added to RomFS, relative to the Makefile (Optional)
#
# NO_ICON: if set to anything, do not use icon.
# NO_NACP: if set to anything, no .nacp file is generated.
# APP_TITLE is the name of the app stored in the .nacp file (Optional)
# APP_AUTHOR is the author of the app stored in the .nacp file (Optional)
# APP_VERSION is the version of the app stored in the .nacp file (Optional)
# APP_TITLEID is the titleID of the app stored in the .nacp file (Optional)
# ICON is the filename of the icon (.jpg), relative to the project folder.
# If not set, it attempts to use one of the following (in this order):
# - <Project name>.jpg
# - icon.jpg
# - <libnx folder>/default_icon.jpg
#
# CONFIG_JSON is the filename of the NPDM config file (.json), relative to the project folder.
# If not set, it attempts to use one of the following (in this order):
# - <Project name>.json
# - config.json
# If a JSON file is provided or autodetected, an ExeFS PFS0 (.nsp) is built instead
# of a homebrew executable (.nro). This is intended to be used for sysmodules.
# NACP building is skipped as well.
#---------------------------------------------------------------------------------
TARGET := ultraship
BUILD := build
SOURCES := \
libultraship/Factories \
libultraship/Lib/Fast3D \
libultraship/Lib/ImGui \
libultraship/Lib/Mercury \
libultraship
DATA :=
INCLUDES := \
../ZAPDTR/ZAPDUtils \
../StormLib/src \
libultraship/Lib/Fast3D/U64 \
libultraship/Lib/ImGui \
libultraship/Lib/spdlog \
libultraship/Lib/spdlog/include \
libultraship
#-------------------------------------------------------------------------------
# source files
#-------------------------------------------------------------------------------
SOURCEFILES_C := \
libultraship/mixer.c \
libultraship/Lib/stb/stb_impl.c \
SOURCEFILES_CPP := \
libultraship/Lib/ImGui/backends/imgui_impl_opengl3.cpp \
libultraship/Lib/ImGui/backends/imgui_impl_sdl.cpp \
libultraship/Lib/StrHash64.cpp \
libultraship/Lib/tinyxml2/tinyxml2.cpp
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIE -ffast-math -O3
CFLAGS := -Wall -ffunction-sections \
$(ARCH) $(DEFINES) \
-DSPDLOG_NO_THREAD_ID \
-DSTBI_NO_THREAD_LOCALS
CFLAGS += $(INCLUDE) -D__SWITCH__ -DENABLE_OPENGL
CXXFLAGS := $(CFLAGS) -std=gnu++20
CFLAGS += -std=gnu11
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
LIBS := -lnx
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(PORTLIBS) $(LIBNX)
#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------
export OUTPUT := $(CURDIR)/lib/lib$(TARGET).a
export TOPDIR := $(CURDIR)
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
$(foreach dir,$(DATA),$(CURDIR)/$(dir)) \
$(foreach sf,$(SOURCEFILES_C),$(CURDIR)/$(dir $(sf))) \
$(foreach sf,$(SOURCEFILES_CPP),$(CURDIR)/$(dir $(sf)))
export DEPSDIR := $(CURDIR)/$(BUILD)
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) \
$(foreach f,$(SOURCEFILES_C),$(notdir $(f)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) \
$(foreach f,$(SOURCEFILES_CPP),$(notdir $(f)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
#---------------------------------------------------------------------------------
export LD := $(CC)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LD := $(CXX)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES)))
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/$(BUILD)
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
.PHONY: $(BUILD) clean all
#---------------------------------------------------------------------------------
all: $(BUILD)
lib:
@[ -d $@ ] || mkdir -p $@
$(BUILD) : lib
@[ -d $@ ] || mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.switch
#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -rf build lib
#---------------------------------------------------------------------------------
else
.PHONY: all
DEPENDS := $(OFILES:.o=.d)
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT) : $(OFILES)
$(OFILES_SRC) : $(HFILES)
$(OFILES_SRC) : $(HFILES_BIN)
#---------------------------------------------------------------------------------
# you need a rule like this for each extension you use as binary data
#---------------------------------------------------------------------------------
%.bin.o %_bin.h : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
-include $(DEPENDS)
#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------

View File

@ -1,64 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30320.27
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libultraship", "libultraship\libultraship.vcxproj", "{6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestApp", "TestApp\TestApp.vcxproj", "{3C4A8151-48D1-4518-BE1A-24016A5B800F}"
ProjectSection(ProjectDependencies) = postProject
{6DA9B521-65B7-41E2-8F8A-F0451CC18ED8} = {6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZAPD", "..\ZAPDTR\ZAPD\ZAPD.vcxproj", "{B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZAPDUtils", "..\ZAPDTR\ZAPDUtils\ZAPDUtils.vcxproj", "{A2E01C3E-D647-45D1-9788-043DEBC1A908}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Debug|x64.ActiveCfg = Debug|x64
{6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Debug|x64.Build.0 = Debug|x64
{6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Debug|x86.ActiveCfg = Debug|Win32
{6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Debug|x86.Build.0 = Debug|Win32
{6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Release|x64.ActiveCfg = Release|x64
{6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Release|x64.Build.0 = Release|x64
{6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Release|x86.ActiveCfg = Release|Win32
{6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Release|x86.Build.0 = Release|Win32
{3C4A8151-48D1-4518-BE1A-24016A5B800F}.Debug|x64.ActiveCfg = Debug|x64
{3C4A8151-48D1-4518-BE1A-24016A5B800F}.Debug|x64.Build.0 = Debug|x64
{3C4A8151-48D1-4518-BE1A-24016A5B800F}.Debug|x86.ActiveCfg = Debug|Win32
{3C4A8151-48D1-4518-BE1A-24016A5B800F}.Debug|x86.Build.0 = Debug|Win32
{3C4A8151-48D1-4518-BE1A-24016A5B800F}.Release|x64.ActiveCfg = Release|x64
{3C4A8151-48D1-4518-BE1A-24016A5B800F}.Release|x64.Build.0 = Release|x64
{3C4A8151-48D1-4518-BE1A-24016A5B800F}.Release|x86.ActiveCfg = Release|Win32
{3C4A8151-48D1-4518-BE1A-24016A5B800F}.Release|x86.Build.0 = Release|Win32
{B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Debug|x64.ActiveCfg = Debug|x64
{B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Debug|x64.Build.0 = Debug|x64
{B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Debug|x86.ActiveCfg = Debug|Win32
{B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Debug|x86.Build.0 = Debug|Win32
{B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Release|x64.ActiveCfg = Release|x64
{B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Release|x64.Build.0 = Release|x64
{B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Release|x86.ActiveCfg = Release|Win32
{B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Release|x86.Build.0 = Release|Win32
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x64.ActiveCfg = Debug|x64
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x64.Build.0 = Debug|x64
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x86.ActiveCfg = Debug|Win32
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x86.Build.0 = Debug|Win32
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x64.ActiveCfg = Release|x64
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x64.Build.0 = Release|x64
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x86.ActiveCfg = Release|Win32
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {DCE19FF1-37C0-49CD-915A-DD695E15F00B}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,655 @@
set(PROJECT_NAME libultraship)
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
enable_language(OBJCXX)
#set(CMAKE_OBJCXX_FLAGS "-Wno-deprecated-declarations -ObjC++")
endif()
################################################################################
# Source groups
################################################################################
set(Header_Files__Resources__Factories
"Factories/AnimationFactory.h"
"Factories/ArrayFactory.h"
"Factories/AudioFactory.h"
"Factories/BlobFactory.h"
"Factories/CollisionHeaderFactory.h"
"Factories/CutsceneFactory.h"
"Factories/DisplayListFactory.h"
"Factories/MaterialFactory.h"
"Factories/MtxFactory.h"
"Factories/PathFactory.h"
"Factories/PlayerAnimationFactory.h"
"Factories/ResourceLoader.h"
"Factories/SceneFactory.h"
"Factories/SkeletonFactory.h"
"Factories/SkeletonLimbFactory.h"
"Factories/TextFactory.h"
"Factories/TextureFactory.h"
"Factories/VtxFactory.h"
)
source_group("Header Files\\Resources\\Factories" FILES ${Header_Files__Resources__Factories})
set(Header_Files__Resources__Files
"Animation.h"
"Array.h"
"Audio.h"
"Blob.h"
"CollisionHeader.h"
"Cutscene.h"
"DisplayList.h"
"Material.h"
"Matrix.h"
"Model.h"
"Path.h"
"PlayerAnimation.h"
"Scene.h"
"Skeleton.h"
"SkeletonLimb.h"
"Text.h"
"Texture.h"
"Vertex.h"
)
source_group("Header Files\\Resources\\Files" FILES ${Header_Files__Resources__Files})
set(Source_Files__Audio
"abi.h"
"AudioPlayer.h"
"mixer.c"
"mixer.h"
"SDLAudioPlayer.cpp"
"SDLAudioPlayer.h"
)
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(Source_Files__Audio__extra
"WasapiAudioPlayer.cpp"
"WasapiAudioPlayer.h"
)
else()
set(Source_Files__Audio__extra
"PulseAudioPlayer.cpp"
"PulseAudioPlayer.h"
)
endif ()
source_group("Source Files\\Audio" FILES ${Source_Files__Audio} ${Source_Files__Audio__extra})
set(Source_Files__Controller
"ControlDeck.cpp"
"ControlDeck.h"
"Controller.cpp"
"Controller.h"
"ControllerAttachment.cpp"
"ControllerAttachment.h"
"InputEditor.cpp"
"InputEditor.h"
"KeyboardController.cpp"
"KeyboardController.h"
"SDLController.cpp"
"SDLController.h"
"UltraController.h"
"VirtualController.h"
)
source_group("Source Files\\Controller" FILES ${Source_Files__Controller})
set(Source_Files__Controller__Attachment
"ControllerAttachment.cpp"
"ControllerAttachment.h"
"MemoryPack.cpp"
"MemoryPack.h"
"RumblePack.cpp"
"RumblePack.h"
)
source_group("Source Files\\Controller\\Attachment" FILES ${Source_Files__Controller__Attachment})
set(Source_Files__CustomImpl
"GameOverlay.cpp"
"GameOverlay.h"
"Console.cpp"
"Console.h"
"ImGuiImpl.cpp"
"ImGuiImpl.h"
)
source_group("Source Files\\CustomImpl" FILES ${Source_Files__CustomImpl})
set(Source_Files__CustomImpl__Hooks
"Hooks.h"
)
source_group("Source Files\\CustomImpl\\Hooks" FILES ${Source_Files__CustomImpl__Hooks})
set(Source_Files__CustomImpl__Utils
"Utils.cpp"
"Utils.h"
)
source_group("Source Files\\CustomImpl\\Utils" FILES ${Source_Files__CustomImpl__Utils})
set(Source_Files__Globals
"Cvar.cpp"
"Cvar.h"
"GlobalCtx2.cpp"
"GlobalCtx2.h"
"LUSMacros.h"
"Window.cpp"
"Window.h"
"WindowShim.cpp"
"WindowShim.h"
)
source_group("Source Files\\Globals" FILES ${Source_Files__Globals})
set(Source_Files__Lib
"Lib/mINI/src/mini/ini.h"
"Lib/StrHash64.cpp"
"Lib/StrHash64.h"
"Lib/tinyxml2/tinyxml2.cpp"
"stox.cpp"
"stox.h"
)
source_group("Source Files\\Lib" FILES ${Source_Files__Lib})
set(Source_Files__Lib__Fast3D
"Lib/Fast3D/gfx_cc.cpp"
"Lib/Fast3D/gfx_cc.h"
"Lib/Fast3D/gfx_opengl.cpp"
"Lib/Fast3D/gfx_opengl.h"
"Lib/Fast3D/gfx_pc.cpp"
"Lib/Fast3D/gfx_pc.h"
"Lib/Fast3D/gfx_rendering_api.h"
"Lib/Fast3D/gfx_screen_config.h"
"Lib/Fast3D/gfx_sdl.h"
"Lib/Fast3D/gfx_sdl2.cpp"
"Lib/Fast3D/gfx_window_manager_api.h"
)
source_group("Source Files\\Lib\\Fast3D" FILES ${Source_Files__Lib__Fast3D})
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(Source_Files__Lib__Fast3D__extra
"Lib/Fast3D/gfx_direct3d11.cpp"
"Lib/Fast3D/gfx_direct3d11.h"
"Lib/Fast3D/gfx_direct3d12.cpp"
"Lib/Fast3D/gfx_direct3d12.h"
"Lib/Fast3D/gfx_direct3d12_guids.h"
"Lib/Fast3D/gfx_direct3d_common.cpp"
"Lib/Fast3D/gfx_direct3d_common.h"
"Lib/Fast3D/gfx_dxgi.cpp"
"Lib/Fast3D/gfx_dxgi.h"
)
elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(Source_Files__Lib__Fast3D__extra
"Lib/Fast3D/gfx_glx.cpp"
"Lib/Fast3D/gfx_glx.h"
)
endif()
source_group("Source Files\\Lib\\Fast3D\\extra" FILES ${Source_Files__Lib__Fast3D__extra})
set(Source_Files__Lib__ImGui
"Lib/ImGui/backends/imgui_impl_opengl3.cpp"
"Lib/ImGui/backends/imgui_impl_opengl3.h"
"Lib/ImGui/backends/imgui_impl_sdl.cpp"
"Lib/ImGui/backends/imgui_impl_sdl.h"
"Lib/ImGui/imconfig.h"
"Lib/ImGui/imgui.cpp"
"Lib/ImGui/imgui.h"
"Lib/ImGui/imgui_demo.cpp"
"Lib/ImGui/imgui_draw.cpp"
"Lib/ImGui/imgui_internal.h"
"Lib/ImGui/imgui_tables.cpp"
"Lib/ImGui/imgui_widgets.cpp"
"Lib/ImGui/imstb_rectpack.h"
"Lib/ImGui/imstb_textedit.h"
"Lib/ImGui/imstb_truetype.h"
)
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(Source_Files__Lib__ImGui__Windows
"Lib/ImGui/backends/imgui_impl_dx11.cpp"
"Lib/ImGui/backends/imgui_impl_dx11.h"
"Lib/ImGui/backends/imgui_impl_win32.cpp"
"Lib/ImGui/backends/imgui_impl_win32.h"
)
endif ()
source_group("Source Files\\Lib\\ImGui" FILES ${Source_Files__Lib__ImGui} ${Source_Files__Lib__ImGui__Windows})
set(Source_Files__Lib__Mercury
"Lib/Mercury/Mercury.cpp"
"Lib/Mercury/Mercury.h"
)
source_group("Source Files\\Lib\\Mercury" FILES ${Source_Files__Lib__Mercury})
set(Source_Files__Lib__stb
"Lib/stb/stb_image.h"
"Lib/stb/stb_image_write.h"
"Lib/stb/stb_impl.c"
)
source_group("Source Files\\Lib\\stb" FILES ${Source_Files__Lib__stb})
set(Source_Files__Lib__dr_libs
"Lib/dr_libs/mp3.h"
"Lib/dr_libs/wav.h"
)
source_group("Source Files\\Lib\\dr_libs" FILES ${Source_Files__Lib__dr_libs})
set(Source_Files__Lib__tinyxml2
"Lib/tinyxml2/tinyxml2.h"
)
source_group("Source Files\\Lib\\tinyxml2" FILES ${Source_Files__Lib__tinyxml2})
set(Source_Files__Logging
"luslog.cpp"
"luslog.h"
)
source_group("Source Files\\Logging" FILES ${Source_Files__Logging})
set(Source_Files__Resources
"GameVersions.h"
"Resource.cpp"
"Resource.h"
"ResourceMgr.cpp"
"ResourceMgr.h"
)
source_group("Source Files\\Resources" FILES ${Source_Files__Resources})
set(Source_Files__Resources__Factories
"Factories/AnimationFactory.cpp"
"Factories/ArrayFactory.cpp"
"Factories/AudioFactory.cpp"
"Factories/BlobFactory.cpp"
"Factories/CollisionHeaderFactory.cpp"
"Factories/CutsceneFactory.cpp"
"Factories/DisplayListFactory.cpp"
"Factories/MaterialFactory.cpp"
"Factories/MtxFactory.cpp"
"Factories/PathFactory.cpp"
"Factories/PlayerAnimationFactory.cpp"
"Factories/ResourceLoader.cpp"
"Factories/SceneFactory.cpp"
"Factories/SkeletonFactory.cpp"
"Factories/SkeletonLimbFactory.cpp"
"Factories/TextFactory.cpp"
"Factories/TextureFactory.cpp"
"Factories/VtxFactory.cpp"
)
source_group("Source Files\\Resources\\Factories" FILES ${Source_Files__Resources__Factories})
set(Source_Files__Resources__Files
"Animation.cpp"
"Array.cpp"
"Audio.cpp"
"Blob.cpp"
"CollisionHeader.cpp"
"Cutscene.cpp"
"DisplayList.cpp"
"Material.cpp"
"Matrix.cpp"
"Model.cpp"
"Path.cpp"
"PlayerAnimation.cpp"
"Scene.cpp"
"Skeleton.cpp"
"SkeletonLimb.cpp"
"Text.cpp"
"Texture.cpp"
"Vertex.cpp"
)
source_group("Source Files\\Resources\\Files" FILES ${Source_Files__Resources__Files})
set(Source_Files__Resources__mpq
"Archive.cpp"
"Archive.h"
"File.cpp"
"File.h"
)
source_group("Source Files\\Resources\\mpq" FILES ${Source_Files__Resources__mpq})
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(Source_Files__Darwin
"OSXFolderManager.mm"
"OSXFolderManager.h"
)
source_group("Source Files\\Darwin" FILES ${Source_Files__Darwin})
endif()
if (CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch")
set(Source_Files__NintendoSwitch
"SwitchImpl.cpp"
"SwitchImpl.h"
)
source_group("Source Files\\NintendoSwitch" FILES ${Source_Files__NintendoSwitch})
endif()
set(ALL_FILES
${Header_Files__Resources__Factories}
${Header_Files__Resources__Files}
${Source_Files__Audio}
${Source_Files__Audio__extra}
${Source_Files__Controller}
${Source_Files__Controller__Attachment}
${Source_Files__CustomImpl}
${Source_Files__CustomImpl__Hooks}
${Source_Files__CustomImpl__Utils}
${Source_Files__Globals}
${Source_Files__Lib}
${Source_Files__Lib__Fast3D}
${Source_Files__Lib__Fast3D__extra}
${Source_Files__Lib__ImGui}
${Source_Files__Lib__ImGui__Windows}
${Source_Files__Lib__Mercury}
${Source_Files__Lib__stb}
${Source_Files__Lib__dr_libs}
${Source_Files__Lib__tinyxml2}
${Source_Files__Logging}
${Source_Files__Resources}
${Source_Files__Resources__Factories}
${Source_Files__Resources__Files}
${Source_Files__Resources__mpq}
${Source_Files__Darwin}
${Source_Files__NintendoSwitch}
)
################################################################################
# Target
################################################################################
add_library(${PROJECT_NAME} STATIC ${ALL_FILES})
if (NOT TARGET storm)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../StormLib ${CMAKE_BINARY_DIR}/StormLib EXCLUDE_FROM_ALL)
endif()
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
use_props(${PROJECT_NAME} "${CMAKE_CONFIGURATION_TYPES}" "${DEFAULT_CXX_PROPS}")
endif()
set(ROOT_NAMESPACE libultraship)
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
set_target_properties(${PROJECT_NAME} PROPERTIES
VS_GLOBAL_KEYWORD "Win32Proj"
)
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
set_target_properties(${PROJECT_NAME} PROPERTIES
INTERPROCEDURAL_OPTIMIZATION_RELEASE "TRUE"
)
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
set_target_properties(${PROJECT_NAME} PROPERTIES
INTERPROCEDURAL_OPTIMIZATION_RELEASE "TRUE"
)
endif()
endif()
################################################################################
# MSVC runtime library
################################################################################
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
get_property(MSVC_RUNTIME_LIBRARY_DEFAULT TARGET ${PROJECT_NAME} PROPERTY MSVC_RUNTIME_LIBRARY)
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
string(CONCAT "MSVC_RUNTIME_LIBRARY_STR"
$<$<CONFIG:Debug>:
MultiThreadedDebug
>
$<$<CONFIG:Release>:
MultiThreaded
>
$<$<NOT:$<OR:$<CONFIG:Debug>,$<CONFIG:Release>>>:${MSVC_RUNTIME_LIBRARY_DEFAULT}>
)
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
string(CONCAT "MSVC_RUNTIME_LIBRARY_STR"
$<$<CONFIG:Debug>:
MultiThreadedDebug
>
$<$<CONFIG:Release>:
MultiThreaded
>
$<$<NOT:$<OR:$<CONFIG:Debug>,$<CONFIG:Release>>>:${MSVC_RUNTIME_LIBRARY_DEFAULT}>
)
endif()
set_target_properties(${PROJECT_NAME} PROPERTIES MSVC_RUNTIME_LIBRARY ${MSVC_RUNTIME_LIBRARY_STR})
endif()
################################################################################
# Compile definitions
################################################################################
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
target_compile_definitions(${PROJECT_NAME} PRIVATE
"$<$<CONFIG:Debug>:"
"_DEBUG"
">"
"$<$<CONFIG:Release>:"
"NDEBUG"
">"
"SPDLOG_ACTIVE_LEVEL=0;"
"WIN32;"
"_CONSOLE;"
"_CRT_SECURE_NO_WARNINGS;"
"ENABLE_DX11;"
"ENABLE_OPENGL;"
"%(PreprocessorDefinitions)GLEW_STATIC;"
"UNICODE;"
"_UNICODE"
STORMLIB_NO_AUTO_LINK
)
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
target_compile_definitions(${PROJECT_NAME} PRIVATE
"$<$<CONFIG:Debug>:"
"_DEBUG"
">"
"$<$<CONFIG:Release>:"
"NDEBUG"
">"
"SPDLOG_ACTIVE_LEVEL=0;"
"WIN32;"
"_CONSOLE;"
"_CRT_SECURE_NO_WARNINGS;"
"ENABLE_OPENGL;"
"ENABLE_DX11;"
"%(PreprocessorDefinitions)GLEW_STATIC;"
"UNICODE;"
"_UNICODE"
STORMLIB_NO_AUTO_LINK
)
endif()
endif()
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU|Clang|AppleClang")
target_compile_definitions(${PROJECT_NAME} PRIVATE
"$<$<CONFIG:Debug>:"
"_DEBUG"
">"
"$<$<CONFIG:Release>:"
"NDEBUG"
">"
"ENABLE_OPENGL;"
)
endif()
################################################################################
# Compile and link options
################################################################################
if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows|NintendoSwitch")
find_package(SDL2)
find_package(GLEW)
find_package(X11)
if (NOT GLEW_FOUND)
if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows|Darwin")
include (FetchContent)
FetchContent_Declare(
glew
GIT_REPOSITORY https://github.com/Perlmint/glew-cmake.git
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../external/glew
)
FetchContent_MakeAvailable(glew)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../external/glew/build/cmake ${CMAKE_BINARY_DIR}/glew EXCLUDE_FROM_ALL)
endif()
endif()
if (NOT GLEW_FOUND)
set(GLEW-INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/../../external/glew/include)
else()
set(GLEW-INCLUDE ${GLEW_INCLUDE_DIRS})
endif()
set(SDL2-INCLUDE ${SDL2_INCLUDE_DIRS})
elseif (CMAKE_SYSTEM_NAME MATCHES "NintendoSwitch")
find_package(SDL2)
else()
set(GLEW-INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/Lib/GLEW/)
set(SDL2-INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/Lib/SDL/)
endif()
target_include_directories(${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/Lib/spdlog/include/
${CMAKE_CURRENT_SOURCE_DIR}/Lib/Fast3D/U64/
${CMAKE_CURRENT_SOURCE_DIR}/Lib/Fast3D/U64/PR
${SDL2-INCLUDE}
${GLEW-INCLUDE}
${SWITCH-INCLUDE}
${CMAKE_CURRENT_SOURCE_DIR}/Lib/ImGui/
${CMAKE_CURRENT_SOURCE_DIR}/../../ZAPDTR/ZAPDUtils
${CMAKE_CURRENT_SOURCE_DIR}/../../StormLib/src
.
)
if(MSVC)
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
target_compile_options(${PROJECT_NAME} PRIVATE
$<$<CONFIG:Release>:
/std:c++latest;
/Oi;
/Gy
>
/permissive-;
/MP;
/sdl;
/W3;
${DEFAULT_CXX_DEBUG_INFORMATION_FORMAT};
${DEFAULT_CXX_EXCEPTION_HANDLING}
)
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
target_compile_options(${PROJECT_NAME} PRIVATE
$<$<CONFIG:Debug>:
/Od;
/Oi-;
/W2
>
$<$<CONFIG:Release>:
/Oi;
/Gy;
/W3
>
/permissive-;
/MP;
/sdl;
${DEFAULT_CXX_DEBUG_INFORMATION_FORMAT};
${DEFAULT_CXX_EXCEPTION_HANDLING}
)
endif()
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
target_link_options(${PROJECT_NAME} PRIVATE
$<$<CONFIG:Release>:
/OPT:REF;
/OPT:ICF
>
/SUBSYSTEM:CONSOLE
)
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
target_link_options(${PROJECT_NAME} PRIVATE
$<$<CONFIG:Release>:
/OPT:REF;
/OPT:ICF
>
/SUBSYSTEM:CONSOLE
)
endif()
endif()
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
target_compile_options(${PROJECT_NAME} PRIVATE
-Wall
-Wextra
-Wno-error
-Wno-unused-variable
-Wno-unused-parameter
-Wno-unused-function
-Wno-parentheses
-Wno-narrowing
-Wno-missing-field-initializers
)
endif()
################################################################################
# Dependencies
################################################################################
# Link with other targets.
find_package(OpenGL QUIET)
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
find_package(X11)
find_package(PulseAudio)
endif()
if (NOT GLEW_FOUND)
set(GLEW-LIB glew_s)
else()
set(GLEW-LIB GLEW::GLEW)
endif()
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
target_link_libraries(${PROJECT_NAME}
"glew32s;"
"opengl32;"
"storm;"
)
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
target_link_libraries(${PROJECT_NAME}
"glew32s;"
"opengl32;"
"storm;"
)
endif()
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
find_package(SDL2)
find_package(GLEW)
find_package(OpenGL QUIET)
find_Library(OSX_FOUNDATION Foundation)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
target_link_libraries(${PROJECT_NAME}
"storm;"
SDL2::SDL2
GLEW::GLEW
${OPENGL_opengl_LIBRARY}
${CMAKE_DL_LIBS}
Threads::Threads
${OSX_FOUNDATION}
)
elseif(CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch")
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
target_link_libraries(${PROJECT_NAME}
storm
SDL2::SDL2
Threads::Threads
)
else()
target_link_libraries(${PROJECT_NAME}
SDL2::SDL2
${PULSEAUDIO_LIBRARY}
${GLEW-LIB}
${OPENGL_glx_LIBRARY}
${OPENGL_opengl_LIBRARY}
${X11_LIBRARIES}
storm
)
endif()
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
add_library(glew32s STATIC IMPORTED )
set_property(TARGET glew32s PROPERTY
IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/Lib/GLEW/x64/glew32s.lib )
set_property(TARGET glew32s PROPERTY
IMPORTED_IMPLIB ${CMAKE_CURRENT_SOURCE_DIR}/Lib/GLEW/x64/glew32s.lib)
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
add_library(glew32s STATIC IMPORTED )
set_property(TARGET glew32s PROPERTY
IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/Lib/GLEW/x86/glew32s.lib )
set_property(TARGET glew32s PROPERTY
IMPORTED_IMPLIB ${CMAKE_CURRENT_SOURCE_DIR}/Lib/GLEW/x86/glew32s.lib)
endif()
endif()

View File

@ -29,7 +29,7 @@
#define GL_GLEXT_PROTOTYPES 1
#include "SDL_opengl.h"
#elif __APPLE__
#include <SDL.h>
#include <SDL2/SDL.h>
#include <GL/glew.h>
#elif __SWITCH__
#include <SDL2/SDL.h>

View File

@ -1,10 +1,6 @@
#pragma once
#include "AudioPlayer.h"
#if __APPLE__
#include <SDL.h>
#else
#include <SDL2/SDL.h>
#endif
namespace Ship {
class SDLAudioPlayer : public AudioPlayer {

View File

@ -1,10 +1,6 @@
#pragma once
#include "Controller.h"
#if __APPLE__
#include <SDL.h>
#else
#include <SDL2/SDL.h>
#endif
namespace Ship {
class SDLController : public Controller {

View File

@ -15,11 +15,7 @@
#include "Lib/Fast3D/gfx_pc.h"
#include "Lib/Fast3D/gfx_sdl.h"
#include "Lib/Fast3D/gfx_opengl.h"
#if __APPLE__
#include <SDL.h>
#else
#include <SDL2/SDL.h>
#endif
#include <string>
#include <chrono>
#include "Console.h"

View File

@ -1,447 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Testing|Win32">
<Configuration>Testing</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Testing|x64">
<Configuration>Testing</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{6da9b521-65b7-41e2-8f8a-f0451cc18ed8}</ProjectGuid>
<RootNamespace>libultraship</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>libultraship</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Testing|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Testing|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Testing|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Testing|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(ProjectDir)..\..\ZAPDTR\ZAPDUtils;$(ProjectDir)Lib\Fast3D\U64;$(ProjectDir)Lib\ImGui;$(ProjectDir)Lib\libjpeg\include;$(ProjectDir)Lib\spdlog\include;$(ProjectDir)Lib\SDL;$(ProjectDir)Lib\GLEW;$(ProjectDir)..\..\StormLib\src\;$(IncludePath)</IncludePath>
<LibraryPath>$(ProjectDir)Lib\SDL\lib\x86;$(LibraryPath)</LibraryPath>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules />
<CodeAnalysisRuleAssemblies />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Testing|Win32'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(ProjectDir)..\..\ZAPDTR\ZAPDUtils;$(ProjectDir)Lib\Fast3D\U64;$(ProjectDir)Lib\ImGui;$(ProjectDir)Lib\libjpeg\include;$(ProjectDir)Lib\spdlog\include;$(ProjectDir)Lib\SDL;$(ProjectDir)Lib\GLEW;$(IncludePath)</IncludePath>
<LibraryPath>$(ProjectDir)Lib\SDL\lib\x86;$(LibraryPath)</LibraryPath>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules />
<CodeAnalysisRuleAssemblies />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(ProjectDir)..\..\ZAPDTR\ZAPDUtils;$(ProjectDir)Lib\Fast3D\U64;$(ProjectDir)Lib\ImGui;$(ProjectDir)Lib\spdlog\include;$(ProjectDir)Lib\SDL;$(ProjectDir)Lib\GLEW;$(ProjectDir)..\..\StormLib\src\;$(IncludePath)</IncludePath>
<LibraryPath>$(ProjectDir)Lib\SDL\lib\x86;$(LibraryPath)</LibraryPath>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules />
<CodeAnalysisRuleAssemblies />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(ProjectDir)..\..\ZAPDTR\ZAPDUtils;$(ProjectDir)Lib\Fast3D\U64;$(ProjectDir)Lib\ImGui;$(ProjectDir)Lib\spdlog\include;$(ProjectDir)Lib\SDL;$(ProjectDir)Lib\GLEW;$(ProjectDir)..\..\StormLib\src\;$(IncludePath)</IncludePath>
<LibraryPath>$(ProjectDir)Lib\SDL\lib\x64;$(LibraryPath)</LibraryPath>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules />
<CodeAnalysisRuleAssemblies />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Testing|x64'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(ProjectDir)..\..\ZAPDTR\ZAPDUtils;$(ProjectDir)Lib\Fast3D\U64;$(ProjectDir)Lib\ImGui;$(ProjectDir)Lib\spdlog\include;$(ProjectDir)Lib\SDL;$(ProjectDir)Lib\GLEW;$(IncludePath)</IncludePath>
<LibraryPath>$(ProjectDir)Lib\SDL\lib\x64;$(LibraryPath)</LibraryPath>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules />
<CodeAnalysisRuleAssemblies />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(ProjectDir)..\..\ZAPDTR\ZAPDUtils;$(ProjectDir)Lib\Fast3D\U64;$(ProjectDir)Lib\ImGui;$(ProjectDir)Lib\spdlog\include;$(ProjectDir)Lib\SDL;$(ProjectDir)Lib\GLEW;$(ProjectDir)..\..\StormLib\src\;$(IncludePath)</IncludePath>
<LibraryPath>$(ProjectDir)Lib\SDL\lib\x64;$(LibraryPath)</LibraryPath>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules />
<CodeAnalysisRuleAssemblies />
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level2</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>SPDLOG_ACTIVE_LEVEL=0;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;ENABLE_OPENGL;ENABLE_DX11;%(PreprocessorDefinitions)GLEW_STATIC </PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp20</LanguageStandard>
<LanguageStandard_C>stdc17</LanguageStandard_C>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<Optimization>Disabled</Optimization>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<IntrinsicFunctions>false</IntrinsicFunctions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Testing|Win32'">
<ClCompile>
<WarningLevel>Level2</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>SPDLOG_ACTIVE_LEVEL=0;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;ENABLE_OPENGL;%(PreprocessorDefinitions)GLEW_STATIC </PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp20</LanguageStandard>
<LanguageStandard_C>stdc17</LanguageStandard_C>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>SPDLOG_ACTIVE_LEVEL=0;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;ENABLE_OPENGL;ENABLE_DX11;%(PreprocessorDefinitions)GLEW_STATIC </PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp20</LanguageStandard>
<LanguageStandard_C>stdc17</LanguageStandard_C>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>SPDLOG_ACTIVE_LEVEL=0;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;ENABLE_OPENGL;ENABLE_DX11;%(PreprocessorDefinitions)GLEW_STATIC </PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp20</LanguageStandard>
<LanguageStandard_C>stdc17</LanguageStandard_C>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Testing|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>SPDLOG_ACTIVE_LEVEL=0;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;ENABLE_OPENGL;%(PreprocessorDefinitions)GLEW_STATIC </PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp20</LanguageStandard>
<LanguageStandard_C>stdc17</LanguageStandard_C>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>SPDLOG_ACTIVE_LEVEL=0;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;ENABLE_OPENGL;ENABLE_DX11;%(PreprocessorDefinitions)GLEW_STATIC</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpplatest</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="Audio.cpp" />
<ClCompile Include="Blob.cpp" />
<ClCompile Include="ControlDeck.cpp" />
<ClCompile Include="Cvar.cpp" />
<ClCompile Include="Factories\AudioFactory.cpp" />
<ClCompile Include="InputEditor.cpp" />
<ClCompile Include="GameOverlay.cpp" />
<ClCompile Include="Lib\ImGui\backends\imgui_impl_dx11.cpp" />
<ClCompile Include="Lib\ImGui\backends\imgui_impl_win32.cpp" />
<ClCompile Include="Lib\Mercury\Mercury.cpp" />
<ClCompile Include="luslog.cpp" />
<ClCompile Include="mixer.c" />
<ClCompile Include="SDLAudioPlayer.cpp" />
<ClCompile Include="Console.cpp" />
<ClCompile Include="Factories\AnimationFactory.cpp" />
<ClCompile Include="Factories\ArrayFactory.cpp" />
<ClCompile Include="Factories\BlobFactory.cpp" />
<ClCompile Include="Factories\CutsceneFactory.cpp" />
<ClCompile Include="Factories\MtxFactory.cpp" />
<ClCompile Include="Factories\PathFactory.cpp" />
<ClCompile Include="Animation.cpp" />
<ClCompile Include="Factories\TextFactory.cpp" />
<ClCompile Include="Factories\TextureFactory.cpp" />
<ClCompile Include="Factories\VtxFactory.cpp" />
<ClCompile Include="Array.cpp" />
<ClCompile Include="Controller.cpp" />
<ClCompile Include="ImGuiImpl.cpp" />
<ClCompile Include="KeyboardController.cpp" />
<ClCompile Include="Factories\CollisionHeaderFactory.cpp" />
<ClCompile Include="Factories\DisplayListFactory.cpp" />
<ClCompile Include="Factories\MaterialFactory.cpp" />
<ClCompile Include="Factories\PlayerAnimationFactory.cpp" />
<ClCompile Include="Factories\ResourceLoader.cpp" />
<ClCompile Include="Factories\SceneFactory.cpp" />
<ClCompile Include="Factories\SkeletonFactory.cpp" />
<ClCompile Include="Factories\SkeletonLimbFactory.cpp" />
<ClCompile Include="Lib\Fast3D\gfx_cc.cpp" />
<ClCompile Include="Lib\Fast3D\gfx_direct3d11.cpp" />
<ClCompile Include="Lib\Fast3D\gfx_direct3d12.cpp" />
<ClCompile Include="Lib\Fast3D\gfx_direct3d_common.cpp" />
<ClCompile Include="Lib\Fast3D\gfx_dxgi.cpp" />
<ClCompile Include="Lib\Fast3D\gfx_glx.cpp" />
<ClCompile Include="Lib\Fast3D\gfx_opengl.cpp" />
<ClCompile Include="Lib\Fast3D\gfx_pc.cpp" />
<ClCompile Include="Lib\Fast3D\gfx_sdl2.cpp" />
<ClCompile Include="Lib\ImGui\backends\imgui_impl_opengl3.cpp" />
<ClCompile Include="Lib\ImGui\backends\imgui_impl_sdl.cpp" />
<ClCompile Include="Lib\ImGui\imgui.cpp" />
<ClCompile Include="Lib\ImGui\imgui_demo.cpp" />
<ClCompile Include="Lib\ImGui\imgui_draw.cpp" />
<ClCompile Include="Lib\ImGui\imgui_tables.cpp" />
<ClCompile Include="Lib\ImGui\imgui_widgets.cpp" />
<ClCompile Include="Lib\stb\stb_impl.c" />
<ClCompile Include="Lib\StrHash64.cpp" />
<ClCompile Include="Lib\tinyxml2\tinyxml2.cpp" />
<ClCompile Include="Archive.cpp" />
<ClCompile Include="CollisionHeader.cpp" />
<ClCompile Include="ControllerAttachment.cpp" />
<ClCompile Include="Cutscene.cpp" />
<ClCompile Include="DisplayList.cpp" />
<ClCompile Include="GlobalCtx2.cpp" />
<ClCompile Include="File.cpp" />
<ClCompile Include="Material.cpp" />
<ClCompile Include="Matrix.cpp" />
<ClCompile Include="MemoryPack.cpp" />
<ClCompile Include="Model.cpp" />
<ClCompile Include="Path.cpp" />
<ClCompile Include="PlayerAnimation.cpp" />
<ClCompile Include="Resource.cpp" />
<ClCompile Include="ResourceMgr.cpp" />
<ClCompile Include="RumblePack.cpp" />
<ClCompile Include="Scene.cpp" />
<ClCompile Include="Skeleton.cpp" />
<ClCompile Include="SkeletonLimb.cpp" />
<ClCompile Include="Text.cpp" />
<ClCompile Include="Texture.cpp" />
<ClCompile Include="Utils.cpp" />
<ClCompile Include="Vertex.cpp" />
<ClCompile Include="WasapiAudioPlayer.cpp" />
<ClCompile Include="Window.cpp" />
<ClCompile Include="WindowShim.cpp" />
<ClCompile Include="stox.cpp" />
<ClCompile Include="SDLController.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="VirtualController.h" />
<ClInclude Include="Lib\Mercury\Mercury.h" />
<ClInclude Include="Lib\nlohmann\json.hpp" />
<ClInclude Include="abi.h" />
<ClInclude Include="Audio.h" />
<ClInclude Include="AudioPlayer.h" />
<ClInclude Include="Blob.h" />
<ClInclude Include="color.h" />
<ClInclude Include="ControlDeck.h" />
<ClInclude Include="Cvar.h" />
<ClInclude Include="Factories\AudioFactory.h" />
<ClInclude Include="InputEditor.h" />
<ClInclude Include="GameOverlay.h" />
<ClInclude Include="GameVersions.h" />
<ClInclude Include="Lib\dr_libs\mp3.h" />
<ClInclude Include="Lib\dr_libs\wav.h" />
<ClInclude Include="Lib\ImGui\backends\imgui_impl_dx11.h" />
<ClInclude Include="Lib\ImGui\backends\imgui_impl_win32.h" />
<ClInclude Include="Lib\stb\stb_image_write.h" />
<ClInclude Include="luslog.h" />
<ClInclude Include="mixer.h" />
<ClInclude Include="SDLAudioPlayer.h" />
<ClInclude Include="Console.h" />
<ClInclude Include="Factories\ArrayFactory.h" />
<ClInclude Include="Factories\BlobFactory.h" />
<ClInclude Include="Factories\CutsceneFactory.h" />
<ClInclude Include="Factories\AnimationFactory.h" />
<ClInclude Include="Factories\MtxFactory.h" />
<ClInclude Include="Factories\PathFactory.h" />
<ClInclude Include="Factories\TextFactory.h" />
<ClInclude Include="Factories\TextureFactory.h" />
<ClInclude Include="Factories\VtxFactory.h" />
<ClInclude Include="Animation.h" />
<ClInclude Include="Array.h" />
<ClInclude Include="Cutscene.h" />
<ClInclude Include="Hooks.h" />
<ClInclude Include="ImGuiImpl.h" />
<ClInclude Include="Lib\Fast3D\gfx_cc.h" />
<ClInclude Include="Lib\Fast3D\gfx_direct3d11.h" />
<ClInclude Include="Lib\Fast3D\gfx_direct3d12.h" />
<ClInclude Include="Lib\Fast3D\gfx_direct3d12_guids.h" />
<ClInclude Include="Lib\Fast3D\gfx_direct3d_common.h" />
<ClInclude Include="Lib\Fast3D\gfx_dxgi.h" />
<ClInclude Include="Lib\Fast3D\gfx_glx.h" />
<ClInclude Include="Lib\Fast3D\gfx_rendering_api.h" />
<ClInclude Include="Lib\Fast3D\gfx_screen_config.h" />
<ClInclude Include="Lib\Fast3D\gfx_window_manager_api.h" />
<ClInclude Include="Lib\ImGui\backends\imgui_impl_opengl3.h" />
<ClInclude Include="Lib\ImGui\backends\imgui_impl_sdl.h" />
<ClInclude Include="Lib\ImGui\imconfig.h" />
<ClInclude Include="Lib\ImGui\imgui.h" />
<ClInclude Include="Lib\ImGui\imgui_internal.h" />
<ClInclude Include="Lib\ImGui\imstb_rectpack.h" />
<ClInclude Include="Lib\ImGui\imstb_textedit.h" />
<ClInclude Include="Lib\ImGui\imstb_truetype.h" />
<ClInclude Include="Lib\stb\stb_image.h" />
<ClInclude Include="Matrix.h" />
<ClInclude Include="Path.h" />
<ClInclude Include="Text.h" />
<ClInclude Include="Utils.h" />
<ClInclude Include="Vertex.h" />
<ClInclude Include="stox.h" />
<ClInclude Include="Lib\mINI\src\mini\ini.h" />
<ClInclude Include="Controller.h" />
<ClInclude Include="KeyboardController.h" />
<ClInclude Include="Factories\CollisionHeaderFactory.h" />
<ClInclude Include="Factories\DisplayListFactory.h" />
<ClInclude Include="Factories\MaterialFactory.h" />
<ClInclude Include="Factories\PlayerAnimationFactory.h" />
<ClInclude Include="Factories\ResourceLoader.h" />
<ClInclude Include="Factories\SceneFactory.h" />
<ClInclude Include="Factories\SkeletonFactory.h" />
<ClInclude Include="Factories\SkeletonLimbFactory.h" />
<ClInclude Include="Lib\Fast3D\gfx_opengl.h" />
<ClInclude Include="Lib\Fast3D\gfx_pc.h" />
<ClInclude Include="Lib\Fast3D\gfx_sdl.h" />
<ClInclude Include="Lib\StrHash64.h" />
<ClInclude Include="Lib\tinyxml2\tinyxml2.h" />
<ClInclude Include="Archive.h" />
<ClInclude Include="CollisionHeader.h" />
<ClInclude Include="ControllerAttachment.h" />
<ClInclude Include="DisplayList.h" />
<ClInclude Include="GlobalCtx2.h" />
<ClInclude Include="File.h" />
<ClInclude Include="LUSMacros.h" />
<ClInclude Include="Material.h" />
<ClInclude Include="MemoryPack.h" />
<ClInclude Include="Model.h" />
<ClInclude Include="PlayerAnimation.h" />
<ClInclude Include="Resource.h" />
<ClInclude Include="ResourceMgr.h" />
<ClInclude Include="RumblePack.h" />
<ClInclude Include="Scene.h" />
<ClInclude Include="Skeleton.h" />
<ClInclude Include="SkeletonLimb.h" />
<ClInclude Include="Texture.h" />
<ClInclude Include="WasapiAudioPlayer.h" />
<ClInclude Include="Window.h" />
<ClInclude Include="UltraController.h" />
<ClInclude Include="SDLController.h" />
<ClInclude Include="WindowShim.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -1,651 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Source Files\Lib">
<UniqueIdentifier>{50e27c70-2679-4f41-9127-fca2c66989ce}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Lib\Fast3D">
<UniqueIdentifier>{19d4557f-ea31-4405-88d5-15504070f479}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Resources">
<UniqueIdentifier>{12c0e217-75b9-47a5-bc2e-a2ea4e5dd992}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Controller">
<UniqueIdentifier>{bec61d88-f3a8-466d-b3e8-cf2e7d963f1b}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Controller\Attachment">
<UniqueIdentifier>{ad191ad0-c9eb-495d-9d45-5d12b9e7c269}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Globals">
<UniqueIdentifier>{c0f07350-c627-444e-9f66-23e19407ad9a}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Resources\Files">
<UniqueIdentifier>{2aa34c3b-6148-480f-a4fc-19c4e0f8c822}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Lib\tinyxml2">
<UniqueIdentifier>{6b6658ad-694d-4943-83b8-c9dbd31ca67d}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\Resources">
<UniqueIdentifier>{ef3683ce-934c-44c3-ae84-99cf22764875}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\Resources\Files">
<UniqueIdentifier>{58ff8972-9dba-4719-aec5-6edc5e6b033d}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Resources\mpq">
<UniqueIdentifier>{dde367c4-c14a-4bf3-b6d9-bc0d2d7d34e6}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Resources\Files\Zelda">
<UniqueIdentifier>{1f5e0ba2-0f3f-456c-9b66-873ed62e9fbe}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Resources\Factories">
<UniqueIdentifier>{3376a196-8303-4613-9721-62f31e746b0d}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\Resources\Factories">
<UniqueIdentifier>{cf7f1b29-bb9a-4844-9ea5-4ac085f942e1}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Lib\stb">
<UniqueIdentifier>{70cd453d-a4dc-4c56-b64e-e50394fd18ee}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Lib\ImGui">
<UniqueIdentifier>{a66f6337-5cde-4e46-8f49-a6c991ea2fe7}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\CustomImpl">
<UniqueIdentifier>{11039197-0b49-4fb9-b9e6-56196220c9d4}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Audio">
<UniqueIdentifier>{ccd6359f-e357-41ca-9b89-5f509dd30649}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\CustomImpl\Utils">
<UniqueIdentifier>{0dca2d94-45ba-4916-b03a-1dd5f949114c}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\CustomImpl\Hooks">
<UniqueIdentifier>{cc8de11b-7305-4482-853f-7f0f843eef28}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Logging">
<UniqueIdentifier>{bd6557f1-9480-413b-b0cd-843f8efc1939}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Lib\dr_libs">
<UniqueIdentifier>{db6e02cc-fc4c-4138-8219-1d281ad93ec2}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Lib\nlohmann">
<UniqueIdentifier>{2be7c90f-ba21-455d-8a11-6f99452be15c}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Lib\Mercury">
<UniqueIdentifier>{7e415dd2-403b-4d4d-b4f2-3e311f91db19}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Controller\InputEditor">
<UniqueIdentifier>{010dc29b-d1f6-4793-a4e7-4156aa4fcdd6}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\GUI">
<UniqueIdentifier>{5d68254f-662d-4e8c-a57f-de0d8e1d4a58}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Factories\MaterialFactory.cpp">
<Filter>Source Files\Resources\Factories</Filter>
</ClCompile>
<ClCompile Include="Factories\ResourceLoader.cpp">
<Filter>Source Files\Resources\Factories</Filter>
</ClCompile>
<ClCompile Include="Lib\Fast3D\gfx_opengl.cpp">
<Filter>Source Files\Lib\Fast3D</Filter>
</ClCompile>
<ClCompile Include="Lib\Fast3D\gfx_pc.cpp">
<Filter>Source Files\Lib\Fast3D</Filter>
</ClCompile>
<ClCompile Include="Lib\Fast3D\gfx_sdl2.cpp">
<Filter>Source Files\Lib\Fast3D</Filter>
</ClCompile>
<ClCompile Include="File.cpp">
<Filter>Source Files\Resources\mpq</Filter>
</ClCompile>
<ClCompile Include="Archive.cpp">
<Filter>Source Files\Resources\mpq</Filter>
</ClCompile>
<ClCompile Include="Lib\StrHash64.cpp">
<Filter>Source Files\Lib</Filter>
</ClCompile>
<ClCompile Include="Lib\tinyxml2\tinyxml2.cpp">
<Filter>Source Files\Lib</Filter>
</ClCompile>
<ClCompile Include="Factories\SceneFactory.cpp">
<Filter>Source Files\Resources\Factories</Filter>
</ClCompile>
<ClCompile Include="Factories\CollisionHeaderFactory.cpp">
<Filter>Source Files\Resources\Factories</Filter>
</ClCompile>
<ClCompile Include="Factories\DisplayListFactory.cpp">
<Filter>Source Files\Resources\Factories</Filter>
</ClCompile>
<ClCompile Include="Factories\PlayerAnimationFactory.cpp">
<Filter>Source Files\Resources\Factories</Filter>
</ClCompile>
<ClCompile Include="Factories\SkeletonFactory.cpp">
<Filter>Source Files\Resources\Factories</Filter>
</ClCompile>
<ClCompile Include="Factories\SkeletonLimbFactory.cpp">
<Filter>Source Files\Resources\Factories</Filter>
</ClCompile>
<ClCompile Include="Controller.cpp">
<Filter>Source Files\Controller</Filter>
</ClCompile>
<ClCompile Include="KeyboardController.cpp">
<Filter>Source Files\Controller</Filter>
</ClCompile>
<ClCompile Include="Window.cpp">
<Filter>Source Files\Globals</Filter>
</ClCompile>
<ClCompile Include="GlobalCtx2.cpp">
<Filter>Source Files\Globals</Filter>
</ClCompile>
<ClCompile Include="WindowShim.cpp">
<Filter>Source Files\Globals</Filter>
</ClCompile>
<ClCompile Include="ControllerAttachment.cpp">
<Filter>Source Files\Controller\Attachment</Filter>
</ClCompile>
<ClCompile Include="RumblePack.cpp">
<Filter>Source Files\Controller\Attachment</Filter>
</ClCompile>
<ClCompile Include="MemoryPack.cpp">
<Filter>Source Files\Controller\Attachment</Filter>
</ClCompile>
<ClCompile Include="CollisionHeader.cpp">
<Filter>Source Files\Resources\Files</Filter>
</ClCompile>
<ClCompile Include="DisplayList.cpp">
<Filter>Source Files\Resources\Files</Filter>
</ClCompile>
<ClCompile Include="Material.cpp">
<Filter>Source Files\Resources\Files</Filter>
</ClCompile>
<ClCompile Include="Model.cpp">
<Filter>Source Files\Resources\Files</Filter>
</ClCompile>
<ClCompile Include="PlayerAnimation.cpp">
<Filter>Source Files\Resources\Files</Filter>
</ClCompile>
<ClCompile Include="Scene.cpp">
<Filter>Source Files\Resources\Files</Filter>
</ClCompile>
<ClCompile Include="Skeleton.cpp">
<Filter>Source Files\Resources\Files</Filter>
</ClCompile>
<ClCompile Include="SkeletonLimb.cpp">
<Filter>Source Files\Resources\Files</Filter>
</ClCompile>
<ClCompile Include="Texture.cpp">
<Filter>Source Files\Resources\Files</Filter>
</ClCompile>
<ClCompile Include="ResourceMgr.cpp">
<Filter>Source Files\Resources</Filter>
</ClCompile>
<ClCompile Include="stox.cpp">
<Filter>Source Files\Lib</Filter>
</ClCompile>
<ClCompile Include="Animation.cpp">
<Filter>Source Files\Resources\Files</Filter>
</ClCompile>
<ClCompile Include="Factories\AnimationFactory.cpp">
<Filter>Source Files\Resources\Factories</Filter>
</ClCompile>
<ClCompile Include="Cutscene.cpp">
<Filter>Source Files\Resources\Files</Filter>
</ClCompile>
<ClCompile Include="Vertex.cpp">
<Filter>Source Files\Resources\Files</Filter>
</ClCompile>
<ClCompile Include="Factories\VtxFactory.cpp">
<Filter>Source Files\Resources\Factories</Filter>
</ClCompile>
<ClCompile Include="SDLController.cpp">
<Filter>Source Files\Controller</Filter>
</ClCompile>
<ClCompile Include="Factories\CutsceneFactory.cpp">
<Filter>Source Files\Resources\Factories</Filter>
</ClCompile>
<ClCompile Include="Path.cpp">
<Filter>Source Files\Resources\Files</Filter>
</ClCompile>
<ClCompile Include="Factories\PathFactory.cpp">
<Filter>Source Files\Resources\Factories</Filter>
</ClCompile>
<ClCompile Include="Array.cpp">
<Filter>Source Files\Resources\Files</Filter>
</ClCompile>
<ClCompile Include="Factories\ArrayFactory.cpp">
<Filter>Source Files\Resources\Factories</Filter>
</ClCompile>
<ClCompile Include="Resource.cpp">
<Filter>Source Files\Resources</Filter>
</ClCompile>
<ClCompile Include="Lib\Fast3D\gfx_cc.cpp">
<Filter>Source Files\Lib\Fast3D</Filter>
</ClCompile>
<ClCompile Include="Lib\Fast3D\gfx_direct3d_common.cpp">
<Filter>Source Files\Lib\Fast3D</Filter>
</ClCompile>
<ClCompile Include="Lib\Fast3D\gfx_direct3d11.cpp">
<Filter>Source Files\Lib\Fast3D</Filter>
</ClCompile>
<ClCompile Include="Lib\Fast3D\gfx_direct3d12.cpp">
<Filter>Source Files\Lib\Fast3D</Filter>
</ClCompile>
<ClCompile Include="Lib\Fast3D\gfx_dxgi.cpp">
<Filter>Source Files\Lib\Fast3D</Filter>
</ClCompile>
<ClCompile Include="Lib\Fast3D\gfx_glx.cpp">
<Filter>Source Files\Lib\Fast3D</Filter>
</ClCompile>
<ClCompile Include="Factories\TextureFactory.cpp">
<Filter>Source Files\Resources\Factories</Filter>
</ClCompile>
<ClCompile Include="Text.cpp">
<Filter>Source Files\Resources\Files</Filter>
</ClCompile>
<ClCompile Include="Factories\TextFactory.cpp">
<Filter>Source Files\Resources\Factories</Filter>
</ClCompile>
<ClCompile Include="Factories\BlobFactory.cpp">
<Filter>Source Files\Resources\Factories</Filter>
</ClCompile>
<ClCompile Include="Blob.cpp">
<Filter>Source Files\Resources\Files</Filter>
</ClCompile>
<ClCompile Include="Lib\stb\stb_impl.c">
<Filter>Source Files\Lib\stb</Filter>
</ClCompile>
<ClCompile Include="Matrix.cpp">
<Filter>Source Files\Resources\Files</Filter>
</ClCompile>
<ClCompile Include="Factories\MtxFactory.cpp">
<Filter>Source Files\Resources\Factories</Filter>
</ClCompile>
<ClCompile Include="Lib\ImGui\imgui.cpp">
<Filter>Source Files\Lib\ImGui</Filter>
</ClCompile>
<ClCompile Include="Lib\ImGui\imgui_demo.cpp">
<Filter>Source Files\Lib\ImGui</Filter>
</ClCompile>
<ClCompile Include="Lib\ImGui\imgui_draw.cpp">
<Filter>Source Files\Lib\ImGui</Filter>
</ClCompile>
<ClCompile Include="Lib\ImGui\imgui_tables.cpp">
<Filter>Source Files\Lib\ImGui</Filter>
</ClCompile>
<ClCompile Include="Lib\ImGui\imgui_widgets.cpp">
<Filter>Source Files\Lib\ImGui</Filter>
</ClCompile>
<ClCompile Include="Lib\ImGui\backends\imgui_impl_opengl3.cpp">
<Filter>Source Files\Lib\ImGui</Filter>
</ClCompile>
<ClCompile Include="Lib\ImGui\backends\imgui_impl_sdl.cpp">
<Filter>Source Files\Lib\ImGui</Filter>
</ClCompile>
<ClCompile Include="Lib\ImGui\backends\imgui_impl_dx11.cpp">
<Filter>Source Files\Lib\ImGui</Filter>
</ClCompile>
<ClCompile Include="Lib\ImGui\backends\imgui_impl_win32.cpp">
<Filter>Source Files\Lib\ImGui</Filter>
</ClCompile>
<ClCompile Include="mixer.c">
<Filter>Source Files\Audio</Filter>
</ClCompile>
<ClCompile Include="SDLAudioPlayer.cpp">
<Filter>Source Files\Audio</Filter>
</ClCompile>
<ClCompile Include="Utils.cpp">
<Filter>Source Files\CustomImpl\Utils</Filter>
</ClCompile>
<ClCompile Include="WasapiAudioPlayer.cpp">
<Filter>Source Files\Audio</Filter>
</ClCompile>
<ClCompile Include="Cvar.cpp">
<Filter>Source Files\Globals</Filter>
</ClCompile>
<ClCompile Include="luslog.cpp">
<Filter>Source Files\Logging</Filter>
</ClCompile>
<ClCompile Include="Audio.cpp">
<Filter>Source Files\Resources\Files</Filter>
</ClCompile>
<ClCompile Include="Factories\AudioFactory.cpp">
<Filter>Source Files\Resources\Factories</Filter>
</ClCompile>
<ClCompile Include="InputEditor.cpp">
<Filter>Source Files\Controller\InputEditor</Filter>
</ClCompile>
<ClCompile Include="ControlDeck.cpp">
<Filter>Source Files\Controller</Filter>
</ClCompile>
<ClCompile Include="Lib\Mercury\Mercury.cpp">
<Filter>Source Files\Lib\Mercury</Filter>
</ClCompile>
<ClCompile Include="Console.cpp">
<Filter>Source Files\GUI</Filter>
</ClCompile>
<ClCompile Include="GameOverlay.cpp">
<Filter>Source Files\GUI</Filter>
</ClCompile>
<ClCompile Include="ImGuiImpl.cpp">
<Filter>Source Files\GUI</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Lib\tinyxml2\tinyxml2.h">
<Filter>Source Files\Lib\tinyxml2</Filter>
</ClInclude>
<ClInclude Include="Controller.h">
<Filter>Source Files\Controller</Filter>
</ClInclude>
<ClInclude Include="KeyboardController.h">
<Filter>Source Files\Controller</Filter>
</ClInclude>
<ClInclude Include="Window.h">
<Filter>Source Files\Globals</Filter>
</ClInclude>
<ClInclude Include="GlobalCtx2.h">
<Filter>Source Files\Globals</Filter>
</ClInclude>
<ClInclude Include="Lib\mINI\src\mini\ini.h">
<Filter>Source Files\Lib</Filter>
</ClInclude>
<ClInclude Include="UltraController.h">
<Filter>Source Files\Controller</Filter>
</ClInclude>
<ClInclude Include="ControllerAttachment.h">
<Filter>Source Files\Controller\Attachment</Filter>
</ClInclude>
<ClInclude Include="RumblePack.h">
<Filter>Source Files\Controller\Attachment</Filter>
</ClInclude>
<ClInclude Include="MemoryPack.h">
<Filter>Source Files\Controller\Attachment</Filter>
</ClInclude>
<ClInclude Include="ResourceMgr.h">
<Filter>Source Files\Resources</Filter>
</ClInclude>
<ClInclude Include="Archive.h">
<Filter>Source Files\Resources\mpq</Filter>
</ClInclude>
<ClInclude Include="File.h">
<Filter>Source Files\Resources\mpq</Filter>
</ClInclude>
<ClInclude Include="Lib\Fast3D\gfx_opengl.h">
<Filter>Source Files\Lib\Fast3D</Filter>
</ClInclude>
<ClInclude Include="Lib\Fast3D\gfx_pc.h">
<Filter>Source Files\Lib\Fast3D</Filter>
</ClInclude>
<ClInclude Include="Lib\Fast3D\gfx_sdl.h">
<Filter>Source Files\Lib\Fast3D</Filter>
</ClInclude>
<ClInclude Include="Lib\StrHash64.h">
<Filter>Source Files\Lib</Filter>
</ClInclude>
<ClInclude Include="LUSMacros.h">
<Filter>Source Files\Globals</Filter>
</ClInclude>
<ClInclude Include="stox.h">
<Filter>Source Files\Lib</Filter>
</ClInclude>
<ClInclude Include="SDLController.h">
<Filter>Source Files\Controller</Filter>
</ClInclude>
<ClInclude Include="Resource.h">
<Filter>Source Files\Resources</Filter>
</ClInclude>
<ClInclude Include="Lib\Fast3D\gfx_rendering_api.h">
<Filter>Source Files\Lib\Fast3D</Filter>
</ClInclude>
<ClInclude Include="Lib\Fast3D\gfx_screen_config.h">
<Filter>Source Files\Lib\Fast3D</Filter>
</ClInclude>
<ClInclude Include="Lib\Fast3D\gfx_window_manager_api.h">
<Filter>Source Files\Lib\Fast3D</Filter>
</ClInclude>
<ClInclude Include="WindowShim.h">
<Filter>Source Files\Globals</Filter>
</ClInclude>
<ClInclude Include="Lib\Fast3D\gfx_cc.h">
<Filter>Source Files\Lib\Fast3D</Filter>
</ClInclude>
<ClInclude Include="Lib\Fast3D\gfx_direct3d_common.h">
<Filter>Source Files\Lib\Fast3D</Filter>
</ClInclude>
<ClInclude Include="Lib\Fast3D\gfx_direct3d11.h">
<Filter>Source Files\Lib\Fast3D</Filter>
</ClInclude>
<ClInclude Include="Lib\Fast3D\gfx_direct3d12.h">
<Filter>Source Files\Lib\Fast3D</Filter>
</ClInclude>
<ClInclude Include="Lib\Fast3D\gfx_direct3d12_guids.h">
<Filter>Source Files\Lib\Fast3D</Filter>
</ClInclude>
<ClInclude Include="Lib\Fast3D\gfx_dxgi.h">
<Filter>Source Files\Lib\Fast3D</Filter>
</ClInclude>
<ClInclude Include="Lib\Fast3D\gfx_glx.h">
<Filter>Source Files\Lib\Fast3D</Filter>
</ClInclude>
<ClInclude Include="Factories\AnimationFactory.h">
<Filter>Header Files\Resources\Factories</Filter>
</ClInclude>
<ClInclude Include="Factories\ArrayFactory.h">
<Filter>Header Files\Resources\Factories</Filter>
</ClInclude>
<ClInclude Include="Factories\BlobFactory.h">
<Filter>Header Files\Resources\Factories</Filter>
</ClInclude>
<ClInclude Include="Factories\CollisionHeaderFactory.h">
<Filter>Header Files\Resources\Factories</Filter>
</ClInclude>
<ClInclude Include="Factories\CutsceneFactory.h">
<Filter>Header Files\Resources\Factories</Filter>
</ClInclude>
<ClInclude Include="Factories\DisplayListFactory.h">
<Filter>Header Files\Resources\Factories</Filter>
</ClInclude>
<ClInclude Include="Factories\MaterialFactory.h">
<Filter>Header Files\Resources\Factories</Filter>
</ClInclude>
<ClInclude Include="Factories\PathFactory.h">
<Filter>Header Files\Resources\Factories</Filter>
</ClInclude>
<ClInclude Include="Factories\PlayerAnimationFactory.h">
<Filter>Header Files\Resources\Factories</Filter>
</ClInclude>
<ClInclude Include="Factories\SceneFactory.h">
<Filter>Header Files\Resources\Factories</Filter>
</ClInclude>
<ClInclude Include="Factories\SkeletonFactory.h">
<Filter>Header Files\Resources\Factories</Filter>
</ClInclude>
<ClInclude Include="Factories\SkeletonLimbFactory.h">
<Filter>Header Files\Resources\Factories</Filter>
</ClInclude>
<ClInclude Include="Factories\TextFactory.h">
<Filter>Header Files\Resources\Factories</Filter>
</ClInclude>
<ClInclude Include="Factories\TextureFactory.h">
<Filter>Header Files\Resources\Factories</Filter>
</ClInclude>
<ClInclude Include="Factories\VtxFactory.h">
<Filter>Header Files\Resources\Factories</Filter>
</ClInclude>
<ClInclude Include="Animation.h">
<Filter>Header Files\Resources\Files</Filter>
</ClInclude>
<ClInclude Include="Array.h">
<Filter>Header Files\Resources\Files</Filter>
</ClInclude>
<ClInclude Include="Blob.h">
<Filter>Header Files\Resources\Files</Filter>
</ClInclude>
<ClInclude Include="CollisionHeader.h">
<Filter>Header Files\Resources\Files</Filter>
</ClInclude>
<ClInclude Include="Cutscene.h">
<Filter>Header Files\Resources\Files</Filter>
</ClInclude>
<ClInclude Include="DisplayList.h">
<Filter>Header Files\Resources\Files</Filter>
</ClInclude>
<ClInclude Include="Material.h">
<Filter>Header Files\Resources\Files</Filter>
</ClInclude>
<ClInclude Include="Model.h">
<Filter>Header Files\Resources\Files</Filter>
</ClInclude>
<ClInclude Include="Path.h">
<Filter>Header Files\Resources\Files</Filter>
</ClInclude>
<ClInclude Include="PlayerAnimation.h">
<Filter>Header Files\Resources\Files</Filter>
</ClInclude>
<ClInclude Include="Factories\ResourceLoader.h">
<Filter>Header Files\Resources\Files</Filter>
</ClInclude>
<ClInclude Include="Scene.h">
<Filter>Header Files\Resources\Files</Filter>
</ClInclude>
<ClInclude Include="Skeleton.h">
<Filter>Header Files\Resources\Files</Filter>
</ClInclude>
<ClInclude Include="SkeletonLimb.h">
<Filter>Header Files\Resources\Files</Filter>
</ClInclude>
<ClInclude Include="Text.h">
<Filter>Header Files\Resources\Files</Filter>
</ClInclude>
<ClInclude Include="Texture.h">
<Filter>Header Files\Resources\Files</Filter>
</ClInclude>
<ClInclude Include="Vertex.h">
<Filter>Header Files\Resources\Files</Filter>
</ClInclude>
<ClInclude Include="Lib\stb\stb_image.h">
<Filter>Source Files\Lib\stb</Filter>
</ClInclude>
<ClInclude Include="Matrix.h">
<Filter>Header Files\Resources\Files</Filter>
</ClInclude>
<ClInclude Include="Factories\MtxFactory.h">
<Filter>Header Files\Resources\Factories</Filter>
</ClInclude>
<ClInclude Include="Lib\ImGui\imconfig.h">
<Filter>Source Files\Lib\ImGui</Filter>
</ClInclude>
<ClInclude Include="Lib\ImGui\imgui.h">
<Filter>Source Files\Lib\ImGui</Filter>
</ClInclude>
<ClInclude Include="Lib\ImGui\imgui_internal.h">
<Filter>Source Files\Lib\ImGui</Filter>
</ClInclude>
<ClInclude Include="Lib\ImGui\imstb_rectpack.h">
<Filter>Source Files\Lib\ImGui</Filter>
</ClInclude>
<ClInclude Include="Lib\ImGui\imstb_textedit.h">
<Filter>Source Files\Lib\ImGui</Filter>
</ClInclude>
<ClInclude Include="Lib\ImGui\imstb_truetype.h">
<Filter>Source Files\Lib\ImGui</Filter>
</ClInclude>
<ClInclude Include="Lib\ImGui\backends\imgui_impl_opengl3.h">
<Filter>Source Files\Lib\ImGui</Filter>
</ClInclude>
<ClInclude Include="Lib\ImGui\backends\imgui_impl_sdl.h">
<Filter>Source Files\Lib\ImGui</Filter>
</ClInclude>
<ClInclude Include="Lib\ImGui\backends\imgui_impl_dx11.h">
<Filter>Source Files\Lib\ImGui</Filter>
</ClInclude>
<ClInclude Include="Lib\ImGui\backends\imgui_impl_win32.h">
<Filter>Source Files\Lib\ImGui</Filter>
</ClInclude>
<ClInclude Include="Utils.h">
<Filter>Source Files\CustomImpl\Utils</Filter>
</ClInclude>
<ClInclude Include="mixer.h">
<Filter>Source Files\Audio</Filter>
</ClInclude>
<ClInclude Include="abi.h">
<Filter>Source Files\Audio</Filter>
</ClInclude>
<ClInclude Include="AudioPlayer.h">
<Filter>Source Files\Audio</Filter>
</ClInclude>
<ClInclude Include="SDLAudioPlayer.h">
<Filter>Source Files\Audio</Filter>
</ClInclude>
<ClInclude Include="WasapiAudioPlayer.h">
<Filter>Source Files\Audio</Filter>
</ClInclude>
<ClInclude Include="Cvar.h">
<Filter>Source Files\Globals</Filter>
</ClInclude>
<ClInclude Include="Lib\stb\stb_image_write.h">
<Filter>Source Files\Lib\stb</Filter>
</ClInclude>
<ClInclude Include="Hooks.h">
<Filter>Source Files\CustomImpl\Hooks</Filter>
</ClInclude>
<ClInclude Include="luslog.h">
<Filter>Source Files\Logging</Filter>
</ClInclude>
<ClInclude Include="GameVersions.h">
<Filter>Source Files\Resources</Filter>
</ClInclude>
<ClInclude Include="color.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Audio.h">
<Filter>Header Files\Resources\Files</Filter>
</ClInclude>
<ClInclude Include="Factories\AudioFactory.h">
<Filter>Header Files\Resources\Factories</Filter>
</ClInclude>
<ClInclude Include="Lib\dr_libs\mp3.h">
<Filter>Source Files\Lib\dr_libs</Filter>
</ClInclude>
<ClInclude Include="Lib\dr_libs\wav.h">
<Filter>Source Files\Lib\dr_libs</Filter>
</ClInclude>
<ClInclude Include="InputEditor.h">
<Filter>Source Files\Controller\InputEditor</Filter>
</ClInclude>
<ClInclude Include="ControlDeck.h">
<Filter>Source Files\Controller</Filter>
</ClInclude>
<ClInclude Include="Lib\nlohmann\json.hpp">
<Filter>Source Files\Lib\nlohmann</Filter>
</ClInclude>
<ClInclude Include="Lib\Mercury\Mercury.h">
<Filter>Source Files\Lib\Mercury</Filter>
</ClInclude>
<ClInclude Include="VirtualController.h">
<Filter>Source Files\Controller</Filter>
</ClInclude>
<ClInclude Include="Console.h">
<Filter>Source Files\GUI</Filter>
</ClInclude>
<ClInclude Include="GameOverlay.h">
<Filter>Source Files\GUI</Filter>
</ClInclude>
<ClInclude Include="ImGuiImpl.h">
<Filter>Source Files\GUI</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -0,0 +1,7 @@
#!/bin/bash
cmake --no-warn-unused-cli -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=Release
cmake --build build-cmake --target ExtractAssets --
cmake --build build-cmake --config Release --
(cd build-cmake && cpack -G External)

View File

@ -1,9 +1,9 @@
[Desktop Entry]
Version=1.0
Name=SOH
Exec=AppRun
Exec=soh.sh
Terminal=false
Icon=soh
Icon=sohIcon
Type=Application
Categories=Game;
Name[en_US]=

View File

@ -1,34 +0,0 @@
#!/bin/bash
curl -sSfLO "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage"
chmod a+x linuxdeploy*.AppImage
curl -sSfL https://github.com$(curl https://github.com/probonopd/go-appimage/releases | grep "mkappimage-.*-x86_64.AppImage" | head -n 1 | cut -d '"' -f 2) -o mkappimage.AppImage
chmod a+x mkappimage.AppImage
mkdir -p AppDir/usr/bin
cp scripts/linux/{soh.desktop,soh.sh} AppDir/
cp soh/macosx/sohIcon.png AppDir/soh.png
curl -sSfL https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt -o AppDir/usr/bin/gamecontrollerdb.txt
mkdir -p AppDir/usr/share/applications
mkdir -p AppDir/usr/share/icons/hicolor/scalable/apps
mkdir -p AppDir/usr/lib
mv AppDir/soh.sh AppDir/usr/bin
cp -r build/* AppDir/usr/bin
chmod +x AppDir/usr/bin/{soh.elf,OTRGui,soh.sh}
cd AppDir && ln -s ./usr/bin/soh.sh ./AppRun && cd ..
export UPD_INFO="gh-releases-zsync|HarbourMasters|Shipwright-linux|develop|SOH-Linux.AppImage.zsync"
./linuxdeploy-x86_64.AppImage --appimage-extract-and-run \
--appdir=./AppDir/ \
-d ./AppDir/soh.desktop \
-i ./AppDir/soh.png \
-e ./AppDir/usr/bin/soh.elf
cd /soh
VERSION=Linux ./mkappimage.AppImage --appimage-extract-and-run ./AppDir # "SOH-Linux-x86_64.AppImage"
mv SOH-Linux-x86_64.AppImage SOH-Linux.AppImage # Keep Original Name

View File

@ -1,11 +0,0 @@
#!/bin/bash
cd soh
make setup -j$(nproc) OPTFLAGS=-O2 DEBUG=0
make -j$(nproc) OPTFLAGS=-O2 DEBUG=0
cd ../OTRGui
mkdir build
cd build
cmake ..
cmake --build . --config Release

View File

@ -1,4 +1,7 @@
#!/bin/bash
make setup -C soh -j$(nproc) OPTFLAGS=-O2 DEBUG=0
make -f Makefile.switch -j$(nproc)
cmake --no-warn-unused-cli -H. -Bbuild-linux -GNinja
cmake --build build-linux --target ExtractAssets
cmake -H. -Bbuild-switch -GNinja -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/Switch.cmake
cmake --build build-switch --target soh_nro

65
soh/CMake/Default.cmake Normal file
View File

@ -0,0 +1,65 @@
################################################################################
# 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}")

View File

@ -0,0 +1,12 @@
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()

View File

@ -0,0 +1,15 @@
# which compilers to use for C and C++
set(CMAKE_C_COMPILER gcc)
set(CMAKE_C_FLAGS "-m32")
set(CMAKE_CXX_COMPILER g++)
set(CMAKE_CXX_FLAGS -m32)
# here is the target environment located
#set(CMAKE_FIND_ROOT_PATH /lib/i386-linux-gnu )
# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment, search
# programs in the host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)

233
soh/CMake/Utils.cmake Normal file
View File

@ -0,0 +1,233 @@
# 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")

1992
soh/CMakeLists.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,235 +0,0 @@
CXX ?= g++
CC ?= gcc
LD := lld
AR := ar
FORMAT := clang-format-11
ZAPD := ../ZAPDTR/ZAPD.out
UNAME := $(shell uname)
UNAMEM := $(shell uname -m)
LIBULTRASHIP := ../libultraship/libultraship.a
ZAPDUTILS := ../ZAPDTR/ZAPDUtils/ZAPDUtils.a
LIBSTORM := ../StormLib/build/libstorm.a
ASAN ?= 0
DEBUG ?= 1
OPTFLAGS ?= -O0
LTO ?= 0
# flag to save whether the compiler being used is clang or gcc by checking CXX --version
CXX_IS_CLANG ?= $(shell $(CXX) --version | grep -c clang)
WARN := \
-Wno-return-type \
-funsigned-char \
-fno-stack-protector -fno-common -fno-zero-initialized-in-bss -fno-strict-aliasing -fno-inline-functions -fno-inline-small-functions -ffreestanding -fwrapv \
ifeq ($(CXX_IS_CLANG),1)
WARN += -Wno-c++11-narrowing
endif
CXXFLAGS := $(WARN) -std=c++20 -D_GNU_SOURCE -fpermissive -nostdlib $(shell pkg-config --cflags glew) $(shell sdl2-config --cflags)
CFLAGS := $(WARN) -std=c99 -Wno-implicit-function-declaration -D_GNU_SOURCE -nostdlib $(shell pkg-config --cflags glew) $(shell sdl2-config --cflags)
LDFLAGS :=
ifneq ($(CXX_IS_CLANG),1)
CXXFLAGS += -no-pie
CFLAGS += -no-pie
endif
ifeq ($(UNAME), Linux)
ifeq ($(UNAMEM), x86_64)
CXXFLAGS += -msse2 -mfpmath=sse -mhard-float
CFLAGS += -msse2 -mfpmath=sse -mhard-float
endif
CXXFLAGS += $(shell pkg-config --cflags libpulse)
CFLAGS += $(shell pkg-config --cflags libpulse)
endif
CPPFLAGS := -MMD
ifneq ($(DEBUG),0)
CXXFLAGS += -g
CFLAGS += -g
endif
ifneq ($(ASAN),0)
CXXFLAGS += -fsanitize=address
CFLAGS += -fsanitize=address
LDFLAGS += -fsanitize=address
endif
ifneq ($(LTO),0)
CXXFLAGS += -flto
CFLAGS += -flto
LDFLAGS += -flto
endif
ifeq ($(UNAME), Linux)
TARGET := soh.elf
endif
ifeq ($(UNAME), Darwin)
TARGET := soh-$(UNAMEM)
endif
INC_DIRS := $(addprefix -I, \
. \
assets \
build \
include \
src \
../ZAPDTR/ZAPDUtils \
../libultraship/libultraship \
../libultraship/libultraship/Lib/spdlog/include \
../libultraship/libultraship/Lib/Fast3D/U64 \
../libultraship/libultraship/Lib/Fast3D/U64/PR \
)
LDDIRS := $(addprefix -L, \
../libultraship/ \
)
LDLIBS := \
$(ZAPDUTILS) \
$(LIBSTORM) \
$(shell sdl2-config --libs) \
$(shell pkg-config --libs glew) \
$(addprefix -l, \
dl \
bz2 \
z \
pthread \
ultraship \
)
ifeq ($(UNAME), Linux)
LDLIBS += $(shell pkg-config --libs x11 libpulse)
endif
ifeq ($(UNAME), Darwin)
LDLIBS += \
$(addprefix -framework , \
OpenGL \
Foundation \
)
endif
ASSET_BIN_DIRS := $(shell find assets/* -type d -not -path "assets/xml*")
ASSET_FILES_XML := $(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.xml))
ASSET_FILES_BIN := $(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.bin))
ASSET_FILES_OUT := $(foreach f,$(ASSET_FILES_XML:.xml=.c),$f) \
$(foreach f,$(ASSET_FILES_BIN:.bin=.bin.inc.c),build/$f)
TEXTURE_FILES_PNG := $(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.png))
TEXTURE_FILES_JPG := $(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.jpg))
TEXTURE_FILES_OUT := $(foreach f,$(TEXTURE_FILES_PNG:.png=.inc.c),build/$f) \
$(foreach f,$(TEXTURE_FILES_JPG:.jpg=.jpg.inc.c),build/$f) \
CXX_FILES := \
$(shell find soh -type f -name "*.cpp")
C_FILES := \
$(shell find soh -type f -name "*.c") \
$(shell find src/boot -type f -name "*.c") \
$(shell find src/buffers -type f -name "*.c") \
$(shell find src/code -type f -name "*.c") \
$(shell find src/overlays -type f -name "*.c") \
src/libultra/gu/coss.c \
src/libultra/gu/guLookAt.c \
src/libultra/gu/guLookAtHilite.c \
src/libultra/gu/guPerspectiveF.c \
src/libultra/gu/guPosition.c \
src/libultra/gu/guS2DInitBg.c \
src/libultra/gu/ortho.c \
src/libultra/gu/rotate.c \
src/libultra/gu/sins.c \
src/libultra/gu/sintable.c \
src/libultra/libc/sprintf.c
O_FILES := \
$(C_FILES:%.c=build/%.o) \
$(CXX_FILES:%.cpp=build/%.o)
D_FILES := $(O_FILES:%.o=%.d)
# Apple App Bundle
APPNAME=soh
APPBUNDLE=$(APPNAME).app
APPBUNDLECONTENTS=$(APPBUNDLE)/Contents
APPBUNDLEEXE=$(APPBUNDLECONTENTS)/MacOS
APPBUNDLERESOURCES=$(APPBUNDLECONTENTS)/Resources
APPBUNDLEICON=$(APPBUNDLECONTENTS)/Resources
# create build directory
SRC_DIRS := $(shell find . -type d -a -not -path "*build*")
$(shell mkdir -p $(SRC_DIRS:%=build/%))
all:
$(MAKE) -C ../libultraship
$(MAKE) $(TARGET)
setup:
cd ../OTRExporter
$(MAKE) mpq
mpq:
$(MAKE) -C ../libultraship
$(MAKE) -C ../OTRExporter/OTRExporter
$(MAKE) -C ../ZAPDTR
rm -rf ../OTRExporter/oot.otr
cd ../OTRExporter && python3 extract_assets.py
cp ../OTRExporter/oot.otr .
distclean: clean
$(RM) -r baserom/
$(MAKE) clean -C ../libultraship
$(MAKE) clean -C ../OTRExporter/OTRExporter
$(MAKE) clean -C ../ZAPDTR
clean:
rm -rf build $(TARGET)
.PHONY: all clean distclean setup mpq
build/%.o: %.cpp
$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $(OPTFLAGS) $(INC_DIRS) $< -o $@
build/%.o: %.c
$(CC) -c $(CFLAGS) $(CPPFLAGS) $(OPTFLAGS) $(INC_DIRS) $< -o $@
# make soh depend on libultraship
$(TARGET): $(LIBULTRASHIP)
$(TARGET): $(O_FILES)
$(CXX) $^ -o $@ $(LDFLAGS) $(LDDIRS) $(LDLIBS)
-include $(D_FILES)
appbundle: macosx/$(APPNAME).icns
rm -rf $(APPBUNDLE)
mkdir $(APPBUNDLE)
mkdir $(APPBUNDLE)/Contents
mkdir $(APPBUNDLE)/Contents/MacOS
mkdir $(APPBUNDLE)/Contents/Resources
cp macosx/Info.plist $(APPBUNDLECONTENTS)/
cp macosx/PkgInfo $(APPBUNDLECONTENTS)/
cp macosx/$(APPNAME).icns $(APPBUNDLEICON)/
cp $(TARGET) $(APPBUNDLEEXE)/soh
otool -l $(TARGET) | grep -A 2 LC_RPATH | tail -n 1 | awk '{print $2}' | dylibbundler -od -b -x $(APPBUNDLEEXE)/soh -d $(APPBUNDLECONTENTS)/libs
macosx/$(APPNAME).icns: macosx/$(APPNAME)Icon.png
rm -rf macosx/$(APPNAME).iconset
mkdir macosx/$(APPNAME).iconset
sips -z 16 16 macosx/$(APPNAME)Icon.png --out macosx/$(APPNAME).iconset/icon_16x16.png
sips -z 32 32 macosx/$(APPNAME)Icon.png --out macosx/$(APPNAME).iconset/icon_16x16@2x.png
sips -z 32 32 macosx/$(APPNAME)Icon.png --out macosx/$(APPNAME).iconset/icon_32x32.png
sips -z 64 64 macosx/$(APPNAME)Icon.png --out macosx/$(APPNAME).iconset/icon_32x32@2x.png
sips -z 128 128 macosx/$(APPNAME)Icon.png --out macosx/$(APPNAME).iconset/icon_128x128.png
sips -z 256 256 macosx/$(APPNAME)Icon.png --out macosx/$(APPNAME).iconset/icon_128x128@2x.png
sips -z 256 256 macosx/$(APPNAME)Icon.png --out macosx/$(APPNAME).iconset/icon_256x256.png
sips -z 512 512 macosx/$(APPNAME)Icon.png --out macosx/$(APPNAME).iconset/icon_256x256@2x.png
sips -z 512 512 macosx/$(APPNAME)Icon.png --out macosx/$(APPNAME).iconset/icon_512x512.png
cp macosx/$(APPNAME)Icon.png macosx/$(APPNAME).iconset/icon_512x512@2x.png
iconutil -c icns -o macosx/$(APPNAME).icns macosx/$(APPNAME).iconset
rm -r macosx/$(APPNAME).iconset

View File

@ -1,280 +0,0 @@
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITPRO)),)
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>/devkitpro")
endif
TOPDIR ?= $(CURDIR)
include $(DEVKITPRO)/libnx/switch_rules
#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# DATA is a list of directories containing data files
# INCLUDES is a list of directories containing header files
# ROMFS is the directory containing data to be added to RomFS, relative to the Makefile (Optional)
#
# NO_ICON: if set to anything, do not use icon.
# NO_NACP: if set to anything, no .nacp file is generated.
# APP_TITLE is the name of the app stored in the .nacp file (Optional)
# APP_AUTHOR is the author of the app stored in the .nacp file (Optional)
# APP_VERSION is the version of the app stored in the .nacp file (Optional)
# APP_TITLEID is the titleID of the app stored in the .nacp file (Optional)
# ICON is the filename of the icon (.jpg), relative to the project folder.
# If not set, it attempts to use one of the following (in this order):
# - <Project name>.jpg
# - icon.jpg
# - <libnx folder>/default_icon.jpg
#
# CONFIG_JSON is the filename of the NPDM config file (.json), relative to the project folder.
# If not set, it attempts to use one of the following (in this order):
# - <Project name>.json
# - config.json
# If a JSON file is provided or autodetected, an ExeFS PFS0 (.nsp) is built instead
# of a homebrew executable (.nro). This is intended to be used for sysmodules.
# NACP building is skipped as well.
#---------------------------------------------------------------------------------
TARGET := $(notdir $(CURDIR))
BUILD := build
SOURCES := switch
DATA :=
INCLUDES := \
. \
assets \
build \
include \
src \
../ZAPDTR/ZAPDUtils \
../libultraship/libultraship \
../libultraship/libultraship/Lib/spdlog/include \
../libultraship/libultraship/Lib/Fast3D/U64 \
../libultraship/libultraship/Lib/Fast3D/U64/PR
#-------------------------------------------------------------------------------
# source files
#-------------------------------------------------------------------------------
SOURCEFILES_C := \
$(shell find soh -type f -name "*.c") \
$(shell find src/boot -type f -name "*.c") \
$(shell find src/buffers -type f -name "*.c") \
$(shell find src/code -type f -name "*.c") \
$(shell find src/overlays -type f -name "*.c") \
src/libultra/gu/coss.c \
src/libultra/gu/guLookAt.c \
src/libultra/gu/guLookAtHilite.c \
src/libultra/gu/guPerspectiveF.c \
src/libultra/gu/guPosition.c \
src/libultra/gu/guS2DInitBg.c \
src/libultra/gu/ortho.c \
src/libultra/gu/rotate.c \
src/libultra/gu/sins.c \
src/libultra/gu/sintable.c \
src/libultra/libc/sprintf.c
SOURCEFILES_CPP := \
$(shell find soh -type f -name "*.cpp")
#---------------------------------------------------------------------------------
# app info
#---------------------------------------------------------------------------------
APP_TITLE := Ship of Harkinian
APP_AUTHOR := Harbour Masters
APP_VERSION := Rachael-Alfa
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIE -ffast-math -O3
CFLAGS := -ffunction-sections \
$(ARCH) $(DEFINES)
CFLAGS += $(INCLUDE) -D__SWITCH__ \
-DSPDLOG_NO_THREAD_ID \
-DSTBI_NO_THREAD_LOCALS \
`sdl2-config --cflags`
CXXFLAGS := $(CFLAGS) -std=gnu++20 -fpermissive
CFLAGS += -std=gnu11
# disable some warnings
CFLAGS += -Wno-incompatible-pointer-types -Wno-int-conversion \
-Wno-builtin-declaration-mismatch -Wno-implicit-function-declaration \
-Wno-stringop-overflow -Wno-discarded-qualifiers -Wno-switch-unreachable
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
STATIC_LIBS := $(SOH_TOP_DIR)/libultraship/lib/libultraship.a \
$(SOH_TOP_DIR)/ZAPDTR/ZAPDUtils/lib/libZAPDUtils.a \
$(SOH_TOP_DIR)/ZAPDTR/ZAPDUtils/lib/libZAPDUtils.a \
$(SOH_TOP_DIR)/StormLib/nxbuild/libstorm.a \
LIBS := -L$(SOH_TOP_DIR)/StormLib/nxbuild/ -lultraship -lZAPDUtils -lstorm -lz -lbz2 -lnx -lglad -lglapi -ldrm_nouveau -lm `sdl2-config --libs`
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(PORTLIBS) $(LIBNX) $(SOH_TOP_DIR)/StormLib/nxbuild $(SOH_TOP_DIR)/libultraship $(SOH_TOP_DIR)/ZAPDTR/ZAPDUtils
#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------
export OUTPUT := $(CURDIR)/$(TARGET)
export TOPDIR := $(CURDIR)
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
$(foreach dir,$(DATA),$(CURDIR)/$(dir)) \
$(foreach sf,$(SOURCEFILES_C),$(CURDIR)/$(dir $(sf))) \
$(foreach sf,$(SOURCEFILES_CPP),$(CURDIR)/$(dir $(sf)))
export DEPSDIR := $(CURDIR)/$(BUILD)
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) \
$(foreach f,$(SOURCEFILES_C),$(notdir $(f)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) \
$(foreach f,$(SOURCEFILES_CPP),$(notdir $(f)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
#---------------------------------------------------------------------------------
export LD := $(CC)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LD := $(CXX)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES)))
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/$(BUILD)
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
ifeq ($(strip $(CONFIG_JSON)),)
jsons := $(wildcard *.json)
ifneq (,$(findstring $(TARGET).json,$(jsons)))
export APP_JSON := $(TOPDIR)/$(TARGET).json
else
ifneq (,$(findstring config.json,$(jsons)))
export APP_JSON := $(TOPDIR)/config.json
endif
endif
else
export APP_JSON := $(TOPDIR)/$(CONFIG_JSON)
endif
ifeq ($(strip $(ICON)),)
icons := $(wildcard *.jpg)
ifneq (,$(findstring $(TARGET).jpg,$(icons)))
export APP_ICON := $(TOPDIR)/$(TARGET).jpg
else
ifneq (,$(findstring icon.jpg,$(icons)))
export APP_ICON := $(TOPDIR)/icon.jpg
endif
endif
else
export APP_ICON := $(TOPDIR)/$(ICON)
endif
ifeq ($(strip $(NO_ICON)),)
export NROFLAGS += --icon=$(APP_ICON)
endif
ifeq ($(strip $(NO_NACP)),)
export NROFLAGS += --nacp=$(CURDIR)/$(TARGET).nacp
endif
ifneq ($(APP_TITLEID),)
export NACPFLAGS += --titleid=$(APP_TITLEID)
endif
ifneq ($(ROMFS),)
export NROFLAGS += --romfsdir=$(CURDIR)/$(ROMFS)
endif
.PHONY: $(BUILD) clean all
#---------------------------------------------------------------------------------
all: $(BUILD)
$(BUILD):
@[ -d $@ ] || mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.switch
#---------------------------------------------------------------------------------
clean:
@echo clean ...
ifeq ($(strip $(APP_JSON)),)
@rm -fr $(BUILD) $(TARGET).nro $(TARGET).nacp $(TARGET).elf
else
@rm -fr $(BUILD) $(TARGET).nsp $(TARGET).nso $(TARGET).npdm $(TARGET).elf
endif
#---------------------------------------------------------------------------------
else
.PHONY: all
DEPENDS := $(OFILES:.o=.d)
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
ifeq ($(strip $(APP_JSON)),)
all : $(OUTPUT).nro
ifeq ($(strip $(NO_NACP)),)
$(OUTPUT).nro : $(OUTPUT).elf $(OUTPUT).nacp
else
$(OUTPUT).nro : $(OUTPUT).elf
endif
else
all : $(OUTPUT).nsp
$(OUTPUT).nsp : $(OUTPUT).nso $(OUTPUT).npdm
$(OUTPUT).nso : $(OUTPUT).elf
endif
$(OUTPUT).elf : $(OFILES) \
$(STATIC_LIBS)
$(OFILES_SRC) : $(HFILES_BIN)
#---------------------------------------------------------------------------------
# you need a rule like this for each extension you use as binary data
#---------------------------------------------------------------------------------
%.bin.o %_bin.h : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
-include $(DEPENDS)
#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------

View File

@ -63,6 +63,9 @@ u32 Locale_IsRegionNative(void);
#if !defined(__APPLE__) && !defined(__SWITCH__)
void __assert(const char* exp, const char* file, s32 line);
#endif
#if defined(__APPLE__) && defined(NDEBUG)
void __assert(const char* exp, const char* file, s32 line);
#endif
void isPrintfInit(void);
void osSyncPrintfUnused(const char* fmt, ...);
//void osSyncPrintf(const char* fmt, ...);

8
soh/macosx/soh-macos.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
BUNDLE="`echo "$0" | sed -e 's/\/Contents\/MacOS\/.*//'`"
RESOURCES="$BUNDLE/Contents/Resources"
export DYLD_FRAMEWORK_PATH=$RESOURCES/Frameworks
export DYLD_LIBRARY_PATH=$RESOURCES/bin
exec "$RESOURCES/soh-macos"

View File

@ -1,66 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31112.23
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "soh", "soh.vcxproj", "{31348AA7-8DC5-4FA7-955F-E80855CADE9E}"
ProjectSection(ProjectDependencies) = postProject
{78424708-1F6E-4D4B-920C-FB6D26847055} = {78424708-1F6E-4D4B-920C-FB6D26847055}
{6DA9B521-65B7-41E2-8F8A-F0451CC18ED8} = {6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}
{A2E01C3E-D647-45D1-9788-043DEBC1A908} = {A2E01C3E-D647-45D1-9788-043DEBC1A908}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libultraship", "..\libultraship\libultraship\libultraship.vcxproj", "{6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZAPDUtils", "..\ZAPDTR\ZAPDUtils\ZAPDUtils.vcxproj", "{A2E01C3E-D647-45D1-9788-043DEBC1A908}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StormLib", "..\StormLib\StormLib_vs19.vcxproj", "{78424708-1F6E-4D4B-920C-FB6D26847055}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{31348AA7-8DC5-4FA7-955F-E80855CADE9E}.Debug|x64.ActiveCfg = Debug|x64
{31348AA7-8DC5-4FA7-955F-E80855CADE9E}.Debug|x64.Build.0 = Debug|x64
{31348AA7-8DC5-4FA7-955F-E80855CADE9E}.Debug|x86.ActiveCfg = Debug|Win32
{31348AA7-8DC5-4FA7-955F-E80855CADE9E}.Debug|x86.Build.0 = Debug|Win32
{31348AA7-8DC5-4FA7-955F-E80855CADE9E}.Release|x64.ActiveCfg = Release|x64
{31348AA7-8DC5-4FA7-955F-E80855CADE9E}.Release|x64.Build.0 = Release|x64
{31348AA7-8DC5-4FA7-955F-E80855CADE9E}.Release|x86.ActiveCfg = Release|Win32
{31348AA7-8DC5-4FA7-955F-E80855CADE9E}.Release|x86.Build.0 = Release|Win32
{6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Debug|x64.ActiveCfg = Debug|x64
{6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Debug|x64.Build.0 = Debug|x64
{6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Debug|x86.ActiveCfg = Debug|Win32
{6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Debug|x86.Build.0 = Debug|Win32
{6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Release|x64.ActiveCfg = Release|x64
{6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Release|x64.Build.0 = Release|x64
{6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Release|x86.ActiveCfg = Release|Win32
{6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Release|x86.Build.0 = Release|Win32
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x64.ActiveCfg = Debug|x64
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x64.Build.0 = Debug|x64
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x86.ActiveCfg = Debug|Win32
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x86.Build.0 = Debug|Win32
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x64.ActiveCfg = Release|x64
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x64.Build.0 = Release|x64
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x86.ActiveCfg = Release|Win32
{A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x86.Build.0 = Release|Win32
{78424708-1F6E-4D4B-920C-FB6D26847055}.Debug|x64.ActiveCfg = DebugUS|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.Debug|x64.Build.0 = DebugUS|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.Debug|x86.ActiveCfg = DebugUS|Win32
{78424708-1F6E-4D4B-920C-FB6D26847055}.Debug|x86.Build.0 = DebugUS|Win32
{78424708-1F6E-4D4B-920C-FB6D26847055}.Release|x64.ActiveCfg = ReleaseUS|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.Release|x64.Build.0 = ReleaseUS|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.Release|x86.ActiveCfg = ReleaseUS|Win32
{78424708-1F6E-4D4B-920C-FB6D26847055}.Release|x86.Build.0 = ReleaseUS|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7659B687-4D92-4865-A037-045115E1C783}
EndGlobalSection
EndGlobal

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerWorkingDirectory>$(TargetDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommandArguments>
</LocalDebuggerCommandArguments>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerWorkingDirectory>$(TargetDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommandArguments>
</LocalDebuggerCommandArguments>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LocalDebuggerWorkingDirectory>$(TargetDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup>
<ShowAllFiles>false</ShowAllFiles>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LocalDebuggerWorkingDirectory>$(TargetDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>