Add WindowsCE platform information files
This enables CMake to create Makefiles targeting Windows CE devices. CMake needs to be run within a cross compile command prompt and requires a toolchain file which sets CMAKE_SYSTEM_NAME to "WindowsCE" and optionally CMAKE_SYSTEM_VERSION.
This commit is contained in:
parent
e7cb80556e
commit
28d744c9ea
|
@ -38,8 +38,13 @@ endif()
|
|||
|
||||
set(WIN32 1)
|
||||
|
||||
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()
|
||||
set(CMAKE_CREATE_WIN32_EXE "/subsystem:windows")
|
||||
set(CMAKE_CREATE_CONSOLE_EXE "/subsystem:console")
|
||||
endif()
|
||||
|
||||
if(CMAKE_GENERATOR MATCHES "Visual Studio 6")
|
||||
set (CMAKE_NO_BUILD_TYPE 1)
|
||||
|
@ -117,14 +122,38 @@ endif()
|
|||
# default to Debug builds
|
||||
set(CMAKE_BUILD_TYPE_INIT Debug)
|
||||
|
||||
if(MSVC_VERSION GREATER 1310)
|
||||
set(_RTC1 "/RTC1")
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "WindowsCE")
|
||||
string(TOUPPER "${MSVC_C_ARCHITECTURE_ID}" _MSVC_C_ARCHITECTURE_ID_UPPER)
|
||||
string(TOUPPER "${MSVC_CXX_ARCHITECTURE_ID}" _MSVC_CXX_ARCHITECTURE_ID_UPPER)
|
||||
|
||||
if("${CMAKE_SYSTEM_VERSION}" MATCHES "^([0-9]+)\\.([0-9]+)")
|
||||
math(EXPR _CE_VERSION "${CMAKE_MATCH_1}*100 + ${CMAKE_MATCH_2}")
|
||||
elseif("${CMAKE_SYSTEM_VERSION}" STREQUAL "")
|
||||
set(_CE_VERSION "500")
|
||||
else()
|
||||
message(FATAL_ERROR "Invalid Windows CE version: ${CMAKE_SYSTEM_VERSION}")
|
||||
endif()
|
||||
|
||||
set(_PLATFORM_DEFINES "/D_WIN32_WCE=0x${_CE_VERSION} /DUNDER_CE")
|
||||
set(_PLATFORM_DEFINES_C " /D${MSVC_C_ARCHITECTURE_ID} /D_${_MSVC_C_ARCHITECTURE_ID_UPPER}_")
|
||||
set(_PLATFORM_DEFINES_CXX " /D${MSVC_CXX_ARCHITECTURE_ID} /D_${_MSVC_CXX_ARCHITECTURE_ID_UPPER}_")
|
||||
|
||||
set(_RTC1 "")
|
||||
set(_FLAGS_CXX " /GR /EHsc")
|
||||
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_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:libc.lib /NODEFAULTLIB:oldnames.lib")
|
||||
else()
|
||||
set(_RTC1 "/GZ")
|
||||
set(_FLAGS_CXX " /GR /GX")
|
||||
set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib")
|
||||
set(_PLATFORM_DEFINES "/DWIN32")
|
||||
|
||||
if(MSVC_VERSION GREATER 1310)
|
||||
set(_RTC1 "/RTC1")
|
||||
set(_FLAGS_CXX " /GR /EHsc")
|
||||
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")
|
||||
else()
|
||||
set(_RTC1 "/GZ")
|
||||
set(_FLAGS_CXX " /GR /GX")
|
||||
set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}")
|
||||
|
@ -136,6 +165,13 @@ set(_MACHINE_ARCH_FLAG ${MSVC_C_ARCHITECTURE_ID})
|
|||
if(NOT _MACHINE_ARCH_FLAG)
|
||||
set(_MACHINE_ARCH_FLAG ${MSVC_CXX_ARCHITECTURE_ID})
|
||||
endif()
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "WindowsCE")
|
||||
if(_MACHINE_ARCH_FLAG MATCHES "ARM")
|
||||
set(_MACHINE_ARCH_FLAG "THUMB")
|
||||
elseif(_MACHINE_ARCH_FLAG MATCHES "SH")
|
||||
set(_MACHINE_ARCH_FLAG "SH4")
|
||||
endif()
|
||||
endif()
|
||||
set (CMAKE_EXE_LINKER_FLAGS_INIT
|
||||
"${CMAKE_EXE_LINKER_FLAGS_INIT} /STACK:10000000 /machine:${_MACHINE_ARCH_FLAG}")
|
||||
|
||||
|
@ -196,7 +232,7 @@ macro(__windows_compiler_msvc lang)
|
|||
set(CMAKE_${lang}_LINK_EXECUTABLE
|
||||
"${_CMAKE_VS_LINK_EXE}<CMAKE_${lang}_COMPILER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} <FLAGS> /Fe<TARGET> /Fd<TARGET_PDB> -link /implib:<TARGET_IMPLIB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
|
||||
|
||||
set(CMAKE_${lang}_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000${_FLAGS_${lang}}")
|
||||
set(CMAKE_${lang}_FLAGS_INIT "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} /D_WINDOWS /W3 /Zm1000${_FLAGS_${lang}}")
|
||||
set(CMAKE_${lang}_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od ${_RTC1}")
|
||||
set(CMAKE_${lang}_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG")
|
||||
set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG")
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
include(Platform/Windows-MSVC-C)
|
|
@ -0,0 +1 @@
|
|||
include(Platform/Windows-MSVC-CXX)
|
|
@ -0,0 +1 @@
|
|||
include(Platform/Windows-MSVC)
|
|
@ -0,0 +1 @@
|
|||
include(Platform/Windows)
|
Loading…
Reference in New Issue