diff --git a/CMakeLists.txt b/CMakeLists.txt index d0296c091..ba8774ead 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -126,7 +126,8 @@ CMAKE_DEPENDENT_OPTION(ENABLE_LIBUSB "Enable libusb for GameCube Adapter support CMAKE_DEPENDENT_OPTION(ENABLE_SOFTWARE_RENDERER "Enables the software renderer" ON "NOT ANDROID" OFF) CMAKE_DEPENDENT_OPTION(ENABLE_OPENGL "Enables the OpenGL renderer" ${DEFAULT_ENABLE_OPENGL} "NOT APPLE" OFF) -option(ENABLE_VULKAN "Enables the Vulkan renderer" ON) +# NetBSD doesn't support Vulkan yet, remove this check when it does. +CMAKE_DEPENDENT_OPTION(ENABLE_VULKAN "Enables the Vulkan renderer" ON "NOT (BSD MATCHES \"NetBSD\")" OFF) option(USE_DISCORD_PRESENCE "Enables Discord Rich Presence" OFF) diff --git a/CMakeModules/DisablePaxMprotect.cmake b/CMakeModules/DisablePaxMprotect.cmake new file mode 100644 index 000000000..e5f83edd0 --- /dev/null +++ b/CMakeModules/DisablePaxMprotect.cmake @@ -0,0 +1,11 @@ +function(disable_pax_mprotect target) + if (BSD STREQUAL "NetBSD") + add_custom_command(TARGET ${target} POST_BUILD + COMMAND paxctl +m "$" + COMMENT "Disabling PaX MPROTECT restrictions for '${target}'" + VERBATIM + ) + else() + message(FATAL_ERROR "disable_pax_mprotect only applies on NetBSD.") + endif() +endfunction() diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index def146c62..5e56105fc 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt @@ -529,6 +529,15 @@ endif() else() target_include_directories(vulkan-headers INTERFACE ./vulkan-headers/include) target_disable_warnings(vulkan-headers) + if (BSD STREQUAL "NetBSD") + # There may be a better way to do this with + # find_package(X11), but I couldn't get + # CMake to do it, so we're depending on + # the x11-links package and assuming the + # prefix location. -OS + target_include_directories(vulkan-headers INTERFACE + /usr/pkg/share/x11-links/include) + endif() endif() # adrenotools diff --git a/src/citra_libretro/CMakeLists.txt b/src/citra_libretro/CMakeLists.txt index cd2f6baaf..797deedb7 100644 --- a/src/citra_libretro/CMakeLists.txt +++ b/src/citra_libretro/CMakeLists.txt @@ -31,6 +31,11 @@ add_library(azahar_libretro SHARED create_target_directory_groups(azahar_libretro) +if (BSD STREQUAL "NetBSD") + include(DisablePaxMprotect) + disable_pax_mprotect(azahar_libretro) +endif() + target_link_libraries(citra_common PRIVATE libretro) target_link_libraries(citra_core PRIVATE libretro) target_link_libraries(video_core PRIVATE libretro) diff --git a/src/citra_meta/CMakeLists.txt b/src/citra_meta/CMakeLists.txt index a8ca812c3..b19238a9c 100644 --- a/src/citra_meta/CMakeLists.txt +++ b/src/citra_meta/CMakeLists.txt @@ -6,6 +6,11 @@ add_executable(citra_meta set_target_properties(citra_meta PROPERTIES OUTPUT_NAME "azahar") +if (BSD STREQUAL "NetBSD") + include(DisablePaxMprotect) + disable_pax_mprotect(citra_meta) +endif() + if (APPLE) set(DIST_DIR "../../dist/apple") set(APPLE_RESOURCES diff --git a/src/citra_room_standalone/CMakeLists.txt b/src/citra_room_standalone/CMakeLists.txt index e48051469..3660b11aa 100644 --- a/src/citra_room_standalone/CMakeLists.txt +++ b/src/citra_room_standalone/CMakeLists.txt @@ -4,6 +4,11 @@ add_executable(citra_room_standalone set_target_properties(citra_room_standalone PROPERTIES OUTPUT_NAME "azahar-room") +if (BSD STREQUAL "NetBSD") + include(DisablePaxMprotect) + disable_pax_mprotect(citra_room_standalone) +endif() + target_link_libraries(citra_room_standalone PRIVATE citra_room) if(UNIX AND NOT APPLE) diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index f248ece4b..d35e6ba21 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -23,6 +23,11 @@ add_executable(tests create_target_directory_groups(tests) +if (BSD STREQUAL "NetBSD") + include(DisablePaxMprotect) + disable_pax_mprotect(tests) +endif() + target_link_libraries(tests PRIVATE citra_common citra_core video_core audio_core) target_link_libraries(tests PRIVATE ${PLATFORM_LIBRARIES} catch2 nihstro-headers Threads::Threads) diff --git a/src/video_core/pica/packed_attribute.h b/src/video_core/pica/packed_attribute.h index 7c8028e38..137c3fb25 100644 --- a/src/video_core/pica/packed_attribute.h +++ b/src/video_core/pica/packed_attribute.h @@ -1,9 +1,10 @@ -// Copyright 2023 Citra Emulator Project +// Copyright Citra Emulator Project / Azahar Emulator Project // Licensed under GPLv2 or any later version // Refer to the license.txt file included. #pragma once +#include #include #include "common/vector_math.h"