Skip to content

Commit

Permalink
minor cleanup of MinGW-related scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
FyiurAmron committed Jun 17, 2024
1 parent 68ea3f5 commit e1c94bd
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 110 deletions.
35 changes: 35 additions & 0 deletions cmake/build_mingw.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

if [ -z "$ARCH" ]; then
ARCH=32
fi
MINGW=mingw$ARCH

if [ -z "$MSYSCON" ]; then
MINGW_PATH=/opt/$MINGW

DISTRO=$(lsb_release -si)

if [ "$DISTRO" != "Ubuntu" ]; then
echo "This script only supports Ubuntu"
exit 1
fi

TOOLCHAIN_NAME="Ubuntu-MinGW-W64-$ARCH"
else
MINGW_PATH=/$MINGW
TOOLCHAIN_NAME="MSYS-$ARCH"
fi

export PATH=$MINGW_PATH/bin:$PATH

if [ "$ARCH" == "32" ]; then
export CFLAGS="-march=pentium4 -mtune=generic -mpreferred-stack-boundary=5 -mfpmath=sse"
fi
export CXXFLAGS="$CFLAGS"

CMAKE_OPTS="-DCMAKE_PREFIX_PATH=$MINGW_PATH $CMAKE_OPTS"

# shellcheck disable=SC2086
cmake "$DIR/.." -DCMAKE_TOOLCHAIN_FILE="$DIR/toolchains/$TOOLCHAIN_NAME.cmake" $CMAKE_OPTS
39 changes: 1 addition & 38 deletions cmake/build_win32.sh
Original file line number Diff line number Diff line change
@@ -1,40 +1,3 @@
#!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

# Accomodate both linux windows mingw locations
if [ -z "$ARCH" ]; then
ARCH=32
fi

MINGW=/mingw$ARCH

if [ -z "$MSYSCON" ]; then
MINGW=/opt$MINGW

DISTRO=$(lsb_release -si)
DISTRO_VERSION=$(lsb_release -sr)

if [ "$DISTRO" != "Ubuntu" ]; then
echo "This script only supports Ubuntu"
exit 1
fi

if [ "$DISTRO_VERSION" == "14.04" ]; then
TOOLCHAIN="$DIR/toolchains/Ubuntu-MinGW-X-Trusty-$ARCH.cmake"
else
TOOLCHAIN="$DIR/toolchains/Ubuntu-MinGW-W64-$ARCH.cmake"
fi
else
TOOLCHAIN="$DIR/toolchains/MSYS-$ARCH.cmake"
fi

export PATH=$MINGW/bin:$PATH
export CXXFLAGS="$CFLAGS"
if [ "$ARCH" == "32" ]; then
export CFLAGS="-march=pentium4 -mtune=generic -mpreferred-stack-boundary=5 -mfpmath=sse"
fi

CMAKE_OPTS="-DCMAKE_PREFIX_PATH=$MINGW $CMAKE_OPTS"

# shellcheck disable=SC2086
cmake "$DIR/.." -DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN" $CMAKE_OPTS
ARCH=32 "$DIR/build_mingw.sh"
2 changes: 1 addition & 1 deletion cmake/build_win64.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
ARCH=64 "$DIR/build_win32.sh"
ARCH=64 "$DIR/build_mingw.sh"
3 changes: 0 additions & 3 deletions cmake/toolchains/Ubuntu-MinGW-X-Trusty-32.cmake

This file was deleted.

9 changes: 0 additions & 9 deletions cmake/toolchains/Ubuntu-MinGW-X-Trusty-64.cmake

This file was deleted.

2 changes: 1 addition & 1 deletion cmake/toolchains/common/Ubuntu-MinGW-W64.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Toolchain for Ubuntu MinGw compiler shipped with the mingw-w64 and
# Toolchain for Ubuntu MinGW compiler shipped with the mingw-w64 and
# g++-mingw-w64 packages
SET(TOOLCHAIN_PREFIX ${CMAKE_SYSTEM_PROCESSOR}-w64-mingw32)
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
Expand Down
58 changes: 0 additions & 58 deletions cmake/toolchains/common/Ubuntu-MinGW-X-Trusty.cmake

This file was deleted.

0 comments on commit e1c94bd

Please sign in to comment.