From b2ab6237901efa4c9129fc659740c116e405391d Mon Sep 17 00:00:00 2001 From: Alexander Karzhenkov Date: Thu, 16 Apr 2020 20:12:33 +0500 Subject: [PATCH] Select appropriate QNX target platform (#568) Select appropriate QNX target platform --- src/tools/qcc.jam | 62 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 57 insertions(+), 5 deletions(-) diff --git a/src/tools/qcc.jam b/src/tools/qcc.jam index 155b1ac3d..a10b8a69c 100644 --- a/src/tools/qcc.jam +++ b/src/tools/qcc.jam @@ -1,6 +1,7 @@ # Copyright (c) 2001 David Abrahams. # Copyright (c) 2002-2003 Rene Rivera. # Copyright (c) 2002-2003 Vladimir Prus. +# Copyright (c) 2020 Alexander Karzhenkov. # # Use, modification and distribution is subject to the Boost Software # License Version 1.0. (See accompanying file LICENSE_1_0.txt or @@ -47,6 +48,43 @@ generators.register-c-compiler qcc.compile.c : C : OBJ : qcc ; generators.register-c-compiler qcc.compile.asm : ASM : OBJ : qcc ; +# Select QCC target platform + +# Configuration checks don't use explicit value of QCC-TARGET-PLATFORM +toolset.flags qcc QCC-TARGET-PLATFORM / : NA ; + +# Combinations supported by both QNX 6.5.0 and QNX 7.0.0 +toolset.flags qcc QCC-TARGET-PLATFORM x86/32 : -Vgcc_ntox86 ; +toolset.flags qcc QCC-TARGET-PLATFORM arm/32 : -Vgcc_ntoarmv7le ; + +# Combinations supported by QNX 7.0.0 +toolset.flags qcc QCC-TARGET-PLATFORM x86/64 : -Vgcc_ntox86_64 ; +toolset.flags qcc QCC-TARGET-PLATFORM arm/64 : -Vgcc_ntoaarch64le ; + +# Combinations supported by QNX 6.5.0 +toolset.flags qcc QCC-TARGET-PLATFORM power/32 : -Vgcc_ntoppcbe ; +toolset.flags qcc QCC-TARGET-PLATFORM mips1/32 : -Vgcc_ntomipsle ; + +# There are also excluded alternatives (supported by QNX 6.5.0) +# toolset.flags qcc QCC-TARGET-PLATFORM arm/32 : -Vgcc_ntoarmle ; +# toolset.flags qcc QCC-TARGET-PLATFORM power/32 : -Vgcc_ntoppcbespe ; +# toolset.flags qcc QCC-TARGET-PLATFORM mips1/32 : -Vgcc_ntomipsbe ; + +local rule check-target-platform +{ + local opt = [ on $(1) return $(QCC-TARGET-PLATFORM) ] ; + + if $(opt) = NA + { + # Configuration checks are performed + QCC-TARGET-PLATFORM on $(1) = ; + } + else if ! $(opt) + { + errors.user-error "Unsupported achitecture / address model" ; + } +} + # Declare flags for compilation. toolset.flags qcc.compile OPTIONS on : -gstabs+ ; @@ -96,21 +134,33 @@ rule compile.c++ { TEMPLATE_DEPTH on $(1) = 128 ; } + + check-target-platform $(1) ; } actions compile.c++ { - "$(CONFIG_COMMAND)" -Wc,-ftemplate-depth-$(TEMPLATE_DEPTH) $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" + "$(CONFIG_COMMAND)" $(QCC-TARGET-PLATFORM) -Wc,-ftemplate-depth-$(TEMPLATE_DEPTH) $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" +} + +rule compile.c +{ + check-target-platform $(1) ; } actions compile.c { - "$(CONFIG_COMMAND)" -lang-c $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" + "$(CONFIG_COMMAND)" $(QCC-TARGET-PLATFORM) -lang-c $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" +} + +rule compile.asm +{ + check-target-platform $(1) ; } actions compile.asm { - "$(CONFIG_COMMAND)" $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" + "$(CONFIG_COMMAND)" $(QCC-TARGET-PLATFORM) $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" } @@ -192,11 +242,12 @@ rule link ( targets * : sources * : properties * ) # parallel is just slower. For now, serialize only qcc links while it might # be a good idea to serialize all links. JAM_SEMAPHORE on $(targets) = qcc-link-semaphore ; + check-target-platform $(1) ; } actions link bind LIBRARIES { - "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,-R$(SPACE)-Wl,"$(RPATH)" -Wl,-rpath-link$(SPACE)-Wl,"$(RPATH_LINK)" -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-ST) -l$(FINDLIBS-SA) $(OPTIONS) + "$(CONFIG_COMMAND)" $(QCC-TARGET-PLATFORM) -L"$(LINKPATH)" -Wl,-R$(SPACE)-Wl,"$(RPATH)" -Wl,-rpath-link$(SPACE)-Wl,"$(RPATH_LINK)" -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-ST) -l$(FINDLIBS-SA) $(OPTIONS) } @@ -231,6 +282,7 @@ rule link.dll ( targets * : sources * : properties * ) { SPACE on $(targets) = " " ; JAM_SEMAPHORE on $(targets) = qcc-link-semaphore ; + check-target-platform $(1) ; } @@ -238,5 +290,5 @@ rule link.dll ( targets * : sources * : properties * ) # actions link.dll bind LIBRARIES { - "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,-R$(SPACE)-Wl,"$(RPATH)" -o "$(<)" -Wl,-h$(SPACE)-Wl,$(<[1]:D=) -shared "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-ST) -l$(FINDLIBS-SA) $(OPTIONS) + "$(CONFIG_COMMAND)" $(QCC-TARGET-PLATFORM) -L"$(LINKPATH)" -Wl,-R$(SPACE)-Wl,"$(RPATH)" -o "$(<)" -Wl,-h$(SPACE)-Wl,$(<[1]:D=) -shared "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-ST) -l$(FINDLIBS-SA) $(OPTIONS) }