mirror of https://github.com/libAthena/athena.git
Merge branch 'master' of ssh://git.axiodl.com:6431/libAthena/athena
This commit is contained in:
commit
5f2611702d
|
@ -29,9 +29,9 @@ list(APPEND CORE_EXTRA src/win32_largefilewrapper.c include/win32_largefilewrapp
|
||||||
src/athena/FileWriterWin32.cpp src/athena/FileReaderWin32.cpp)
|
src/athena/FileWriterWin32.cpp src/athena/FileReaderWin32.cpp)
|
||||||
else()
|
else()
|
||||||
list(APPEND CORE_EXTRA src/athena/FileWriterNix.cpp src/athena/FileReader.cpp)
|
list(APPEND CORE_EXTRA src/athena/FileWriterNix.cpp src/athena/FileReader.cpp)
|
||||||
if(APPLE OR GEKKO OR ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
if(APPLE OR GEKKO OR NX OR ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||||
list(APPEND CORE_EXTRA src/osx_largefilewrapper.c include/osx_largefilewrapper.h)
|
list(APPEND CORE_EXTRA src/osx_largefilewrapper.c include/osx_largefilewrapper.h)
|
||||||
if(GEKKO)
|
if(GEKKO OR NX)
|
||||||
list(APPEND CORE_EXTRA src/gekko_support.c include/gekko_support.h)
|
list(APPEND CORE_EXTRA src/gekko_support.c include/gekko_support.h)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
@ -243,12 +243,15 @@ install(EXPORT AthenaTargets DESTINATION ${INSTALL_CMAKE_DIR} COMPONENT athena)
|
||||||
# atdna import #
|
# atdna import #
|
||||||
################
|
################
|
||||||
|
|
||||||
if(NOT GEKKO AND NOT NX)
|
|
||||||
add_subdirectory(atdna)
|
add_subdirectory(atdna)
|
||||||
# Test target
|
# Test target
|
||||||
atdna(atdna_test.cpp atdna/test.hpp)
|
atdna(atdna_test.cpp atdna/test.hpp)
|
||||||
add_executable(atdna-test atdna/test.cpp atdna_test.cpp atdna/test.hpp)
|
add_executable(atdna-test atdna/test.cpp atdna_test.cpp atdna/test.hpp)
|
||||||
target_link_libraries(atdna-test athena-core athena-libyaml)
|
if (CMAKE_SYSTEM_NAME STREQUAL "Switch")
|
||||||
|
set_target_properties(atdna-test PROPERTIES SUFFIX ".elf")
|
||||||
|
target_link_libraries(atdna-test athena-core athena-libyaml nx)
|
||||||
|
else()
|
||||||
|
target_link_libraries(atdna-test athena-core athena-libyaml)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#########
|
#########
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
set(CMAKE_EXECUTABLE_SUFFIX ".nro.so")
|
||||||
|
SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE)
|
||||||
|
set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "/usr/bin/llvm-mc ${AS_FLAGS} <INCLUDES> <FLAGS> -o <OBJECT> <SOURCE>")
|
|
@ -0,0 +1,175 @@
|
||||||
|
|
||||||
|
get_filename_component(__tools_switch_sdir ${CMAKE_CURRENT_LIST_FILE} PATH) # Used to locate files to be used with configure_file
|
||||||
|
|
||||||
|
#############
|
||||||
|
## ELF2NRO ##
|
||||||
|
#############
|
||||||
|
if (NOT ELF2NRO)
|
||||||
|
# message(STATUS "Looking for makerom...")
|
||||||
|
find_program(ELF2NRO elf2nro ${DEVKITPRO}/tools/bin)
|
||||||
|
if (ELF2NRO)
|
||||||
|
message(STATUS "elf2nro: ${ELF2NRO} - found")
|
||||||
|
else ()
|
||||||
|
message(WARNING "elf2nro - not found")
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
#############
|
||||||
|
## ELF2KIP ##
|
||||||
|
#############
|
||||||
|
if (NOT ELF2KIP)
|
||||||
|
# message(STATUS "Looking for makerom...")
|
||||||
|
find_program(ELF2KIP elf2kip ${DEVKITPRO}/tools/bin)
|
||||||
|
if (ELF2KIP)
|
||||||
|
message(STATUS "elf2kip: ${ELF2KIP} - found")
|
||||||
|
else ()
|
||||||
|
message(WARNING "elf2kip - not found")
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
#############
|
||||||
|
## ELF2NSO ##
|
||||||
|
#############
|
||||||
|
if (NOT ELF2NSO)
|
||||||
|
# message(STATUS "Looking for makerom...")
|
||||||
|
find_program(ELF2NSO elf2nso ${DEVKITPRO}/tools/bin)
|
||||||
|
if (ELF2NSO)
|
||||||
|
message(STATUS "elf2nso: ${ELF2NSO} - found")
|
||||||
|
else ()
|
||||||
|
message(WARNING "elf2nso - not found")
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
#############
|
||||||
|
## BIN2S ##
|
||||||
|
#############
|
||||||
|
if (NOT BIN2S)
|
||||||
|
# message(STATUS "Looking for bin2s...")
|
||||||
|
find_program(BIN2S bin2s ${DEVKITPRO}/tools/bin)
|
||||||
|
if (BIN2S)
|
||||||
|
message(STATUS "bin2s: ${BIN2S} - found")
|
||||||
|
else ()
|
||||||
|
message(WARNING "bin2s - not found")
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
#############
|
||||||
|
## RAW2C ##
|
||||||
|
#############
|
||||||
|
if (NOT RAW2C)
|
||||||
|
# message(STATUS "Looking for bin2s...")
|
||||||
|
find_program(RAW2C raw2c ${DEVKITPRO}/tools/bin)
|
||||||
|
if (RAW2C)
|
||||||
|
message(STATUS "raw2c: ${RAW2C} - found")
|
||||||
|
else ()
|
||||||
|
message(WARNING "raw2c - not found")
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
##################
|
||||||
|
## BUILD_PFS0 ##
|
||||||
|
##################
|
||||||
|
if (NOT BUILD_PFS0)
|
||||||
|
# message(STATUS "Looking for bin2s...")
|
||||||
|
find_program(BUILD_PFS0 build_pfs0 ${DEVKITPRO}/tools/bin)
|
||||||
|
if (BUILD_PFS0)
|
||||||
|
message(STATUS "build_pfs0: ${BUILD_PFS0} - found")
|
||||||
|
else ()
|
||||||
|
message(WARNING "build_pfs0 - not found")
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
################
|
||||||
|
## NACPTOOL ##
|
||||||
|
################
|
||||||
|
if (NOT NACPTOOL)
|
||||||
|
# message(STATUS "Looking for bin2s...")
|
||||||
|
find_program(NACPTOOL nacptool ${DEVKITPRO}/tools/bin)
|
||||||
|
if (NACPTOOL)
|
||||||
|
message(STATUS "nacptool: ${NACPTOOL} - found")
|
||||||
|
else ()
|
||||||
|
message(WARNING "nacptool - not found")
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
|
||||||
|
function(__add_nacp target APP_TITLE APP_AUTHOR APP_VERSION)
|
||||||
|
set(__NACP_COMMAND ${NACPTOOL} --create ${APP_TITLE} ${APP_AUTHOR} ${APP_VERSION} ${CMAKE_CURRENT_BINARY_DIR}/${target})
|
||||||
|
|
||||||
|
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${target}
|
||||||
|
COMMAND ${__NACP_COMMAND}
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
endfunction()
|
||||||
|
function(add_nro_target target)
|
||||||
|
get_filename_component(target_we ${target} NAME_WE)
|
||||||
|
if ((NOT (${ARGC} GREATER 1 AND "${ARGV1}" STREQUAL "NO_NACP")) OR (${ARGC} GREATER 3))
|
||||||
|
if (${ARGC} GREATER 3)
|
||||||
|
set(APP_TITLE ${ARGV1})
|
||||||
|
set(APP_AUTHOR ${ARGV2})
|
||||||
|
set(APP_VERSION ${ARGV3})
|
||||||
|
endif ()
|
||||||
|
if (${ARGC} EQUAL 5)
|
||||||
|
set(APP_ICON ${ARGV4})
|
||||||
|
endif ()
|
||||||
|
if (NOT APP_TITLE)
|
||||||
|
set(APP_TITLE ${target})
|
||||||
|
endif ()
|
||||||
|
if (NOT APP_AUTHOR)
|
||||||
|
set(APP_AUTHOR "Unspecified Author")
|
||||||
|
endif ()
|
||||||
|
if (NOT APP_VERSION)
|
||||||
|
set(APP_VERSION "1.0")
|
||||||
|
endif ()
|
||||||
|
if (NOT APP_ICON)
|
||||||
|
if (EXISTS ${target}.png)
|
||||||
|
set(APP_ICON ${target}.jpg)
|
||||||
|
elseif (EXISTS icon.jpg)
|
||||||
|
set(APP_ICON icon.jpg)
|
||||||
|
elseif (NX)
|
||||||
|
set(APP_ICON ${DEVKITPRO}/libnx/default_icon.jpg)
|
||||||
|
else ()
|
||||||
|
message(FATAL_ERROR "No icon found ! Please use NO_SMDH or provide some icon.")
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
if (NOT ${target_we}.nacp)
|
||||||
|
__add_nacp(${target_we}.nacp ${APP_TITLE} ${APP_AUTHOR} ${APP_VERSION})
|
||||||
|
endif ()
|
||||||
|
if (CMAKE_RUNTIME_OUTPUT_DIRECTORY)
|
||||||
|
add_custom_command(OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target_we}.nro
|
||||||
|
COMMAND ${ELF2NRO} $<TARGET_FILE:${target}> ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target_we}.nro --icon=${APP_ICON} --nacp=${CMAKE_CURRENT_BINARY_DIR}/${target_we}.nacp
|
||||||
|
DEPENDS ${target} ${CMAKE_CURRENT_BINARY_DIR}/${target_we}.nacp
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
else ()
|
||||||
|
message("${CMAKE_CURRENT_BINARY_DIR}/${target_we}.nacp")
|
||||||
|
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${target_we}.nro
|
||||||
|
COMMAND ${ELF2NRO} $<TARGET_FILE:${target}> ${CMAKE_CURRENT_BINARY_DIR}/${target_we}.nro --icon=${APP_ICON} --nacp=${CMAKE_CURRENT_BINARY_DIR}/${target_we}.nacp
|
||||||
|
DEPENDS ${target} ${CMAKE_CURRENT_BINARY_DIR}/${target_we}.nacp
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
endif ()
|
||||||
|
else ()
|
||||||
|
message(STATUS "No nacp file will be generated")
|
||||||
|
if (CMAKE_RUNTIME_OUTPUT_DIRECTORY)
|
||||||
|
add_custom_command(OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target_we}.nro
|
||||||
|
COMMAND ${ELF2NRO} $<TARGET_FILE:${target}> ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target_we}.nro
|
||||||
|
DEPENDS ${target}
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
else ()
|
||||||
|
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${target_we}.nro
|
||||||
|
COMMAND ${ELF2NRO} $<TARGET_FILE:${target}> ${CMAKE_CURRENT_BINARY_DIR}/${target_we}.nro
|
||||||
|
DEPENDS ${target}
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
endif ()
|
||||||
|
if (CMAKE_RUNTIME_OUTPUT_DIRECTORY)
|
||||||
|
add_custom_target(${target_we}_nro ALL SOURCES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target_we}.nro)
|
||||||
|
|
||||||
|
else ()
|
||||||
|
add_custom_target(${target_we}_nro ALL SOURCES ${CMAKE_CURRENT_BINARY_DIR}/${target_we}.nro)
|
||||||
|
endif ()
|
||||||
|
endfunction()
|
|
@ -0,0 +1,71 @@
|
||||||
|
set(Python_ADDITIONAL_VERSIONS 3.4 3.5 3.6)
|
||||||
|
find_package(PythonInterp 3 REQUIRED)
|
||||||
|
|
||||||
|
set(CONVERTER "${LIBTRN}/tools/elf2nxo.py")
|
||||||
|
|
||||||
|
function(add_nro_target target)
|
||||||
|
get_filename_component(target_we ${target} NAME_WE)
|
||||||
|
if ((NOT (${ARGC} GREATER 1 AND "${ARGV1}" STREQUAL "NO_HDR")) OR (${ARGC} GREATER 3))
|
||||||
|
if (${ARGC} GREATER 3)
|
||||||
|
set(APP_TITLE ${ARGV1})
|
||||||
|
set(APP_AUTHOR ${ARGV2})
|
||||||
|
set(APP_VERSION ${ARGV3})
|
||||||
|
endif ()
|
||||||
|
if (${ARGC} EQUAL 5)
|
||||||
|
set(APP_ICON ${ARGV4})
|
||||||
|
endif ()
|
||||||
|
if (NOT APP_TITLE)
|
||||||
|
set(APP_TITLE ${target})
|
||||||
|
endif ()
|
||||||
|
if (NOT APP_AUTHOR)
|
||||||
|
set(APP_AUTHOR "Unspecified Author")
|
||||||
|
endif ()
|
||||||
|
if (NOT APP_VERSION)
|
||||||
|
set(APP_VERSION "1.0")
|
||||||
|
endif ()
|
||||||
|
if (NOT APP_ICON)
|
||||||
|
if (EXISTS ${target}.png)
|
||||||
|
set(APP_ICON ${target}.png)
|
||||||
|
elseif (EXISTS icon.png)
|
||||||
|
set(APP_ICON icon.png)
|
||||||
|
else ()
|
||||||
|
message(FATAL_ERROR "No icon found ! Please use NO_SMDH or provide some icon.")
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
if (CMAKE_RUNTIME_OUTPUT_DIRECTORY)
|
||||||
|
add_custom_command(OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target_we}.nro
|
||||||
|
COMMAND ${PYTHON_EXECUTABLE} ${CONVERTER} -n ${APP_TITLE} -d ${APP_AUTHOR} -v ${APP_VERSION} -i ${APP_ICON} $<TARGET_FILE:${target}> ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target_we}.nro nro
|
||||||
|
DEPENDS ${target} ${CMAKE_CURRENT_BINARY_DIR}/${target_we}.nacp
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
else ()
|
||||||
|
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${target_we}.nro
|
||||||
|
COMMAND ${PYTHON_EXECUTABLE} ${CONVERTER} -n ${APP_TITLE} -d ${APP_AUTHOR} -v ${APP_VERSION} -i ${APP_ICON} $<TARGET_FILE:${target}> ${CMAKE_CURRENT_BINARY_DIR}/${target_we}.nro nro
|
||||||
|
DEPENDS ${target} ${CMAKE_CURRENT_BINARY_DIR}/${target_we}.nacp
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
endif ()
|
||||||
|
else ()
|
||||||
|
message(STATUS "No header will be generated")
|
||||||
|
if (CMAKE_RUNTIME_OUTPUT_DIRECTORY)
|
||||||
|
add_custom_command(OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target_we}.nro
|
||||||
|
COMMAND ${PYTHON_EXECUTABLE} ${CONVERTER} $<TARGET_FILE:${target}> ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target_we}.nro nro
|
||||||
|
DEPENDS ${target}
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
else ()
|
||||||
|
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${target_we}.nro
|
||||||
|
COMMAND ${PYTHON_EXECUTABLE} ${CONVERTER} $<TARGET_FILE:${target}> ${CMAKE_CURRENT_BINARY_DIR}/${target_we}.nro nro
|
||||||
|
DEPENDS ${target}
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
endif ()
|
||||||
|
if (CMAKE_RUNTIME_OUTPUT_DIRECTORY)
|
||||||
|
add_custom_target(${target_we}_nro ALL SOURCES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target_we}.nro)
|
||||||
|
|
||||||
|
else ()
|
||||||
|
add_custom_target(${target_we}_nro ALL SOURCES ${CMAKE_CURRENT_BINARY_DIR}/${target_we}.nro)
|
||||||
|
endif ()
|
||||||
|
endfunction()
|
|
@ -1,7 +1,7 @@
|
||||||
if(NOT WIN32 AND NOT APPLE)
|
if(NOT WIN32 AND NOT APPLE AND NOT NX)
|
||||||
find_library(LZO_LIB lzo2)
|
find_library(LZO_LIB lzo2)
|
||||||
endif()
|
endif()
|
||||||
if(WIN32 OR APPLE OR LZO_LIB STREQUAL LZO_LIB-NOTFOUND)
|
if(WIN32 OR APPLE OR NX OR LZO_LIB STREQUAL LZO_LIB-NOTFOUND)
|
||||||
include_directories(include)
|
include_directories(include)
|
||||||
message(STATUS "Using Athena's built-in lzo")
|
message(STATUS "Using Athena's built-in lzo")
|
||||||
add_library(lzo2
|
add_library(lzo2
|
||||||
|
@ -77,7 +77,7 @@ add_library(lzo2
|
||||||
include/lzo/lzoconf.h
|
include/lzo/lzoconf.h
|
||||||
include/lzo/lzodefs.h
|
include/lzo/lzodefs.h
|
||||||
include/lzo/lzoutil.h)
|
include/lzo/lzoutil.h)
|
||||||
if(WIN32 AND NOT UNIX)
|
if(WIN32 AND NOT UNIX AND NOT NX)
|
||||||
install(DIRECTORY include/lzo DESTINATION include COMPONENT lzo2)
|
install(DIRECTORY include/lzo DESTINATION include COMPONENT lzo2)
|
||||||
install(TARGETS lzo2 DESTINATION lib COMPONENT lzo2)
|
install(TARGETS lzo2 DESTINATION lib COMPONENT lzo2)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
#endif
|
#endif
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
#ifdef GEKKO
|
#if defined(GEKKO) || defined(__SWITCH__)
|
||||||
#include "gekko_support.h"
|
#include "gekko_support.h"
|
||||||
typedef struct stat atStat64_t;
|
typedef struct stat atStat64_t;
|
||||||
#define atStat64 stat
|
#define atStat64 stat
|
||||||
|
|
|
@ -8,6 +8,8 @@ namespace athena::Sakura
|
||||||
class SpriteFile;
|
class SpriteFile;
|
||||||
} // Sakura
|
} // Sakura
|
||||||
|
|
||||||
|
namespace athena
|
||||||
|
{
|
||||||
namespace io
|
namespace io
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -19,6 +21,7 @@ public:
|
||||||
|
|
||||||
Sakura::SpriteFile* readFile();
|
Sakura::SpriteFile* readFile();
|
||||||
};
|
};
|
||||||
|
}
|
||||||
} // zelda
|
} // zelda
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <vector>
|
||||||
#include "athena/Global.hpp"
|
#include "athena/Global.hpp"
|
||||||
|
|
||||||
namespace athena
|
namespace athena
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
#include "athena/Global.hpp"
|
#include "athena/Global.hpp"
|
||||||
|
|
||||||
namespace athena
|
namespace athena
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef GEKKO_SUPPORT_H
|
#ifndef GEKKO_SUPPORT_H
|
||||||
#define GEKKO_SUPPORT_H
|
#define GEKKO_SUPPORT_H
|
||||||
|
|
||||||
#ifdef GEKKO
|
#if defined(GEKKO) || defined(__SWITCH__)
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
|
@ -11,6 +11,11 @@
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef __SWITCH__
|
||||||
|
#define ftello64 ftello
|
||||||
|
#define fseeko64 fseeko
|
||||||
|
#endif
|
||||||
|
|
||||||
char *
|
char *
|
||||||
realpath(const char *path, char *resolved);
|
realpath(const char *path, char *resolved);
|
||||||
int
|
int
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
set(CMAKE_SYSTEM_NAME "Switch")
|
||||||
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
|
set(CMAKE_C_STANDARD 11)
|
||||||
|
set(WITH_PORTLIBS ON CACHE BOOL "use portlibs ?")
|
||||||
|
|
||||||
|
macro(msys_to_cmake_path MsysPath ResultingPath)
|
||||||
|
if(WIN32)
|
||||||
|
string(REGEX REPLACE "^/([a-zA-Z])/" "\\1:/" ${ResultingPath} "${MsysPath}")
|
||||||
|
else()
|
||||||
|
set(${ResultingPath} "${MsysPath}")
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
msys_to_cmake_path("$ENV{DEVKITPRO}" DEVKITPRO)
|
||||||
|
|
||||||
|
set(NX 1)
|
||||||
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
|
||||||
|
include(SwitchTools_nx)
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
set(CMAKE_C_COMPILER "${DEVKITPRO}/devkitA64/bin/aarch64-none-elf-gcc.exe")
|
||||||
|
set(CMAKE_CXX_COMPILER "${DEVKITPRO}/devkitA64/bin/aarch64-none-elf-g++.exe")
|
||||||
|
set(CMAKE_AR "${DEVKITPRO}/devkitA64/bin/aarch64-none-elf-gcc-ar.exe" CACHE STRING "")
|
||||||
|
set(CMAKE_RANLIB "${DEVKITPRO}/devkitA64/bin/aarch64-none-elf-gcc-ranlib.exe" CACHE STRING "")
|
||||||
|
else()
|
||||||
|
set(CMAKE_C_COMPILER "${DEVKITPRO}/devkitA64/bin/aarch64-none-elf-gcc")
|
||||||
|
set(CMAKE_CXX_COMPILER "${DEVKITPRO}/devkitA64/bin/aarch64-none-elf-g++")
|
||||||
|
set(CMAKE_AR "${DEVKITPRO}/devkitA64/bin/aarch64-none-elf-gcc-ar" CACHE STRING "")
|
||||||
|
set(CMAKE_RANLIB "${DEVKITPRO}/devkitA64/bin/aarch64-none-elf-gcc-ranlib" CACHE STRING "")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(PKG_CONFIG "${DEVKITPRO}/portlibs/bin/aarch64-none-elf-pkg-config" CACHE STRING "")
|
||||||
|
set(CPPFLAGS "-D__SWITCH__ -I${DEVKITPRO}/libnx/include -I${DEVKITPRO}/portlibs/switch/include")
|
||||||
|
set(CMAKE_C_FLAGS "${CPPFLAGS} -march=armv8-a -neon -mtune=cortex-a57 -mfpu=neon -mtp=soft -fPIC -ffunction-sections" CACHE STRING "C flags")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CPPFLAGS} ${CMAKE_C_FLAGS} -fno-exceptions -std=gnu++11" CACHE STRING "C++ flags")
|
||||||
|
|
||||||
|
if(WITH_PORTLIBS)
|
||||||
|
set(CMAKE_FIND_ROOT_PATH / ${DEVKITPRO}/devkitA64 ${DEVKITPRO} ${DEVKITPRO}/libnx ${DEVKITPRO}/portlibs/switch)
|
||||||
|
else()
|
||||||
|
set(CMAKE_FIND_ROOT_PATH / ${DEVKITPRO}/devkitA64 ${DEVKITPRO}/libnx ${DEVKITPRO})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||||
|
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||||
|
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||||
|
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
||||||
|
#set(CMAKE_STATIC_LINKER_FLAGS_INIT "-march=armv8-a -mtune=cortex-a57 -mtp=soft -L${DEVKITPRO}/libnx/lib -L${DEVKITPRO}/portlibs/switch/lib")
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS "-specs=${DEVKITPRO}/libnx/switch.specs -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE -L${DEVKITPRO}/libnx/lib -L${DEVKITPRO}/portlibs/switch/lib")
|
||||||
|
|
||||||
|
|
||||||
|
set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "Shared libs not available")
|
||||||
|
set(CMAKE_INSTALL_PREFIX ${DEVKITPRO}/portlibs/switch)
|
|
@ -3,7 +3,7 @@
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
#include <intrin.h>
|
#include <intrin.h>
|
||||||
#elif !GEKKO
|
#elif !defined(GEKKO) && !defined(__SWITCH__)
|
||||||
#include <cpuid.h>
|
#include <cpuid.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,13 @@
|
||||||
|
|
||||||
#if __APPLE__ || __FreeBSD__
|
#if __APPLE__ || __FreeBSD__
|
||||||
#include "osx_largefilewrapper.h"
|
#include "osx_largefilewrapper.h"
|
||||||
#elif GEKKO
|
#elif GEKKO || __SWITCH__
|
||||||
#include "gekko_support.h"
|
#include "gekko_support.h"
|
||||||
#include "osx_largefilewrapper.h"
|
#include "osx_largefilewrapper.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
namespace athena::io
|
namespace athena::io
|
||||||
{
|
{
|
||||||
FileWriter::FileWriter(std::string_view filename, bool overwrite, bool globalErr)
|
FileWriter::FileWriter(std::string_view filename, bool overwrite, bool globalErr)
|
||||||
|
@ -82,6 +84,10 @@ void FileWriter::close()
|
||||||
m_fileHandle = NULL;
|
m_fileHandle = NULL;
|
||||||
|
|
||||||
std::string tmpFilename = m_filename + '~';
|
std::string tmpFilename = m_filename + '~';
|
||||||
|
#ifdef __SWITCH__
|
||||||
|
/* Due to Horizon not being a fully POSIX compatible OS, we need to make sure the file *does not* exist before attempting to rename */
|
||||||
|
unlink(m_filename.c_str());
|
||||||
|
#endif
|
||||||
rename(tmpFilename.c_str(), m_filename.c_str());
|
rename(tmpFilename.c_str(), m_filename.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "athena/SkywardSwordQuest.hpp"
|
#include "athena/SkywardSwordQuest.hpp"
|
||||||
#include "athena/Checksums.hpp"
|
#include "athena/Checksums.hpp"
|
||||||
|
#include "athena/Utility.hpp"
|
||||||
#include "utf8proc.h"
|
#include "utf8proc.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "athena/WiiFile.hpp"
|
#include "athena/WiiFile.hpp"
|
||||||
|
#include "athena/Utility.hpp"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
namespace athena
|
namespace athena
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#if defined(GEKKO)
|
#if defined(GEKKO) || defined(__SWITCH__)
|
||||||
#include "gekko_support.h"
|
#include "gekko_support.h"
|
||||||
#define SYMLOOP_MAX 8
|
#define SYMLOOP_MAX 8
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
Loading…
Reference in New Issue