mirror of https://github.com/libAthena/athena.git
Various NX build fixes
This commit is contained in:
parent
5306525029
commit
80c283736e
|
@ -123,11 +123,11 @@ function(add_nro_target target)
|
|||
endif ()
|
||||
if (NOT APP_ICON)
|
||||
if (EXISTS ${target}.png)
|
||||
set(APP_ICON ${target}.png)
|
||||
elseif (EXISTS icon.png)
|
||||
set(APP_ICON icon.png)
|
||||
set(APP_ICON ${target}.jpg)
|
||||
elseif (EXISTS icon.jpg)
|
||||
set(APP_ICON icon.jpg)
|
||||
elseif (NX)
|
||||
set(APP_ICON ${DEVKITPRO}/libnx/default_icon.png)
|
||||
set(APP_ICON ${DEVKITPRO}/libnx/default_icon.jpg)
|
||||
else ()
|
||||
message(FATAL_ERROR "No icon found ! Please use NO_SMDH or provide some icon.")
|
||||
endif ()
|
||||
|
@ -137,13 +137,14 @@ function(add_nro_target target)
|
|||
endif ()
|
||||
if (CMAKE_RUNTIME_OUTPUT_DIRECTORY)
|
||||
add_custom_command(OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target_we}.nro
|
||||
COMMAND ${ELF2NRO} $<TARGET_FILE:${target}> --icon=${APP_ICON} --nacp=${CMAKE_CURRENT_BINARY_DIR}/${target_we}.nacp ${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}> --icon=${APP_ICON} --nacp=${CMAKE_CURRENT_BINARY_DIR}/${target_we}.nacp ${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
|
||||
)
|
||||
|
|
|
@ -30,7 +30,7 @@ else()
|
|||
endif()
|
||||
|
||||
set(PKG_CONFIG "${DEVKITPRO}/portlibs/bin/aarch64-none-elf-pkg-config" CACHE STRING "")
|
||||
set(CPPFLAGS "-D__SWITCH__ -D__USE_LARGEFILE64=1 -D__USE_LARGEOFFSET64=1 -I${DEVKITPRO}/libnx/include -I${DEVKITPRO}/portlibs/switch/include")
|
||||
set(CPPFLAGS "-D__SWITCH__ -I${DEVKITPRO}/libnx/include -I${DEVKITPRO}/portlibs/switch/include")
|
||||
set(CMAKE_C_FLAGS "${CPPFLAGS} -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIC -ffunction-sections" CACHE STRING "C flags")
|
||||
set(CMAKE_CXX_FLAGS "${CPPFLAGS} ${CMAKE_C_FLAGS} -fno-rtti -fno-exceptions -std=gnu++11" CACHE STRING "C++ flags")
|
||||
|
||||
|
@ -45,7 +45,8 @@ 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_INIT "-specs=${DEVKITPRO}/libnx/switch.specs -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE -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)
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
#include "osx_largefilewrapper.h"
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
namespace athena::io
|
||||
{
|
||||
FileWriter::FileWriter(std::string_view filename, bool overwrite, bool globalErr)
|
||||
|
@ -82,6 +84,10 @@ void FileWriter::close()
|
|||
m_fileHandle = NULL;
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue