Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Patch for CMake (v3.20.5) and PDCurses (3.9) for cross-compile with mingw64
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a2fcf2e372..ae32ce17b8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -656,25 +656,12 @@ macro (CMAKE_BUILD_UTILITIES)
endif()
#---------------------------------------------------------------------
- # Use curses?
- if (UNIX)
- if(NOT DEFINED BUILD_CursesDialog)
- include(${CMake_SOURCE_DIR}/Source/Checks/Curses.cmake)
- option(BUILD_CursesDialog "Build the CMake Curses Dialog ccmake" "${CMakeCheckCurses_COMPILED}")
- endif()
- else ()
- set(BUILD_CursesDialog 0)
- endif ()
+ set(CURSES_INCLUDE_PATH "/usr/x86_64-w64-mingw32/include/pdcurses")
+ set(CURSES_LIBRARY "/usr/x86_64-w64-mingw32/lib/pdcurses.a")
+
+ set(BUILD_CursesDialog 1)
if(BUILD_CursesDialog)
set(CURSES_NEED_NCURSES TRUE)
- find_package(Curses)
- if(NOT CURSES_FOUND)
- message(WARNING
- "'ccmake' will not be built because Curses was not found.\n"
- "Turn off BUILD_CursesDialog to suppress this message."
- )
- set(BUILD_CursesDialog 0)
- endif()
endif()
if(BUILD_CursesDialog)
if(NOT CMAKE_USE_SYSTEM_FORM)
diff --git a/Source/Checks/Curses/CMakeLists.txt b/Source/Checks/Curses/CMakeLists.txt
index 17318a33b2..b31931d698 100644
--- a/Source/Checks/Curses/CMakeLists.txt
+++ b/Source/Checks/Curses/CMakeLists.txt
@@ -5,6 +5,9 @@ endif()
project(CheckCurses C)
set(CURSES_NEED_NCURSES TRUE)
+set(CURSES_INCLUDE_PATH "/usr/x86_64-w64-mingw32/include/pdcurses")
+set(CURSES_LIBRARY "/usr/x86_64-w64-mingw32/lib/pdcurses.a")
+
find_package(Curses)
if(NOT CURSES_FOUND)
return()
diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx
index 85e256b8bc..dbfec618e2 100644
--- a/Source/CursesDialog/ccmake.cxx
+++ b/Source/CursesDialog/ccmake.cxx
@@ -74,7 +74,7 @@ void onsig(int /*unused*/)
cmCursesForm::CurrentForm->Render(1, 1, x, y);
cmCursesForm::CurrentForm->UpdateStatusBar();
}
- signal(SIGWINCH, onsig);
+ signal(28, onsig);
}
}
@@ -142,7 +142,7 @@ int main(int argc, char const* const* argv)
keypad(stdscr, true); /* Use key symbols as KEY_DOWN */
cmCursesColor::InitColors();
- signal(SIGWINCH, onsig);
+ signal(28, onsig);
int x;
int y;
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index c23ee94511..a727ac3268 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -3,7 +3,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGlobalVisualStudioGenerator.h"
-#include <future>
+#include <mingw-std-threads/mingw.future.h>
#include <iostream>
#include <cm/iterator>
diff --git a/Source/cmQtAutoGenerator.h b/Source/cmQtAutoGenerator.h
index 5c3a8adccb..d0d9d3e180 100644
--- a/Source/cmQtAutoGenerator.h
+++ b/Source/cmQtAutoGenerator.h
@@ -5,7 +5,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <istream>
-#include <mutex>
+#include <mingw-std-threads/mingw.mutex.h>
#include <string>
#include <unordered_set>
#include <vector>
diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx
index f5831628d3..c8204a1610 100644
--- a/Source/cmQtAutoMocUic.cxx
+++ b/Source/cmQtAutoMocUic.cxx
@@ -6,7 +6,7 @@
#include <atomic>
#include <cstddef>
#include <map>
-#include <mutex>
+#include <mingw-std-threads/mingw.mutex.h>
#include <set>
#include <string>
#include <unordered_map>
diff --git a/Source/cmUVHandlePtr.cxx b/Source/cmUVHandlePtr.cxx
index 8ea19423da..4f2346ad53 100644
--- a/Source/cmUVHandlePtr.cxx
+++ b/Source/cmUVHandlePtr.cxx
@@ -5,7 +5,7 @@
#include <cassert>
#include <cstdlib>
-#include <mutex>
+#include <mingw-std-threads/mingw.mutex.h>
#include <cm3p/uv.h>
diff --git a/Source/cmWorkerPool.cxx b/Source/cmWorkerPool.cxx
index 1d15c27adb..c02a4bdb6e 100644
--- a/Source/cmWorkerPool.cxx
+++ b/Source/cmWorkerPool.cxx
@@ -4,12 +4,12 @@
#include <algorithm>
#include <array>
-#include <condition_variable>
+#include <mingw-std-threads/mingw.condition_variable.h>
#include <cstddef>
#include <deque>
#include <functional>
-#include <mutex>
-#include <thread>
+#include <mingw-std-threads/mingw.mutex.h>
+#include <mingw-std-threads/mingw.thread.h>
#include <cm/memory>
diff --git a/Tests/CMakeLib/testUVProcessChainHelper.cxx b/Tests/CMakeLib/testUVProcessChainHelper.cxx
index 9c258342eb..93431d8d91 100644
--- a/Tests/CMakeLib/testUVProcessChainHelper.cxx
+++ b/Tests/CMakeLib/testUVProcessChainHelper.cxx
@@ -5,7 +5,7 @@
#include <set>
#include <sstream>
#include <string>
-#include <thread>
+#include <mingw-std-threads/mingw.thread.h>
std::string getStdin()
{
diff --git a/Tests/CMakeLib/testUVRAII.cxx b/Tests/CMakeLib/testUVRAII.cxx
index 0607f449fa..c721814e2c 100644
--- a/Tests/CMakeLib/testUVRAII.cxx
+++ b/Tests/CMakeLib/testUVRAII.cxx
@@ -1,6 +1,6 @@
#include <chrono>
#include <iostream>
-#include <thread>
+#include <mingw-std-threads/mingw.thread.h>
#include <utility>
#include <cm3p/uv.h>
diff --git a/Tests/RunCMake/CTestResourceAllocation/ctresalloc.cxx b/Tests/RunCMake/CTestResourceAllocation/ctresalloc.cxx
index daf8a2d808..150148efa8 100644
--- a/Tests/RunCMake/CTestResourceAllocation/ctresalloc.cxx
+++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc.cxx
@@ -6,7 +6,7 @@
#include <map>
#include <set>
#include <string>
-#include <thread>
+#include <mingw-std-threads/mingw.thread.h>
#include <utility>
#include <vector>
diff --git a/Utilities/std/cm/shared_mutex b/Utilities/std/cm/shared_mutex
index a1204fa557..f13c99a75e 100644
--- a/Utilities/std/cm/shared_mutex
+++ b/Utilities/std/cm/shared_mutex
@@ -13,7 +13,7 @@
#endif
#if defined(CMake_HAVE_CXX_SHARED_LOCK)
-# include <shared_mutex> // IWYU pragma: export
+# include <mingw-std-threads/mingw.shared_mutex.h> // IWYU pragma: export
#endif
#if !defined(CMake_HAVE_CXX_SHARED_MUTEX)
# include <cm3p/uv.h>
diff --git a/curses.h b/curses.h
index b5b91fda..0978a286 100644
--- a/curses.h
+++ b/curses.h
@@ -621,10 +621,10 @@ indicator.
#define KEY_CODE_YES 0x100 /* If get_wch() gives a key code */
#define KEY_BREAK 0x101 /* Not on PC KBD */
-#define KEY_DOWN 0x102 /* Down arrow key */
-#define KEY_UP 0x103 /* Up arrow key */
-#define KEY_LEFT 0x104 /* Left arrow key */
-#define KEY_RIGHT 0x105 /* Right arrow key */
+#define KEY_DOWN 0x1C8 /* Down arrow key */
+#define KEY_UP 0x1C2 /* Up arrow key */
+#define KEY_LEFT 0x1C4 /* Left arrow key */
+#define KEY_RIGHT 0x1C6 /* Right arrow key */
#define KEY_HOME 0x106 /* home key */
#define KEY_BACKSPACE 0x107 /* not on pc */
#define KEY_F0 0x108 /* function keys; 64 reserved */
diff --git a/wincon/Makefile b/wincon/Makefile
index b7d7c90b..e0b22af9 100644
--- a/wincon/Makefile
+++ b/wincon/Makefile
@@ -26,11 +26,11 @@ include $(common)/libobjs.mif
PDCURSES_WIN_H = $(osdir)/pdcwin.h
-CC = gcc
-AR = ar
-STRIP = strip
-LINK = gcc
-WINDRES = windres
+CC = /usr/bin/x86_64-w64-mingw32-gcc
+AR = /usr/bin/x86_64-w64-mingw32-ar
+STRIP = /usr/bin/x86_64-w64-mingw32-strip
+LINK = /usr/bin/x86_64-w64-mingw32-gcc
+WINDRES = /usr/bin/x86_64-w64-mingw32-windres
ifeq ($(DEBUG),Y)
CFLAGS = -g -Wall -DPDCDEBUG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment