summaryrefslogtreecommitdiff
path: root/ZAPDTR
diff options
context:
space:
mode:
authorth-2021 <90853655+th-2021@users.noreply.github.com>2022-08-05 07:59:19 +0200
committerGitHub <noreply@github.com>2022-08-05 07:59:19 +0200
commit1ebca42f46712293a38a571ab46285a23e9fc2e6 (patch)
tree2ab9388eec98c6c4e1dbcc9f51ce47d62597b8ce /ZAPDTR
parent93d0d7443a3443905a31556a28f060d885ee22dd (diff)
Move to cmake across all platforms (#363)
Diffstat (limited to 'ZAPDTR')
-rw-r--r--ZAPDTR/Makefile146
-rw-r--r--ZAPDTR/ZAPD/CMakeLists.txt486
-rw-r--r--ZAPDTR/ZAPD/pathconf.c6
-rw-r--r--ZAPDTR/ZAPDTR.sln82
-rw-r--r--ZAPDTR/ZAPDUtils/CMakeLists.txt218
-rw-r--r--ZAPDTR/ZAPDUtils/Makefile29
-rw-r--r--ZAPDTR/ZAPDUtils/Makefile.switch171
7 files changed, 710 insertions, 428 deletions
diff --git a/ZAPDTR/Makefile b/ZAPDTR/Makefile
deleted file mode 100644
index 660e0469c..000000000
--- a/ZAPDTR/Makefile
+++ /dev/null
@@ -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)
diff --git a/ZAPDTR/ZAPD/CMakeLists.txt b/ZAPDTR/ZAPD/CMakeLists.txt
new file mode 100644
index 000000000..748793885
--- /dev/null
+++ b/ZAPDTR/ZAPD/CMakeLists.txt
@@ -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()
diff --git a/ZAPDTR/ZAPD/pathconf.c b/ZAPDTR/ZAPD/pathconf.c
new file mode 100644
index 000000000..8ef448999
--- /dev/null
+++ b/ZAPDTR/ZAPD/pathconf.c
@@ -0,0 +1,6 @@
+#include <unistd.h>
+
+long pathconf(const char *path, int name) {
+ return -1;
+}
+
diff --git a/ZAPDTR/ZAPDTR.sln b/ZAPDTR/ZAPDTR.sln
deleted file mode 100644
index 82538dd9f..000000000
--- a/ZAPDTR/ZAPDTR.sln
+++ /dev/null
@@ -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
diff --git a/ZAPDTR/ZAPDUtils/CMakeLists.txt b/ZAPDTR/ZAPDUtils/CMakeLists.txt
new file mode 100644
index 000000000..68e83591e
--- /dev/null
+++ b/ZAPDTR/ZAPDUtils/CMakeLists.txt
@@ -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.
+
+
diff --git a/ZAPDTR/ZAPDUtils/Makefile b/ZAPDTR/ZAPDUtils/Makefile
deleted file mode 100644
index b9c4e29ad..000000000
--- a/ZAPDTR/ZAPDUtils/Makefile
+++ /dev/null
@@ -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 $@ $^
diff --git a/ZAPDTR/ZAPDUtils/Makefile.switch b/ZAPDTR/ZAPDUtils/Makefile.switch
deleted file mode 100644
index ed173c44f..000000000
--- a/ZAPDTR/ZAPDUtils/Makefile.switch
+++ /dev/null
@@ -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
-#--------------------------------------------------------------------------------------- \ No newline at end of file