From b803da8a582990898b1bccb667144f314a326a1b Mon Sep 17 00:00:00 2001 From: theofficialgman <28281419+theofficialgman@users.noreply.github.com> Date: Tue, 21 May 2024 20:39:34 -0400 Subject: [PATCH] Fix arm64 building and X11 conflicts (#214) --- .gitmodules | 3 +++ CMakeLists.txt | 32 ++++++++++++++++++++++++++------ include/rsp_vu.h | 9 ++++----- lib/rt64 | 2 +- lib/sse2neon | 1 + 5 files changed, 35 insertions(+), 12 deletions(-) create mode 160000 lib/sse2neon diff --git a/.gitmodules b/.gitmodules index 25e5d53..34f6676 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,3 +13,6 @@ [submodule "lib/lunasvg"] path = lib/lunasvg url = https://github.com/sammycage/lunasvg +[submodule "lib/sse2neon"] + path = lib/sse2neon + url = https://github.com/DLTcollab/sse2neon.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 243ba12..73156a4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -175,17 +175,25 @@ target_include_directories(Zelda64Recompiled PRIVATE ${CMAKE_SOURCE_DIR}/lib/rt64/src ${CMAKE_SOURCE_DIR}/lib/rt64/src/rhi ${CMAKE_SOURCE_DIR}/lib/rt64/src/render + ${CMAKE_SOURCE_DIR}/lib/sse2neon ${CMAKE_SOURCE_DIR}/lib/freetype-windows-binaries/include ${CMAKE_SOURCE_DIR}/lib/rt64/src/contrib/nativefiledialog-extended/src/include ${CMAKE_BINARY_DIR}/shaders ${CMAKE_CURRENT_BINARY_DIR} ) -target_compile_options(Zelda64Recompiled PRIVATE - -march=nehalem - -fno-strict-aliasing - -fms-extensions -) +if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64|AMD64") + target_compile_options(Zelda64Recompiled PRIVATE + -march=nehalem + -fno-strict-aliasing + -fms-extensions + ) +else() + target_compile_options(Zelda64Recompiled PRIVATE + -fno-strict-aliasing + -fms-extensions + ) +endif() if (WIN32) include(FetchContent) @@ -289,7 +297,19 @@ if (${WIN32}) set (DXC "${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/dxc/bin/x64/dxc.exe") add_compile_definitions(NOMINMAX) else() - set (DXC "LD_LIBRARY_PATH=${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/dxc/lib/x64" "${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/dxc/bin/x64/dxc") + if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64|AMD64") + if (APPLE) + set (DXC "DYLD_LIBRARY_PATH=${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/dxc/lib/x64" "${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/dxc/bin/x64/dxc") + else() + set (DXC "LD_LIBRARY_PATH=${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/dxc/lib/x64" "${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/dxc/bin/x64/dxc") + endif() + else() + if (APPLE) + set (DXC "DYLD_LIBRARY_PATH=${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/dxc/lib/arm64" "${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/dxc/bin/arm64/dxc-macos") + else() + set (DXC "LD_LIBRARY_PATH=${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/dxc/lib/arm64" "${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/dxc/bin/arm64/dxc-linux") + endif() + endif() endif() build_vertex_shader(Zelda64Recompiled "shaders/InterfaceVS.hlsl" "shaders/InterfaceVS.hlsl") diff --git a/include/rsp_vu.h b/include/rsp_vu.h index 8be1b1c..f98fdc7 100644 --- a/include/rsp_vu.h +++ b/include/rsp_vu.h @@ -20,14 +20,13 @@ // ---------------------------------------------------------------------- #include -#define ARCHITECTURE_AMD64 +#if defined(__x86_64__) || defined(_M_X64) #define ARCHITECTURE_SUPPORTS_SSE4_1 1 - -#if defined(ARCHITECTURE_AMD64) #include using v128 = __m128i; -#elif defined(ARCHITECTURE_ARM64) -#include +#elif defined(__aarch64__) || defined(_M_ARM64) +#define ARCHITECTURE_SUPPORTS_SSE4_1 1 +#include "sse2neon.h" using v128 = __m128i; #endif diff --git a/lib/rt64 b/lib/rt64 index ecdd609..1dd8012 160000 --- a/lib/rt64 +++ b/lib/rt64 @@ -1 +1 @@ -Subproject commit ecdd609c49fb5f10e3040335901d8860ef259f67 +Subproject commit 1dd801264dbbf7a2f4e8fc483d28664852f50082 diff --git a/lib/sse2neon b/lib/sse2neon new file mode 160000 index 0000000..42c7047 --- /dev/null +++ b/lib/sse2neon @@ -0,0 +1 @@ +Subproject commit 42c704755d3ec218ed9126a122f0a667beeb630a