mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 15:29:55 +00:00
Create platform component for platform specific things
This commit is contained in:
parent
787f8fb627
commit
d5ec959449
8 changed files with 54 additions and 0 deletions
|
@ -16,6 +16,7 @@
|
|||
#include <components/vfs/manager.hpp>
|
||||
#include <components/vfs/registerarchives.hpp>
|
||||
#include <components/esm3/readerscache.hpp>
|
||||
#include <components/platform/platform.hpp>
|
||||
|
||||
#include <boost/program_options.hpp>
|
||||
|
||||
|
@ -26,6 +27,7 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
namespace bpo = boost::program_options;
|
||||
|
@ -106,6 +108,8 @@ namespace
|
|||
|
||||
int runBulletObjectTool(int argc, char *argv[])
|
||||
{
|
||||
Platform::init();
|
||||
|
||||
bpo::options_description desc = makeOptionsDescription();
|
||||
|
||||
bpo::parsed_options options = bpo::command_line_parser(argc, argv)
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <QDir>
|
||||
|
||||
#include <components/debug/debugging.hpp>
|
||||
#include <components/platform/platform.hpp>
|
||||
|
||||
#ifdef MAC_OS_X_VERSION_MIN_REQUIRED
|
||||
#undef MAC_OS_X_VERSION_MIN_REQUIRED
|
||||
|
@ -16,6 +17,8 @@
|
|||
|
||||
int runLauncher(int argc, char *argv[])
|
||||
{
|
||||
Platform::init();
|
||||
|
||||
try
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <components/vfs/manager.hpp>
|
||||
#include <components/vfs/registerarchives.hpp>
|
||||
#include <components/esm3/readerscache.hpp>
|
||||
#include <components/platform/platform.hpp>
|
||||
|
||||
#include <osg/Vec3f>
|
||||
|
||||
|
@ -36,6 +37,7 @@
|
|||
#include <io.h>
|
||||
#endif
|
||||
|
||||
|
||||
namespace NavMeshTool
|
||||
{
|
||||
namespace
|
||||
|
@ -102,6 +104,8 @@ namespace NavMeshTool
|
|||
|
||||
int runNavMeshTool(int argc, char *argv[])
|
||||
{
|
||||
Platform::init();
|
||||
|
||||
bpo::options_description desc = makeOptionsDescription();
|
||||
|
||||
bpo::parsed_options options = bpo::command_line_parser(argc, argv)
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <QMetaType>
|
||||
|
||||
#include <components/debug/debugging.hpp>
|
||||
#include <components/platform/platform.hpp>
|
||||
|
||||
#include "model/doc/messages.hpp"
|
||||
#include "model/world/universalid.hpp"
|
||||
|
@ -43,6 +44,8 @@ class Application : public QApplication
|
|||
|
||||
int runApplication(int argc, char *argv[])
|
||||
{
|
||||
Platform::init();
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
setenv("OSG_GL_TEXTURE_STORAGE", "OFF", 0);
|
||||
#endif
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <components/fallback/validate.hpp>
|
||||
#include <components/debug/debugging.hpp>
|
||||
#include <components/misc/rng.hpp>
|
||||
#include <components/platform/platform.hpp>
|
||||
|
||||
#include "mwgui/debugwindow.hpp"
|
||||
|
||||
|
@ -207,6 +208,8 @@ namespace
|
|||
|
||||
int runApplication(int argc, char *argv[])
|
||||
{
|
||||
Platform::init();
|
||||
|
||||
#ifdef __APPLE__
|
||||
std::filesystem::path binary_path = std::filesystem::system_complete(std::filesystem::path(argv[0]));
|
||||
std::filesystem::current_path(binary_path.parent_path());
|
||||
|
|
|
@ -335,6 +335,10 @@ add_component_dir(navmeshtool
|
|||
protocol
|
||||
)
|
||||
|
||||
add_component_dir(platform
|
||||
platform
|
||||
)
|
||||
|
||||
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…
Reference in a new issue