IT Technology

Cocos2d-Lua-Community编译Linux external

编译png

$cmake .. -DPNG_STATIC=ON -DZLIB_INCLUDE_DIR=/home/u0u0/works/Cocos2d-thirdpart/tarballs/zlib-1.2.8/ -DZLIB_LIBRARY=/home/u0u0/works/Cocos2d-thirdpart/tarballs/zlib-1.2.8/

编译websockets

$cmake .. -DOPENSSL_ROOT_DIR=/home/u0u0/works/Cocos2d-thirdpart/tarballs/openssl-1.1.0c -DZLIB_INCLUDE_DIR=/home/u0u0/works/Cocos2d-thirdpart/tarballs/zlib-1.2.8/ -DZLIB_LIBRARY=/home/u0u0/works/Cocos2d-thirdpart/tarballs/zlib-1.2.8/ -DLWS_WITH_LIBUV=OFF -DLWS_WITH_SSL=ON -DLWS_WITH_SHARED=OFF -DLWS_WITHOUT_TEST_SERVER=ON -DLWS_WITHOUT_TEST_SERVER_EXTPOLL=ON -DLWS_WITHOUT_TEST_PING=ON -DLWS_WITHOUT_TEST_ECHO=ON -DLWS_WITHOUT_TEST_CLIENT=ON -DLWS_WITHOUT_TEST_FRAGGLE=ON -DLWS_IPV6=ON

编译OpenSSL

在 Linux 下自定义OpenSSL库,需要安装到一个路径,以便curl能找到。

./config --prefix=/home/u0u0/works/projects/Cocos2d-thirdpart/tarballs/openssl_install --openssldir=/home/u0u0/works/projects/Cocos2d-thirdpart/tarballs/openssl_install
make
make install

编译curl

./configure --enable-static --disable-ldap --enable-ipv6 --with-zlib=/home/u0u0/works/Cocos2d-thirdpart/tarballs/zlib-1.2.8/ --with-ssl=/home/u0u0/works/projects/Cocos2d-thirdpart/tarballs/openssl_install --prefix=/home/u0u0/works/projects/Cocos2d-thirdpart/tarballs/curl_install
make
make install

编译OpenAL

$sudo apt-get install libasound2-dev
$cmake .. -DLIBTYPE=STATIC -DALSOFT_INSTALL=OFF -DALSOFT_REQUIRE_ALSA=ON

macbook 安装ubuntu 相关设置

  1. 安装配置 mbpfan 风扇控制器: https://github.com/linux-on-mac/mbpfan
    mbpfan.service文件从github获取。
sudo apt-get install mbpfan
sudo cp mbpfan.service /etc/systemd/system/
sudo systemctl enable mbpfan.service
sudo systemctl daemon-reload
sudo systemctl start mbpfan.service
  1. “软件和更新”中启用附加驱动,使用专有驱动。
  2. 安装最新的tlp电源管理。
sudo add-apt-repository ppa:linrunner/tlp
sudo apt update
sudo apt install tlp
sudo systemctl enable tlp.service
sudo systemctl daemon-reload
sudo systemctl start mbpfan.service
sudo tlp start

ubunut 64系统编译32位程序

macOS 10.14之后不支持交叉编译32位程序。退求其次,虚拟机装ubunut来解决问题。
ubunut 64系统,默认不带32相关头文件和库,需要

sudo apt-get install libc6-dev-i386

之后就能正确交叉编译了。

visual studio 2019 命令编译

32位 luajit

D:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars32.bat
msvcbuild.bat

64位 luajit

D:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat
msvcbuild.bat gc64