{"id":311053,"date":"2020-10-06T15:00:46","date_gmt":"2020-10-06T15:00:46","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=311053"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=311053","title":{"rendered":"\u041a\u0430\u043a \u0441\u043a\u0440\u0435\u0441\u0442\u0438\u0442\u044c Clion, Emscripten \u0438 Cmake"},"content":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/522284\/\">\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u043f\u0440\u043e\u0439\u0442\u0438\u0441\u044c \u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c IDE CLion \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 CMake \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 Emscripten. \u041a\u043e\u0433\u0434\u0430 \u044f \u0437\u0430\u043d\u0438\u043c\u0430\u043b\u0441\u044f \u044d\u0442\u0438\u043c \u0441\u043a\u0440\u0435\u0449\u0438\u0432\u0430\u043d\u0438\u0435\u043c \u043c\u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0434\u0435\u043d\u044c \u0438\u043b\u0438 \u0434\u0432\u0430 \u043d\u0430 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u044b. \u0418 \u0432 \u044d\u0442\u043e\u0439 \u0437\u0430\u043c\u0435\u0442\u043a\u0435 \u044f \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0441\u044c \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0435 &#171;how to&#187;, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432 \u0438\u0442\u043e\u0433\u0435 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e. <\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u0442\u043e \u0432\u0441\u0435 \u044d\u0442\u0438 \u043b\u044e\u0434\u0438?<\/summary>\n<div class=\"spoiler__content\">\n<p><strong>Emscripten<\/strong> &#8212; \u044d\u0442\u043e \u043d\u0430\u0431\u043e\u0440 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f C++ \u043a\u043e\u0434\u0430 \u0432 Asm.js\/WebAssembly. \u0421\u0435\u0439\u0447\u0430\u0441 WebAssembly \u0443\u0436\u0435 \u0432\u044b\u0448\u0435\u043b \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u043b\u0430\u043d,<\/p>\n<p><strong>CMake<\/strong> &#8212; \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430. <\/p>\n<p><strong>CLion<\/strong> &#8212; \u0441\u0440\u0435\u0434\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u043b\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u043d\u0430 C\/C++ \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0430\u044f \u0432\u043e\u043a\u0440\u0443\u0433 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f CMake \u043a\u0430\u043a \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u0441\u0431\u043e\u0440\u043a\u0438. \u041d\u043e \u043f\u043e\u0434\u043a\u0440\u0435\u043f\u0438\u0442\u044c \u043a \u044d\u0442\u043e\u043c\u0443 Emscripten \u0431\u044b\u043b\u043e \u043d\u0435 \u0442\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e<\/p>\n<\/div>\n<\/details>\n<h3>\u041f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f<\/h3>\n<p>\u0413\u043b\u0430\u0432\u043d\u044b\u043c \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435\u043c, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u0437\u0430\u0432\u0435\u043b\u043e\u0441\u044c \u0441 \u043f\u043e\u043b\u043f\u0438\u043d\u043a\u0430 \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u043e \u0443\u0436\u0435 \u0438\u043c\u0435\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 Python \u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e 3-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438. \u0422\u0430\u043a \u0436\u0435 python \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0438\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438\\<\/p>\n<p>Cmake \u0431\u0443\u0434\u0435\u0442 \u043d\u0443\u0436\u0435\u043d \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0432\u0435\u0440\u0441\u0438\u0438<em>&nbsp;<\/em>3.13<\/p>\n<p>\u0418 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u043f\u0440\u043e Git<\/p>\n<h3>\u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c Emscripten<\/h3>\n<p>\u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c emsdk. ( https:\/\/github.com\/emscripten-core\/emsdk )<\/p>\n<p>\u0418 \u0438\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0434\u0435\u043b\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0448\u0430\u0433\u0438:<\/p>\n<ol>\n<li>\n<p>\u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0432\u0435\u0440\u0441\u0438\u044e Emscripten<\/p>\n<pre><code>.\/emsdk install latest<\/code><\/pre>\n<\/li>\n<li>\n<p>\u0410\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0432\u0435\u0440\u0441\u0438\u044e<\/p>\n<pre><code>.\/emsdk activate latest<\/code><\/pre>\n<\/li>\n<\/ol>\n<p>\u0418 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u0441\u0435 \u0438\u043c\u0435\u043d\u043d\u043e \u0432 \u0442\u0430\u043a\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438. \u041e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 help \u0434\u043b\u044f emsdk \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0435\u0449\u0435 \u0448\u0430\u0433\u0438, \u043d\u043e \u043e\u043d\u0438 \u043d\u0443\u0436\u043d\u044b \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0438\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438. \u041c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0437 IDE.<\/p>\n<h3>\u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c CLion<\/h3>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c, \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442. \u0418 \u0437\u0430\u0445\u043e\u0434\u0438\u043c \u0432 File -&gt; Settings. \u0410 \u0432 \u043f\u043e\u044f\u0432\u0438\u0432\u0448\u0435\u043c\u0441\u044f \u043e\u043a\u043d\u0435 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c Build, Execution, Deployment -&gt; Toolchains.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0443\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 CLion \u043f\u043e\u0434 Windows, \u0442\u043e \u0443 \u0432\u0430\u0441 \u0441 \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0434\u043e\u043b\u0435\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0443\u0436\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d MSYS2 ( \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f MinGW ). \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0433\u043e \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0435 \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 gcc \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0434\u043b\u044f \u0441++ header&#8217;\u043e\u0432 \u044f \u043c\u043e\u043b\u0447\u0430\u043b\u0438\u0432\u043e \u043f\u0440\u043e\u043f\u0443\u0449\u0443.<\/p>\n<p>\u041f\u043e\u0434 Linux \u044d\u0442\u043e \u043e\u043a\u043d\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f, \u043d\u043e \u0432\u043e\u0442 \u043a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043e\u043a\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 Toolchain \u0432 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u0434 Windows:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/bb9\/b55\/929\/bb9b55929f3d728ae775fc40e6303b01.png\" width=\"966\" height=\"703\"><figcaption><\/figcaption><\/figure>\n<p>\u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c + \u0438 \u0432 \u043f\u043e\u044f\u0432\u0438\u0432\u0448\u0435\u043c\u0441\u044f \u043c\u0435\u043d\u044e \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c MinGW.<\/p>\n<p>\u0412 Environment \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043f\u0443\u0442\u044c \u043a \u0432\u043d\u0443\u0442\u0440\u044c MSYS2. \u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 MSYS2 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0432 \u043f\u0430\u043f\u043a\u0443 e:\\msys64<\/p>\n<p>\u0412 CMake \u043f\u043e \u0436\u0435\u043b\u0430\u043d\u0438\u044e \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043f\u0443\u0442\u044c \u043a \u0432\u043d\u0435\u0448\u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0443 \u043e\u043d\u043e\u0433\u043e (\u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f CLion \u0438 CMake \u0442\u043e\u0436\u0435 \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438). <\/p>\n<p><strong>!<\/strong> \u0412 C Compiler \u0438 C++ Compiler \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043f\u0443\u0442\u0438 \u043a \u044d\u0442\u0438\u043c .bat \u0444\u0430\u0439\u043b\u0430\u043c. \u0414\u043b\u044f Linux \u0441\u0440\u0435\u0434\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u0431\u0435\u0440\u0438\u0442\u0435 .bat \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435. \u0421\u0443\u0442\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e Emscripten \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 python \u0441\u043a\u0440\u0438\u043f\u0442\u044b, \u0430 \u044d\u0442\u0438 shell \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442 \u044d\u0442\u0438 python \u0444\u0430\u0439\u043b\u044b. <\/p>\n<p> \u0414\u0430\u043b\u0435\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u043f\u0443\u043d\u043a\u0442 CMake. \u0418 \u0442\u0443\u0442 \u0441\u043e\u0437\u0434\u0430\u0435\u043c target \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/324\/a58\/5ae\/324a585aeaacf8034ee54370803c9297.png\" width=\"1546\" height=\"701\"><figcaption><\/figcaption><\/figure>\n<p>\u0412 Toolchains \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 toolchain<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u043f\u044c\u0435\u0441\u044b: \u0412 CMake Options \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432\u043e\u043b\u0448\u0435\u0431\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u0447\u043a\u0443 <code>-DCMAKE_TOOLCHAIN_FILE=<\/code> \u0438 \u043f\u0443\u0442\u044c \u043a \u0432\u043d\u0443\u0442\u0440\u0438 emsdk \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043a \u0444\u0430\u0439\u043b\u0443 Emscripten.cmake. <\/p>\n<p>Emscripten.cmake \u0438 \u043f\u0443\u0442\u0438 \u0432 C Compiler \u0438 C++ Compiler &#8212; \u044d\u0442\u043e \u0447\u0442\u043e \u0437\u0430\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u0441\u0435 \u0432 \u0438\u0442\u043e\u0433\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c.<\/p>\n<h3>\u041f\u0438\u0448\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0434\u043b\u044f CMake.<\/h3>\n<p>\u0422\u0443\u0442 \u0432\u0441\u0435 \u0443\u0436\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438. \u0418 \u043f\u0440\u043e\u0435\u043a\u0442 \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u043d\u0430\u0436\u0430\u0442\u0438\u044e Build-&gt;Build Project. \u041d\u043e \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0442\u043e\u0438\u043b\u043e \u0431\u044b \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044c.<\/p>\n<ol>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u043d\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443, \u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0442\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0432\u044b\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0434\u043b\u044f \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 .js<\/p>\n<pre><code class=\"cmake\">set(CMAKE_EXECUTABLE_SUFFIX .js)<\/code><\/pre>\n<\/li>\n<li>\n<p>\u0423 Emscripten <a href=\"https:\/\/emscripten.org\/docs\/tools_reference\/emcc.html\" rel=\"noopener noreferrer nofollow\">\u0444\u043b\u0430\u0433\u0438 \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430\u0440\u0430<\/a> \u0438 \u0444\u043b\u0430\u0433\u0438 \u0434\u043b\u044f \u043b\u0438\u043d\u043a\u0435\u0440\u0430 \u0441\u043e\u0432\u043c\u0435\u0449\u0435\u043d\u044b \u0432\u043c\u0435\u0441\u0442\u0435. \u0412\u0438\u0434\u0438\u043c\u043e \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0442\u043e\u0432\u0430\u0440\u0438\u0449\u0438 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043b\u0438, \u0447\u0442\u043e emcc \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0434\u0430\u0432\u0430\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0439 .js \u0444\u0430\u0439\u043b. \u041d\u043e \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0435\u043a\u0442 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c 1 \u0444\u0430\u0439\u043b, \u043b\u043e\u0433\u0438\u043a\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043b\u043e\u043c\u0430\u0435\u0442\u0441\u044f<\/p>\n<p>\u0412 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0444\u043b\u0430\u0433\u0438 \u0438\u0437 \u0441\u0441\u044b\u043b\u043a\u0438 \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0430\u0431\u0437\u0430\u0446\u0430 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f linker&#8217;\u0430, \u0431\u0435\u0437 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0438\u0445 \u0432 \u0444\u043b\u0430\u0433\u0430\u0445 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"cmake\">target_link_options(project PUBLIC \"SHELL: --pre-js ${CMAKE_CURRENT_SOURCE_DIR}\/prejs.js --js-library ${CMAKE_CURRENT_SOURCE_DIR}\/jsLib.js\") target_link_options(project PUBLIC \"SHELL: -s USE_GLFW=3 --preload-file glsl -s ALLOW_MEMORY_GROWTH=1\")<\/code><\/pre>\n<p><code>target_link_options<\/code> \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0432 \u043d\u0435\u0434\u0430\u0432\u043d\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 Cmake \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0432 \u043a\u043e\u043c\u043c\u0430\u043d\u0434\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0434\u043b\u044f \u043b\u0438\u043d\u043a\u0435\u0440\u0430. \u0418\u0437 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434 \u0437\u0434\u0435\u0441\u044c \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c <code>--preload-file<\/code> \u0417\u0430 \u0441\u0447\u0435\u0442 \u044d\u0442\u043e\u0433\u043e \u0447\u0443\u0434\u0430, \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0432\u0441\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f glsl \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438, \u0437\u0430\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u0442 \u0432\u043d\u0443\u0442\u0440\u044c bundle&#8217;\u0430. \u0418 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0447\u0435\u0440\u0435\u0437 \u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438. <\/p>\n<\/li>\n<li>\n<p>\u0412 \u043c\u043e\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043c\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0431\u0438\u043b\u0434\u0438\u0442\u044c \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0442 \u043a\u043e\u0434. \u0414\u043b\u044f emscripten \u0432\u0435\u0440\u0441\u0438\u0438 \u0431\u0438\u043b\u0434\u044f\u0442\u0441\u044f \u0432 .js \u0444\u0430\u0439\u043b\u044b \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 nodejs. \u0418 \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c\u044b\u0439 .js \u0438\u0437 nodejs \u0441\u043c\u043e\u0442\u0440\u0435\u043b \u043d\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u0443\u044e \u0444\u0430\u0439\u043b\u043e\u0432\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e \u043e\u0434\u0438\u043d \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 \u0444\u043b\u0430\u0433 \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438:<\/p>\n<p><code>target_link_options(glslangValidator PUBLIC -s NODERAWFS=1)<\/code><\/p>\n<\/li>\n<\/ol>\n<h3>\u0418\u0442\u043e\u0433\u043e<\/h3>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438\u0437 CLion \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 Emscripten.<\/p>\n<p>\u041d\u0430\u0434\u0435\u044e\u0441\u044c \u043d\u0430 \u0430\u0434\u0435\u043a\u0432\u0430\u0442\u043d\u0443\u044e \u043a\u0440\u0438\u0442\u0438\u043a\u0443 \u043e\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0430  <\/p>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/522284\/\"> https:\/\/habr.com\/ru\/post\/522284\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/522284\/\">\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u043f\u0440\u043e\u0439\u0442\u0438\u0441\u044c \u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c IDE CLion \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 CMake \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 Emscripten. \u041a\u043e\u0433\u0434\u0430 \u044f \u0437\u0430\u043d\u0438\u043c\u0430\u043b\u0441\u044f \u044d\u0442\u0438\u043c \u0441\u043a\u0440\u0435\u0449\u0438\u0432\u0430\u043d\u0438\u0435\u043c \u043c\u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0434\u0435\u043d\u044c \u0438\u043b\u0438 \u0434\u0432\u0430 \u043d\u0430 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u044b. \u0418 \u0432 \u044d\u0442\u043e\u0439 \u0437\u0430\u043c\u0435\u0442\u043a\u0435 \u044f \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0441\u044c \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0435 &#171;how to&#187;, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432 \u0438\u0442\u043e\u0433\u0435 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e. <\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u0442\u043e \u0432\u0441\u0435 \u044d\u0442\u0438 \u043b\u044e\u0434\u0438?<\/summary>\n<div class=\"spoiler__content\">\n<p><strong>Emscripten<\/strong> &#8212; \u044d\u0442\u043e \u043d\u0430\u0431\u043e\u0440 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f C++ \u043a\u043e\u0434\u0430 \u0432 Asm.js\/WebAssembly. \u0421\u0435\u0439\u0447\u0430\u0441 WebAssembly \u0443\u0436\u0435 \u0432\u044b\u0448\u0435\u043b \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u043b\u0430\u043d,<\/p>\n<p><strong>CMake<\/strong> &#8212; \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430. <\/p>\n<p><strong>CLion<\/strong> &#8212; \u0441\u0440\u0435\u0434\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u043b\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u043d\u0430 C\/C++ \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0430\u044f \u0432\u043e\u043a\u0440\u0443\u0433 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f CMake \u043a\u0430\u043a \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u0441\u0431\u043e\u0440\u043a\u0438. \u041d\u043e \u043f\u043e\u0434\u043a\u0440\u0435\u043f\u0438\u0442\u044c \u043a \u044d\u0442\u043e\u043c\u0443 Emscripten \u0431\u044b\u043b\u043e \u043d\u0435 \u0442\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e<\/p>\n<\/div>\n<\/details>\n<h3>\u041f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f<\/h3>\n<p>\u0413\u043b\u0430\u0432\u043d\u044b\u043c \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435\u043c, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u0437\u0430\u0432\u0435\u043b\u043e\u0441\u044c \u0441 \u043f\u043e\u043b\u043f\u0438\u043d\u043a\u0430 \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u043e \u0443\u0436\u0435 \u0438\u043c\u0435\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 Python \u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e 3-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438. \u0422\u0430\u043a \u0436\u0435 python \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0438\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438\\<\/p>\n<p>Cmake \u0431\u0443\u0434\u0435\u0442 \u043d\u0443\u0436\u0435\u043d \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0432\u0435\u0440\u0441\u0438\u0438<em>&nbsp;<\/em>3.13<\/p>\n<p>\u0418 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u043f\u0440\u043e Git<\/p>\n<h3>\u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c Emscripten<\/h3>\n<p>\u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c emsdk. ( https:\/\/github.com\/emscripten-core\/emsdk )<\/p>\n<p>\u0418 \u0438\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0434\u0435\u043b\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0448\u0430\u0433\u0438:<\/p>\n<ol>\n<li>\n<p>\u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0432\u0435\u0440\u0441\u0438\u044e Emscripten<\/p>\n<pre><code>.\/emsdk install latest<\/code><\/pre>\n<\/li>\n<li>\n<p>\u0410\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0432\u0435\u0440\u0441\u0438\u044e<\/p>\n<pre><code>.\/emsdk activate latest<\/code><\/pre>\n<\/li>\n<\/ol>\n<p>\u0418 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u0441\u0435 \u0438\u043c\u0435\u043d\u043d\u043e \u0432 \u0442\u0430\u043a\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438. \u041e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 help \u0434\u043b\u044f emsdk \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0435\u0449\u0435 \u0448\u0430\u0433\u0438, \u043d\u043e \u043e\u043d\u0438 \u043d\u0443\u0436\u043d\u044b \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0438\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438. \u041c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0437 IDE.<\/p>\n<h3>\u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c CLion<\/h3>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c, \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442. \u0418 \u0437\u0430\u0445\u043e\u0434\u0438\u043c \u0432 File -&gt; Settings. \u0410 \u0432 \u043f\u043e\u044f\u0432\u0438\u0432\u0448\u0435\u043c\u0441\u044f \u043e\u043a\u043d\u0435 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c Build, Execution, Deployment -&gt; Toolchains.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0443\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 CLion \u043f\u043e\u0434 Windows, \u0442\u043e \u0443 \u0432\u0430\u0441 \u0441 \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0434\u043e\u043b\u0435\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0443\u0436\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d MSYS2 ( \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f MinGW ). \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0433\u043e \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0435 \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 gcc \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0434\u043b\u044f \u0441++ header&#8217;\u043e\u0432 \u044f \u043c\u043e\u043b\u0447\u0430\u043b\u0438\u0432\u043e \u043f\u0440\u043e\u043f\u0443\u0449\u0443.<\/p>\n<p>\u041f\u043e\u0434 Linux \u044d\u0442\u043e \u043e\u043a\u043d\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f, \u043d\u043e \u0432\u043e\u0442 \u043a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043e\u043a\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 Toolchain \u0432 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u0434 Windows:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c + \u0438 \u0432 \u043f\u043e\u044f\u0432\u0438\u0432\u0448\u0435\u043c\u0441\u044f \u043c\u0435\u043d\u044e \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c MinGW.<\/p>\n<p>\u0412 Environment \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043f\u0443\u0442\u044c \u043a \u0432\u043d\u0443\u0442\u0440\u044c MSYS2. \u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 MSYS2 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0432 \u043f\u0430\u043f\u043a\u0443 e:\\msys64<\/p>\n<p>\u0412 CMake \u043f\u043e \u0436\u0435\u043b\u0430\u043d\u0438\u044e \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043f\u0443\u0442\u044c \u043a \u0432\u043d\u0435\u0448\u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0443 \u043e\u043d\u043e\u0433\u043e (\u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f CLion \u0438 CMake \u0442\u043e\u0436\u0435 \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438). <\/p>\n<p><strong>!<\/strong> \u0412 C Compiler \u0438 C++ Compiler \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043f\u0443\u0442\u0438 \u043a \u044d\u0442\u0438\u043c .bat \u0444\u0430\u0439\u043b\u0430\u043c. \u0414\u043b\u044f Linux \u0441\u0440\u0435\u0434\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u0431\u0435\u0440\u0438\u0442\u0435 .bat \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435. \u0421\u0443\u0442\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e Emscripten \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 python \u0441\u043a\u0440\u0438\u043f\u0442\u044b, \u0430 \u044d\u0442\u0438 shell \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442 \u044d\u0442\u0438 python \u0444\u0430\u0439\u043b\u044b. <\/p>\n<p> \u0414\u0430\u043b\u0435\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u043f\u0443\u043d\u043a\u0442 CMake. \u0418 \u0442\u0443\u0442 \u0441\u043e\u0437\u0434\u0430\u0435\u043c target \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0412 Toolchains \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 toolchain<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u043f\u044c\u0435\u0441\u044b: \u0412 CMake Options \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432\u043e\u043b\u0448\u0435\u0431\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u0447\u043a\u0443 <code>-DCMAKE_TOOLCHAIN_FILE=<\/code> \u0438 \u043f\u0443\u0442\u044c \u043a \u0432\u043d\u0443\u0442\u0440\u0438 emsdk \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043a \u0444\u0430\u0439\u043b\u0443 Emscripten.cmake. <\/p>\n<p>Emscripten.cmake \u0438 \u043f\u0443\u0442\u0438 \u0432 C Compiler \u0438 C++ Compiler &#8212; \u044d\u0442\u043e \u0447\u0442\u043e \u0437\u0430\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u0441\u0435 \u0432 \u0438\u0442\u043e\u0433\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c.<\/p>\n<h3>\u041f\u0438\u0448\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0434\u043b\u044f CMake.<\/h3>\n<p>\u0422\u0443\u0442 \u0432\u0441\u0435 \u0443\u0436\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438. \u0418 \u043f\u0440\u043e\u0435\u043a\u0442 \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u043d\u0430\u0436\u0430\u0442\u0438\u044e Build-&gt;Build Project. \u041d\u043e \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0442\u043e\u0438\u043b\u043e \u0431\u044b \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044c.<\/p>\n<ol>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u043d\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443, \u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0442\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0432\u044b\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0434\u043b\u044f \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 .js<\/p>\n<pre><code class=\"cmake\">set(CMAKE_EXECUTABLE_SUFFIX .js)<\/code><\/pre>\n<\/li>\n<li>\n<p>\u0423 Emscripten <a href=\"https:\/\/emscripten.org\/docs\/tools_reference\/emcc.html\" rel=\"noopener noreferrer nofollow\">\u0444\u043b\u0430\u0433\u0438 \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430\u0440\u0430<\/a> \u0438 \u0444\u043b\u0430\u0433\u0438 \u0434\u043b\u044f \u043b\u0438\u043d\u043a\u0435\u0440\u0430 \u0441\u043e\u0432\u043c\u0435\u0449\u0435\u043d\u044b \u0432\u043c\u0435\u0441\u0442\u0435. \u0412\u0438\u0434\u0438\u043c\u043e \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0442\u043e\u0432\u0430\u0440\u0438\u0449\u0438 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043b\u0438, \u0447\u0442\u043e emcc \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0434\u0430\u0432\u0430\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0439 .js \u0444\u0430\u0439\u043b. \u041d\u043e \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0435\u043a\u0442 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c 1 \u0444\u0430\u0439\u043b, \u043b\u043e\u0433\u0438\u043a\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043b\u043e\u043c\u0430\u0435\u0442\u0441\u044f<\/p>\n<p>\u0412 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0444\u043b\u0430\u0433\u0438 \u0438\u0437 \u0441\u0441\u044b\u043b\u043a\u0438 \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0430\u0431\u0437\u0430\u0446\u0430 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f linker&#8217;\u0430, \u0431\u0435\u0437 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0438\u0445 \u0432 \u0444\u043b\u0430\u0433\u0430\u0445 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"cmake\">target_link_options(project PUBLIC \"SHELL: --pre-js ${CMAKE_CURRENT_SOURCE_DIR}\/prejs.js --js-library ${CMAKE_CURRENT_SOURCE_DIR}\/jsLib.js\") target_link_options(project PUBLIC \"SHELL: -s USE_GLFW=3 --preload-file glsl -s ALLOW_MEMORY_GROWTH=1\")<\/code><\/pre>\n<p><code>target_link_options<\/code> \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0432 \u043d\u0435\u0434\u0430\u0432\u043d\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 Cmake \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0432 \u043a\u043e\u043c\u043c\u0430\u043d\u0434\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0434\u043b\u044f \u043b\u0438\u043d\u043a\u0435\u0440\u0430. \u0418\u0437 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434 \u0437\u0434\u0435\u0441\u044c \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c <code>--preload-file<\/code> \u0417\u0430 \u0441\u0447\u0435\u0442 \u044d\u0442\u043e\u0433\u043e \u0447\u0443\u0434\u0430, \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0432\u0441\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f glsl \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438, \u0437\u0430\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u0442 \u0432\u043d\u0443\u0442\u0440\u044c bundle&#8217;\u0430. \u0418 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0447\u0435\u0440\u0435\u0437 \u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438. <\/p>\n<\/li>\n<li>\n<p>\u0412 \u043c\u043e\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043c\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0431\u0438\u043b\u0434\u0438\u0442\u044c \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0442 \u043a\u043e\u0434. \u0414\u043b\u044f emscripten \u0432\u0435\u0440\u0441\u0438\u0438 \u0431\u0438\u043b\u0434\u044f\u0442\u0441\u044f \u0432 .js \u0444\u0430\u0439\u043b\u044b \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 nodejs. \u0418 \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c\u044b\u0439 .js \u0438\u0437 nodejs \u0441\u043c\u043e\u0442\u0440\u0435\u043b \u043d\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u0443\u044e \u0444\u0430\u0439\u043b\u043e\u0432\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e \u043e\u0434\u0438\u043d \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 \u0444\u043b\u0430\u0433 \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438:<\/p>\n<p><code>target_link_options(glslangValidator PUBLIC -s NODERAWFS=1)<\/code><\/p>\n<\/li>\n<\/ol>\n<h3>\u0418\u0442\u043e\u0433\u043e<\/h3>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438\u0437 CLion \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 Emscripten.<\/p>\n<p>\u041d\u0430\u0434\u0435\u044e\u0441\u044c \u043d\u0430 \u0430\u0434\u0435\u043a\u0432\u0430\u0442\u043d\u0443\u044e \u043a\u0440\u0438\u0442\u0438\u043a\u0443 \u043e\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0430  <\/p>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/522284\/\"> https:\/\/habr.com\/ru\/post\/522284\/<\/a><br \/><\/br><\/br><\/br><\/p>\n<\/li>\n<\/li>\n<\/ol>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-311053","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/311053","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=311053"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/311053\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=311053"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=311053"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=311053"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}