Use cmakedefine01 instead of cmakedefine
This commit is contained in:
@@ -19,16 +19,16 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#cmakedefine WIVRN_USE_NVENC
|
#cmakedefine01 WIVRN_USE_NVENC
|
||||||
#cmakedefine WIVRN_USE_VAAPI
|
#cmakedefine01 WIVRN_USE_VAAPI
|
||||||
#cmakedefine WIVRN_USE_X264
|
#cmakedefine01 WIVRN_USE_X264
|
||||||
|
|
||||||
#cmakedefine WIVRN_USE_SYSTEMD
|
#cmakedefine01 WIVRN_USE_SYSTEMD
|
||||||
|
|
||||||
#cmakedefine WIVRN_USE_PIPEWIRE
|
#cmakedefine01 WIVRN_USE_PIPEWIRE
|
||||||
#cmakedefine WIVRN_USE_PULSEAUDIO
|
#cmakedefine01 WIVRN_USE_PULSEAUDIO
|
||||||
|
|
||||||
#cmakedefine WIVRN_FEATURE_STEAMVR_LIGHTHOUSE
|
#cmakedefine01 WIVRN_FEATURE_STEAMVR_LIGHTHOUSE
|
||||||
#cmakedefine WIVRN_FEATURE_SOLARXR
|
#cmakedefine01 WIVRN_FEATURE_SOLARXR
|
||||||
|
|
||||||
#define WIVRN_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@"
|
#define WIVRN_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@"
|
||||||
|
|||||||
@@ -22,11 +22,11 @@
|
|||||||
#include "util/u_logging.h"
|
#include "util/u_logging.h"
|
||||||
#include "wivrn_config.h"
|
#include "wivrn_config.h"
|
||||||
|
|
||||||
#ifdef WIVRN_USE_PULSEAUDIO
|
#if WIVRN_USE_PULSEAUDIO
|
||||||
#include "audio_pulse.h"
|
#include "audio_pulse.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIVRN_USE_PIPEWIRE
|
#if WIVRN_USE_PIPEWIRE
|
||||||
#include "audio_pipewire.h"
|
#include "audio_pipewire.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -38,12 +38,12 @@ std::shared_ptr<audio_device> audio_device::create(
|
|||||||
const xrt::drivers::wivrn::from_headset::headset_info_packet & info,
|
const xrt::drivers::wivrn::from_headset::headset_info_packet & info,
|
||||||
xrt::drivers::wivrn::wivrn_session & session)
|
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))
|
if (auto res = create_pipewire_handle(source_name, source_description, sink_name, sink_description, info, session))
|
||||||
return res;
|
return res;
|
||||||
#endif
|
#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))
|
if (auto res = create_pulse_handle(source_name, source_description, sink_name, sink_description, info, session))
|
||||||
return res;
|
return res;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -47,11 +47,11 @@
|
|||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
|
|
||||||
#ifdef WIVRN_FEATURE_STEAMVR_LIGHTHOUSE
|
#if WIVRN_FEATURE_STEAMVR_LIGHTHOUSE
|
||||||
#include "steamvr_lh_interface.h"
|
#include "steamvr_lh_interface.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIVRN_FEATURE_SOLARXR
|
#if WIVRN_FEATURE_SOLARXR
|
||||||
#include "solarxr_device.h"
|
#include "solarxr_device.h"
|
||||||
#endif
|
#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();
|
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");
|
auto use_steamvr_lh = std::getenv("WIVRN_USE_STEAMVR_LH");
|
||||||
xrt_system_devices * lhdevs = NULL;
|
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();
|
devices->xdevs[n++] = self->fb_face2_tracker.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIVRN_FEATURE_SOLARXR
|
#if WIVRN_FEATURE_SOLARXR
|
||||||
xrt_device * solar_devs[XRT_SYSTEM_MAX_DEVICES];
|
xrt_device * solar_devs[XRT_SYSTEM_MAX_DEVICES];
|
||||||
uint32_t solar_devs_cap = XRT_SYSTEM_MAX_DEVICES - devices->xdev_count;
|
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);
|
uint32_t num_devs = solarxr_device_create_xdevs(self->hmd.get(), solar_devs, XRT_SYSTEM_MAX_DEVICES - devices->xdev_count);
|
||||||
|
|||||||
@@ -30,10 +30,10 @@
|
|||||||
|
|
||||||
#include "wivrn_config.h"
|
#include "wivrn_config.h"
|
||||||
|
|
||||||
#ifdef WIVRN_USE_NVENC
|
#if WIVRN_USE_NVENC
|
||||||
#include "video_encoder_nvenc.h"
|
#include "video_encoder_nvenc.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef WIVRN_USE_VAAPI
|
#if WIVRN_USE_VAAPI
|
||||||
#include "ffmpeg/video_encoder_va.h"
|
#include "ffmpeg/video_encoder_va.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ void print_encoders(const std::vector<xrt::drivers::wivrn::encoder_settings> & e
|
|||||||
|
|
||||||
static void check_scale(std::string_view encoder_name, video_codec codec, uint16_t width, uint16_t height, std::array<double, 2> & scale)
|
static void check_scale(std::string_view encoder_name, video_codec codec, uint16_t width, uint16_t height, std::array<double, 2> & scale)
|
||||||
{
|
{
|
||||||
#ifdef WIVRN_USE_NVENC
|
#if WIVRN_USE_NVENC
|
||||||
if (encoder_name == encoder_nvenc)
|
if (encoder_name == encoder_nvenc)
|
||||||
{
|
{
|
||||||
auto max = VideoEncoderNvenc::get_max_size(codec);
|
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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIVRN_USE_VAAPI
|
#if WIVRN_USE_VAAPI
|
||||||
static std::optional<xrt::drivers::wivrn::video_codec> filter_codecs_vaapi(wivrn_vk_bundle & bundle, const std::vector<xrt::drivers::wivrn::video_codec> & codecs)
|
static std::optional<xrt::drivers::wivrn::video_codec> filter_codecs_vaapi(wivrn_vk_bundle & bundle, const std::vector<xrt::drivers::wivrn::video_codec> & codecs)
|
||||||
{
|
{
|
||||||
VideoEncoderFFMPEG::mute_logs mute;
|
VideoEncoderFFMPEG::mute_logs mute;
|
||||||
@@ -154,9 +154,9 @@ static void fill_defaults(wivrn_vk_bundle & bundle, const std::vector<xrt::drive
|
|||||||
{
|
{
|
||||||
if (is_nvidia(*bundle.physical_device))
|
if (is_nvidia(*bundle.physical_device))
|
||||||
{
|
{
|
||||||
#ifdef WIVRN_USE_NVENC
|
#if WIVRN_USE_NVENC
|
||||||
config.name = encoder_nvenc;
|
config.name = encoder_nvenc;
|
||||||
#elif defined(WIVRN_USE_X264)
|
#elif WIVRN_USE_X264
|
||||||
U_LOG_W("nvidia GPU detected, but nvenc support not compiled");
|
U_LOG_W("nvidia GPU detected, but nvenc support not compiled");
|
||||||
config.name = encoder_x264;
|
config.name = encoder_x264;
|
||||||
config.codec = h264;
|
config.codec = h264;
|
||||||
@@ -166,9 +166,9 @@ static void fill_defaults(wivrn_vk_bundle & bundle, const std::vector<xrt::drive
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef WIVRN_USE_VAAPI
|
#if WIVRN_USE_VAAPI
|
||||||
config.name = encoder_vaapi;
|
config.name = encoder_vaapi;
|
||||||
#elif defined(WIVRN_USE_X264)
|
#elif WIVRN_USE_X264
|
||||||
U_LOG_W("ffmpeg support not compiled, vaapi encoder not available");
|
U_LOG_W("ffmpeg support not compiled, vaapi encoder not available");
|
||||||
config.name = encoder_x264;
|
config.name = encoder_x264;
|
||||||
config.codec = h264;
|
config.codec = h264;
|
||||||
@@ -178,7 +178,7 @@ static void fill_defaults(wivrn_vk_bundle & bundle, const std::vector<xrt::drive
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIVRN_USE_VAAPI
|
#if WIVRN_USE_VAAPI
|
||||||
if (config.name == encoder_vaapi and not config.codec)
|
if (config.name == encoder_vaapi and not config.codec)
|
||||||
{
|
{
|
||||||
config.codec = filter_codecs_vaapi(bundle, headset_codecs);
|
config.codec = filter_codecs_vaapi(bundle, headset_codecs);
|
||||||
@@ -191,7 +191,7 @@ static void fill_defaults(wivrn_vk_bundle & bundle, const std::vector<xrt::drive
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIVRN_USE_X264
|
#if WIVRN_USE_X264
|
||||||
if (config.name == encoder_x264)
|
if (config.name == encoder_x264)
|
||||||
config.codec = h264;
|
config.codec = h264;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -29,13 +29,13 @@
|
|||||||
|
|
||||||
#include "wivrn_config.h"
|
#include "wivrn_config.h"
|
||||||
|
|
||||||
#ifdef WIVRN_USE_NVENC
|
#if WIVRN_USE_NVENC
|
||||||
#include "video_encoder_nvenc.h"
|
#include "video_encoder_nvenc.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef WIVRN_USE_VAAPI
|
#if WIVRN_USE_VAAPI
|
||||||
#include "ffmpeg/video_encoder_va.h"
|
#include "ffmpeg/video_encoder_va.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef WIVRN_USE_X264
|
#if WIVRN_USE_X264
|
||||||
#include "video_encoder_x264.h"
|
#include "video_encoder_x264.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -108,7 +108,7 @@ std::unique_ptr<VideoEncoder> VideoEncoder::Create(
|
|||||||
std::unique_ptr<VideoEncoder> res;
|
std::unique_ptr<VideoEncoder> res;
|
||||||
if (settings.encoder_name == encoder_x264)
|
if (settings.encoder_name == encoder_x264)
|
||||||
{
|
{
|
||||||
#ifdef WIVRN_USE_X264
|
#if WIVRN_USE_X264
|
||||||
res = std::make_unique<VideoEncoderX264>(wivrn_vk, settings, fps);
|
res = std::make_unique<VideoEncoderX264>(wivrn_vk, settings, fps);
|
||||||
#else
|
#else
|
||||||
throw std::runtime_error("x264 encoder not enabled");
|
throw std::runtime_error("x264 encoder not enabled");
|
||||||
@@ -116,7 +116,7 @@ std::unique_ptr<VideoEncoder> VideoEncoder::Create(
|
|||||||
}
|
}
|
||||||
if (settings.encoder_name == encoder_nvenc)
|
if (settings.encoder_name == encoder_nvenc)
|
||||||
{
|
{
|
||||||
#ifdef WIVRN_USE_NVENC
|
#if WIVRN_USE_NVENC
|
||||||
res = std::make_unique<VideoEncoderNvenc>(wivrn_vk, settings, fps);
|
res = std::make_unique<VideoEncoderNvenc>(wivrn_vk, settings, fps);
|
||||||
#else
|
#else
|
||||||
throw std::runtime_error("nvenc support not enabled");
|
throw std::runtime_error("nvenc support not enabled");
|
||||||
@@ -124,7 +124,7 @@ std::unique_ptr<VideoEncoder> VideoEncoder::Create(
|
|||||||
}
|
}
|
||||||
if (settings.encoder_name == encoder_vaapi)
|
if (settings.encoder_name == encoder_vaapi)
|
||||||
{
|
{
|
||||||
#ifdef WIVRN_USE_VAAPI
|
#if WIVRN_USE_VAAPI
|
||||||
res = std::make_unique<video_encoder_va>(wivrn_vk, settings, fps);
|
res = std::make_unique<video_encoder_va>(wivrn_vk, settings, fps);
|
||||||
#else
|
#else
|
||||||
throw std::runtime_error("vaapi support not enabled");
|
throw std::runtime_error("vaapi support not enabled");
|
||||||
|
|||||||
+6
-6
@@ -64,7 +64,7 @@ std::filesystem::path socket_path()
|
|||||||
return {sock_file, sock_file + size};
|
return {sock_file, sock_file + size};
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIVRN_USE_SYSTEMD
|
#if WIVRN_USE_SYSTEMD
|
||||||
int create_listen_socket()
|
int create_listen_socket()
|
||||||
{
|
{
|
||||||
sockaddr_un addr{};
|
sockaddr_un addr{};
|
||||||
@@ -214,7 +214,7 @@ void update_fsm();
|
|||||||
|
|
||||||
void start_app()
|
void start_app()
|
||||||
{
|
{
|
||||||
#ifdef WIVRN_USE_SYSTEMD
|
#if WIVRN_USE_SYSTEMD
|
||||||
app_pid = use_systemd ? start_unit_file() : fork_application();
|
app_pid = use_systemd ? start_unit_file() : fork_application();
|
||||||
#else
|
#else
|
||||||
app_pid = fork_application();
|
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());
|
std::filesystem::create_directories(socket_path().parent_path());
|
||||||
|
|
||||||
#ifdef WIVRN_USE_SYSTEMD
|
#if WIVRN_USE_SYSTEMD
|
||||||
create_listen_socket();
|
create_listen_socket();
|
||||||
#else
|
#else
|
||||||
assert(not use_systemd);
|
assert(not use_systemd);
|
||||||
@@ -670,7 +670,7 @@ int inner_main(int argc, char * argv[], bool show_instructions)
|
|||||||
avahi_glib_poll_free(glib_poll);
|
avahi_glib_poll_free(glib_poll);
|
||||||
g_main_loop_unref(main_loop);
|
g_main_loop_unref(main_loop);
|
||||||
|
|
||||||
#ifdef WIVRN_USE_SYSTEMD
|
#if WIVRN_USE_SYSTEMD
|
||||||
std::error_code ec;
|
std::error_code ec;
|
||||||
std::filesystem::remove(socket_path(), ec);
|
std::filesystem::remove(socket_path(), ec);
|
||||||
#endif
|
#endif
|
||||||
@@ -685,7 +685,7 @@ int main(int argc, char * argv[])
|
|||||||
std::string config_file;
|
std::string config_file;
|
||||||
app.add_option("-f", config_file, "configuration file")->option_text("FILE")->check(CLI::ExistingFile);
|
app.add_option("-f", config_file, "configuration file")->option_text("FILE")->check(CLI::ExistingFile);
|
||||||
auto no_instructions = app.add_flag("--no-instructions")->group("");
|
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
|
// --application should only be used from wivrn-application unit file
|
||||||
auto app_flag = app.add_flag("--application")->group("");
|
auto app_flag = app.add_flag("--application")->group("");
|
||||||
app.add_flag("--systemd", use_systemd, "use systemd to launch user-configured application");
|
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())
|
if (not config_file.empty())
|
||||||
configuration::set_config_file(config_file);
|
configuration::set_config_file(config_file);
|
||||||
|
|
||||||
#ifdef WIVRN_USE_SYSTEMD
|
#if WIVRN_USE_SYSTEMD
|
||||||
if (*app_flag)
|
if (*app_flag)
|
||||||
return exec_application(configuration::read_user_configuration());
|
return exec_application(configuration::read_user_configuration());
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user