From f5e2f6f613948a450e9ae8499e48d019c76106b5 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sun, 21 Jan 2024 16:27:57 +0100 Subject: [PATCH 1/6] cross compilation toolchain for win32 --- .github/workflows/cross-compile-client.yml | 87 +++++++++++++++++++ CMakeLists.txt | 6 +- CMakeModules/GetRevision.cmake | 2 - CMakeModules/nel.cmake | 6 +- CMakeModules/toolchain-mingw.cmake | 35 ++++++++ nel/include/nel/misc/log.h | 6 +- nel/include/nel/misc/types_nl.h | 1 + nel/src/gui/lua_helper.cpp | 2 +- nel/src/gui/lua_ihm.cpp | 2 +- nel/src/gui/stdpch.h | 2 +- nel/src/logic/stdlogic.h | 4 +- nel/src/misc/CMakeLists.txt | 4 + nel/src/misc/common.cpp | 2 +- nel/src/misc/log.cpp | 10 +-- nel/src/misc/stdmisc.h | 4 +- nel/src/misc/system_info.cpp | 2 +- nel/src/misc/system_utils.cpp | 6 +- nel/src/misc/time_nl.cpp | 2 +- nel/src/net/stdnet.h | 6 +- nel/src/pipeline/project_config.cpp | 2 +- .../sound/driver/fmod/sound_driver_fmod.cpp | 2 +- nel/src/web/stdweb.h | 4 +- .../3d/object_viewer_widget/src/stdpch.h | 2 +- nel/tools/nel_unit_test/nel_unit_test.cpp | 2 +- ryzom/client/src/client.cpp | 2 +- ryzom/client/src/stdpch.h | 2 +- ryzom/common/src/game_share/stdpch.h | 4 +- .../src/monitor_service/service_main.cpp | 4 +- ryzom/server/src/server_share/mysql_wrapper.h | 4 +- snowballs2/client/src/snowballs_client.cpp | 2 +- snowballs2/server/chat/src/main.cpp | 2 +- .../collision/src/collision_service.cpp | 2 +- snowballs2/server/frontend/src/main.cpp | 2 +- snowballs2/server/position/src/main.cpp | 2 +- 34 files changed, 179 insertions(+), 48 deletions(-) create mode 100644 .github/workflows/cross-compile-client.yml create mode 100644 CMakeModules/toolchain-mingw.cmake diff --git a/.github/workflows/cross-compile-client.yml b/.github/workflows/cross-compile-client.yml new file mode 100644 index 0000000000..fa335158a5 --- /dev/null +++ b/.github/workflows/cross-compile-client.yml @@ -0,0 +1,87 @@ +name: build 32-Bit windows client + +on: + push: + branches: [ "core4", "feature/*" ] + pull_request: + branches: [ "core4" ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set reusable strings + # Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file. + id: strings + shell: bash + run: | + echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" + echo "hunter-dir=${{ github.workspace }}/.hunter" >> "$GITHUB_OUTPUT" + echo "cmake-version=3.27.9" >> "$GITHUB_OUTPUT" + echo "cmake-install-dir=/opt/cmake-3.27.9" >> "$GITHUB_OUTPUT" + COMMIT_HASH=${{ github.sha }} + echo "version=sha.${COMMIT_HASH:0:8}" >> "$GITHUB_OUTPUT" + + - name: Dependencies + run: | + sudo apt update + sudo apt install --yes \ + libasound2-dev \ + libgl1-mesa-dev \ + libjack-dev \ + libpulse-dev \ + libxrandr-dev \ + libxrender-dev \ + libxxf86vm-dev \ + mingw-w64 \ + mingw-w64-tools \ + ninja-build + wget --output-document=/tmp/cmake.sh https://github.com/Kitware/CMake/releases/download/v${{ steps.strings.outputs.cmake-version }}/cmake-${{ steps.strings.outputs.cmake-version }}-linux-x86_64.sh + sudo mkdir ${{ steps.strings.outputs.cmake-install-dir }} + sudo sh /tmp/cmake.sh --skip-license --prefix=${{ steps.strings.outputs.cmake-install-dir }} + sudo ln --symbolic --force ${{ steps.strings.outputs.cmake-install-dir }}/bin/cmake /usr/local/bin/cmake + git clone --depth 1 --branch openssl-3.0.12 https://github.com/openssl/openssl.git + cd openssl + ./Configure mingw --cross-compile-prefix=i686-w64-mingw32- --prefix=/usr/i686-w64-mingw32 + make + sudo make install + + - name: Cache Hunter Dependencies + uses: actions/cache@v3.3.2 + with: + path: ${{ steps.strings.outputs.hunter-dir }} + key: ubuntu-latest-hunter-cache + + - name: Configure CMake + # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. + # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type + run: > + cmake --version; + cmake -B ${{ steps.strings.outputs.build-output-dir }} + -G Ninja + -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/CMakeModules/toolchain-mingw.cmake + -DCMAKE_CONFIGURATION_TYPES=Release + -DFINAL_VERSION=OFF + -DHUNTER_CONFIGURATION_TYPES=Release + -DHUNTER_ENABLED=ON + -DHUNTER_ROOT=${{ steps.strings.outputs.hunter-dir }} + -DWITH_DRIVER_OPENAL=ON + -DWITH_DRIVER_OPENGL=ON + -DWITH_INSTALL_LIBRARIES=OFF + -DWITH_NEL_SAMPLES=OFF + -DWITH_NEL_TESTS=OFF + -DWITH_NEL_TOOLS=OFF + -DWITH_RYZOM_CLIENT=ON + -DWITH_RYZOM_SERVER=OFF + -DWITH_RYZOM_TOOLS=OFF + -S ${{ github.workspace }} + + - name: Build + run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config Release + + - uses: actions/upload-artifact@v4 + with: + name: ryzom-client-win32-${{ steps.strings.outputs.version }} + path: ${{ steps.strings.outputs.build-output-dir }}/bin diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f4f994e39..21603dfb91 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,8 @@ # * To build binary archive, use the 'package' target. # To build source archive, use the 'package_source' target. +CMAKE_MINIMUM_REQUIRED(VERSION 3.22) + #----------------------------------------------------------------------------- # Load some macros. SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}") @@ -39,6 +41,7 @@ ENDIF() # Downloads and install Hunger into HUNTER_ROOT directory. OPTION(HUNTER_ENABLED "Enable Hunter package manager" OFF) IF(HUNTER_ENABLED) + cmake_minimum_required(VERSION 3.24) INCLUDE("CMakeModules/HunterGate.cmake") HunterGate( URL "https://github.com/cpp-pm/hunter/archive/v0.25.3.tar.gz" @@ -79,7 +82,6 @@ ELSE() SET(CURRENT_YEAR "2019") ENDIF() -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) PROJECT(RyzomCore CXX C) SET(NL_VERSION_MAJOR 4) SET(NL_VERSION_MINOR 1) @@ -184,7 +186,7 @@ IF(HUNTER_ENABLED) FIND_PACKAGE(libxml2 CONFIG REQUIRED) SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} libxml2::libxml2) - HUNTER_ADD_PACKAGE(OpenSSL) +# HUNTER_ADD_PACKAGE(OpenSSL) FIND_PACKAGE(OpenSSL REQUIRED) # TODO: is OpenSSL::Crypto only needed for WIN32? SET(OPENSSL_LIBRARIES OpenSSL::SSL OpenSSL::Crypto) diff --git a/CMakeModules/GetRevision.cmake b/CMakeModules/GetRevision.cmake index 1455b39317..418cc74b27 100644 --- a/CMakeModules/GetRevision.cmake +++ b/CMakeModules/GetRevision.cmake @@ -1,5 +1,3 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3) - # ROOT_DIR should be set to root of the repository (where to find the .svn or .hg directory) # SOURCE_DIR should be set to root of your code (where to find CMakeLists.txt) # BINARY_DIR should be set to root of your build directory diff --git a/CMakeModules/nel.cmake b/CMakeModules/nel.cmake index ecc3f5b52c..98610c9d6a 100644 --- a/CMakeModules/nel.cmake +++ b/CMakeModules/nel.cmake @@ -1052,7 +1052,9 @@ MACRO(NL_SETUP_BUILD) ENDIF() # Fix undefined reference to `__stack_chk_fail' error - ADD_PLATFORM_LINKFLAGS("-lc") + IF(NOT MINGW) + ADD_PLATFORM_LINKFLAGS("-lc") + ENDIF() IF(NOT APPLE) ADD_PLATFORM_LINKFLAGS("-Wl,--no-undefined -Wl,--as-needed") @@ -1062,7 +1064,7 @@ MACRO(NL_SETUP_BUILD) ENDIF() ENDIF() - IF(NOT APPLE) + IF(NOT APPLE AND NOT MINGW) # hardening ADD_PLATFORM_LINKFLAGS("-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now") ENDIF() diff --git a/CMakeModules/toolchain-mingw.cmake b/CMakeModules/toolchain-mingw.cmake new file mode 100644 index 0000000000..8b3051cc62 --- /dev/null +++ b/CMakeModules/toolchain-mingw.cmake @@ -0,0 +1,35 @@ +set(CMAKE_SYSTEM_NAME Windows) + +set(CMAKE_C_COMPILER_TARGET i686-w64-mingw32) +set(CMAKE_CXX_COMPILER_TARGET i686-w64-mingw32) +set(CMAKE_RC_COMPILER_TARGET i686-w64-mingw32) + +set(CMAKE_CROSSCOMPILING TRUE) +set(CMAKE_CROSSCOMPILING_EMULATOR wine) + +set(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32) +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + +# Prefer posix gcc variant for gtest pthread support +find_program(C_COMPILER_FULL_PATH NAMES + ${CMAKE_C_COMPILER_TARGET}-gcc-posix + ${CMAKE_C_COMPILER_TARGET}-gcc) +if(NOT C_COMPILER_FULL_PATH) + message(FATAL_ERROR "Cross-compiler for ${CMAKE_C_COMPILER_TARGET} not found") +endif() +set(CMAKE_C_COMPILER ${C_COMPILER_FULL_PATH}) + +find_program(CXX_COMPILER_FULL_PATH NAMES + ${CMAKE_CXX_COMPILER_TARGET}-g++-posix + ${CMAKE_CXX_COMPILER_TARGET}-g++) +if(CXX_COMPILER_FULL_PATH) + set(CMAKE_CXX_COMPILER ${CXX_COMPILER_FULL_PATH}) +endif() + +find_program(RC_COMPILER_FULL_PATH NAMES + ${CMAKE_RC_COMPILER_TARGET}-windres) +if(RC_COMPILER_FULL_PATH) + set(CMAKE_RC_COMPILER ${RC_COMPILER_FULL_PATH}) +endif() diff --git a/nel/include/nel/misc/log.h b/nel/include/nel/misc/log.h index 19939fc36a..cee41e9bbb 100644 --- a/nel/include/nel/misc/log.h +++ b/nel/include/nel/misc/log.h @@ -93,9 +93,11 @@ class CLog { /// Find the process name if nobody call setProcessName before static void setDefaultProcessName (); +#if defined(NL_OS_WINDOWS) && !defined(__GNUC__) +#define USE_LOG_CHECK_TYPES +#endif -#ifdef NL_OS_WINDOWS - +#ifdef USE_LOG_CHECK_TYPES #define CHECK_TYPES2(__a,__b) \ inline __a(const char *fmt) { __b(fmt); } \ template __a(const char *fmt, A a) { _check(a); __b(fmt, a); } \ diff --git a/nel/include/nel/misc/types_nl.h b/nel/include/nel/misc/types_nl.h index 012728cbf0..f23cf36807 100644 --- a/nel/include/nel/misc/types_nl.h +++ b/nel/include/nel/misc/types_nl.h @@ -502,6 +502,7 @@ extern void operator delete[](void *p) throw(); #elif defined(NL_ISO_CPP0X_AVAILABLE) || (defined(NL_COMP_VC) && (NL_COMP_VC_VERSION >= 100)) # include # include +# include # define CHashMap ::std::unordered_map # define CHashSet ::std::unordered_set # define CHashMultiMap ::std::unordered_multimap diff --git a/nel/src/gui/lua_helper.cpp b/nel/src/gui/lua_helper.cpp index b06a0a088e..cb10174ccd 100644 --- a/nel/src/gui/lua_helper.cpp +++ b/nel/src/gui/lua_helper.cpp @@ -53,7 +53,7 @@ #include #ifdef NL_OS_WINDOWS -#include +#include #endif using namespace std; diff --git a/nel/src/gui/lua_ihm.cpp b/nel/src/gui/lua_ihm.cpp index d37474fbe1..dcf3b31172 100644 --- a/nel/src/gui/lua_ihm.cpp +++ b/nel/src/gui/lua_ihm.cpp @@ -32,7 +32,7 @@ #endif #ifdef NL_OS_WINDOWS -#include +#include #endif // Warning: cannot use namespace std, when using luabind diff --git a/nel/src/gui/stdpch.h b/nel/src/gui/stdpch.h index 4b4a1a99eb..1d8cb27bf4 100644 --- a/nel/src/gui/stdpch.h +++ b/nel/src/gui/stdpch.h @@ -48,7 +48,7 @@ #ifndef NL_COMP_MINGW # define NOMINMAX #endif - #include + #include #include #endif diff --git a/nel/src/logic/stdlogic.h b/nel/src/logic/stdlogic.h index cdfe3f6f75..a537d3eb63 100644 --- a/nel/src/logic/stdlogic.h +++ b/nel/src/logic/stdlogic.h @@ -47,8 +47,8 @@ # define WINVER 0x0500 # define NOMINMAX # endif -# include -# include +# include +# include #endif #endif // NL_STDMISC_H diff --git a/nel/src/misc/CMakeLists.txt b/nel/src/misc/CMakeLists.txt index 79fe5ed844..b08278f213 100644 --- a/nel/src/misc/CMakeLists.txt +++ b/nel/src/misc/CMakeLists.txt @@ -217,6 +217,10 @@ ELSE() TARGET_LINK_LIBRARIES(nelmisc ${PNG_LIBRARY}) ENDIF() +IF(WIN32) + TARGET_LINK_LIBRARIES(nelmisc winmm.lib dbghelp) +ENDIF() + #TODO: needed for hunter aswell? IF(UNIX) TARGET_LINK_LIBRARIES(nelmisc -lc -ldl) diff --git a/nel/src/misc/common.cpp b/nel/src/misc/common.cpp index 2342cf3b9f..80b254cff0 100644 --- a/nel/src/misc/common.cpp +++ b/nel/src/misc/common.cpp @@ -23,7 +23,7 @@ #include "nel/misc/common.h" #ifdef NL_OS_WINDOWS -# include +# include # include # include diff --git a/nel/src/misc/log.cpp b/nel/src/misc/log.cpp index c47aae04b9..cdd0178399 100644 --- a/nel/src/misc/log.cpp +++ b/nel/src/misc/log.cpp @@ -342,7 +342,7 @@ void CLog::displayString (const char *str) /* * Display the string with decoration and final new line to all attached displayers */ -#ifdef NL_OS_WINDOWS +#ifdef USE_LOG_CHECK_TYPES void CLog::_displayNL (const char *format, ...) #else void CLog::displayNL (const char *format, ...) @@ -367,7 +367,7 @@ void CLog::displayNL (const char *format, ...) /* * Display the string with decoration to all attached displayers */ -#ifdef NL_OS_WINDOWS +#ifdef USE_LOG_CHECK_TYPES void CLog::_display (const char *format, ...) #else void CLog::display (const char *format, ...) @@ -461,7 +461,7 @@ void CLog::displayRawString (const char *str) /* * Display a string (and nothing more) to all attached displayers */ -#ifdef NL_OS_WINDOWS +#ifdef USE_LOG_CHECK_TYPES void CLog::_displayRawNL( const char *format, ... ) #else void CLog::displayRawNL( const char *format, ... ) @@ -486,7 +486,7 @@ void CLog::displayRawNL( const char *format, ... ) /* * Display a string (and nothing more) to all attached displayers */ -#ifdef NL_OS_WINDOWS +#ifdef USE_LOG_CHECK_TYPES void CLog::_displayRaw( const char *format, ... ) #else void CLog::displayRaw( const char *format, ... ) @@ -504,7 +504,7 @@ void CLog::displayRaw( const char *format, ... ) } -#ifdef NL_OS_WINDOWS +#ifdef USE_LOG_CHECK_TYPES void CLog::_forceDisplayRaw (const char *format, ...) #else void CLog::forceDisplayRaw (const char *format, ...) diff --git a/nel/src/misc/stdmisc.h b/nel/src/misc/stdmisc.h index f5cc506b3e..8f227ab2b7 100644 --- a/nel/src/misc/stdmisc.h +++ b/nel/src/misc/stdmisc.h @@ -69,8 +69,8 @@ # define WINVER 0x0500 # define NOMINMAX # endif -# include -# include +# include +# include #endif #endif // NL_STDMISC_H diff --git a/nel/src/misc/system_info.cpp b/nel/src/misc/system_info.cpp index c0b626f8ac..4bad388460 100644 --- a/nel/src/misc/system_info.cpp +++ b/nel/src/misc/system_info.cpp @@ -22,7 +22,7 @@ #include "nel/misc/system_info.h" #ifdef NL_OS_WINDOWS -# include +# include # include # include # define nlcpuid(regs, idx) __cpuid(regs, idx) diff --git a/nel/src/misc/system_utils.cpp b/nel/src/misc/system_utils.cpp index 8c01b227c6..9a6945242e 100644 --- a/nel/src/misc/system_utils.cpp +++ b/nel/src/misc/system_utils.cpp @@ -55,11 +55,11 @@ #endif #include #include -#include -# include +#include +# include # ifdef _WIN32_WINNT_WIN7 // only supported by Windows 7 Platform SDK -# include +# include # define TASKBAR_PROGRESS 1 # endif #elif defined(NL_OS_UNIX) && !defined(NL_OS_MAC) diff --git a/nel/src/misc/time_nl.cpp b/nel/src/misc/time_nl.cpp index cca6f14aab..58d1a911ab 100644 --- a/nel/src/misc/time_nl.cpp +++ b/nel/src/misc/time_nl.cpp @@ -24,7 +24,7 @@ #include "nel/misc/thread.h" #ifdef NL_OS_WINDOWS -# include +# include #elif defined (NL_OS_UNIX) # include # include diff --git a/nel/src/net/stdnet.h b/nel/src/net/stdnet.h index 677206ec26..b7a71b1fbf 100644 --- a/nel/src/net/stdnet.h +++ b/nel/src/net/stdnet.h @@ -75,9 +75,9 @@ # define NOMINMAX # endif # endif -# include -# include -# include +# include +# include +# include #endif #endif diff --git a/nel/src/pipeline/project_config.cpp b/nel/src/pipeline/project_config.cpp index 1dd149313b..c4af296978 100644 --- a/nel/src/pipeline/project_config.cpp +++ b/nel/src/pipeline/project_config.cpp @@ -23,7 +23,7 @@ #include "nel/pipeline/project_config.h" #ifdef NL_OS_WINDOWS -# include +# include #else # include #endif diff --git a/nel/src/sound/driver/fmod/sound_driver_fmod.cpp b/nel/src/sound/driver/fmod/sound_driver_fmod.cpp index a473b5bd91..bac0ca080b 100644 --- a/nel/src/sound/driver/fmod/sound_driver_fmod.cpp +++ b/nel/src/sound/driver/fmod/sound_driver_fmod.cpp @@ -23,7 +23,7 @@ #include "buffer_fmod.h" #ifdef NL_OS_WINDOWS -#include +#include #endif #ifdef DEBUG_NEW diff --git a/nel/src/web/stdweb.h b/nel/src/web/stdweb.h index 1399a3318d..c726d4dfd6 100644 --- a/nel/src/web/stdweb.h +++ b/nel/src/web/stdweb.h @@ -67,8 +67,8 @@ # define WINVER 0x0500 # define NOMINMAX # endif -# include -# include +# include +# include # include # ifdef X509_NAME # undef X509_NAME diff --git a/nel/tools/3d/object_viewer_widget/src/stdpch.h b/nel/tools/3d/object_viewer_widget/src/stdpch.h index 588d8a8986..d1dd781d7e 100644 --- a/nel/tools/3d/object_viewer_widget/src/stdpch.h +++ b/nel/tools/3d/object_viewer_widget/src/stdpch.h @@ -52,7 +52,7 @@ along with this program. If not, see . #if defined(NL_OS_WINDOWS) #define NOMINMAX -#include +#include #elif defined(NL_OS_MAC) #else #include diff --git a/nel/tools/nel_unit_test/nel_unit_test.cpp b/nel/tools/nel_unit_test/nel_unit_test.cpp index d716fef98a..2451dffb9d 100644 --- a/nel/tools/nel_unit_test/nel_unit_test.cpp +++ b/nel/tools/nel_unit_test/nel_unit_test.cpp @@ -34,7 +34,7 @@ using namespace std; #ifdef _MSC_VER -#include +#include /** A special stream buffer that output in the 'output debug string' feature of windows. */ diff --git a/ryzom/client/src/client.cpp b/ryzom/client/src/client.cpp index 5fb236ad94..ec240c603b 100644 --- a/ryzom/client/src/client.cpp +++ b/ryzom/client/src/client.cpp @@ -123,7 +123,7 @@ NLMISC::CCmdArgs Args; // enable optimus for NVIDIA cards extern "C" { - _declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001; + __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001; } void pump () diff --git a/ryzom/client/src/stdpch.h b/ryzom/client/src/stdpch.h index a17f627fb2..33ec186d92 100644 --- a/ryzom/client/src/stdpch.h +++ b/ryzom/client/src/stdpch.h @@ -137,7 +137,7 @@ # ifndef NL_COMP_MINGW # define NOMINMAX # endif -# include +# include # include #endif // NL_OS_WINDOWS diff --git a/ryzom/common/src/game_share/stdpch.h b/ryzom/common/src/game_share/stdpch.h index a5c29704d8..483335a8a8 100644 --- a/ryzom/common/src/game_share/stdpch.h +++ b/ryzom/common/src/game_share/stdpch.h @@ -84,8 +84,8 @@ # ifndef NL_COMP_MINGW # define NOMINMAX # endif -# include -# include +# include +# include #endif #endif diff --git a/ryzom/server/src/monitor_service/service_main.cpp b/ryzom/server/src/monitor_service/service_main.cpp index dd60290b64..7f8f331812 100644 --- a/ryzom/server/src/monitor_service/service_main.cpp +++ b/ryzom/server/src/monitor_service/service_main.cpp @@ -34,8 +34,8 @@ # ifndef NL_COMP_MINGW # define NOMINMAX # endif -# include -# include +# include +# include typedef unsigned long ulong; #endif // NL_OS_WINDOWS diff --git a/ryzom/server/src/server_share/mysql_wrapper.h b/ryzom/server/src/server_share/mysql_wrapper.h index ee0d8386ce..96822e4734 100644 --- a/ryzom/server/src/server_share/mysql_wrapper.h +++ b/ryzom/server/src/server_share/mysql_wrapper.h @@ -29,8 +29,8 @@ #include "nel/net/module_common.h" #include "game_share/utils.h" #ifdef NL_OS_WINDOWS -# include -# include +# include +# include typedef unsigned long ulong; #endif #ifdef NL_OS_MAC diff --git a/snowballs2/client/src/snowballs_client.cpp b/snowballs2/client/src/snowballs_client.cpp index 0d18b53610..7a109eea78 100644 --- a/snowballs2/client/src/snowballs_client.cpp +++ b/snowballs2/client/src/snowballs_client.cpp @@ -77,7 +77,7 @@ #include "game_time.h" #ifdef NL_OS_WINDOWS -#include +#include #endif using namespace std; diff --git a/snowballs2/server/chat/src/main.cpp b/snowballs2/server/chat/src/main.cpp index 42a13d92a6..d2128e8e24 100644 --- a/snowballs2/server/chat/src/main.cpp +++ b/snowballs2/server/chat/src/main.cpp @@ -37,7 +37,7 @@ #include #ifdef NL_OS_WINDOWS -#include +#include #endif using namespace std; diff --git a/snowballs2/server/collision/src/collision_service.cpp b/snowballs2/server/collision/src/collision_service.cpp index e421186012..bea829870f 100644 --- a/snowballs2/server/collision/src/collision_service.cpp +++ b/snowballs2/server/collision/src/collision_service.cpp @@ -18,7 +18,7 @@ #include #ifdef NL_OS_WINDOWS -#include +#include #endif using namespace SBSERVICE; diff --git a/snowballs2/server/frontend/src/main.cpp b/snowballs2/server/frontend/src/main.cpp index 4d9d94ae96..da68d9d602 100644 --- a/snowballs2/server/frontend/src/main.cpp +++ b/snowballs2/server/frontend/src/main.cpp @@ -42,7 +42,7 @@ #include #ifdef NL_OS_WINDOWS -#include +#include #endif using namespace NLMISC; diff --git a/snowballs2/server/position/src/main.cpp b/snowballs2/server/position/src/main.cpp index a1ea5ceddf..a52a0f623e 100644 --- a/snowballs2/server/position/src/main.cpp +++ b/snowballs2/server/position/src/main.cpp @@ -42,7 +42,7 @@ #include "physics.h" #ifdef NL_OS_WINDOWS -#include +#include #endif using namespace NLMISC; From e784b6536f2a4ef7a65d849e619070369da6a1c6 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sun, 21 Jan 2024 16:40:26 +0100 Subject: [PATCH 2/6] set policy for using Documentation.cmake --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 21603dfb91..26b10ccb80 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,6 +34,9 @@ IF(COMMAND cmake_policy) IF(POLICY CMP0020) CMAKE_POLICY(SET CMP0020 NEW) ENDIF() + + # allow usage of Documentation.cmake + cmake_policy(SET CMP0106 OLD) ENDIF() From ef1c206efcb56da9fa0c6127bf972c7d63fc6c11 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sun, 21 Jan 2024 16:56:58 +0100 Subject: [PATCH 3/6] remove deprecated cmake module --- CMakeLists.txt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 26b10ccb80..1d319cf6ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,9 +34,6 @@ IF(COMMAND cmake_policy) IF(POLICY CMP0020) CMAKE_POLICY(SET CMP0020 NEW) ENDIF() - - # allow usage of Documentation.cmake - cmake_policy(SET CMP0106 OLD) ENDIF() @@ -71,7 +68,6 @@ ENDIF() INCLUDE(nel) INCLUDE(ConfigureChecks) INCLUDE(CheckDepends) -INCLUDE(${CMAKE_ROOT}/Modules/Documentation.cmake OPTIONAL) # Force out of source builds. CHECK_OUT_OF_SOURCE() From 1d78df9e8c9d78ed5b53ef38f68fe07c105037d7 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sun, 21 Jan 2024 17:30:59 +0100 Subject: [PATCH 4/6] set opengl reference legacy apis as newer cmake versions use different ones by default --- nel/src/3d/driver/opengl/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/nel/src/3d/driver/opengl/CMakeLists.txt b/nel/src/3d/driver/opengl/CMakeLists.txt index e9f4a2a7ed..8b73799f61 100644 --- a/nel/src/3d/driver/opengl/CMakeLists.txt +++ b/nel/src/3d/driver/opengl/CMakeLists.txt @@ -1,3 +1,4 @@ +SET(OpenGL_GL_PREFERENCE "LEGACY") IF(NOT WIN32) IF(APPLE) FIND_LIBRARY(CARBON NAMES Carbon) From 42262cc4b58b7e520dd337a7c0f93ab15e846e75 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sun, 21 Jan 2024 21:01:51 +0100 Subject: [PATCH 5/6] use existing openssl package over hunter if available --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d319cf6ce..35019eb9b4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -185,7 +185,11 @@ IF(HUNTER_ENABLED) FIND_PACKAGE(libxml2 CONFIG REQUIRED) SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} libxml2::libxml2) -# HUNTER_ADD_PACKAGE(OpenSSL) + # cross compiling doesn't quite work on the hunter openssl package therefor compile it separately and use it + FIND_PACKAGE(OpenSSL QUIET) + if(NOT OpenSSL_FOUND) + HUNTER_ADD_PACKAGE(OpenSSL) + endif() FIND_PACKAGE(OpenSSL REQUIRED) # TODO: is OpenSSL::Crypto only needed for WIN32? SET(OPENSSL_LIBRARIES OpenSSL::SSL OpenSSL::Crypto) From 818956ba2db0931d140c07d362d868defa4025a8 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Mon, 22 Jan 2024 18:08:20 +0100 Subject: [PATCH 6/6] only use hunter package when not cross compiling --- CMakeLists.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 35019eb9b4..23cf7ef867 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -186,10 +186,9 @@ IF(HUNTER_ENABLED) SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} libxml2::libxml2) # cross compiling doesn't quite work on the hunter openssl package therefor compile it separately and use it - FIND_PACKAGE(OpenSSL QUIET) - if(NOT OpenSSL_FOUND) + IF(NOT CMAKE_CROSSCOMPILING) HUNTER_ADD_PACKAGE(OpenSSL) - endif() + ENDIF() FIND_PACKAGE(OpenSSL REQUIRED) # TODO: is OpenSSL::Crypto only needed for WIN32? SET(OPENSSL_LIBRARIES OpenSSL::SSL OpenSSL::Crypto)