[cmake] account for sysroot when cross compiling for SunOS/FBSD/etc; dynarmic now uses ARCHITECTURE_* from global defs (#2928)
fixes when cross compiling for fbsd/openbsd Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2928 Reviewed-by: Caio Oliveira <caiooliveirafarias0@gmail.com> Reviewed-by: MaranBr <maranbr@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
This commit is contained in:
parent
c0663ccd6b
commit
5cc218084b
|
|
@ -48,12 +48,12 @@ endif()
|
||||||
# and you will be hailed for eternity
|
# and you will be hailed for eternity
|
||||||
if (PLATFORM_SUN)
|
if (PLATFORM_SUN)
|
||||||
# Terrific Solaris pkg shenanigans
|
# Terrific Solaris pkg shenanigans
|
||||||
list(APPEND CMAKE_PREFIX_PATH "/usr/lib/qt/6.6/lib/amd64/cmake")
|
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_SYSROOT}/usr/lib/qt/6.6/lib/amd64/cmake")
|
||||||
list(APPEND CMAKE_MODULE_PATH "/usr/lib/qt/6.6/lib/amd64/cmake")
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SYSROOT}/usr/lib/qt/6.6/lib/amd64/cmake")
|
||||||
|
|
||||||
# Amazing - absolutely incredible
|
# Amazing - absolutely incredible
|
||||||
list(APPEND CMAKE_PREFIX_PATH "/usr/lib/amd64/cmake")
|
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_SYSROOT}/usr/lib/amd64/cmake")
|
||||||
list(APPEND CMAKE_MODULE_PATH "/usr/lib/amd64/cmake")
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SYSROOT}/usr/lib/amd64/cmake")
|
||||||
|
|
||||||
# For some mighty reason, doing a normal release build sometimes may not trigger
|
# For some mighty reason, doing a normal release build sometimes may not trigger
|
||||||
# the proper -O3 switch to materialize
|
# the proper -O3 switch to materialize
|
||||||
|
|
@ -69,18 +69,18 @@ endif()
|
||||||
|
|
||||||
# Needed for FFmpeg w/ VAAPI and DRM
|
# Needed for FFmpeg w/ VAAPI and DRM
|
||||||
if (PLATFORM_OPENBSD)
|
if (PLATFORM_OPENBSD)
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I/usr/X11R6/include")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${CMAKE_SYSROOT}/usr/X11R6/include")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I/usr/X11R6/include")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${CMAKE_SYSROOT}/usr/X11R6/include")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L/usr/X11R6/lib")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L${CMAKE_SYSROOT}/usr/X11R6/lib")
|
||||||
elseif (PLATFORM_NETBSD)
|
elseif (PLATFORM_NETBSD)
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I/usr/X11R7/include")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${CMAKE_SYSROOT}/usr/X11R7/include")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I/usr/X11R7/include")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${CMAKE_SYSROOT}/usr/X11R7/include")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L/usr/X11R7/lib")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L${CMAKE_SYSROOT}/usr/X11R7/lib")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# NetBSD: Fun for the whole family!
|
# NetBSD: Fun for the whole family!
|
||||||
if (PLATFORM_NETBSD)
|
if (PLATFORM_NETBSD)
|
||||||
set(ENV{PKG_CONFIG_PATH} "${PKG_CONFIG_PATH}:/usr/pkg/lib/ffmpeg7/pkgconfig")
|
set(ENV{PKG_CONFIG_PATH} "${PKG_CONFIG_PATH}:${CMAKE_SYSROOT}/usr/pkg/lib/ffmpeg7/pkgconfig")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Detect current compilation architecture and create standard definitions
|
# Detect current compilation architecture and create standard definitions
|
||||||
|
|
@ -98,12 +98,14 @@ function(detect_architecture symbol arch)
|
||||||
if (ARCHITECTURE_${arch})
|
if (ARCHITECTURE_${arch})
|
||||||
set(ARCHITECTURE "${arch}" PARENT_SCOPE)
|
set(ARCHITECTURE "${arch}" PARENT_SCOPE)
|
||||||
set(ARCHITECTURE_${arch} 1 PARENT_SCOPE)
|
set(ARCHITECTURE_${arch} 1 PARENT_SCOPE)
|
||||||
add_definitions(-DARCHITECTURE_${arch}=1)
|
add_definitions("-DARCHITECTURE_${arch}=1")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
if (NOT ENABLE_GENERIC)
|
if (NOT ENABLE_GENERIC)
|
||||||
|
# https://sourceforge.net/p/predef/wiki/Architectures/
|
||||||
|
# TODO: THIS IS FUCKING FLAWED ONLY THE FIRST SYMBOL THAT APPEARS WILL BE CONSIDERED :(
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
detect_architecture("_M_AMD64" x86_64)
|
detect_architecture("_M_AMD64" x86_64)
|
||||||
detect_architecture("_M_IX86" x86)
|
detect_architecture("_M_IX86" x86)
|
||||||
|
|
@ -115,6 +117,48 @@ if (NOT ENABLE_GENERIC)
|
||||||
detect_architecture("__arm__" arm)
|
detect_architecture("__arm__" arm)
|
||||||
detect_architecture("__aarch64__" arm64)
|
detect_architecture("__aarch64__" arm64)
|
||||||
endif()
|
endif()
|
||||||
|
detect_architecture("__ARM64__" arm64)
|
||||||
|
detect_architecture("__aarch64__" arm64)
|
||||||
|
detect_architecture("_M_ARM64" arm64)
|
||||||
|
|
||||||
|
detect_architecture("__arm__" arm)
|
||||||
|
detect_architecture("__TARGET_ARCH_ARM" arm)
|
||||||
|
detect_architecture("_M_ARM" arm)
|
||||||
|
|
||||||
|
detect_architecture("__x86_64" x86_64)
|
||||||
|
detect_architecture("__x86_64__" x86_64)
|
||||||
|
detect_architecture("__amd64" x86_64)
|
||||||
|
detect_architecture("_M_X64" x86_64)
|
||||||
|
|
||||||
|
detect_architecture("__i386" x86)
|
||||||
|
detect_architecture("__i386__" x86)
|
||||||
|
detect_architecture("_M_IX86" x86)
|
||||||
|
|
||||||
|
detect_architecture("__ia64" ia64)
|
||||||
|
detect_architecture("__ia64__" ia64)
|
||||||
|
detect_architecture("_M_IA64" ia64)
|
||||||
|
|
||||||
|
detect_architecture("__mips" mips)
|
||||||
|
detect_architecture("__mips__" mips)
|
||||||
|
detect_architecture("_M_MRX000" mips)
|
||||||
|
|
||||||
|
detect_architecture("__powerpc64__" ppc64)
|
||||||
|
detect_architecture("__ppc64__" ppc64)
|
||||||
|
detect_architecture("__PPC64__" ppc64)
|
||||||
|
detect_architecture("_ARCH_PPC64" ppc64)
|
||||||
|
|
||||||
|
detect_architecture("__ppc__" ppc)
|
||||||
|
detect_architecture("__ppc" ppc)
|
||||||
|
detect_architecture("__powerpc__" ppc)
|
||||||
|
detect_architecture("_ARCH_COM" ppc)
|
||||||
|
detect_architecture("_ARCH_PWR" ppc)
|
||||||
|
detect_architecture("_ARCH_PPC" ppc)
|
||||||
|
detect_architecture("_M_MPPC" ppc)
|
||||||
|
detect_architecture("_M_PPC" ppc)
|
||||||
|
|
||||||
|
detect_architecture("__riscv" riscv)
|
||||||
|
|
||||||
|
detect_architecture("__EMSCRIPTEN__" wasm)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT DEFINED ARCHITECTURE)
|
if (NOT DEFINED ARCHITECTURE)
|
||||||
|
|
@ -166,7 +210,7 @@ if (MSVC AND NOT CXX_CLANG)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (PLATFORM_FREEBSD)
|
if (PLATFORM_FREEBSD)
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L/usr/local/lib")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L${CMAKE_SYSROOT}/usr/local/lib")
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,6 @@
|
||||||
|
# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
# SPDX-FileCopyrightText: 2019 Citra Emulator Project
|
# SPDX-FileCopyrightText: 2019 Citra Emulator Project
|
||||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
|
@ -75,16 +78,16 @@ function(find_ffmpeg LIBNAME)
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
list(APPEND INCLUDE_PATHS
|
list(APPEND INCLUDE_PATHS
|
||||||
/usr/local/include/ffmpeg
|
${CMAKE_SYSROOT}/usr/local/include/ffmpeg
|
||||||
/usr/local/include/lib${LIBNAME}
|
${CMAKE_SYSROOT}/usr/local/include/lib${LIBNAME}
|
||||||
/usr/include/ffmpeg
|
${CMAKE_SYSROOT}/usr/include/ffmpeg
|
||||||
/usr/include/lib${LIBNAME}
|
${CMAKE_SYSROOT}/usr/include/lib${LIBNAME}
|
||||||
/usr/include/ffmpeg/lib${LIBNAME}
|
${CMAKE_SYSROOT}/usr/include/ffmpeg/lib${LIBNAME}
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND LIB_PATHS
|
list(APPEND LIB_PATHS
|
||||||
/usr/local/lib
|
${CMAKE_SYSROOT}/usr/local/lib
|
||||||
/usr/lib
|
${CMAKE_SYSROOT}/usr/lib
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,6 @@ endif()
|
||||||
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMakeModules")
|
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMakeModules")
|
||||||
|
|
||||||
# Arch detection
|
# Arch detection
|
||||||
include(DetectArchitecture)
|
|
||||||
if (NOT DEFINED ARCHITECTURE)
|
if (NOT DEFINED ARCHITECTURE)
|
||||||
message(FATAL_ERROR "Unsupported architecture encountered. Ending CMake generation.")
|
message(FATAL_ERROR "Unsupported architecture encountered. Ending CMake generation.")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
|
|
@ -1,62 +0,0 @@
|
||||||
include(CheckSymbolExists)
|
|
||||||
|
|
||||||
if (CMAKE_OSX_ARCHITECTURES)
|
|
||||||
set(DYNARMIC_MULTIARCH_BUILD 1)
|
|
||||||
set(ARCHITECTURE "${CMAKE_OSX_ARCHITECTURES}")
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
function(detect_architecture symbol arch)
|
|
||||||
if (NOT DEFINED ARCHITECTURE)
|
|
||||||
set(CMAKE_REQUIRED_QUIET YES)
|
|
||||||
check_symbol_exists("${symbol}" "" DETECT_ARCHITECTURE_${arch})
|
|
||||||
unset(CMAKE_REQUIRED_QUIET)
|
|
||||||
|
|
||||||
if (DETECT_ARCHITECTURE_${arch})
|
|
||||||
set(ARCHITECTURE "${arch}" PARENT_SCOPE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
unset(DETECT_ARCHITECTURE_${arch} CACHE)
|
|
||||||
endif()
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
detect_architecture("__ARM64__" arm64)
|
|
||||||
detect_architecture("__aarch64__" arm64)
|
|
||||||
detect_architecture("_M_ARM64" arm64)
|
|
||||||
|
|
||||||
detect_architecture("__arm__" arm)
|
|
||||||
detect_architecture("__TARGET_ARCH_ARM" arm)
|
|
||||||
detect_architecture("_M_ARM" arm)
|
|
||||||
|
|
||||||
detect_architecture("__x86_64" x86_64)
|
|
||||||
detect_architecture("__x86_64__" x86_64)
|
|
||||||
detect_architecture("__amd64" x86_64)
|
|
||||||
detect_architecture("_M_X64" x86_64)
|
|
||||||
|
|
||||||
detect_architecture("__i386" x86)
|
|
||||||
detect_architecture("__i386__" x86)
|
|
||||||
detect_architecture("_M_IX86" x86)
|
|
||||||
|
|
||||||
detect_architecture("__ia64" ia64)
|
|
||||||
detect_architecture("__ia64__" ia64)
|
|
||||||
detect_architecture("_M_IA64" ia64)
|
|
||||||
|
|
||||||
detect_architecture("__mips" mips)
|
|
||||||
detect_architecture("__mips__" mips)
|
|
||||||
detect_architecture("_M_MRX000" mips)
|
|
||||||
|
|
||||||
detect_architecture("__ppc64__" ppc64)
|
|
||||||
detect_architecture("__powerpc64__" ppc64)
|
|
||||||
|
|
||||||
detect_architecture("__ppc__" ppc)
|
|
||||||
detect_architecture("__ppc" ppc)
|
|
||||||
detect_architecture("__powerpc__" ppc)
|
|
||||||
detect_architecture("_ARCH_COM" ppc)
|
|
||||||
detect_architecture("_ARCH_PWR" ppc)
|
|
||||||
detect_architecture("_ARCH_PPC" ppc)
|
|
||||||
detect_architecture("_M_MPPC" ppc)
|
|
||||||
detect_architecture("_M_PPC" ppc)
|
|
||||||
|
|
||||||
detect_architecture("__riscv" riscv)
|
|
||||||
|
|
||||||
detect_architecture("__EMSCRIPTEN__" wasm)
|
|
||||||
|
|
@ -29,7 +29,6 @@ target_link_libraries(dynarmic_tests PRIVATE merry::oaknut)
|
||||||
|
|
||||||
if (DYNARMIC_TESTS_USE_UNICORN)
|
if (DYNARMIC_TESTS_USE_UNICORN)
|
||||||
target_link_libraries(dynarmic_tests PRIVATE Unicorn::Unicorn)
|
target_link_libraries(dynarmic_tests PRIVATE Unicorn::Unicorn)
|
||||||
|
|
||||||
target_sources(dynarmic_tests PRIVATE
|
target_sources(dynarmic_tests PRIVATE
|
||||||
fuzz_util.cpp
|
fuzz_util.cpp
|
||||||
fuzz_util.h
|
fuzz_util.h
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue