-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'winbuild' into 'master'
Enable Cross Compile with MingW and Cygwin support See merge request koehlerm/qrupdate-ng!5
- Loading branch information
Showing
13 changed files
with
252 additions
and
25 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
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,36 @@ | ||
# Sample toolchain file for building for Windows from an Ubuntu Linux system. | ||
# | ||
# Typical usage: | ||
# *) install cross compiler: `sudo apt-get install mingw-w64` or `brew install mingw-w64` on macOS | ||
# *) cmake -DCMAKE_TOOLCHAIN_FILE=~/mingw-w64-x86_64.cmake -G Ninja -B build -S . | ||
# *) ninja -C build | ||
|
||
|
||
set(CMAKE_SYSTEM_NAME Windows) | ||
set(TOOLCHAIN_PREFIX i686-w64-mingw32) | ||
|
||
# cross compilers to use for C, C++ and Fortran | ||
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc) | ||
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++) | ||
set(CMAKE_Fortran_COMPILER ${TOOLCHAIN_PREFIX}-gfortran) | ||
set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres) | ||
|
||
# target environment on the build host system | ||
set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX} ${CMAKE_SOURCE_DIR}/tools/${TOOLCHAIN_PREFIX}) | ||
|
||
# modify default behavior of FIND_XXX() commands | ||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) | ||
|
||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") | ||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}") | ||
|
||
set(Fortran_LOCAL_FLAGS "-static") | ||
set(C_LOCAL_FLAGS "-static") | ||
set(CXX_LOCAL_FLAGS "-static") | ||
|
||
#set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libgcc -Wl,-Bstatic -lgfortran -lquadmath -Wl,-Bdynamic") | ||
#set(CMAKE_EXE_LINKER_FLAGS " -static-libgcc -Wl,-Bstatic -lgfortran -lquadmath -Wl,-Bdynamic ${CMAKE_EXE_LINKER_FLAGS} ") | ||
|
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,35 @@ | ||
# Sample toolchain file for building for Windows from an Ubuntu Linux system. | ||
# | ||
# Typical usage: | ||
# *) install cross compiler: `sudo apt-get install mingw-w64` or `brew install mingw-w64` on macOS | ||
# *) cmake -DCMAKE_TOOLCHAIN_FILE=~/mingw-w64-x86_64.cmake -G Ninja -B build -S . | ||
# *) ninja -C build | ||
|
||
|
||
set(CMAKE_SYSTEM_NAME Windows) | ||
set(TOOLCHAIN_PREFIX x86_64-w64-mingw32) | ||
|
||
# cross compilers to use for C, C++ and Fortran | ||
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc) | ||
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++) | ||
set(CMAKE_Fortran_COMPILER ${TOOLCHAIN_PREFIX}-gfortran) | ||
set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres) | ||
|
||
# target environment on the build host system | ||
set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX} ${CMAKE_SOURCE_DIR}/tools/${TOOLCHAIN_PREFIX}) | ||
|
||
# modify default behavior of FIND_XXX() commands | ||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) | ||
|
||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ") | ||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ") | ||
|
||
set(Fortran_LOCAL_FLAGS "-static") | ||
set(C_LOCAL_FLAGS "-static") | ||
set(CXX_LOCAL_FLAGS "-static") | ||
|
||
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static -Os") | ||
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static -Os") |
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,7 @@ | ||
#!/bin/bash | ||
set -x | ||
(cd tools/; bash install-lapack-mingw-i686.sh) | ||
cmake -S . -B build.win32 -DCMAKE_TOOLCHAIN_FILE=$(pwd)/cmake/mingw-w32-i686.cmake -DBUILD_SHARED_LIBS=ON | ||
make -C build.win32 all | ||
(cd build.win32; ctest -V ) | ||
|
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,7 @@ | ||
#!/bin/bash | ||
set -x | ||
(cd tools/; bash install-lapack-mingw-x86_64.sh) | ||
cmake -S . -B build.win64 -DCMAKE_TOOLCHAIN_FILE=$(pwd)/cmake/mingw-w64-x86_64.cmake -DBUILD_SHARED_LIBS=ON | ||
make -C build.win64 all | ||
(cd build.win64; ctest -V ) | ||
|
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 @@ | ||
#!/bin/bash | ||
set -x | ||
|
||
[ -d build-lapack-win32 ] && rm -rf build-lapack-win32 | ||
|
||
[ -e v3.10.0.tar.gz ] || wget -c https://github.com/Reference-LAPACK/lapack/archive/refs/tags/v3.10.0.tar.gz | ||
tar xf v3.10.0.tar.gz | ||
cmake -S lapack-3.10.0 -B build-lapack-win32 \ | ||
-DCMAKE_TOOLCHAIN_FILE=$(pwd)/../cmake/mingw-w32-i686.cmake \ | ||
-DBUILD_SHARED_LIBS=ON \ | ||
-DCMAKE_INSTALL_PREFIX=`dirname $(realpath $0)`/i686-w64-mingw32 | ||
make -C build-lapack-win32 -j 4 | ||
make -C build-lapack-win32 install |
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,15 @@ | ||
#!/bin/bash | ||
|
||
#!/bin/bash | ||
set -x | ||
|
||
[ -d build-lapack-win64 ] && rm -rf build-lapack-win64 | ||
|
||
[ -e v3.10.0.tar.gz ] || wget -c https://github.com/Reference-LAPACK/lapack/archive/refs/tags/v3.10.0.tar.gz | ||
tar xf v3.10.0.tar.gz | ||
cmake -S lapack-3.10.0 -B build-lapack-win64 \ | ||
-DCMAKE_TOOLCHAIN_FILE=$(pwd)/../cmake/mingw-w64-x86_64.cmake \ | ||
-DBUILD_SHARED_LIBS=ON \ | ||
-DCMAKE_INSTALL_PREFIX=`dirname $(realpath $0)`/x86_64-w64-mingw32 | ||
make -C build-lapack-win64 -j 4 | ||
make -C build-lapack-win64 install |