builder: fix ccache, mingw-cross

Update mingw cmake toolchain files to work-around a bug in cmake where
find_program() would return the current working directory instead of the
executable path if CMAKE_C_COMPILER and related are passed on the
command line.

Fix $CC/$CC_ORIG and $CXX/$CXX_ORIG handling for the core and
mingw-cross (_ORIG is without ccache.)
This commit is contained in:
Rafael Kitover 2018-07-01 22:18:59 -04:00
parent f937aa72f5
commit 459a1fbebb
5 changed files with 23 additions and 4 deletions

View File

@ -2,6 +2,11 @@ SET(CMAKE_SYSTEM_NAME Windows)
set(COMPILER_PREFIX "i686-w64-mingw32")
unset(CMAKE_RC_COMPILER CACHE)
unset(CMAKE_C_COMPILER CACHE)
unset(CMAKE_CXX_COMPILER CACHE)
unset(PKG_CONFIG_EXECUTABLE CACHE)
# which compilers to use for C and C++
find_program(CMAKE_RC_COMPILER NAMES ${COMPILER_PREFIX}-windres)
find_program(CMAKE_C_COMPILER NAMES ${COMPILER_PREFIX}-gcc)

View File

@ -2,6 +2,11 @@ SET(CMAKE_SYSTEM_NAME Windows)
set(COMPILER_PREFIX "x86_64-w64-mingw32")
unset(CMAKE_RC_COMPILER CACHE)
unset(CMAKE_C_COMPILER CACHE)
unset(CMAKE_CXX_COMPILER CACHE)
unset(PKG_CONFIG_EXECUTABLE CACHE)
# which compilers to use for C and C++
find_program(CMAKE_RC_COMPILER NAMES ${COMPILER_PREFIX}-windres)
find_program(CMAKE_C_COMPILER NAMES ${COMPILER_PREFIX}-gcc)

View File

@ -40,6 +40,9 @@ case "\$CC" in
;;
esac
export CC_ORIG="\${CC_ORIG:-\$CC}"
export CXX_ORIG="\${CXX_ORIG:-\$CXX}"
export CPPFLAGS="$CPPFLAGS -I$BUILD_ROOT/root/include"
export CFLAGS="$CFLAGS -fPIC -I$BUILD_ROOT/root/include -L$BUILD_ROOT/root/lib -Wno-error=all"
export CXXFLAGS="$CXXFLAGS -fPIC -I$BUILD_ROOT/root/include -L$BUILD_ROOT/root/lib -std=gnu++11 -Wno-error=all -fpermissive"
@ -112,7 +115,7 @@ DISTS=$DISTS'
unzip https://downloads.sourceforge.net/project/infozip/UnZip%206.x%20%28latest%29/UnZip%206.0/unzip60.tar.gz bin/unzip
zip https://downloads.sourceforge.net/project/infozip/Zip%203.x%20%28latest%29/3.0/zip30.tar.gz bin/zip
openssl https://www.openssl.org/source/openssl-1.0.2o.tar.gz lib/libssl.a
cmake https://cmake.org/files/v3.10/cmake-3.10.0-rc3.tar.gz bin/cmake
cmake https://cmake.org/files/v3.10/cmake-3.10.3.tar.gz bin/cmake
zlib https://zlib.net/zlib-1.2.11.tar.gz lib/libz.a
m4 http://ftp.gnu.org/gnu/m4/m4-1.4.18.tar.xz bin/m4
autoconf https://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.xz bin/autoconf

View File

@ -40,8 +40,8 @@ both_dists='
BUILD_ENV=$BUILD_ENV$(cat <<EOF
export CC='ccache ${target_arch}-gcc'
export CXX='ccache ${target_arch}-g++'
export CC='${target_arch}-gcc'
export CXX='${target_arch}-g++'
EOF
)

View File

@ -50,9 +50,13 @@ set_host_env() {
if [ -z "$OCC" ]; then
OCC=$CC
OCXX=$CXX
OCC_ORIG=$CC_ORIG
OCXX_ORIG=$CXX_ORIG
export CC='ccache gcc'
export CXX='ccache g++'
export CC_ORIG="gcc"
export CXX_ORIG="g++"
OCFLAGS=$CFLAGS OCXXFLAGS=$CXXFLAGS OLDFLAGS=$LDFLAGS
@ -75,7 +79,9 @@ unset_host_env() {
if [ -n "$OCC" ]; then
export CC="$OCC"
export CXX="$OCXX"
OCC= OCXX=
export CC_ORIG="$OCC_ORIG"
export CXX_ORIG="$OCXX_ORIG"
OCC= OCXX= OCC_ORIG= OCXX_ORIG=
export CFLAGS="$OCFLAGS"
export CXXFLAGS="$OCXXFLAGS"