@@ -41,7 +41,7 @@ make -j`nproc`
4141```
4242
4343
44- ## cross building on linus for windows (single executable)
44+ ## cross building on linux for windows (single executable, simple way )
4545
4646Install mingw on linux (something like ` cross-x86_64-w64-mingw32 ` )
4747
@@ -84,6 +84,155 @@ cmake .. -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=$PWD/conan_toolchain.cmake \
8484make -j`nproc`
8585```
8686
87+ ## cross building on linux for modern windows (single executable, more reliable way)
88+
89+ Download [ mxe] ( https://mxe.cc ) ; make sure all requirements are met.
90+
91+ Your ` settings.mk ` should contain something like:
92+
93+ ```
94+ MXE_TARGETS := x86_64-w64-mingw32.static
95+ ```
96+
97+
98+ Validate, that everything is OK via typing in mxe dir something like
99+
100+ ```
101+ make zip
102+ ```
103+
104+
105+ Add $mxe_dir/uer/bin to your ` PATH ` , and make sure something like that works:
106+
107+ ```
108+ export PATH=`pwd`/usr/bin:$PATH
109+ x86_64-w64-mingw32.static-g++ --version
110+ x86_64-w64-mingw32.static-g++ (GCC) 11.2.0
111+ ```
112+
113+ Make a conan profile for mingw:
114+
115+ ```
116+ cat ~/.conan2/profiles/mxe
117+ [settings]
118+ os=Windows
119+ arch=x86_64
120+ compiler=gcc
121+ build_type=Release
122+ compiler.cppstd=gnu17
123+ compiler.libcxx=libstdc++11
124+ compiler.version=11
125+ [buildenv]
126+ CC=x86_64-w64-mingw32.static-gcc
127+ CXX=x86_64-w64-mingw32.static-g++
128+ LD=x86_64-w64-mingw32.static-ld
129+ RC=x86_64-w64-mingw32.static-windres
130+
131+ [options]
132+ boost/*:without_fiber=True
133+ boost/*:without_graph=True
134+ boost/*:without_log=True
135+ boost/*:without_stacktrace=True
136+ boost/*:without_test=True
137+ boost/*:without_wave=True
138+ ```
139+
140+ Go to ` syncspirit ` dir and then make a build
141+
142+
143+ ```
144+ cd syncspirit
145+ mkdir build.release && cd build.release
146+ conan install --build=missing -o '*:shared=False' -o shared=False --output-folder . \
147+ -s build_type=Release --profile:build=default --profile:host=mxe ..
148+ source ./conanbuild.sh
149+ cmake .. -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=$PWD/conan_toolchain.cmake \
150+ -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=off
151+ make -j`nproc`
152+ ```
153+
154+ ## cross building on linux for windows xp
155+
156+ Download [ mxe] ( https://mxe.cc ) ; make sure all requirements are met.
157+
158+ Your ` settings.mk ` should contain something like:
159+
160+ ```
161+ MXE_TARGETS := i686-w64-mingw32.static
162+ MXE_PLUGIN_DIRS=plugins/windows-xp
163+ ```
164+
165+
166+ Validate, that everything is OK via typing in mxe dir something like
167+
168+ ```
169+ make zip
170+ ```
171+
172+ Copy the resulting ` zip.exe ` to windows xp host and launch, i.e. make sure
173+ everything is ok with the toolchain.
174+
175+
176+ Add $mxe_dir/uer/bin to your ` PATH ` , and make sure something like that works:
177+
178+ ```
179+ export PATH=`pwd`/usr/bin:$PATH
180+ i686-w64-mingw32.static-g++ --version
181+ i686-w64-mingw32.static-g++ (GCC) 11.2.0
182+ ```
183+
184+ Make a conan profile for mingw:
185+
186+ ```
187+ cat ~/.conan2/profiles/xp
188+ [settings]
189+ os=Windows
190+ arch=x86
191+ compiler=gcc
192+ build_type=Release
193+ compiler.cppstd=gnu17
194+ compiler.libcxx=libstdc++11
195+ compiler.version=12
196+ [buildenv]
197+ CC=i686-w64-mingw32.static-gcc
198+ CXX=i686-w64-mingw32.static-g++
199+ LD=i686-w64-mingw32.static-ld
200+ RC=i686-w64-mingw32.static-windres
201+
202+ [options]
203+ boost/*:without_fiber=True
204+ boost/*:without_graph=True
205+ boost/*:without_log=True
206+ boost/*:without_stacktrace=True
207+ boost/*:without_test=True
208+ boost/*:without_wave=True
209+
210+ [conf]
211+ tools.build:cflags=["-D_WIN32_WINNT=0x0501"]
212+ tools.build:cxxflags=["-D_WIN32_WINNT=0x0501"]
213+ ```
214+
215+ The supped libmbdx should be patched for windows xp support:
216+
217+ ```
218+ cd syncspirit/lib/mbdx
219+ patch -p1 < ../windows-xp.patch
220+ ```
221+
222+ Go to ` syncspirit ` dir and then make a build
223+
224+ ```
225+ cd syncspirit
226+ mkdir build.release && cd build.release
227+ conan install --build=missing -o '*:shared=False' -o shared=False --output-folder . \
228+ -s build_type=Release --profile:build=default --profile:host=xp ..
229+ source ./conanbuild.sh
230+ cmake .. -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=$PWD/conan_toolchain.cmake \
231+ -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=off \
232+ -DCMAKE_CXX_FLAGS="-D_WIN32_WINNT=0x0501 -DBOOST_ASIO_ENABLE_CANCELIO=1"
233+ make -j`nproc`
234+ ```
235+
87236
88237## cross building on linux for old linux (ubuntu 16.04 etc.)
89238
@@ -128,7 +277,7 @@ boost/*:without_wave=True
128277```
129278
130279```
131- conan install --build=missing -o '*:shared=False' -o shared=False --output-folder .
280+ conan install --build=missing -o '*:shared=False' -o shared=False --output-folder . \
132281 -s build_type=Release --profile:build=default --profile:host=old_linux ..
133282source ./conanbuild.sh
134283cmake .. -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=$PWD/conan_toolchain.cmake \
0 commit comments