Cygwin: repair NuttX build (#8737)

* Cygwin: repaired NuttX build after 1f63d85869
all the NuttX specific WINTOOL define handling was skiped in cmake Make.defs generation
The Nuttx build is makfile based and needs its cygwin treatment

Additionally the ${PX4_SOURCE_DIR}/src/include which was added through cmake needs path conversion

The two root causes for the special handling are:
- ARM GCC for Windows doesn't support cygwin paths passed as an argument
  so they need to be either relative or converted via cypath tool
- Symbolic links are totally different under Windows and because NuttX uses them extensively
  it has special handling scripts that need to be fed with the correct defines

* Cygwin: NuttX include paths all converted in Make.defs.in

differentiate between WINTOOL define (MSYS & cygwin) and cygwin using uname command:
- MSYS needs symbolic link handling for ARM GCC but no path conversion
- Cygwin needs both
This commit is contained in:
Matthias Grob 2018-01-21 05:26:12 +01:00 committed by Daniel Agar
parent 45458fe9eb
commit 463217a5f9
2 changed files with 22 additions and 3 deletions

View File

@ -20,7 +20,7 @@ include(CMakeForceCompiler)
# this one is important
set(CMAKE_SYSTEM_NAME Generic)
#this one not so much
# this one not so much
set(CMAKE_SYSTEM_VERSION 1)
# specify the cross compiler

View File

@ -45,7 +45,26 @@ NM = ${CMAKE_NM}
OBJCOPY = ${CMAKE_OBJCOPY}
OBJDUMP = ${CMAKE_OBJDUMP}
CFLAGS = -Os -g2 -I${PX4_SOURCE_DIR}/src/include ${CMAKE_C_FLAGS} -I. -isystem $(TOPDIR)/include \
# Include paths with Cygwin path conversion
ifneq (, $(findstring CYGWIN, $(shell uname)))
WINTOOL = y
PX4INCLUDES = -I"$(shell cygpath -w ${PX4_SOURCE_DIR}/src/include)"
ARCHINCLUDES = $(PX4INCLUDES) -I. -isystem "$(shell cygpath -w $(TOPDIR)/include)"
ARCHXXINCLUDES = $(ARCHINCLUDES) -isystem "$(shell cygpath -w $(TOPDIR)/include/cxx)"
else
PX4INCLUDES = -I${PX4_SOURCE_DIR}/src/include
ARCHINCLUDES = $(PX4INCLUDES) -I. -isystem $(TOPDIR)/include
ARCHXXINCLUDES = $(ARCHINCLUDES) -isystem $(TOPDIR)/include/cxx
endif
# Windows toolchain (MSYS & Cygwin) symbolic link handling
ifeq ($(WINTOOL),y)
DIRLINK = $(TOPDIR)/tools/copydir.sh
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
MKDEP = $(TOPDIR)/tools/mknulldeps.sh
endif
CFLAGS = -Os -g2 ${CMAKE_C_FLAGS} $(ARCHINCLUDES) \
-Wno-bad-function-cast \
-Wno-cpp \
-Wno-float-equal \
@ -62,7 +81,7 @@ CFLAGS = -Os -g2 -I${PX4_SOURCE_DIR}/src/include ${CMAKE_C_FLAGS} -I. -isystem $
-Wno-sign-compare \
-Wno-type-limits
CXXFLAGS = -Os -g2 -I${PX4_SOURCE_DIR}/src/include ${CMAKE_CXX_FLAGS} -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx \
CXXFLAGS = -Os -g2 ${CMAKE_CXX_FLAGS} $(ARCHXXINCLUDES) \
-fcheck-new \
-fno-builtin \
-Wno-double-promotion \