nightsky30 / koikoi

Koi Koi Hanafuda
GNU General Public License v2.0
7 stars 1 forks source link

Cross-compiling #21

Closed nightsky30 closed 4 years ago

nightsky30 commented 4 years ago

Cross-compile g++

Windows: https://stackoverflow.com/questions/2033997/how-to-compile-for-windows-on-linux-with-gcc-g

MacOS: https://stackoverflow.com/questions/693952/how-to-compile-for-os-x-in-linux-or-windows

Good Info: https://wiki.qt.io/Building_Qt_5_from_Git https://forum.qt.io/topic/94742/cross-compile-and-deploy-from-linux-to-windows/9

Have to build qt5 for Windows using mingw to satisfy the qt5 deps before building koikoi for Windows with said qt5 deps.

From Delphi251189:

Simply You can use mxe for cross compilation from linux to Windows targets (not only qt, its supports the wide range of varios open-source libraries and tools like qt, sdl, wxwidgets, cryptopp and others) Just type: git clone https://github.com/mxe/mxe.git cd mxe make qt qt5 MXE_TARGETS='x86_64-w64-mingw32.shared i686-w64-mingw32.shared x86_64-w64-mingw32.static i686-w64-mingw32.static'

Cross toolchain building process may take up to 10 hours (on my cor i5-2350 laptop) but it will download and build qt4.8.7 and the latest (5.11.1 in my case) qt versions (and dependencies also ) for mingw 32 and 64 bit static and shared respectively. After You can add new kit in QtCreator assuming the path of mingw compiler and qmake executable (mxe builds compiler too, no need to install mingw seperatly) . That's all, u can compile existing qt project into MS Windows exe file.

About running windows exe-s in Linux - just install WINE

Other junks: https://mesonbuild.com/Cross-compilation.html https://github.com/pololu/nixcrpkgs https://packages.ubuntu.com/search?mode=filename&suite=eoan&section=all&arch=any&keywords=mingw+gcc&searchon=contents

nightsky30 commented 4 years ago

Meson might allow this... https://mesonbuild.com/Cross-compilation.html

nightsky30 commented 4 years ago

meson srcdir builddir --cross-file cross_file.txt

nightsky30 commented 4 years ago

Files added: commit 026a8073af5609fc19aa4ea5890e992f0a7ce0ed Paths/binaries fixed: commit dddca5ccbc8631e4396cfae8fda9012e3241913a

nightsky30 commented 4 years ago

sudo apt install mingw-w64 mingw-w64-tools

meson koikoi koikoi/builddir_x64 --cross-file koikoi/misc/meson.cross.win.x64

Build type: cross build Project name: koikoi Project version: undefined C++ compiler for the build machine: c++ (gcc 9.2.1 "c++ (Ubuntu 9.2.1-8ubuntu1) 9.2.1 20190909") C++ compiler for the host machine: /usr/bin/x86_64-w64-mingw32-g++ (gcc 9.2.0 "x86_64-w64-mingw32-g++ (GCC) 9.2-win32 20190909") Host machine cpu family: x86_64 Host machine cpu: i686 Target machine cpu family: x86_64 Target machine cpu: i686 Build machine cpu family: x86_64 Build machine cpu: x86_64 WARNING: rcc dependencies will not work reliably until this upstream issue is fixed: https://bugreports.qt.io/browse/QTBUG-45460 Found pkg-config: /usr/bin/x86_64-w64-mingw32-pkg-config (1.6.3) Found qmake: /usr/bin/qmake (5.12.4) Run-time dependency qt5 (modules: Widgets) found: NO (tried pkgconfig, qmake-qt5 and qmake)

meson.build:7:0: ERROR: Dependency "qt5" not found, tried pkgconfig, qmake-qt5 and qmake

nightsky30 commented 4 years ago

See https://github.com/nightsky30/koikoi/issues/11#issuecomment-542102700 on tools...

nightsky30 commented 4 years ago

sudo apt install \ autoconf \ automake \ autopoint \ bash \ bison \ bzip2 \ flex \ g++ \ g++-multilib \ gettext \ git \ gperf \ intltool \ libc6-dev-i386 \ libgdk-pixbuf2.0-dev \ libltdl-dev \ libssl-dev \ libtool-bin \ libxml-parser-perl \ lzip \ make \ openssl \ p7zip-full \ patch \ perl \ pkg-config \ python \ ruby \ sed \ unzip \ wget \ xz-utils

sudo apt-mark auto \ autoconf \ automake \ autopoint \ bash \ bison \ bzip2 \ flex \ g++ \ g++-multilib \ gettext \ git \ gperf \ intltool \ libc6-dev-i386 \ libgdk-pixbuf2.0-dev \ libltdl-dev \ libssl-dev \ libtool-bin \ libxml-parser-perl \ lzip \ make \ openssl \ p7zip-full \ patch \ perl \ pkg-config \ python \ ruby \ sed \ unzip \ wget \ xz-utils

https://github.com/mxe/mxe

mkdir mxe_build cd mxe_build git clone git@github.com:mxe/mxe.git cd mxe make qt5 MXE_TARGETS='x86_64-w64-mingw32.shared i686-w64-mingw32.shared x86_64-w64-mingw32.static i686-w64-mingw32.static'

Ref: https://mxe.cc/#tutorial

nightsky30 commented 4 years ago

Compiling .exe files, but not certain it is linking properly...

nightsky30 commented 4 years ago

In liu of cross-compiling, just installed Qt in Win10 VM and compiled there...

Looking into Qt Installer Framework. Maybe revisit this later.