From e32a7896a96f7d592fa6aad5d6af7ba0c4dac25c Mon Sep 17 00:00:00 2001 From: alex <38814044+alextwothousand@users.noreply.github.com> Date: Sat, 31 Jul 2021 13:38:53 +0100 Subject: [PATCH 1/7] only pragma comment if using 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 8d3fc7d7..e641cde6 100644 --- a/src/skel/glfw/glfw.cpp +++ b/src/skel/glfw/glfw.cpp @@ -233,7 +233,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 de4bb5302943e7269bf3c2fa8360ca703f095a43 Mon Sep 17 00:00:00 2001 From: alex <38814044+alextwothousand@users.noreply.github.com> Date: Sat, 31 Jul 2021 13:42:32 +0100 Subject: [PATCH 2/7] (re3) 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 e641cde6..23ee972b 100644 --- a/src/skel/glfw/glfw.cpp +++ b/src/skel/glfw/glfw.cpp @@ -1131,11 +1131,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 4a1386e0c38fdd2e9cefd66e59445d321218eb5b Mon Sep 17 00:00:00 2001 From: alex <38814044+alextwothousand@users.noreply.github.com> Date: Sat, 31 Jul 2021 13:44:33 +0100 Subject: [PATCH 3/7] 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..45926e5a 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 + winmm) +endif() + target_include_directories(${EXECUTABLE} PRIVATE $ -- 2.45.2 From 9e6652918ef16c44c9e5d05478e629d50203ac66 Mon Sep 17 00:00:00 2001 From: alex <38814044+alextwothousand@users.noreply.github.com> Date: Sat, 31 Jul 2021 17:04:03 +0100 Subject: [PATCH 4/7] (re3) 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 23ee972b..9f6d4b3c 100644 --- a/src/skel/glfw/glfw.cpp +++ b/src/skel/glfw/glfw.cpp @@ -1131,11 +1131,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 d51adae07ae6a9ff2b395b5c02c3f8010200b281 Mon Sep 17 00:00:00 2001 From: alex <38814044+alextwothousand@users.noreply.github.com> Date: Sat, 31 Jul 2021 17:17:24 +0100 Subject: [PATCH 5/7] (re3) Link winmm on win 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 45926e5a..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 - winmm) -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 4a6997ad63a7886666280722646281483e49c75c Mon Sep 17 00:00:00 2001 From: alex <38814044+alextwothousand@users.noreply.github.com> Date: Sat, 31 Jul 2021 17:33:28 +0100 Subject: [PATCH 6/7] (re3) Link X11 library on LINUX platforms --- 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 From 5d44792757d3730714810aec39a4d7492930ca1a Mon Sep 17 00:00:00 2001 From: alex <38814044+alextwothousand@users.noreply.github.com> Date: Sat, 31 Jul 2021 20:59:01 +0100 Subject: [PATCH 7/7] Update src/skel/glfw/glfw.cpp Co-authored-by: Anonymous Maarten --- src/skel/glfw/glfw.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp index 9f6d4b3c..977af517 100644 --- a/src/skel/glfw/glfw.cpp +++ b/src/skel/glfw/glfw.cpp @@ -233,7 +233,7 @@ psGrabScreen(RwCamera *pCamera) ***************************************************************************** */ #ifdef _WIN32 -#ifdef _MSC_VER +#if defined _MSC_VER && !defined CMAKE_NO_AUTOLINK #pragma comment( lib, "Winmm.lib" ) // Needed for time #endif RwUInt32 -- 2.45.2