mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-07-20 12:55:45 +00:00
Add native FreeBSD building functionality (#35)
This commit enables native building on FreeBSD through Cmake + ninja. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/35 Reviewed-by: crueter <crueter@eden-emu.dev> Co-authored-by: SDK-Chan <sdkchan@eden-emu.dev> Co-committed-by: SDK-Chan <sdkchan@eden-emu.dev>
This commit is contained in:
parent
e5074c90ad
commit
7f48f4efb6
4 changed files with 63 additions and 12 deletions
|
@ -17,6 +17,10 @@ if (MSVC)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3 /WX-")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3 /WX-")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L/usr/local/lib")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Check if SDL2::SDL2 target exists; if not, create an alias
|
# Check if SDL2::SDL2 target exists; if not, create an alias
|
||||||
if (TARGET SDL2::SDL2-static)
|
if (TARGET SDL2::SDL2-static)
|
||||||
add_library(SDL2::SDL2 ALIAS SDL2::SDL2-static)
|
add_library(SDL2::SDL2 ALIAS SDL2::SDL2-static)
|
||||||
|
@ -27,8 +31,12 @@ endif()
|
||||||
# Set bundled sdl2/qt as dependent options.
|
# Set bundled sdl2/qt as dependent options.
|
||||||
option(ENABLE_SDL2 "Enable the SDL2 frontend" ON)
|
option(ENABLE_SDL2 "Enable the SDL2 frontend" ON)
|
||||||
CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_SDL2 "Download bundled SDL2 binaries" ON "ENABLE_SDL2;MSVC" OFF)
|
CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_SDL2 "Download bundled SDL2 binaries" ON "ENABLE_SDL2;MSVC" OFF)
|
||||||
# On Linux system SDL2 is likely to be lacking HIDAPI support which have drawbacks but is needed for SDL motion
|
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
||||||
CMAKE_DEPENDENT_OPTION(YUZU_USE_EXTERNAL_SDL2 "Compile external SDL2" ON "ENABLE_SDL2;NOT MSVC" OFF)
|
# On Linux system SDL2 is likely to be lacking HIDAPI support which have drawbacks but is needed for SDL motion
|
||||||
|
CMAKE_DEPENDENT_OPTION(YUZU_USE_EXTERNAL_SDL2 "Compile external SDL2" OFF "ENABLE_SDL2;NOT MSVC" OFF)
|
||||||
|
else()
|
||||||
|
CMAKE_DEPENDENT_OPTION(YUZU_USE_EXTERNAL_SDL2 "Compile external SDL2" ON "ENABLE_SDL2;NOT MSVC" OFF)
|
||||||
|
endif()
|
||||||
|
|
||||||
cmake_dependent_option(ENABLE_LIBUSB "Enable the use of LibUSB" ON "NOT ANDROID" OFF)
|
cmake_dependent_option(ENABLE_LIBUSB "Enable the use of LibUSB" ON "NOT ANDROID" OFF)
|
||||||
|
|
||||||
|
@ -43,13 +51,29 @@ CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_QT "Download bundled Qt binaries" "${MSV
|
||||||
|
|
||||||
option(ENABLE_WEB_SERVICE "Enable web services (telemetry, etc.)" ON)
|
option(ENABLE_WEB_SERVICE "Enable web services (telemetry, etc.)" ON)
|
||||||
|
|
||||||
option(YUZU_USE_BUNDLED_FFMPEG "Download/Build bundled FFmpeg" "ON")
|
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
||||||
|
option(YUZU_USE_BUNDLED_FFMPEG "Download/Build bundled FFmpeg" OFF)
|
||||||
|
else()
|
||||||
|
option(YUZU_USE_BUNDLED_FFMPEG "Download/Build bundled FFmpeg" ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
option(YUZU_USE_EXTERNAL_VULKAN_HEADERS "Use Vulkan-Headers from externals" ON)
|
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
||||||
|
option(YUZU_USE_EXTERNAL_VULKAN_HEADERS "Use Vulkan-Headers from externals" OFF)
|
||||||
|
else()
|
||||||
|
option(YUZU_USE_EXTERNAL_VULKAN_HEADERS "Use Vulkan-Headers from externals" ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
option(YUZU_USE_EXTERNAL_VULKAN_UTILITY_LIBRARIES "Use Vulkan-Utility-Libraries from externals" ON)
|
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
||||||
|
option(YUZU_USE_EXTERNAL_VULKAN_UTILITY_LIBRARIES "Use Vulkan-Utility-Libraries from externals" OFF)
|
||||||
|
else()
|
||||||
|
option(YUZU_USE_EXTERNAL_VULKAN_UTILITY_LIBRARIES "Use Vulkan-Utility-Libraries from externals" ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
option(YUZU_USE_EXTERNAL_VULKAN_SPIRV_TOOLS "Use SPIRV-Tools from externals" ON)
|
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
||||||
|
option(YUZU_USE_EXTERNAL_VULKAN_SPIRV_TOOLS "Use SPIRV-Tools from externals" OFF)
|
||||||
|
else()
|
||||||
|
option(YUZU_USE_EXTERNAL_VULKAN_SPIRV_TOOLS "Use SPIRV-Tools from externals" ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
option(YUZU_USE_QT_MULTIMEDIA "Use QtMultimedia for Camera" OFF)
|
option(YUZU_USE_QT_MULTIMEDIA "Use QtMultimedia for Camera" OFF)
|
||||||
|
|
||||||
|
@ -61,7 +85,11 @@ option(USE_DISCORD_PRESENCE "Enables Discord Rich Presence" OFF)
|
||||||
|
|
||||||
option(YUZU_TESTS "Compile tests" "${BUILD_TESTING}")
|
option(YUZU_TESTS "Compile tests" "${BUILD_TESTING}")
|
||||||
|
|
||||||
option(YUZU_USE_PRECOMPILED_HEADERS "Use precompiled headers" ON)
|
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
||||||
|
option(YUZU_USE_PRECOMPILED_HEADERS "Use precompiled headers" OFF)
|
||||||
|
else()
|
||||||
|
option(YUZU_USE_PRECOMPILED_HEADERS "Use precompiled headers" ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
option(YUZU_DOWNLOAD_ANDROID_VVL "Download validation layer binary for android" ON)
|
option(YUZU_DOWNLOAD_ANDROID_VVL "Download validation layer binary for android" ON)
|
||||||
|
|
||||||
|
@ -75,7 +103,11 @@ CMAKE_DEPENDENT_OPTION(YUZU_CRASH_DUMPS "Compile crash dump (Minidump) support"
|
||||||
|
|
||||||
option(YUZU_USE_BUNDLED_VCPKG "Use vcpkg for yuzu dependencies" "${MSVC}")
|
option(YUZU_USE_BUNDLED_VCPKG "Use vcpkg for yuzu dependencies" "${MSVC}")
|
||||||
|
|
||||||
option(YUZU_CHECK_SUBMODULES "Check if submodules are present" ON)
|
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
||||||
|
option(YUZU_CHECK_SUBMODULES "Check if submodules are present" OFF)
|
||||||
|
else()
|
||||||
|
option(YUZU_CHECK_SUBMODULES "Check if submodules are present" ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
option(YUZU_ENABLE_LTO "Enable link-time optimization" OFF)
|
option(YUZU_ENABLE_LTO "Enable link-time optimization" OFF)
|
||||||
|
|
||||||
|
@ -337,7 +369,11 @@ if (NOT YUZU_USE_EXTERNAL_VULKAN_SPIRV_TOOLS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (ENABLE_LIBUSB)
|
if (ENABLE_LIBUSB)
|
||||||
find_package(libusb 1.0.24 MODULE)
|
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
||||||
|
find_package(libusb MODULE)
|
||||||
|
else()
|
||||||
|
find_package(libusb 1.0.24 MODULE)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (ARCHITECTURE_x86 OR ARCHITECTURE_x86_64)
|
if (ARCHITECTURE_x86 OR ARCHITECTURE_x86_64)
|
||||||
|
@ -429,7 +465,13 @@ if (ENABLE_QT)
|
||||||
list(APPEND CMAKE_PREFIX_PATH "${Qt6_DIR}")
|
list(APPEND CMAKE_PREFIX_PATH "${Qt6_DIR}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(Qt6 REQUIRED COMPONENTS Widgets Multimedia Concurrent)
|
# QT6 Multimedia pulls in unneeded audio systems (ALSA, Pulseaudio) for FreeBSD
|
||||||
|
# ALSA is the default sound system on Linux, but FreeBSD uses OSS which works well enough
|
||||||
|
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
||||||
|
find_package(Qt6 REQUIRED COMPONENTS Widgets Concurrent)
|
||||||
|
else()
|
||||||
|
find_package(Qt6 REQUIRED COMPONENTS Widgets Multimedia Concurrent)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (UNIX AND NOT APPLE)
|
if (UNIX AND NOT APPLE)
|
||||||
find_package(Qt6 REQUIRED COMPONENTS DBus)
|
find_package(Qt6 REQUIRED COMPONENTS DBus)
|
||||||
|
@ -485,7 +527,8 @@ if (UNIX AND NOT APPLE AND NOT ANDROID)
|
||||||
endif()
|
endif()
|
||||||
if (NOT YUZU_USE_BUNDLED_FFMPEG)
|
if (NOT YUZU_USE_BUNDLED_FFMPEG)
|
||||||
# Use system installed FFmpeg
|
# Use system installed FFmpeg
|
||||||
find_package(FFmpeg 4.3 REQUIRED QUIET COMPONENTS ${FFmpeg_COMPONENTS})
|
#find_package(FFmpeg 4.3 REQUIRED QUIET COMPONENTS ${FFmpeg_COMPONENTS})
|
||||||
|
find_package(FFmpeg REQUIRED QUIET COMPONENTS ${FFmpeg_COMPONENTS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ENABLE_QT)
|
if(ENABLE_QT)
|
||||||
|
|
2
externals/renderdoc/renderdoc_app.h
vendored
2
externals/renderdoc/renderdoc_app.h
vendored
|
@ -42,6 +42,8 @@
|
||||||
#define RENDERDOC_CC
|
#define RENDERDOC_CC
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
#define RENDERDOC_CC
|
#define RENDERDOC_CC
|
||||||
|
#elif defined(__FreeBSD__)
|
||||||
|
#define RENDERDOC_CC
|
||||||
#else
|
#else
|
||||||
#error "Unknown platform"
|
#error "Unknown platform"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1150,7 +1150,7 @@ add_library(core STATIC
|
||||||
tools/renderdoc.h
|
tools/renderdoc.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if (UNIX AND NOT APPLE AND NOT ANDROID)
|
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||||
# find_package(libiw REQUIRED)
|
# find_package(libiw REQUIRED)
|
||||||
target_link_libraries(core PRIVATE iw)
|
target_link_libraries(core PRIVATE iw)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -25,7 +25,13 @@ extern "C" {
|
||||||
#include <libavcodec/avcodec.h>
|
#include <libavcodec/avcodec.h>
|
||||||
#include <libavutil/opt.h>
|
#include <libavutil/opt.h>
|
||||||
#include <libavutil/pixdesc.h>
|
#include <libavutil/pixdesc.h>
|
||||||
|
|
||||||
|
// Works quite fine, and omits the hacky ffmpeg building for now...
|
||||||
|
#if defined(__FreeBSD__)
|
||||||
|
#include <libavcodec/codec.h>
|
||||||
|
#else
|
||||||
#include <libavcodec/codec_internal.h>
|
#include <libavcodec/codec_internal.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__GNUC__) || defined(__clang__)
|
#if defined(__GNUC__) || defined(__clang__)
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue