<?xml version="1.0" encoding="UTF-8" ?> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/"> <channel> <title>在MacOS M1处理器平台编译ygopro的过程</title> <link>https://ygobbs2.com/t/%E5%9C%A8macos-m1%E5%A4%84%E7%90%86%E5%99%A8%E5%B9%B3%E5%8F%B0%E7%BC%96%E8%AF%91ygopro%E7%9A%84%E8%BF%87%E7%A8%8B/406685</link> <description>声明:本教程好像没啥卵用,我忙活了半天才发现萌卡已经原生支持ygopro了。但是作为一种摸索过程还是挺有趣的。 Ygopro支持premake和cmake生成makefile,但是我无法用premake编译出能使用的irrlicht。 由于本教程使用的是homebrew自带的**irrlicht**包所以不支持中文输入。irrlicht在M1平台编译成静态库之后,在最后编译app时候会出现若干错误: `Symbol not found: _inflateValidate on macOS ...` 所以权衡之下只能用homebrew自带的包了。 irrKlang不支持arm64架构,所以默认无法使用。 主要的流程大致与[mercury233写的mac编译教程](https://github.com/Fluorohydride/ygopro/wiki/macOS%E4%B8%8A%E7%BC%96%E8%AF%91)差不多,但是如果直接按照教程走会出现各种问题(M1平台的mac更改了库的路径)。 ## Clone the repo Clone the ygopro repo along with submodules to local: git clone git@github.com:Fluorohydride/ygopro.git --recursive cd ygopro git submodule update --init cd ocgcore/ git checkout master cd .. cd script/ git checkout master cd .. # Install dependencies through Homebrew The following dependencies should be installed by [homebrew](https://brew.sh/): * freetype * libevent * libx11 * sqlite * zlib Download [Source Code of Lua](https://www.lua.org/download.html) and extract it to ygopro folder. Rename it as `lua`. You should have a folder named **lua** in **ygopro** directory. By default lua is compiled with c compiler in MacOS. We need to modify the makefile in `ygopro/lua/src/Makefile` and set `CC= clang++` in 9th line. Now run command `make macosx` in `lua` folder to generate lua library. The next step is to tell cmake to find the lua lib: go to `cmake/macros/FindLua.cmake` and change the first two code blocks into: ``` FIND_PATH(LUA_INCLUDE_DIR lua.h HINTS ./lua/src $ENV{LUA_DIR} PATH_SUFFIXES include/lua53 include/lua5.3 include/lua include PATHS ~/Library/Frameworks /Library/Frameworks /sw # Fink /opt/homebrew /opt/local # DarwinPorts /opt/csw # Blastwave /opt ) FIND_LIBRARY(LUA_LIBRARY NAMES lua53-c++ lua5.3-c++ lua-5.3-c++ lua-c++ lua HINTS ./lua/src $ENV{LUA_DIR} PATH_SUFFIXES lib64 lib PATHS ~/Library/Frameworks /Library/Frameworks /sw /opt/homebrew /opt/local /opt/csw /opt ) ``` go back to ygopro folder and run: ``` ccmake . ``` This should toggle an interface and you should type `c` to configure the cmake setting (you should see `Configuring done` in the last line after the configuration is done). type `e` to exit the interface and type `q` to exit ccmake. run ``` cmake . ``` to generate the Makefile. run ``` make ``` to build the project. M1 cpu has 8 cores so I strongly recommend using `make -j8` to accelerate the process. You should see an file named ygopro in the `bin` folder. Now run the following command in ygopro folder to generate an app bundle in MacOS platform. ``` mkdir -p ./ygopro.app/Contents/MacOS/ cp ./bin/ygopro ./ygopro.app/Contents/MacOS/ygopro ``` The app may have problem when running in high resolution. The solution is to create a file under ./ygopro.app/Contents/ and copy/paste the following code to the file. ``` <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>NSHighResolutionCapable</key> <false/> <key>CFBundleIdenfier</key> <string>com.ygopro.1app</string> </dict> </plist> ``` # Open the app and enjoy the game!</description> <language>zh-CN</language> <lastBuildDate>Tue, 14 Feb 2023 09:14:45 +0000</lastBuildDate> <category>日常交流</category> <atom:link href="https://ygobbs2.com/t/%E5%9C%A8macos-m1%E5%A4%84%E7%90%86%E5%99%A8%E5%B9%B3%E5%8F%B0%E7%BC%96%E8%AF%91ygopro%E7%9A%84%E8%BF%87%E7%A8%8B/406685.rss" rel="self" type="application/rss+xml" /> <item> <title>在MacOS M1处理器平台编译ygopro的过程</title> <dc:creator><![CDATA[stupidhumanbein]]></dc:creator> <description><![CDATA[ <p>我发现了哈哈,所以我说这是个摸索过程。</p> <p><a href="https://ygobbs2.com/t/%E5%9C%A8macos-m1%E5%A4%84%E7%90%86%E5%99%A8%E5%B9%B3%E5%8F%B0%E7%BC%96%E8%AF%91ygopro%E7%9A%84%E8%BF%87%E7%A8%8B/406685/3">阅读整个主题</a></p> ]]></description> <link>https://ygobbs2.com/t/%E5%9C%A8macos-m1%E5%A4%84%E7%90%86%E5%99%A8%E5%B9%B3%E5%8F%B0%E7%BC%96%E8%AF%91ygopro%E7%9A%84%E8%BF%87%E7%A8%8B/406685/3</link> <pubDate>Tue, 14 Feb 2023 09:14:45 +0000</pubDate> <guid isPermaLink="false">ygobbs2.com-post-406685-3</guid> <source url="https://ygobbs2.com/t/%E5%9C%A8macos-m1%E5%A4%84%E7%90%86%E5%99%A8%E5%B9%B3%E5%8F%B0%E7%BC%96%E8%AF%91ygopro%E7%9A%84%E8%BF%87%E7%A8%8B/406685.rss">在MacOS M1处理器平台编译ygopro的过程</source> </item> <item> <title>在MacOS M1处理器平台编译ygopro的过程</title> <dc:creator><![CDATA[Nanahira]]></dc:creator> <description><![CDATA[ <p>MyCard 发行的 Mac YGOPro 是 x86 Mac 和 M1 Mac 双兼容的,而且 MyCard 客户端也同时支持 x86 和 M1 的 Mac。</p> <p><a href="https://ygobbs2.com/t/%E5%9C%A8macos-m1%E5%A4%84%E7%90%86%E5%99%A8%E5%B9%B3%E5%8F%B0%E7%BC%96%E8%AF%91ygopro%E7%9A%84%E8%BF%87%E7%A8%8B/406685/2">阅读整个主题</a></p> ]]></description> <link>https://ygobbs2.com/t/%E5%9C%A8macos-m1%E5%A4%84%E7%90%86%E5%99%A8%E5%B9%B3%E5%8F%B0%E7%BC%96%E8%AF%91ygopro%E7%9A%84%E8%BF%87%E7%A8%8B/406685/2</link> <pubDate>Fri, 27 Jan 2023 14:26:49 +0000</pubDate> <guid isPermaLink="false">ygobbs2.com-post-406685-2</guid> <source url="https://ygobbs2.com/t/%E5%9C%A8macos-m1%E5%A4%84%E7%90%86%E5%99%A8%E5%B9%B3%E5%8F%B0%E7%BC%96%E8%AF%91ygopro%E7%9A%84%E8%BF%87%E7%A8%8B/406685.rss">在MacOS M1处理器平台编译ygopro的过程</source> </item> <item> <title>在MacOS M1处理器平台编译ygopro的过程</title> <dc:creator><![CDATA[stupidhumanbein]]></dc:creator> <description><![CDATA[ <p>声明:本教程好像没啥卵用,我忙活了半天才发现萌卡已经原生支持ygopro了。但是作为一种摸索过程还是挺有趣的。</p> <p>Ygopro支持premake和cmake生成makefile,但是我无法用premake编译出能使用的irrlicht。</p> <p>由于本教程使用的是homebrew自带的<strong>irrlicht</strong>包所以不支持中文输入。irrlicht在M1平台编译成静态库之后,在最后编译app时候会出现若干错误:<br> <code>Symbol not found: _inflateValidate on macOS ...</code><br> 所以权衡之下只能用homebrew自带的包了。</p> <p>irrKlang不支持arm64架构,所以默认无法使用。</p> <p>主要的流程大致与<a href="https://github.com/Fluorohydride/ygopro/wiki/macOS%E4%B8%8A%E7%BC%96%E8%AF%91" rel="noopener nofollow ugc">mercury233写的mac编译教程</a>差不多,但是如果直接按照教程走会出现各种问题(M1平台的mac更改了库的路径)。</p> <h2>Clone the repo</h2> <p>Clone the ygopro repo along with submodules to local:</p> <pre><code>git clone git@github.com:Fluorohydride/ygopro.git --recursive cd ygopro git submodule update --init cd ocgcore/ git checkout master cd .. cd script/ git checkout master cd .. </code></pre> <h1>Install dependencies through Homebrew</h1> <p>The following dependencies should be installed by <a href="https://brew.sh/" rel="noopener nofollow ugc">homebrew</a>:</p> <ul> <li>freetype</li> <li>libevent</li> <li>libx11</li> <li>sqlite</li> <li>zlib</li> </ul> <p>Download <a href="https://www.lua.org/download.html" rel="noopener nofollow ugc">Source Code of Lua</a> and extract it to ygopro folder. Rename it as <code>lua</code>. You should have a folder named <strong>lua</strong> in <strong>ygopro</strong> directory.</p> <p>By default lua is compiled with c compiler in MacOS. We need to modify the makefile in <code>ygopro/lua/src/Makefile</code> and set <code>CC= clang++</code> in 9th line.</p> <p>Now run command <code>make macosx</code> in <code>lua</code> folder to generate lua library.</p> <p>The next step is to tell cmake to find the lua lib:</p> <p>go to</p> <p><code>cmake/macros/FindLua.cmake</code></p> <p>and change the first two code blocks into:</p> <pre><code class="lang-auto">FIND_PATH(LUA_INCLUDE_DIR lua.h HINTS ./lua/src $ENV{LUA_DIR} PATH_SUFFIXES include/lua53 include/lua5.3 include/lua include PATHS ~/Library/Frameworks /Library/Frameworks /sw # Fink /opt/homebrew /opt/local # DarwinPorts /opt/csw # Blastwave /opt ) FIND_LIBRARY(LUA_LIBRARY NAMES lua53-c++ lua5.3-c++ lua-5.3-c++ lua-c++ lua HINTS ./lua/src $ENV{LUA_DIR} PATH_SUFFIXES lib64 lib PATHS ~/Library/Frameworks /Library/Frameworks /sw /opt/homebrew /opt/local /opt/csw /opt ) </code></pre> <p>go back to ygopro folder and run:</p> <pre><code class="lang-auto">ccmake . </code></pre> <p>This should toggle an interface and you should type <code>c</code> to configure the cmake setting (you should see <code>Configuring done</code> in the last line after the configuration is done). type <code>e</code> to exit the interface and type <code>q</code> to exit ccmake.</p> <p>run</p> <pre><code class="lang-auto">cmake . </code></pre> <p>to generate the Makefile.</p> <p>run</p> <pre><code class="lang-auto">make </code></pre> <p>to build the project.</p> <p>M1 cpu has 8 cores so I strongly recommend using <code>make -j8</code> to accelerate the process.</p> <p>You should see an file named ygopro in the <code>bin</code> folder. Now run the following command in ygopro folder to generate an app bundle in MacOS platform.</p> <pre><code class="lang-auto">mkdir -p ./ygopro.app/Contents/MacOS/ cp ./bin/ygopro ./ygopro.app/Contents/MacOS/ygopro </code></pre> <p>The app may have problem when running in high resolution. The solution is to create a file under ./ygopro.app/Contents/ and copy/paste the following code to the file.</p> <pre><code class="lang-auto"><?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>NSHighResolutionCapable</key> <false/> <key>CFBundleIdenfier</key> <string>com.ygopro.1app</string> </dict> </plist> </code></pre> <h1>Open the app and enjoy the game!</h1> <p><a href="https://ygobbs2.com/t/%E5%9C%A8macos-m1%E5%A4%84%E7%90%86%E5%99%A8%E5%B9%B3%E5%8F%B0%E7%BC%96%E8%AF%91ygopro%E7%9A%84%E8%BF%87%E7%A8%8B/406685/1">阅读整个主题</a></p> ]]></description> <link>https://ygobbs2.com/t/%E5%9C%A8macos-m1%E5%A4%84%E7%90%86%E5%99%A8%E5%B9%B3%E5%8F%B0%E7%BC%96%E8%AF%91ygopro%E7%9A%84%E8%BF%87%E7%A8%8B/406685/1</link> <pubDate>Thu, 19 Jan 2023 09:34:01 +0000</pubDate> <guid isPermaLink="false">ygobbs2.com-post-406685-1</guid> <source url="https://ygobbs2.com/t/%E5%9C%A8macos-m1%E5%A4%84%E7%90%86%E5%99%A8%E5%B9%B3%E5%8F%B0%E7%BC%96%E8%AF%91ygopro%E7%9A%84%E8%BF%87%E7%A8%8B/406685.rss">在MacOS M1处理器平台编译ygopro的过程</source> </item> </channel> </rss>