mirror of https://github.com/AxioDL/boo.git
Linux build fixes
This commit is contained in:
parent
cb5d22eed6
commit
6950d96b46
|
@ -75,7 +75,7 @@ struct VulkanContext
|
||||||
};
|
};
|
||||||
std::unordered_map<const boo::IWindow*, std::unique_ptr<Window>> m_windows;
|
std::unordered_map<const boo::IWindow*, std::unique_ptr<Window>> m_windows;
|
||||||
|
|
||||||
void initVulkan(const char* appName);
|
void initVulkan(std::string_view appName);
|
||||||
bool enumerateDevices();
|
bool enumerateDevices();
|
||||||
void initDevice();
|
void initDevice();
|
||||||
void initSwapChain(Window& windowCtx, VkSurfaceKHR surface, VkFormat format, VkColorSpaceKHR colorspace);
|
void initSwapChain(Window& windowCtx, VkSurfaceKHR surface, VkFormat format, VkColorSpaceKHR colorspace);
|
||||||
|
|
|
@ -260,7 +260,7 @@ static void demo_check_layers(const std::vector<VulkanContext::LayerProperties>&
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VulkanContext::initVulkan(const char* appName)
|
void VulkanContext::initVulkan(std::string_view appName)
|
||||||
{
|
{
|
||||||
if (!glslang::InitializeProcess())
|
if (!glslang::InitializeProcess())
|
||||||
Log.report(logvisor::Fatal, "unable to initialize glslang");
|
Log.report(logvisor::Fatal, "unable to initialize glslang");
|
||||||
|
@ -346,7 +346,7 @@ void VulkanContext::initVulkan(const char* appName)
|
||||||
VkApplicationInfo appInfo = {};
|
VkApplicationInfo appInfo = {};
|
||||||
appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
|
appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
|
||||||
appInfo.pNext = nullptr;
|
appInfo.pNext = nullptr;
|
||||||
appInfo.pApplicationName = appName;
|
appInfo.pApplicationName = appName.data();
|
||||||
appInfo.applicationVersion = 1;
|
appInfo.applicationVersion = 1;
|
||||||
appInfo.pEngineName = "Boo";
|
appInfo.pEngineName = "Boo";
|
||||||
appInfo.engineVersion = 1;
|
appInfo.engineVersion = 1;
|
||||||
|
|
|
@ -82,7 +82,7 @@ class HIDDeviceUdev final : public IHIDDevice
|
||||||
int i;
|
int i;
|
||||||
char errStr[256];
|
char errStr[256];
|
||||||
std::unique_lock<std::mutex> lk(device->m_initMutex);
|
std::unique_lock<std::mutex> lk(device->m_initMutex);
|
||||||
udev_device* udevDev = udev_device_new_from_syspath(GetUdev(), device->m_devPath.c_str());
|
udev_device* udevDev = udev_device_new_from_syspath(GetUdev(), device->m_devPath.data());
|
||||||
|
|
||||||
/* Get device file */
|
/* Get device file */
|
||||||
const char* dp = udev_device_get_devnode(udevDev);
|
const char* dp = udev_device_get_devnode(udevDev);
|
||||||
|
@ -90,7 +90,7 @@ class HIDDeviceUdev final : public IHIDDevice
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
{
|
{
|
||||||
snprintf(errStr, 256, "Unable to open %s@%s: %s\n",
|
snprintf(errStr, 256, "Unable to open %s@%s: %s\n",
|
||||||
device->m_token.getProductName().c_str(), dp, strerror(errno));
|
device->m_token.getProductName().data(), dp, strerror(errno));
|
||||||
device->m_devImp->deviceError(errStr);
|
device->m_devImp->deviceError(errStr);
|
||||||
lk.unlock();
|
lk.unlock();
|
||||||
device->m_initCond.notify_one();
|
device->m_initCond.notify_one();
|
||||||
|
@ -155,7 +155,7 @@ class HIDDeviceUdev final : public IHIDDevice
|
||||||
static void _threadProcBTLL(std::shared_ptr<HIDDeviceUdev> device)
|
static void _threadProcBTLL(std::shared_ptr<HIDDeviceUdev> device)
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> lk(device->m_initMutex);
|
std::unique_lock<std::mutex> lk(device->m_initMutex);
|
||||||
udev_device* udevDev = udev_device_new_from_syspath(GetUdev(), device->m_devPath.c_str());
|
udev_device* udevDev = udev_device_new_from_syspath(GetUdev(), device->m_devPath.data());
|
||||||
|
|
||||||
/* Return control to main thread */
|
/* Return control to main thread */
|
||||||
device->m_runningTransferLoop = true;
|
device->m_runningTransferLoop = true;
|
||||||
|
@ -177,7 +177,7 @@ class HIDDeviceUdev final : public IHIDDevice
|
||||||
{
|
{
|
||||||
char errStr[256];
|
char errStr[256];
|
||||||
std::unique_lock<std::mutex> lk(device->m_initMutex);
|
std::unique_lock<std::mutex> lk(device->m_initMutex);
|
||||||
udev_device* udevDev = udev_device_new_from_syspath(GetUdev(), device->m_devPath.c_str());
|
udev_device* udevDev = udev_device_new_from_syspath(GetUdev(), device->m_devPath.data());
|
||||||
|
|
||||||
/* Get device file */
|
/* Get device file */
|
||||||
const char* dp = udev_device_get_devnode(udevDev);
|
const char* dp = udev_device_get_devnode(udevDev);
|
||||||
|
@ -185,7 +185,7 @@ class HIDDeviceUdev final : public IHIDDevice
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
{
|
{
|
||||||
snprintf(errStr, 256, "Unable to open %s@%s: %s\n",
|
snprintf(errStr, 256, "Unable to open %s@%s: %s\n",
|
||||||
device->m_token.getProductName().c_str(), dp, strerror(errno));
|
device->m_token.getProductName().data(), dp, strerror(errno));
|
||||||
device->m_devImp->deviceError(errStr);
|
device->m_devImp->deviceError(errStr);
|
||||||
lk.unlock();
|
lk.unlock();
|
||||||
device->m_initCond.notify_one();
|
device->m_initCond.notify_one();
|
||||||
|
@ -204,7 +204,7 @@ class HIDDeviceUdev final : public IHIDDevice
|
||||||
if (ioctl(fd, HIDIOCGRDESCSIZE, &reportDescSize) == -1)
|
if (ioctl(fd, HIDIOCGRDESCSIZE, &reportDescSize) == -1)
|
||||||
{
|
{
|
||||||
snprintf(errStr, 256, "Unable to ioctl(HIDIOCGRDESCSIZE) %s@%s: %s\n",
|
snprintf(errStr, 256, "Unable to ioctl(HIDIOCGRDESCSIZE) %s@%s: %s\n",
|
||||||
device->m_token.getProductName().c_str(), dp, strerror(errno));
|
device->m_token.getProductName().data(), dp, strerror(errno));
|
||||||
device->m_devImp->deviceError(errStr);
|
device->m_devImp->deviceError(errStr);
|
||||||
close(fd);
|
close(fd);
|
||||||
return;
|
return;
|
||||||
|
@ -216,7 +216,7 @@ class HIDDeviceUdev final : public IHIDDevice
|
||||||
if (ioctl(fd, HIDIOCGRDESC, &reportDesc) == -1)
|
if (ioctl(fd, HIDIOCGRDESC, &reportDesc) == -1)
|
||||||
{
|
{
|
||||||
snprintf(errStr, 256, "Unable to ioctl(HIDIOCGRDESC) %s@%s: %s\n",
|
snprintf(errStr, 256, "Unable to ioctl(HIDIOCGRDESC) %s@%s: %s\n",
|
||||||
device->m_token.getProductName().c_str(), dp, strerror(errno));
|
device->m_token.getProductName().data(), dp, strerror(errno));
|
||||||
device->m_devImp->deviceError(errStr);
|
device->m_devImp->deviceError(errStr);
|
||||||
close(fd);
|
close(fd);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -50,13 +50,13 @@ namespace boo
|
||||||
IApplication* APP = NULL;
|
IApplication* APP = NULL;
|
||||||
int ApplicationRun(IApplication::EPlatformType platform,
|
int ApplicationRun(IApplication::EPlatformType platform,
|
||||||
IApplicationCallback& cb,
|
IApplicationCallback& cb,
|
||||||
const std::string& uniqueName,
|
std::string_view uniqueName,
|
||||||
const std::string& friendlyName,
|
std::string_view friendlyName,
|
||||||
const std::string& pname,
|
std::string_view pname,
|
||||||
const std::vector<std::string>& args,
|
const std::vector<std::string>& args,
|
||||||
bool singleInstance)
|
bool singleInstance)
|
||||||
{
|
{
|
||||||
std::string thrName = friendlyName + " Main Thread";
|
std::string thrName = std::string(friendlyName) + " Main Thread";
|
||||||
logvisor::RegisterThreadName(thrName.c_str());
|
logvisor::RegisterThreadName(thrName.c_str());
|
||||||
if (APP)
|
if (APP)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -10,7 +10,7 @@ DBusConnection* RegisterDBus(const char* appName, bool& isFirst);
|
||||||
namespace boo
|
namespace boo
|
||||||
{
|
{
|
||||||
|
|
||||||
std::shared_ptr<IWindow> _WindowWaylandNew(const std::string& title);
|
std::shared_ptr<IWindow> _WindowWaylandNew(std::string_view title);
|
||||||
|
|
||||||
class ApplicationWayland final : public IApplication
|
class ApplicationWayland final : public IApplication
|
||||||
{
|
{
|
||||||
|
@ -28,9 +28,9 @@ class ApplicationWayland final : public IApplication
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ApplicationWayland(IApplicationCallback& callback,
|
ApplicationWayland(IApplicationCallback& callback,
|
||||||
const std::string& uniqueName,
|
std::string_view uniqueName,
|
||||||
const std::string& friendlyName,
|
std::string_view friendlyName,
|
||||||
const std::string& pname,
|
std::string_view pname,
|
||||||
const std::vector<std::string>& args,
|
const std::vector<std::string>& args,
|
||||||
bool singleInstance)
|
bool singleInstance)
|
||||||
: m_callback(callback),
|
: m_callback(callback),
|
||||||
|
@ -51,17 +51,17 @@ public:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& getUniqueName() const
|
std::string_view getUniqueName() const
|
||||||
{
|
{
|
||||||
return m_uniqueName;
|
return m_uniqueName;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& getFriendlyName() const
|
std::string_view getFriendlyName() const
|
||||||
{
|
{
|
||||||
return m_friendlyName;
|
return m_friendlyName;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& getProcessName() const
|
std::string_view getProcessName() const
|
||||||
{
|
{
|
||||||
return m_pname;
|
return m_pname;
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ public:
|
||||||
return m_args;
|
return m_args;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<IWindow> newWindow(const std::string& title, uint32_t drawSamples)
|
std::shared_ptr<IWindow> newWindow(std::string_view title, uint32_t drawSamples)
|
||||||
{
|
{
|
||||||
return _WindowWaylandNew(title);
|
return _WindowWaylandNew(title);
|
||||||
}
|
}
|
||||||
|
|
|
@ -219,9 +219,9 @@ class ApplicationXlib final : public IApplication
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ApplicationXlib(IApplicationCallback& callback,
|
ApplicationXlib(IApplicationCallback& callback,
|
||||||
const std::string& uniqueName,
|
std::string_view uniqueName,
|
||||||
const std::string& friendlyName,
|
std::string_view friendlyName,
|
||||||
const std::string& pname,
|
std::string_view pname,
|
||||||
const std::vector<std::string>& args,
|
const std::vector<std::string>& args,
|
||||||
bool singleInstance)
|
bool singleInstance)
|
||||||
: m_callback(callback),
|
: m_callback(callback),
|
||||||
|
@ -254,7 +254,7 @@ public:
|
||||||
|
|
||||||
/* DBus single instance registration */
|
/* DBus single instance registration */
|
||||||
bool isFirst;
|
bool isFirst;
|
||||||
m_dbus = RegisterDBus(uniqueName.c_str(), isFirst);
|
m_dbus = RegisterDBus(uniqueName.data(), isFirst);
|
||||||
if (m_singleInstance)
|
if (m_singleInstance)
|
||||||
{
|
{
|
||||||
if (!isFirst)
|
if (!isFirst)
|
||||||
|
@ -433,7 +433,7 @@ public:
|
||||||
std::unique_lock<std::mutex> innerLk(initmt);
|
std::unique_lock<std::mutex> innerLk(initmt);
|
||||||
innerLk.unlock();
|
innerLk.unlock();
|
||||||
initcv.notify_one();
|
initcv.notify_one();
|
||||||
std::string thrName = getFriendlyName() + " Client Thread";
|
std::string thrName = std::string(getFriendlyName()) + " Client Thread";
|
||||||
logvisor::RegisterThreadName(thrName.c_str());
|
logvisor::RegisterThreadName(thrName.c_str());
|
||||||
clientReturn = m_callback.appMain(this);
|
clientReturn = m_callback.appMain(this);
|
||||||
pthread_kill(mainThread, SIGUSR2);
|
pthread_kill(mainThread, SIGUSR2);
|
||||||
|
@ -507,17 +507,17 @@ public:
|
||||||
return clientReturn;
|
return clientReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& getUniqueName() const
|
std::string_view getUniqueName() const
|
||||||
{
|
{
|
||||||
return m_uniqueName;
|
return m_uniqueName;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& getFriendlyName() const
|
std::string_view getFriendlyName() const
|
||||||
{
|
{
|
||||||
return m_friendlyName;
|
return m_friendlyName;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& getProcessName() const
|
std::string_view getProcessName() const
|
||||||
{
|
{
|
||||||
return m_pname;
|
return m_pname;
|
||||||
}
|
}
|
||||||
|
@ -527,7 +527,7 @@ public:
|
||||||
return m_args;
|
return m_args;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<IWindow> newWindow(const std::string& title, uint32_t drawSamples)
|
std::shared_ptr<IWindow> newWindow(std::string_view title, uint32_t drawSamples)
|
||||||
{
|
{
|
||||||
#if BOO_HAS_VULKAN
|
#if BOO_HAS_VULKAN
|
||||||
std::shared_ptr<IWindow> newWindow = _WindowXlibNew(title, m_xDisp, m_xcbConn, m_xDefaultScreen, m_xIM,
|
std::shared_ptr<IWindow> newWindow = _WindowXlibNew(title, m_xDisp, m_xcbConn, m_xDefaultScreen, m_xIM,
|
||||||
|
|
|
@ -130,7 +130,7 @@ struct WindowWayland : IWindow
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void setTitle(const std::string& title)
|
void setTitle(std::string_view title)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -244,7 +244,7 @@ struct WindowWayland : IWindow
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
std::shared_ptr<IWindow> _WindowWaylandNew(const std::string& title)
|
std::shared_ptr<IWindow> _WindowWaylandNew(std::string_view title)
|
||||||
{
|
{
|
||||||
return std::make_shared<WindowWayland>(title);
|
return std::make_shared<WindowWayland>(title);
|
||||||
}
|
}
|
||||||
|
|
|
@ -704,7 +704,7 @@ public:
|
||||||
|
|
||||||
vk::init_dispatch_table_top(PFN_vkGetInstanceProcAddr(getVkProc));
|
vk::init_dispatch_table_top(PFN_vkGetInstanceProcAddr(getVkProc));
|
||||||
if (m_ctx->m_instance == VK_NULL_HANDLE)
|
if (m_ctx->m_instance == VK_NULL_HANDLE)
|
||||||
m_ctx->initVulkan(APP->getUniqueName().c_str());
|
m_ctx->initVulkan(APP->getUniqueName());
|
||||||
|
|
||||||
vk::init_dispatch_table_middle(m_ctx->m_instance, false);
|
vk::init_dispatch_table_middle(m_ctx->m_instance, false);
|
||||||
if (!m_ctx->enumerateDevices())
|
if (!m_ctx->enumerateDevices())
|
||||||
|
@ -1042,7 +1042,7 @@ public:
|
||||||
XSetWMProtocols(m_xDisp, m_windowId, &S_ATOMS->m_wmDeleteWindow, 1);
|
XSetWMProtocols(m_xDisp, m_windowId, &S_ATOMS->m_wmDeleteWindow, 1);
|
||||||
|
|
||||||
/* Set the title of the window */
|
/* Set the title of the window */
|
||||||
const unsigned char* c_title = (unsigned char*)title.c_str();
|
const unsigned char* c_title = (unsigned char*)title.data();
|
||||||
XChangeProperty(m_xDisp, m_windowId, XA_WM_NAME, XA_STRING, 8, PropModeReplace, c_title, title.length());
|
XChangeProperty(m_xDisp, m_windowId, XA_WM_NAME, XA_STRING, 8, PropModeReplace, c_title, title.length());
|
||||||
|
|
||||||
/* Set the title of the window icon */
|
/* Set the title of the window icon */
|
||||||
|
@ -1133,7 +1133,7 @@ public:
|
||||||
|
|
||||||
void setTitle(std::string_view title)
|
void setTitle(std::string_view title)
|
||||||
{
|
{
|
||||||
const unsigned char* c_title = (unsigned char*)title.c_str();
|
const unsigned char* c_title = (unsigned char*)title.data();
|
||||||
XLockDisplay(m_xDisp);
|
XLockDisplay(m_xDisp);
|
||||||
XChangeProperty(m_xDisp, m_windowId, XA_WM_NAME, XA_STRING, 8,
|
XChangeProperty(m_xDisp, m_windowId, XA_WM_NAME, XA_STRING, 8,
|
||||||
PropModeReplace, c_title, title.length());
|
PropModeReplace, c_title, title.length());
|
||||||
|
@ -2011,7 +2011,7 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
std::shared_ptr<IWindow> _WindowXlibNew(const std::string& title,
|
std::shared_ptr<IWindow> _WindowXlibNew(std::string_view title,
|
||||||
Display* display, void* xcbConn,
|
Display* display, void* xcbConn,
|
||||||
int defaultScreen, XIM xIM, XIMStyle bestInputStyle, XFontSet fontset,
|
int defaultScreen, XIM xIM, XIMStyle bestInputStyle, XFontSet fontset,
|
||||||
GLXContext lastCtx, void* vulkanHandle, uint32_t drawSamples)
|
GLXContext lastCtx, void* vulkanHandle, uint32_t drawSamples)
|
||||||
|
|
Loading…
Reference in New Issue