From 7d42048180a2000d715e3192394d4e1bd01f77f4 Mon Sep 17 00:00:00 2001 From: alex <38814044+alextwothousand@users.noreply.github.com> Date: Sat, 31 Jul 2021 13:39:38 +0100 Subject: [PATCH 1/8] (revc) only link winmm with pragma comment if msvc --- src/skel/glfw/glfw.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp index 0928229f..39817ee7 100644 --- a/src/skel/glfw/glfw.cpp +++ b/src/skel/glfw/glfw.cpp @@ -237,7 +237,9 @@ psGrabScreen(RwCamera *pCamera) ***************************************************************************** */ #ifdef _WIN32 +#ifdef _MSC_VER #pragma comment( lib, "Winmm.lib" ) // Needed for time +#endif RwUInt32 psTimer(void) { -- 2.45.2 From 4eed11e1a56fd42085e3fbfff534c6f4753c7f2d Mon Sep 17 00:00:00 2001 From: alex <38814044+alextwothousand@users.noreply.github.com> Date: Sat, 31 Jul 2021 13:41:22 +0100 Subject: [PATCH 2/8] workaround for -Wpedantic error --- src/skel/glfw/glfw.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp index 39817ee7..6e6affdf 100644 --- a/src/skel/glfw/glfw.cpp +++ b/src/skel/glfw/glfw.cpp @@ -1164,11 +1164,11 @@ void InitialiseLanguage() #else WORD primUserLCID = PRIMARYLANGID(GetSystemDefaultLCID()); WORD primSystemLCID = PRIMARYLANGID(GetUserDefaultLCID()); - WORD primLayout = PRIMARYLANGID((DWORD)GetKeyboardLayout(0)); + WORD primLayout = PRIMARYLANGID((DWORD)((uintptr_t)GetKeyboardLayout(0))); WORD subUserLCID = SUBLANGID(GetSystemDefaultLCID()); WORD subSystemLCID = SUBLANGID(GetUserDefaultLCID()); - WORD subLayout = SUBLANGID((DWORD)GetKeyboardLayout(0)); + WORD subLayout = SUBLANGID((DWORD)((uintptr_t)GetKeyboardLayout(0))); #endif if ( primUserLCID == LANG_GERMAN || primSystemLCID == LANG_GERMAN -- 2.45.2 From c0e136ca9227572eeb7c9673b5ee228b771652d4 Mon Sep 17 00:00:00 2001 From: alex <38814044+alextwothousand@users.noreply.github.com> Date: Sat, 31 Jul 2021 13:44:55 +0100 Subject: [PATCH 3/8] (reVC) link winmm if using mingw --- src/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 28090d7e..1456f20c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -29,6 +29,11 @@ target_link_libraries(${EXECUTABLE} PRIVATE Threads::Threads ) +if (MINGW) + target_link_libraries(${EXECUTABLE} PRIVATE + winnm) +endif() + target_include_directories(${EXECUTABLE} PRIVATE $ -- 2.45.2 From 46eaa22888d9fcdb56a54ad12689c55bf3aa7284 Mon Sep 17 00:00:00 2001 From: alex <38814044+alextwothousand@users.noreply.github.com> Date: Sat, 31 Jul 2021 13:46:00 +0100 Subject: [PATCH 4/8] (reVC) fix float.h error with mingw --- src/peds/CivilianPed.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/peds/CivilianPed.cpp b/src/peds/CivilianPed.cpp index f3511366..658ad89e 100644 --- a/src/peds/CivilianPed.cpp +++ b/src/peds/CivilianPed.cpp @@ -14,7 +14,8 @@ #include "Object.h" #include "CarCtrl.h" -#ifndef _WIN32 +#ifndef _MSC_VER +// float.h is still necessary on MinGW. #include #endif @@ -607,4 +608,4 @@ CCivilianPed::IsOnStealWishList(int32 model) } } return false; -} \ No newline at end of file +} -- 2.45.2 From e9431be769821ee71bf0435291fb0157ef5e30a2 Mon Sep 17 00:00:00 2001 From: alex <38814044+alextwothousand@users.noreply.github.com> Date: Sat, 31 Jul 2021 17:05:01 +0100 Subject: [PATCH 5/8] (reVC) cast to DWORD_PTR instead of uintptr --- src/skel/glfw/glfw.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp index 6e6affdf..55f3e639 100644 --- a/src/skel/glfw/glfw.cpp +++ b/src/skel/glfw/glfw.cpp @@ -1164,11 +1164,11 @@ void InitialiseLanguage() #else WORD primUserLCID = PRIMARYLANGID(GetSystemDefaultLCID()); WORD primSystemLCID = PRIMARYLANGID(GetUserDefaultLCID()); - WORD primLayout = PRIMARYLANGID((DWORD)((uintptr_t)GetKeyboardLayout(0))); + WORD primLayout = PRIMARYLANGID((DWORD_PTR)GetKeyboardLayout(0)); WORD subUserLCID = SUBLANGID(GetSystemDefaultLCID()); WORD subSystemLCID = SUBLANGID(GetUserDefaultLCID()); - WORD subLayout = SUBLANGID((DWORD)((uintptr_t)GetKeyboardLayout(0))); + WORD subLayout = SUBLANGID((DWORD_PTR)GetKeyboardLayout(0)); #endif if ( primUserLCID == LANG_GERMAN || primSystemLCID == LANG_GERMAN -- 2.45.2 From c0a3365f93adb31d98feb5b5cee3efb014dbc546 Mon Sep 17 00:00:00 2001 From: alex <38814044+alextwothousand@users.noreply.github.com> Date: Sat, 31 Jul 2021 17:13:48 +0100 Subject: [PATCH 6/8] (reVC) link winmm on Windows regardless of compiler --- src/CMakeLists.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1456f20c..26318f32 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -29,11 +29,6 @@ target_link_libraries(${EXECUTABLE} PRIVATE Threads::Threads ) -if (MINGW) - target_link_libraries(${EXECUTABLE} PRIVATE - winnm) -endif() - target_include_directories(${EXECUTABLE} PRIVATE $ @@ -125,6 +120,11 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") ) endif() +if (WIN32) + target_link_libraries(${EXECUTABLE} PRIVATE + winnm) +endif() + set_target_properties(${EXECUTABLE} PROPERTIES C_STANDARD 11 -- 2.45.2 From 6a56e98e69d8f80af5de0e5bc4ce1661c8713cbb Mon Sep 17 00:00:00 2001 From: alex <38814044+alextwothousand@users.noreply.github.com> Date: Sat, 31 Jul 2021 17:14:10 +0100 Subject: [PATCH 7/8] (reVC) always include float.h --- src/peds/CivilianPed.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/peds/CivilianPed.cpp b/src/peds/CivilianPed.cpp index 658ad89e..e6eaed3d 100644 --- a/src/peds/CivilianPed.cpp +++ b/src/peds/CivilianPed.cpp @@ -14,10 +14,8 @@ #include "Object.h" #include "CarCtrl.h" -#ifndef _MSC_VER // float.h is still necessary on MinGW. #include -#endif CCivilianPed::CCivilianPed(ePedType pedtype, uint32 mi) : CPed(pedtype) { -- 2.45.2 From 0cf98fa028729bf7536e418f03a078f93025e969 Mon Sep 17 00:00:00 2001 From: alex <38814044+alextwothousand@users.noreply.github.com> Date: Sat, 31 Jul 2021 17:33:55 +0100 Subject: [PATCH 8/8] (reVC) link X11 library on Linux --- src/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 26318f32..3029398e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -113,6 +113,12 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang -Wpedantic ) endif() + if (NOT WIN32 AND NOT APPLE) + target_link_libraries(${EXECUTABLE} + PRIVATE + X11 + ) + endif() elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") target_compile_options(${EXECUTABLE} PUBLIC -- 2.45.2