Skip to content

Commit

Permalink
switch: reapply switch changes on latest master again
Browse files Browse the repository at this point in the history
  • Loading branch information
fgsfdsfgs committed Jul 9, 2023
1 parent 99850ea commit 7f198aa
Show file tree
Hide file tree
Showing 51 changed files with 4,636 additions and 21 deletions.
41 changes: 37 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ if(CMAKE_CROSSCOMPILING)
include(${IMPORT_EXECUTABLES})
endif()

if( NINTENDO_SWITCH )
# our gcc complains about the use of alloca, stricmp, etc without including the appropriate headers
# unless we just do this
set( CMAKE_CXX_EXTENSIONS ON )
# used in both gzdoom and launcher
set( SWITCH_APP_VERSION "nx4.11-pre-1" )
endif()

# Recursive function to place PK3 archive source files into a hierarchy of source file in the IDE
function( assort_pk3_source_folder FOLDER_NAME PK3_DIR )
# Assort source files into folders in the IDE
Expand Down Expand Up @@ -202,6 +210,12 @@ endif()

option (HAVE_VULKAN "Enable Vulkan support" ON)
option (HAVE_GLES2 "Enable GLES2 support" ON)
option (NO_DISCORDRPC "Disable Discord RPC support" ON) # why the fuck was there no option for this

if( NINTENDO_SWITCH )
set( HAVE_VULKAN OFF )
set( NO_DISCORDRPC ON )
endif()

# no, we're not using external asmjit for now, we made too many modifications to our's.
# if the asmjit author uses our changes then we'll update this.
Expand All @@ -228,6 +242,10 @@ if( MSVC )
set( ALL_C_FLAGS "${ALL_C_FLAGS} /DHAVE_GLES2" )
endif()

if ( NO_DISCORDRPC )
set( ALL_C_FLAGS "${ALL_C_FLAGS} /DNO_DISCORDRPC" )
endif()

# Use SSE 2 as minimum always as the true color drawers needs it for __vectorcall
#set( ALL_C_FLAGS "${ALL_C_FLAGS} /arch:SSE2") # This is already the default

Expand Down Expand Up @@ -270,6 +288,10 @@ else()
set( ALL_C_FLAGS "${ALL_C_FLAGS} -DHAVE_GLES2" )
endif()

if ( NO_DISCORDRPC )
set( ALL_C_FLAGS "${ALL_C_FLAGS} -DNO_DISCORDRPC" )
endif()

if ( UNIX )
include(CheckSymbolExists)
check_symbol_exists( "fts_set" "fts.h" HAVE_FTS )
Expand All @@ -294,6 +316,9 @@ else()
# If we're compiling with a custom GCC on the Mac (which we know since g++-4.2 doesn't support C++11) statically link libgcc.
set( ALL_C_FLAGS "-static-libgcc" )
endif()
elseif( NINTENDO_SWITCH )
set( ALL_C_FLAGS "${ALL_C_FLAGS} -D__SWITCH__ -I$ENV{PORTLIBS_PREFIX}/include -I$ENV{DEVKITPRO}/libnx/include" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-class-memaccess" )
elseif( NOT MINGW )
# Generic GCC/Clang requires position independent executable to be enabled explicitly
set( ALL_C_FLAGS "${ALL_C_FLAGS} -fPIE" )
Expand Down Expand Up @@ -327,10 +352,14 @@ if (HAVE_VULKAN)
add_subdirectory( libraries/ZVulkan )
endif()

add_subdirectory( libraries/discordrpc EXCLUDE_FROM_ALL )
set( DRPC_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libraries/discordrpc/include" )
set( DRPC_LIBRARIES discord-rpc )
set( DRPC_LIBRARY discord-rpc )
if (NO_DISCORDRPC)
add_definitions()
else()
add_subdirectory( libraries/discordrpc EXCLUDE_FROM_ALL )
set( DRPC_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libraries/discordrpc/include" )
set( DRPC_LIBRARIES discord-rpc )
set( DRPC_LIBRARY discord-rpc )
endif()

if( ZLIB_FOUND AND NOT FORCE_INTERNAL_ZLIB )
message( STATUS "Using system zlib, includes found at ${ZLIB_INCLUDE_DIR}" )
Expand Down Expand Up @@ -410,6 +439,10 @@ install(DIRECTORY docs/

option( DYN_OPENAL "Dynamically load OpenAL" ON )

if( NINTENDO_SWITCH )
set( DYN_OPENAL OFF )
endif()

add_subdirectory( libraries/lzma )
add_subdirectory( tools )
add_subdirectory( libraries/gdtoa )
Expand Down
9 changes: 8 additions & 1 deletion libraries/lzma/C/CpuArch.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,15 @@ BoolInt CPU_IsSupported_SHA1(void) { return APPLE_CRYPTO_SUPPORT_VAL; }
BoolInt CPU_IsSupported_SHA2(void) { return APPLE_CRYPTO_SUPPORT_VAL; }
BoolInt CPU_IsSupported_AES (void) { return APPLE_CRYPTO_SUPPORT_VAL; }

#elif defined(__SWITCH__)

#else // __APPLE__
BoolInt CPU_IsSupported_NEON(void) { return 1; }
BoolInt CPU_IsSupported_CRC32(void) { return 1; }
BoolInt CPU_IsSupported_SHA1(void) { return 1; }
BoolInt CPU_IsSupported_SHA2(void) { return 1; }
BoolInt CPU_IsSupported_AES(void) { return 1; }

#else // not __APPLE__ or __SWITCH__

#include <sys/auxv.h>

Expand Down
Loading

0 comments on commit 7f198aa

Please sign in to comment.