diff --git a/common/wivrn_config.h.in b/common/wivrn_config.h.in index 6a960b52..83502ecc 100644 --- a/common/wivrn_config.h.in +++ b/common/wivrn_config.h.in @@ -19,16 +19,16 @@ #pragma once -#cmakedefine WIVRN_USE_NVENC -#cmakedefine WIVRN_USE_VAAPI -#cmakedefine WIVRN_USE_X264 +#cmakedefine01 WIVRN_USE_NVENC +#cmakedefine01 WIVRN_USE_VAAPI +#cmakedefine01 WIVRN_USE_X264 -#cmakedefine WIVRN_USE_SYSTEMD +#cmakedefine01 WIVRN_USE_SYSTEMD -#cmakedefine WIVRN_USE_PIPEWIRE -#cmakedefine WIVRN_USE_PULSEAUDIO +#cmakedefine01 WIVRN_USE_PIPEWIRE +#cmakedefine01 WIVRN_USE_PULSEAUDIO -#cmakedefine WIVRN_FEATURE_STEAMVR_LIGHTHOUSE -#cmakedefine WIVRN_FEATURE_SOLARXR +#cmakedefine01 WIVRN_FEATURE_STEAMVR_LIGHTHOUSE +#cmakedefine01 WIVRN_FEATURE_SOLARXR #define WIVRN_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@" diff --git a/server/audio/audio_setup.cpp b/server/audio/audio_setup.cpp index 4aa8fc74..ad5f7d1c 100644 --- a/server/audio/audio_setup.cpp +++ b/server/audio/audio_setup.cpp @@ -22,11 +22,11 @@ #include "util/u_logging.h" #include "wivrn_config.h" -#ifdef WIVRN_USE_PULSEAUDIO +#if WIVRN_USE_PULSEAUDIO #include "audio_pulse.h" #endif -#ifdef WIVRN_USE_PIPEWIRE +#if WIVRN_USE_PIPEWIRE #include "audio_pipewire.h" #endif @@ -38,12 +38,12 @@ std::shared_ptr audio_device::create( const xrt::drivers::wivrn::from_headset::headset_info_packet & info, xrt::drivers::wivrn::wivrn_session & session) { -#ifdef WIVRN_USE_PIPEWIRE +#if WIVRN_USE_PIPEWIRE if (auto res = create_pipewire_handle(source_name, source_description, sink_name, sink_description, info, session)) return res; #endif -#ifdef WIVRN_USE_PULSEAUDIO +#if WIVRN_USE_PULSEAUDIO if (auto res = create_pulse_handle(source_name, source_description, sink_name, sink_description, info, session)) return res; #endif diff --git a/server/driver/wivrn_session.cpp b/server/driver/wivrn_session.cpp index a3028f5d..3eb97be7 100644 --- a/server/driver/wivrn_session.cpp +++ b/server/driver/wivrn_session.cpp @@ -47,11 +47,11 @@ #include #include -#ifdef WIVRN_FEATURE_STEAMVR_LIGHTHOUSE +#if WIVRN_FEATURE_STEAMVR_LIGHTHOUSE #include "steamvr_lh_interface.h" #endif -#ifdef WIVRN_FEATURE_SOLARXR +#if WIVRN_FEATURE_SOLARXR #include "solarxr_device.h" #endif @@ -189,7 +189,7 @@ xrt_result_t xrt::drivers::wivrn::wivrn_session::create_session(xrt::drivers::wi usysds->base.base.static_roles.hand_tracking.right = self->right_hand.get(); } -#ifdef WIVRN_FEATURE_STEAMVR_LIGHTHOUSE +#if WIVRN_FEATURE_STEAMVR_LIGHTHOUSE auto use_steamvr_lh = std::getenv("WIVRN_USE_STEAMVR_LH"); xrt_system_devices * lhdevs = NULL; @@ -230,7 +230,7 @@ xrt_result_t xrt::drivers::wivrn::wivrn_session::create_session(xrt::drivers::wi devices->xdevs[n++] = self->fb_face2_tracker.get(); } -#ifdef WIVRN_FEATURE_SOLARXR +#if WIVRN_FEATURE_SOLARXR xrt_device * solar_devs[XRT_SYSTEM_MAX_DEVICES]; uint32_t solar_devs_cap = XRT_SYSTEM_MAX_DEVICES - devices->xdev_count; uint32_t num_devs = solarxr_device_create_xdevs(self->hmd.get(), solar_devs, XRT_SYSTEM_MAX_DEVICES - devices->xdev_count); diff --git a/server/encoder/encoder_settings.cpp b/server/encoder/encoder_settings.cpp index 929b9883..acdd6dbf 100644 --- a/server/encoder/encoder_settings.cpp +++ b/server/encoder/encoder_settings.cpp @@ -30,10 +30,10 @@ #include "wivrn_config.h" -#ifdef WIVRN_USE_NVENC +#if WIVRN_USE_NVENC #include "video_encoder_nvenc.h" #endif -#ifdef WIVRN_USE_VAAPI +#if WIVRN_USE_VAAPI #include "ffmpeg/video_encoder_va.h" #endif @@ -98,7 +98,7 @@ void print_encoders(const std::vector & e static void check_scale(std::string_view encoder_name, video_codec codec, uint16_t width, uint16_t height, std::array & scale) { -#ifdef WIVRN_USE_NVENC +#if WIVRN_USE_NVENC if (encoder_name == encoder_nvenc) { auto max = VideoEncoderNvenc::get_max_size(codec); @@ -116,7 +116,7 @@ static void check_scale(std::string_view encoder_name, video_codec codec, uint16 #endif } -#ifdef WIVRN_USE_VAAPI +#if WIVRN_USE_VAAPI static std::optional filter_codecs_vaapi(wivrn_vk_bundle & bundle, const std::vector & codecs) { VideoEncoderFFMPEG::mute_logs mute; @@ -154,9 +154,9 @@ static void fill_defaults(wivrn_vk_bundle & bundle, const std::vector VideoEncoder::Create( std::unique_ptr res; if (settings.encoder_name == encoder_x264) { -#ifdef WIVRN_USE_X264 +#if WIVRN_USE_X264 res = std::make_unique(wivrn_vk, settings, fps); #else throw std::runtime_error("x264 encoder not enabled"); @@ -116,7 +116,7 @@ std::unique_ptr VideoEncoder::Create( } if (settings.encoder_name == encoder_nvenc) { -#ifdef WIVRN_USE_NVENC +#if WIVRN_USE_NVENC res = std::make_unique(wivrn_vk, settings, fps); #else throw std::runtime_error("nvenc support not enabled"); @@ -124,7 +124,7 @@ std::unique_ptr VideoEncoder::Create( } if (settings.encoder_name == encoder_vaapi) { -#ifdef WIVRN_USE_VAAPI +#if WIVRN_USE_VAAPI res = std::make_unique(wivrn_vk, settings, fps); #else throw std::runtime_error("vaapi support not enabled"); diff --git a/server/main.cpp b/server/main.cpp index 1353f95c..5293b088 100644 --- a/server/main.cpp +++ b/server/main.cpp @@ -64,7 +64,7 @@ std::filesystem::path socket_path() return {sock_file, sock_file + size}; } -#ifdef WIVRN_USE_SYSTEMD +#if WIVRN_USE_SYSTEMD int create_listen_socket() { sockaddr_un addr{}; @@ -214,7 +214,7 @@ void update_fsm(); void start_app() { -#ifdef WIVRN_USE_SYSTEMD +#if WIVRN_USE_SYSTEMD app_pid = use_systemd ? start_unit_file() : fork_application(); #else app_pid = fork_application(); @@ -599,7 +599,7 @@ int inner_main(int argc, char * argv[], bool show_instructions) std::filesystem::create_directories(socket_path().parent_path()); -#ifdef WIVRN_USE_SYSTEMD +#if WIVRN_USE_SYSTEMD create_listen_socket(); #else assert(not use_systemd); @@ -670,7 +670,7 @@ int inner_main(int argc, char * argv[], bool show_instructions) avahi_glib_poll_free(glib_poll); g_main_loop_unref(main_loop); -#ifdef WIVRN_USE_SYSTEMD +#if WIVRN_USE_SYSTEMD std::error_code ec; std::filesystem::remove(socket_path(), ec); #endif @@ -685,7 +685,7 @@ int main(int argc, char * argv[]) std::string config_file; app.add_option("-f", config_file, "configuration file")->option_text("FILE")->check(CLI::ExistingFile); auto no_instructions = app.add_flag("--no-instructions")->group(""); -#ifdef WIVRN_USE_SYSTEMD +#if WIVRN_USE_SYSTEMD // --application should only be used from wivrn-application unit file auto app_flag = app.add_flag("--application")->group(""); app.add_flag("--systemd", use_systemd, "use systemd to launch user-configured application"); @@ -696,7 +696,7 @@ int main(int argc, char * argv[]) if (not config_file.empty()) configuration::set_config_file(config_file); -#ifdef WIVRN_USE_SYSTEMD +#if WIVRN_USE_SYSTEMD if (*app_flag) return exec_application(configuration::read_user_configuration()); #endif