mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-23 15:40:42 +00:00
Merge branch 'issue/6756' into 'master'
Create platform component for platform specific things See merge request OpenMW/openmw!1960
This commit is contained in:
commit
e6fcb8bd2d
@ -16,6 +16,7 @@
|
|||||||
#include <components/vfs/manager.hpp>
|
#include <components/vfs/manager.hpp>
|
||||||
#include <components/vfs/registerarchives.hpp>
|
#include <components/vfs/registerarchives.hpp>
|
||||||
#include <components/esm3/readerscache.hpp>
|
#include <components/esm3/readerscache.hpp>
|
||||||
|
#include <components/platform/platform.hpp>
|
||||||
|
|
||||||
#include <boost/program_options.hpp>
|
#include <boost/program_options.hpp>
|
||||||
|
|
||||||
@ -26,6 +27,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
namespace bpo = boost::program_options;
|
namespace bpo = boost::program_options;
|
||||||
@ -106,6 +108,8 @@ namespace
|
|||||||
|
|
||||||
int runBulletObjectTool(int argc, char *argv[])
|
int runBulletObjectTool(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
Platform::init();
|
||||||
|
|
||||||
bpo::options_description desc = makeOptionsDescription();
|
bpo::options_description desc = makeOptionsDescription();
|
||||||
|
|
||||||
bpo::parsed_options options = bpo::command_line_parser(argc, argv)
|
bpo::parsed_options options = bpo::command_line_parser(argc, argv)
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
#include <components/debug/debugging.hpp>
|
#include <components/debug/debugging.hpp>
|
||||||
|
#include <components/platform/platform.hpp>
|
||||||
|
|
||||||
#ifdef MAC_OS_X_VERSION_MIN_REQUIRED
|
#ifdef MAC_OS_X_VERSION_MIN_REQUIRED
|
||||||
#undef MAC_OS_X_VERSION_MIN_REQUIRED
|
#undef MAC_OS_X_VERSION_MIN_REQUIRED
|
||||||
@ -16,6 +17,8 @@
|
|||||||
|
|
||||||
int runLauncher(int argc, char *argv[])
|
int runLauncher(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
Platform::init();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <components/vfs/manager.hpp>
|
#include <components/vfs/manager.hpp>
|
||||||
#include <components/vfs/registerarchives.hpp>
|
#include <components/vfs/registerarchives.hpp>
|
||||||
#include <components/esm3/readerscache.hpp>
|
#include <components/esm3/readerscache.hpp>
|
||||||
|
#include <components/platform/platform.hpp>
|
||||||
|
|
||||||
#include <osg/Vec3f>
|
#include <osg/Vec3f>
|
||||||
|
|
||||||
@ -36,6 +37,7 @@
|
|||||||
#include <io.h>
|
#include <io.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
namespace NavMeshTool
|
namespace NavMeshTool
|
||||||
{
|
{
|
||||||
namespace
|
namespace
|
||||||
@ -102,6 +104,8 @@ namespace NavMeshTool
|
|||||||
|
|
||||||
int runNavMeshTool(int argc, char *argv[])
|
int runNavMeshTool(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
Platform::init();
|
||||||
|
|
||||||
bpo::options_description desc = makeOptionsDescription();
|
bpo::options_description desc = makeOptionsDescription();
|
||||||
|
|
||||||
bpo::parsed_options options = bpo::command_line_parser(argc, argv)
|
bpo::parsed_options options = bpo::command_line_parser(argc, argv)
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include <QMetaType>
|
#include <QMetaType>
|
||||||
|
|
||||||
#include <components/debug/debugging.hpp>
|
#include <components/debug/debugging.hpp>
|
||||||
|
#include <components/platform/platform.hpp>
|
||||||
|
|
||||||
#include "model/doc/messages.hpp"
|
#include "model/doc/messages.hpp"
|
||||||
#include "model/world/universalid.hpp"
|
#include "model/world/universalid.hpp"
|
||||||
@ -43,6 +44,8 @@ class Application : public QApplication
|
|||||||
|
|
||||||
int runApplication(int argc, char *argv[])
|
int runApplication(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
Platform::init();
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
setenv("OSG_GL_TEXTURE_STORAGE", "OFF", 0);
|
setenv("OSG_GL_TEXTURE_STORAGE", "OFF", 0);
|
||||||
#endif
|
#endif
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include <components/fallback/validate.hpp>
|
#include <components/fallback/validate.hpp>
|
||||||
#include <components/debug/debugging.hpp>
|
#include <components/debug/debugging.hpp>
|
||||||
#include <components/misc/rng.hpp>
|
#include <components/misc/rng.hpp>
|
||||||
|
#include <components/platform/platform.hpp>
|
||||||
|
|
||||||
#include "mwgui/debugwindow.hpp"
|
#include "mwgui/debugwindow.hpp"
|
||||||
|
|
||||||
@ -207,6 +208,8 @@ namespace
|
|||||||
|
|
||||||
int runApplication(int argc, char *argv[])
|
int runApplication(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
Platform::init();
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
std::filesystem::path binary_path = std::filesystem::system_complete(std::filesystem::path(argv[0]));
|
std::filesystem::path binary_path = std::filesystem::system_complete(std::filesystem::path(argv[0]));
|
||||||
std::filesystem::current_path(binary_path.parent_path());
|
std::filesystem::current_path(binary_path.parent_path());
|
||||||
|
@ -335,6 +335,10 @@ add_component_dir(navmeshtool
|
|||||||
protocol
|
protocol
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_component_dir(platform
|
||||||
|
platform
|
||||||
|
)
|
||||||
|
|
||||||
set (ESM_UI ${CMAKE_SOURCE_DIR}/files/ui/contentselector.ui
|
set (ESM_UI ${CMAKE_SOURCE_DIR}/files/ui/contentselector.ui
|
||||||
)
|
)
|
||||||
|
|
||||||
|
23
components/platform/platform.cpp
Normal file
23
components/platform/platform.cpp
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#include "platform.hpp"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
namespace Platform {
|
||||||
|
|
||||||
|
static void increaseFileHandleLimit()
|
||||||
|
{
|
||||||
|
#ifdef WIN32
|
||||||
|
// Increase limit for open files at the stream I/O level, see
|
||||||
|
// https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/setmaxstdio?view=msvc-170#remarks
|
||||||
|
_setmaxstdio(8192);
|
||||||
|
#else
|
||||||
|
// No-op on any other platform.
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void init()
|
||||||
|
{
|
||||||
|
increaseFileHandleLimit();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
10
components/platform/platform.hpp
Normal file
10
components/platform/platform.hpp
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#ifndef OPENMW_COMPONENTS_PLATFORM_PLATFORM_HPP
|
||||||
|
#define OPENMW_COMPONENTS_PLATFORM_PLATFORM_HPP
|
||||||
|
|
||||||
|
namespace Platform {
|
||||||
|
|
||||||
|
void init();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // OPENMW_COMPONENTS_PLATFORM_PLATFORM_HPP
|
Loading…
x
Reference in New Issue
Block a user