Commit 1178fc19 authored by Mark Olesen's avatar Mark Olesen

CONFIG: add runtime settings for mingw cross-compiled binaries

- WM_ARCH=win64 to indicate the runtime environment

ENH: cross-compile wmake toolchain for the target-side as well
parent 44052de5
...@@ -90,12 +90,22 @@ case Linux: ...@@ -90,12 +90,22 @@ case Linux:
endsw endsw
breaksw breaksw
case Darwin: # Presume x86_64, with clang (not gcc) as system compiler # Presume x86_64, with clang (not gcc) as system compiler
case Darwin:
setenv WM_ARCH darwin64 setenv WM_ARCH darwin64
if ("$WM_COMPILER" == Gcc) setenv WM_COMPILER Clang if ("$WM_COMPILER" == Gcc) setenv WM_COMPILER Clang
echo "Darwin support is clang/llvm only" echo "Darwin support is clang/llvm only"
breaksw breaksw
# Presume x86_64, with mingw cross-compiled
case MINGW*:
case MSYS*:
WM_ARCH=win64
if ("$WM_COMPILER" == Gcc) setenv WM_COMPILER Mingw
setenv WM_COMPILER_LIB_ARCH 64 # Consistent with linux64Mingw
echo "Windows support (mingw64) is runtime only"
;;
case SunOS*: case SunOS*:
setenv WM_ARCH solaris64 setenv WM_ARCH solaris64
setenv WM_COMPILER_LIB_ARCH 64 setenv WM_COMPILER_LIB_ARCH 64
......
...@@ -82,18 +82,27 @@ Linux) ...@@ -82,18 +82,27 @@ Linux)
esac esac
;; ;;
Darwin) # Presume x86_64, with clang (not gcc) as system compiler # Presume x86_64, with clang (not gcc) as system compiler
Darwin)
WM_ARCH=darwin64 WM_ARCH=darwin64
[ "$WM_COMPILER" = Gcc ] && WM_COMPILER=Clang [ "$WM_COMPILER" = Gcc ] && WM_COMPILER=Clang
echo "Darwin support is clang/llvm only" 1>&2 echo "Darwin support is clang/llvm only" 1>&2
;; ;;
# Presume x86_64, with mingw cross-compiled
MINGW* | MSYS*)
WM_ARCH=win64
[ "$WM_COMPILER" = Gcc ] && WM_COMPILER=Mingw
export WM_COMPILER_LIB_ARCH=64 # Consistent with linux64Mingw
echo "Windows support (mingw64) is runtime only" 1>&2
;;
SunOS*) SunOS*)
WM_ARCH=solaris64 WM_ARCH=solaris64
export WM_COMPILER_LIB_ARCH=64 export WM_COMPILER_LIB_ARCH=64
;; ;;
*) # An unsupported operating system *)
/bin/cat << UNSUPPORTED 1>&2 /bin/cat << UNSUPPORTED 1>&2
=============================================================================== ===============================================================================
Operating system '$WM_ARCH' is unsupported by this OpenFOAM release. Operating system '$WM_ARCH' is unsupported by this OpenFOAM release.
......
...@@ -21,19 +21,26 @@ then ...@@ -21,19 +21,26 @@ then
exit 1 exit 1
fi fi
case "$WM_COMPILER" in
Mingw*) if [ "${WM_COMPILER%Mingw}" != "$WM_COMPILER" ] && [ "$WM_ARCH" != win64 ]
# Host wmake toolchain with system gcc (when cross-compiling) then
# Mingw cross-compilation
# Toolchain for build (system gcc)
make \ make \
WM_COMPILER=Gcc WM_COMPILER_TYPE=system \ WM_COMPILER=Gcc WM_COMPILER_TYPE=system \
WMAKE_BIN="${WM_PROJECT_DIR}/platforms/tools/${WM_ARCH}${WM_COMPILER}" \ WMAKE_BIN="${WM_PROJECT_DIR}/platforms/tools/${WM_ARCH}${WM_COMPILER}" \
"$@" "$@"
;;
*) # Toolchain for target (mingw)
make \
WMAKE_BIN="${WM_PROJECT_DIR}/platforms/tools/win64${WM_COMPILER}" \
"$@"
else
# Regular wmake toolchain # Regular wmake toolchain
make "$@" make "$@"
;;
esac fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
...@@ -6,29 +6,20 @@ ...@@ -6,29 +6,20 @@
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation # Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2017-2019 OpenCFD Ltd. # Copyright (C) 2017-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM. # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# OpenFOAM is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
# #
# File # File
# Makefile # Makefile
# #
# Description # Description
# Makefile used to compile wmake utilities. # Makefile for compiling wmake toolchain.
#
# Note
# The 'createCode' script is used to pre-generate the scanner code
# since ragel is not very prevalent.
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
...@@ -55,7 +46,7 @@ WM_COMPILE_OPTION = Opt ...@@ -55,7 +46,7 @@ WM_COMPILE_OPTION = Opt
GENERAL_RULES = $(WM_DIR)/rules/General GENERAL_RULES = $(WM_DIR)/rules/General
include $(GENERAL_RULES)/general include $(GENERAL_RULES)/general
archHost := $(WM_ARCH)$(WM_COMPILER) archBuild := $(WM_ARCH)$(WM_COMPILER)
archTarget := $(shell basename $(WMAKE_BIN)) archTarget := $(shell basename $(WMAKE_BIN))
...@@ -71,8 +62,8 @@ all: $(WMAKE_BIN)/lemon$(EXT_EXE) $(WMAKE_BIN)/wmkdepend$(EXT_EXE) message ...@@ -71,8 +62,8 @@ all: $(WMAKE_BIN)/lemon$(EXT_EXE) $(WMAKE_BIN)/wmkdepend$(EXT_EXE) message
old: $(WMAKE_BIN)/wmkdep$(EXT_EXE) old: $(WMAKE_BIN)/wmkdep$(EXT_EXE)
message: message:
ifneq ($(archHost),$(archTarget)) ifneq ($(archBuild),$(archTarget))
@echo "built wmake-bin ($(archTarget)) for $(archHost) host" @echo "built wmake-bin ($(archTarget)) with $(archBuild)"
else else
@echo "built wmake-bin ($(archTarget))" @echo "built wmake-bin ($(archTarget))"
endif endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment