{"id":98,"date":"2026-07-19T16:16:14","date_gmt":"2026-07-19T16:16:14","guid":{"rendered":"https:\/\/demensdeum.com\/blog\/2026\/07\/19\/crosscompile-for-window-on-ubuntu-mingw-cmake\/"},"modified":"2026-07-19T16:16:14","modified_gmt":"2026-07-19T16:16:14","slug":"crosscompile-for-window-on-ubuntu-mingw-cmake","status":"publish","type":"post","link":"https:\/\/demensdeum.com\/blog\/ru\/2026\/07\/19\/crosscompile-for-window-on-ubuntu-mingw-cmake\/","title":{"rendered":"\u0421\u0431\u043e\u0440\u043a\u0430 \u0434\u043b\u044f Windows \u043f\u043e\u0434 Ubuntu MinGW CMake"},"content":{"rendered":"<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u043c\u0435\u0442\u043a\u0435 \u044f \u043e\u043f\u0438\u0448\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u0431\u043e\u0440\u043a\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0434\u043b\u044f Windows \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0443\u043b\u0447\u0435\u0439\u043d\u0430 MinGW32 \u043d\u0430 Ubuntu.<br \/>\n\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c wine, mingw:<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-unknown\" data-lang=\"unknown\"><code>sudo apt-get install wine mingw-w64\n<\/code><\/pre>\n<\/div>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0443\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c C\/C++ \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u0434 Windows:<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-unknown\" data-lang=\"unknown\"><code># C\ni686-w64-mingw32-gcc helloWorld.c -o helloWorld32.exe      # 32-bit\nx86_64-w64-mingw32-gcc helloWorld.c -o helloWorld64.exe    # 64-bit\n \n# C++\ni686-w64-mingw32-g++ helloWorld.cc -o helloWorld32.exe     # 32-bit\nx86_64-w64-mingw32-g++ helloWorld.cc -o helloWorld64.exe   # 64-bit\n<\/code><\/pre>\n<\/div>\n<p>\u0421\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0435 exe \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e wine.<br \/>\n\u0414\u0430\u043b\u0435\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u0431\u043e\u0440\u043a\u0438 CMake, \u0444\u0430\u0439\u043b\u0430 CMakeLists.txt, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c MinGW \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0435 \u0432\u0435\u0449\u0438 \u043a \u0444\u0430\u0439\u043b\u0443 \u0441\u0431\u043e\u0440\u043a\u0438:<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-unknown\" data-lang=\"unknown\"><code>if (MINGW32)\nset(CMAKE_SYSTEM_NAME Windows)\nSET(CMAKE_C_COMPILER i686-w64-mingw32-gcc)\nSET(CMAKE_CXX_COMPILER i686-w64-mingw32-g++)\nSET(CMAKE_RC_COMPILER i686-w64-mingw32-windres)\nset(CMAKE_RANLIB i686-w64-mingw32-ranlib)\nendif()\n\n\/\/ \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 shared dll\nelseif (MINGW32)\nadd_library(FlameSteelEngineGameToolkit.dll SHARED ${SOURCE_FILES})\nelse()\n\n\/\/ \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043b\u0438\u043d\u043a\u0443\u0435\u043c \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044f\u043c\u0438\nif (MINGW32)\ntarget_link_libraries(\n                        FlameSteelEngineGameToolkit.dll \n                        -static-libgcc\n                        -static-libstdc++\n                        SDL2 \n                        SDL2_mixer \n                        \/home\/demensdeum\/Sources\/cube-art-project-bootstrap\/FlameSteelFramework\/FlameSteelCore\/FlameSteelCore.dll\n                        \/home\/demensdeum\/Sources\/cube-art-project-bootstrap\/FlameSteelFramework\/FlameSteelBattleHorn\/FlameSteelBattleHorn.dll\n                        \/home\/demensdeum\/Sources\/cube-art-project-bootstrap\/FlameSteelFramework\/FlameSteelCommonTraits\/FlameSteelCommonTraits.dll)\n\nset_target_properties(FlameSteelEngineGameToolkit.dll PROPERTIES\n        PREFIX \"\"\n        SUFFIX \"\"\n        LINK_FLAGS \"-Wl,--add-stdcall-alias\"\n        POSITION_INDEPENDENT_CODE 0 # this is to avoid MinGW warning; \n        # MinGW generates position-independent-code for DLL by default\n)\nelse()\n<\/code><\/pre>\n<\/div>\n<p>\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c:<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-unknown\" data-lang=\"unknown\"><code>cmake -DMINGW32=1 .\nmake\n<\/code><\/pre>\n<\/div>\n<p>\u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0431\u0443\u0434\u0435\u0442 dll \u0438\u043b\u0438 exe, \u0441\u043c\u043e\u0442\u0440\u044f \u0447\u0442\u043e \u0432\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0435. \u0417\u0430 \u0440\u0430\u0431\u043e\u0447\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 Cube-Art-Project \u0438 \u0435\u0433\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438:<br \/>\n<a href=\"https:\/\/gitlab.com\/demensdeum\/cube-art-project\" rel=\"noopener noreferrer\" target=\"_blank\">https:\/\/gitlab.com\/demensdeum\/cube-art-project<\/a><\/p>\n<p><a href=\"https:\/\/gitlab.com\/demensdeum\/FlameSteelEngineGameToolkitFSGL\" rel=\"noopener noreferrer\" target=\"_blank\">https:\/\/gitlab.com\/demensdeum\/FlameSteelEngineGameToolkitFSGL<\/a><\/p>\n<p><a href=\"https:\/\/gitlab.com\/demensdeum\/cube-art-project-bootstrap\" rel=\"noopener noreferrer\" target=\"_blank\">https:\/\/gitlab.com\/demensdeum\/cube-art-project-bootstrap<\/a><\/p>\n<p>\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438<br \/>\n<a href=\"https:\/\/arrayfire.com\/cross-compile-to-windows-from-linux\/\" rel=\"noopener noreferrer\" target=\"_blank\">https:\/\/arrayfire.com\/cross-compile-to-windows-from-linux\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u043c\u0435\u0442\u043a\u0435 \u044f \u043e\u043f\u0438\u0448\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u0431\u043e\u0440\u043a\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0434\u043b\u044f Windows \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0443\u043b\u0447\u0435\u0439\u043d\u0430 MinGW32 \u043d\u0430 Ubuntu. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c wine, mingw: sudo apt-get install wine mingw-w64 \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0443\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c C\/C++ \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u0434 Windows: # C i686-w64-mingw32-gcc helloWorld.c -o helloWorld32.exe # 32-bit x86_64-w64-mingw32-gcc helloWorld.c -o helloWorld64.exe # 64-bit # C++ i686-w64-mingw32-g++ helloWorld.cc -o helloWorld32.exe [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-98","post","type-post","status-publish","format-standard","hentry","category-notes"],"translation":{"provider":"WPGlobus","version":"3.0.3","language":"ru","enabled_languages":["en","ru","zh","de","ja","fr","es","pt","hi"],"languages":{"en":{"title":true,"content":true,"excerpt":false},"ru":{"title":true,"content":true,"excerpt":false},"zh":{"title":true,"content":true,"excerpt":false},"de":{"title":true,"content":true,"excerpt":false},"ja":{"title":true,"content":true,"excerpt":false},"fr":{"title":true,"content":true,"excerpt":false},"es":{"title":false,"content":false,"excerpt":false},"pt":{"title":true,"content":true,"excerpt":false},"hi":{"title":true,"content":true,"excerpt":false}}},"_links":{"self":[{"href":"https:\/\/demensdeum.com\/blog\/ru\/wp-json\/wp\/v2\/posts\/98","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/demensdeum.com\/blog\/ru\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/demensdeum.com\/blog\/ru\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/demensdeum.com\/blog\/ru\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/demensdeum.com\/blog\/ru\/wp-json\/wp\/v2\/comments?post=98"}],"version-history":[{"count":0,"href":"https:\/\/demensdeum.com\/blog\/ru\/wp-json\/wp\/v2\/posts\/98\/revisions"}],"wp:attachment":[{"href":"https:\/\/demensdeum.com\/blog\/ru\/wp-json\/wp\/v2\/media?parent=98"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/demensdeum.com\/blog\/ru\/wp-json\/wp\/v2\/categories?post=98"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/demensdeum.com\/blog\/ru\/wp-json\/wp\/v2\/tags?post=98"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}