Hi,

at first: Sorry for the very long delay.

On Mon, 14 Nov 2011 21:12:24 +0100, Alexander Neundorf wrote:
On Saturday 12 November 2011, Patrick Gansterer wrote:
Hi,

I've created a very simple patch to add the basic support for WindowsCE to CMake. I does not provide any automatically architecture detection or so
on, but enables user to use a vanilla CMake for compiling Windows CE
projects. If the patch gets accepted I'll write a few lines into the wiki.

Looks ok from my side. I'm not sure it's complete.
It hardcodes the ARM architecture.
WinCE supports more than that, right ?
But maybe ARM covers most users, I don't know.

In one of the tickets below there is a patch which tries to detect the architecture and was not applied because of the way it tried to do this.

Should we considers the people which reported and commented on those bugs:
http://public.kitware.com/Bug/view.php?id=8486
http://public.kitware.com/Bug/view.php?id=8102
http://public.kitware.com/Bug/view.php?id=7919

They include patches, which are also in use by them.

I know of of the other patches and my work is based on them (see als https://gitorious.org/~paroga/cmake/parogas-cmake). But since there is not much progress on the mentioned bugs, I'll try to upstream my solution in small reviewable patches.

-- Patrick
From 4579b8be19c0afae66a78691b705b7fcb8d6a935 Mon Sep 17 00:00:00 2001
From: Patrick Gansterer <par...@paroga.com>
Date: Sat, 14 Jul 2012 07:12:23 +0200
Subject: [PATCH] Added very basic Windows CE Makefile support

This patch enables CMake to create Makefiles targeting
Windows CE devices.
CMake needs to be run within an cross compile command prompt
and requires a toolchain file which sets CMAKE_SYSTEM_NAME
to "WindowsCE" and CMAKE_SYSTEM_PROCESSOR to the target
machine architecture (e.g. THUMB).
---
 Modules/Platform/Windows-cl.cmake   |   29 ++++++++++++++++++++++-------
 Modules/Platform/WindowsCE-cl.cmake |   13 +++++++++++++
 Modules/Platform/WindowsCE.cmake    |    1 +
 3 files changed, 36 insertions(+), 7 deletions(-)
 create mode 100644 Modules/Platform/WindowsCE-cl.cmake
 create mode 100644 Modules/Platform/WindowsCE.cmake

diff --git a/Modules/Platform/Windows-cl.cmake 
b/Modules/Platform/Windows-cl.cmake
index be6abb6..691ac78 100644
--- a/Modules/Platform/Windows-cl.cmake
+++ b/Modules/Platform/Windows-cl.cmake
@@ -7,8 +7,13 @@ SET(WIN32 1)
 
 INCLUDE(Platform/cl)
 
-SET(CMAKE_CREATE_WIN32_EXE /subsystem:windows)
-SET(CMAKE_CREATE_CONSOLE_EXE /subsystem:console)
+IF(CMAKE_SYSTEM_NAME MATCHES "WindowsCE")
+  SET(CMAKE_CREATE_WIN32_EXE "/subsystem:windowsce /entry:WinMainCRTStartup")
+  SET(CMAKE_CREATE_CONSOLE_EXE "/subsystem:windowsce /entry:mainACRTStartup")
+ELSE(CMAKE_SYSTEM_NAME MATCHES "WindowsCE")
+  SET(CMAKE_CREATE_WIN32_EXE "/subsystem:windows")
+  SET(CMAKE_CREATE_CONSOLE_EXE "/subsystem:console")
+ENDIF(CMAKE_SYSTEM_NAME MATCHES "WindowsCE")
 
 IF(CMAKE_GENERATOR MATCHES "Visual Studio 6")
    SET (CMAKE_NO_BUILD_TYPE 1)
@@ -152,18 +157,28 @@ IF(MSVC_VERSION GREATER 1310)
   SET(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_COMMAND> -E vs_link_exe 
${CMAKE_CXX_LINK_EXECUTABLE}")
   SET(CMAKE_C_LINK_EXECUTABLE "<CMAKE_COMMAND> -E vs_link_exe 
${CMAKE_C_LINK_EXECUTABLE}")
 
+  IF(CMAKE_SYSTEM_NAME MATCHES "WindowsCE")
+    STRING(TOUPPER ${MSVC_ARCHITECTURE_FAMILY} MSVC_ARCHITECTURE_FAMILY_UPPER)
+    SET(CMAKE_PLATFORM_DEFINES "/D_WIN32_WCE=0x500 /DUNDER_CE 
/D${MSVC_ARCHITECTURE_FAMILY} /D_${MSVC_ARCHITECTURE_FAMILY_UPPER}_")
+    SET(CMAKE_C_STANDARD_LIBRARIES_INIT "coredll.lib corelibc.lib ole32.lib 
oleaut32.lib uuid.lib commctrl.lib ")
+    SET(CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} 
/NODEFAULTLIB:oldnames.lib")
+  ELSE(CMAKE_SYSTEM_NAME MATCHES "WindowsCE")
+    SET(CMAKE_PLATFORM_DEFINES "/DWIN32")
+    SET(CMAKE_DEBUG_PLATFORM_DEFINES "/RTC1")
+    SET(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib 
winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib 
advapi32.lib ")
+  ENDIF(CMAKE_SYSTEM_NAME MATCHES "WindowsCE")
+
   SET(CMAKE_BUILD_TYPE_INIT Debug)
-  SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc /GR")
-  SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1")
+  SET (CMAKE_CXX_FLAGS_INIT "${CMAKE_PLATFORM_DEFINES} /D_WINDOWS /W3 /Zm1000 
/EHsc /GR")
+  SET (CMAKE_CXX_FLAGS_DEBUG_INIT "${CMAKE_DEBUG_PLATFORM_DEFINES} /D_DEBUG 
/MDd /Zi /Ob0 /Od")
   SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG")
   SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG")
   SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG")
-  SET (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000")
-  SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi  /Ob0 /Od /RTC1")
+  SET (CMAKE_C_FLAGS_INIT "${CMAKE_PLATFORM_DEFINES} /D_WINDOWS /W3 /Zm1000")
+  SET (CMAKE_C_FLAGS_DEBUG_INIT "${CMAKE_DEBUG_PLATFORM_DEFINES} /D_DEBUG /MDd 
/Zi  /Ob0 /Od")
   SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG")
   SET (CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG")
   SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG")
-  SET (CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib 
winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib 
advapi32.lib ")
   SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT}")
 ELSE(MSVC_VERSION GREATER 1310)
   IF(CMAKE_USING_VC_FREE_TOOLS)
diff --git a/Modules/Platform/WindowsCE-cl.cmake 
b/Modules/Platform/WindowsCE-cl.cmake
new file mode 100644
index 0000000..690b2ad
--- /dev/null
+++ b/Modules/Platform/WindowsCE-cl.cmake
@@ -0,0 +1,13 @@
+if (CMAKE_SYSTEM_PROCESSOR MATCHES "SH4")
+  set (MSVC_ARCHITECTURE_FAMILY "SHx")
+elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "THUMB")
+  set (MSVC_ARCHITECTURE_FAMILY "ARM")
+elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "X86")
+  set (MSVC_ARCHITECTURE_FAMILY "x86")
+else ()
+  set (MSVC_ARCHITECTURE_FAMILY ${CMAKE_SYSTEM_PROCESSOR})
+endif ()
+
+set (MSVC_C_ARCHITECTURE_ID ${CMAKE_SYSTEM_PROCESSOR})
+set (MSVC_CXX_ARCHITECTURE_ID ${CMAKE_SYSTEM_PROCESSOR})
+include (Platform/Windows-cl)
diff --git a/Modules/Platform/WindowsCE.cmake b/Modules/Platform/WindowsCE.cmake
new file mode 100644
index 0000000..151301e
--- /dev/null
+++ b/Modules/Platform/WindowsCE.cmake
@@ -0,0 +1 @@
+include (Platform/Windows)
-- 
1.7.10.msysgit.1

--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to