-
Notifications
You must be signed in to change notification settings - Fork 365
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support building with MinGW-w64 toolchain
Signed-off-by: Patrick Masselink <[email protected]>
- Loading branch information
1 parent
4c510fd
commit d73155d
Showing
11 changed files
with
83 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
ARG ARCH=x86_64 | ||
|
||
FROM ubuntu:24.04 AS build | ||
# supports x86_64 or i686 | ||
ARG ARCH | ||
|
||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y -q\ | ||
build-essential \ | ||
cmake \ | ||
mingw-w64 | ||
|
||
WORKDIR /project | ||
COPY --link . src | ||
|
||
# Host build, only for idlc (+ libidlc) but building individual targets doesn't really work... | ||
RUN cmake -S src -B host-build | ||
RUN cmake --build host-build --parallel | ||
RUN cmake --install host-build --prefix /project/install | ||
|
||
# Cross build with mingw-w64 toolchain | ||
RUN cmake -S src -B build \ | ||
-DBUILD_EXAMPLES=1 \ | ||
-DCMAKE_TOOLCHAIN_FILE=/project/src/ports/mingw-w64/mingw-w64-${ARCH}.cmake \ | ||
-DCMAKE_PREFIX_PATH=/project/install | ||
RUN cmake --build build --parallel | ||
RUN cmake --install build | ||
|
||
FROM ubuntu:24.04 | ||
ARG ARCH | ||
|
||
RUN if [ "${ARCH}" = "i686" ]; then \ | ||
dpkg --add-architecture i386; \ | ||
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y -q mingw-w64 wine wine32:i386; \ | ||
echo "export WINEARCH=win32" >> /etc/bash.bashrc; \ | ||
else \ | ||
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y -q mingw-w64 wine; \ | ||
fi | ||
|
||
COPY --from=build /usr/local/bin /usr/local/bin | ||
COPY --from=build /usr/local/lib /usr/local/lib | ||
COPY --from=build /usr/local/include /usr/local/include | ||
COPY --from=build /project/build/bin /usr/local/bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
set(CMAKE_SYSTEM_NAME Windows) | ||
set(CMAKE_SYSTEM_PROCESSOR i686) | ||
|
||
set(TOOLCHAIN_PREFIX i686-w64-mingw32) | ||
|
||
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc) | ||
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++) | ||
|
||
set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX}) | ||
|
||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
set(CMAKE_SYSTEM_NAME Windows) | ||
set(CMAKE_SYSTEM_PROCESSOR x86_64) | ||
|
||
set(TOOLCHAIN_PREFIX x86_64-w64-mingw32) | ||
|
||
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc) | ||
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++) | ||
|
||
set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX}) | ||
|
||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters