From 64323abb38a00cf1aee9a43270d9ab70db6e5fa2 Mon Sep 17 00:00:00 2001 From: neverix Date: Thu, 8 Dec 2022 23:14:44 +0300 Subject: [PATCH 01/10] Update IrrCompileConfig.h --- include/IrrCompileConfig.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/IrrCompileConfig.h b/include/IrrCompileConfig.h index 5d9006bb6..f195fb1f5 100644 --- a/include/IrrCompileConfig.h +++ b/include/IrrCompileConfig.h @@ -45,7 +45,7 @@ //! Example: NO_IRR_COMPILE_WITH_X11_ would disable X11 //! Uncomment this line to compile with the SDL device -//#define _IRR_COMPILE_WITH_SDL_DEVICE_ +#define _IRR_COMPILE_WITH_SDL_DEVICE_ #ifdef NO_IRR_COMPILE_WITH_SDL_DEVICE_ #undef _IRR_COMPILE_WITH_SDL_DEVICE_ #endif From fb03fd893114fc64166ed822623401ee4ac17e67 Mon Sep 17 00:00:00 2001 From: neverix Date: Thu, 8 Dec 2022 23:18:27 +0300 Subject: [PATCH 02/10] Update CIrrDeviceSDL.cpp --- source/Irrlicht/CIrrDeviceSDL.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/Irrlicht/CIrrDeviceSDL.cpp b/source/Irrlicht/CIrrDeviceSDL.cpp index 12574d5a7..a0847baaf 100644 --- a/source/Irrlicht/CIrrDeviceSDL.cpp +++ b/source/Irrlicht/CIrrDeviceSDL.cpp @@ -120,8 +120,8 @@ CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters& param) if ( ++SDLDeviceInstances == 1 ) { u32 flags = SDL_INIT_TIMER | SDL_INIT_EVENTS; - if (CreationParams.DriverType != video::EDT_NULL) - flags |= SDL_INIT_VIDEO; + // if (CreationParams.DriverType != video::EDT_NULL) + // flags |= SDL_INIT_VIDEO; #if defined(_IRR_COMPILE_WITH_JOYSTICK_EVENTS_) flags |= SDL_INIT_JOYSTICK; #endif From 4c173950bdc7d490baf98e85cb89a5d710a6ac49 Mon Sep 17 00:00:00 2001 From: neverix Date: Sat, 17 Dec 2022 15:13:48 +0300 Subject: [PATCH 03/10] Update CIrrDeviceSDL.cpp --- source/Irrlicht/CIrrDeviceSDL.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/Irrlicht/CIrrDeviceSDL.cpp b/source/Irrlicht/CIrrDeviceSDL.cpp index a0847baaf..4a23d2c1e 100644 --- a/source/Irrlicht/CIrrDeviceSDL.cpp +++ b/source/Irrlicht/CIrrDeviceSDL.cpp @@ -120,8 +120,10 @@ CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters& param) if ( ++SDLDeviceInstances == 1 ) { u32 flags = SDL_INIT_TIMER | SDL_INIT_EVENTS; - // if (CreationParams.DriverType != video::EDT_NULL) - // flags |= SDL_INIT_VIDEO; + #if BUILD_HEADLESS + if (CreationParams.DriverType != video::EDT_NULL) + flags |= SDL_INIT_VIDEO; + #endif #if defined(_IRR_COMPILE_WITH_JOYSTICK_EVENTS_) flags |= SDL_INIT_JOYSTICK; #endif From 3b7fa4a8f6f48c7e94bd01c939a475ac6f8bae68 Mon Sep 17 00:00:00 2001 From: neverix Date: Sat, 17 Dec 2022 15:14:57 +0300 Subject: [PATCH 04/10] Update IrrCompileConfig.h --- include/IrrCompileConfig.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/IrrCompileConfig.h b/include/IrrCompileConfig.h index 4ad13348d..9fc3f831b 100644 --- a/include/IrrCompileConfig.h +++ b/include/IrrCompileConfig.h @@ -44,8 +44,9 @@ //! different library versions without having to change the sources. //! Example: NO_IRR_COMPILE_WITH_X11_ would disable X11 -//! Uncomment this line to compile with the SDL device +#if BUILD_HEADLESS #define _IRR_COMPILE_WITH_SDL_DEVICE_ +#endif #ifdef NO_IRR_COMPILE_WITH_SDL_DEVICE_ #undef _IRR_COMPILE_WITH_SDL_DEVICE_ #endif From c4c125691ae50ac596caaf43c5984356a34cad02 Mon Sep 17 00:00:00 2001 From: neverix Date: Sat, 17 Dec 2022 15:27:07 +0300 Subject: [PATCH 05/10] Quick fix --- include/IrrCompileConfig.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/IrrCompileConfig.h b/include/IrrCompileConfig.h index 9fc3f831b..2c25e8cd5 100644 --- a/include/IrrCompileConfig.h +++ b/include/IrrCompileConfig.h @@ -44,9 +44,9 @@ //! different library versions without having to change the sources. //! Example: NO_IRR_COMPILE_WITH_X11_ would disable X11 -#if BUILD_HEADLESS +// #if BUILD_HEADLESS #define _IRR_COMPILE_WITH_SDL_DEVICE_ -#endif +// #endif #ifdef NO_IRR_COMPILE_WITH_SDL_DEVICE_ #undef _IRR_COMPILE_WITH_SDL_DEVICE_ #endif From f29b8b460596a1cf555695c7b76de49dcc299fa9 Mon Sep 17 00:00:00 2001 From: neverix Date: Sat, 17 Dec 2022 17:15:51 +0300 Subject: [PATCH 06/10] Update CIrrDeviceSDL.cpp --- source/Irrlicht/CIrrDeviceSDL.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/source/Irrlicht/CIrrDeviceSDL.cpp b/source/Irrlicht/CIrrDeviceSDL.cpp index 4a23d2c1e..7dff77179 100644 --- a/source/Irrlicht/CIrrDeviceSDL.cpp +++ b/source/Irrlicht/CIrrDeviceSDL.cpp @@ -121,6 +121,7 @@ CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters& param) { u32 flags = SDL_INIT_TIMER | SDL_INIT_EVENTS; #if BUILD_HEADLESS + #else if (CreationParams.DriverType != video::EDT_NULL) flags |= SDL_INIT_VIDEO; #endif From 18a46dd7bcb7e5d988d2c66c4f9311932c2ff254 Mon Sep 17 00:00:00 2001 From: Rabbidon Date: Thu, 12 Jan 2023 12:18:44 +0000 Subject: [PATCH 07/10] Added headless changes to cmakelists.txt --- source/Irrlicht/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/Irrlicht/CMakeLists.txt b/source/Irrlicht/CMakeLists.txt index 57a43048f..3cdba21c3 100644 --- a/source/Irrlicht/CMakeLists.txt +++ b/source/Irrlicht/CMakeLists.txt @@ -99,6 +99,12 @@ if(SDL_ENABLED) find_package(SDL2 CONFIG REQUIRED) message(STATUS "Found SDL2: ${SDL2_LIBRARIES}") endif() +if(BUILD_HEADLESS) + # always require SDL for headless build + find_package(SDL2 REQUIRED) + # SDL won't be included in source code unless defined + add_definitions(-D_IRR_BUILD_WITH_SDL_DRIVER_) # I forget what the define is actually called +endif() # Platform-specific libs From ba6144a8066973e167546072c76f06b2d6ae23b9 Mon Sep 17 00:00:00 2001 From: Josiah VanderZee Date: Thu, 12 Jan 2023 14:54:13 -0600 Subject: [PATCH 08/10] Add CMake option for building in headless mode --- CMakeLists.txt | 1 + include/IrrCompileConfig.h | 4 ++-- source/Irrlicht/CMakeLists.txt | 6 ++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b7b244a9a..a9ccb8870 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,6 +40,7 @@ endif() list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") add_subdirectory(source/Irrlicht) +option(BUILD_HEADLESS "Build in headless mode" ON) option(BUILD_EXAMPLES "Build example applications" FALSE) if(BUILD_EXAMPLES) add_subdirectory(examples) diff --git a/include/IrrCompileConfig.h b/include/IrrCompileConfig.h index 2c25e8cd5..0b0709f0e 100644 --- a/include/IrrCompileConfig.h +++ b/include/IrrCompileConfig.h @@ -44,9 +44,9 @@ //! different library versions without having to change the sources. //! Example: NO_IRR_COMPILE_WITH_X11_ would disable X11 -// #if BUILD_HEADLESS +#ifdef BUILD_HEADLESS #define _IRR_COMPILE_WITH_SDL_DEVICE_ -// #endif +#endif #ifdef NO_IRR_COMPILE_WITH_SDL_DEVICE_ #undef _IRR_COMPILE_WITH_SDL_DEVICE_ #endif diff --git a/source/Irrlicht/CMakeLists.txt b/source/Irrlicht/CMakeLists.txt index 3cdba21c3..c30d5614e 100644 --- a/source/Irrlicht/CMakeLists.txt +++ b/source/Irrlicht/CMakeLists.txt @@ -100,10 +100,8 @@ if(SDL_ENABLED) message(STATUS "Found SDL2: ${SDL2_LIBRARIES}") endif() if(BUILD_HEADLESS) - # always require SDL for headless build - find_package(SDL2 REQUIRED) - # SDL won't be included in source code unless defined - add_definitions(-D_IRR_BUILD_WITH_SDL_DRIVER_) # I forget what the define is actually called + find_package(SDL2 REQUIRED) + add_definitions(-DBUILD_HEADLESS=1) endif() # Platform-specific libs From 7c4fb27602410e41f171571ef28239815b392b1a Mon Sep 17 00:00:00 2001 From: AI_WAIFU Date: Thu, 9 Feb 2023 13:48:45 +0000 Subject: [PATCH 09/10] minor change to BUILD_HEADLESS flag --- include/IrrCompileConfig.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/IrrCompileConfig.h b/include/IrrCompileConfig.h index 0b0709f0e..d987d869f 100644 --- a/include/IrrCompileConfig.h +++ b/include/IrrCompileConfig.h @@ -44,9 +44,10 @@ //! different library versions without having to change the sources. //! Example: NO_IRR_COMPILE_WITH_X11_ would disable X11 -#ifdef BUILD_HEADLESS +#if BUILD_HEADLESS #define _IRR_COMPILE_WITH_SDL_DEVICE_ #endif + #ifdef NO_IRR_COMPILE_WITH_SDL_DEVICE_ #undef _IRR_COMPILE_WITH_SDL_DEVICE_ #endif From c315141d36437fe39092dfb4ebd755b0689de3be Mon Sep 17 00:00:00 2001 From: Gary Miguel Date: Fri, 17 Nov 2023 17:22:18 -0800 Subject: [PATCH 10/10] remove reference to std::unary_function It is not part of c++17 and this code is supposed to build as c++17. See https://en.cppreference.com/w/cpp/utility/functional/unary_function. --- include/irrUString.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/irrUString.h b/include/irrUString.h index 49cc67044..bd026e070 100644 --- a/include/irrUString.h +++ b/include/irrUString.h @@ -3678,7 +3678,7 @@ namespace unicode //! Hashing algorithm for hashing a ustring. Used for things like unordered_maps. //! Algorithm taken from std::hash. -class hash : public std::unary_function +class hash { public: size_t operator()(const core::ustring& s) const