[推荐] 免费的编程字体
May 16, 2022
Source Code Pro Adobe 出品的开源字体,不支持连字符和 Powerline。 https://github.com/adobe-fonts/source-code-pro/releases 下载:Source-Code-Pro.tar.xz Cascadia Code 微软内置于 Windows Terminal 和 Visual Studio 2019 里的字体,免费开源,而且支持提供连字符、Powerline 字体支持。 …
Visual Studio 2022 中使用 Clang
May 15, 2022
本文适用 Visual Studio 2017 以及更高版本 下载 LLVM for Windows 当前最新的 LLVM 版本是 14.0.3,在以下链接可以下载官方编译好的版本: https://github.com/llvm/llvm-project/releases x86: LLVM-14.0.3-win32.exe x86_64: LLVM-14.0.3-win64.exe arm64: LLVM-14.0.3-woa64.zip 我下载的是 LLVM-14.0.3-win64.exe,安装在目录 C:\Program Files\LLVM-14.0.3 …
Visual Studio 2022 以 UTF-8 编译 CMake 项目
May 14, 2022
本文适用 Visual Studio 2017 以及更高版本 默认情况下,MSVC 使用当前系统的代码页(Code Page)编译源文件,这样在编译字符串字面量的时候就和当前系统的代码页一致。 …
制作 Visual Studio 2022 离线安装包
May 09, 2022
Create an offline installation of Visual Studio Workload Component ID Visual Studio 2022 version: 17.4 %~dp0\vs2022_Professional.exe ^ --lang zh-CN ^ --add Microsoft.VisualStudio.Workload.CoreEditor ^ --add Microsoft.VisualStudio.Workload.NativeDesktop ^ --add Microsoft.VisualStudio.Component.Git ^ --add Microsoft.VisualStudio.Component.VC.ATL.ARM ^ --add Microsoft.VisualStudio.Component.VC.ATL.ARM64 ^ --add Microsoft.VisualStudio.Component.VC.ATL.ARM.Spectre ^ --add Microsoft.VisualStudio.Component.VC.ATL.ARM64.Spectre ^ --add Microsoft.VisualStudio.Component.VC.ATL.Spectre ^ --add Microsoft.VisualStudio.Component.VC.ATLMFC.Spectre ^ --add Microsoft.VisualStudio.Component.VC.MFC.ARM ^ --add Microsoft.VisualStudio.Component.VC.MFC.ARM64 ^ --add Microsoft.VisualStudio.Component.VC.MFC.ARM.Spectre ^ --add Microsoft.VisualStudio.Component.VC.MFC.ARM64.Spectre ^ --add Microsoft.VisualStudio.Component.VC.Redist.MSM ^ --add Microsoft.VisualStudio.Component.VC.Runtimes.ARM.Spectre ^ --add Microsoft.VisualStudio.Component.VC.Runtimes.ARM64.Spectre ^ --add Microsoft.VisualStudio.Component.VC.Runtimes.x86.x64.Spectre ^ --includeRecommended ^ --includeOptional ^ --layout %~dp0\vs2022_professional Visual Studio 2019 …
Swift 使用泛型实现命名空间形式的扩展
May 03, 2022
什么是命名空间形式的扩展 什么是扩展? extension UIView { var v: ... } v 就是扩展出来的一个 UIView 属性。 什么是命名空间? 相较于 ObjC 没有命名空间的特性,Swift 使用模块名作为命名空间进行隔离,防止不同模块中有同名扩展而造成冲突。 …
Debian 手动设置 DNS 服务器地址
May 03, 2022
编辑 dhcpcd.conf 文件,在里面添加 DNS 地址: sudo vi /etc/dhcpcd.conf interface eth0 #static ip_address=10.2.2.250/24 #static ip6_address=fd51:42f8:caae:d92e::ff/64 #static routers=10.2.2.1 static domain_name_servers=127.0.0.1 domain_name_servers 支持设置 IPv4 和 IPv6 格式的地址,多个地址使用空格隔开。 保存修改后,重启 dhcpcd 服务: sudo systemctl restart dhcpcd 验证一下当前使用的 DNS 服务器地址: …
使用代理克隆 Chromium 源码
May 03, 2022
创建一个 .boto 配置文件: vi ~/.config/gclient.boto 内容如下: [Boto] proxy = 127.0.0.1 proxy_port = 7890 proxy_type = http 设置环境变量 NO_AUTH_BOTO_CONFIG 指向刚才创建的配置文件: export NO_AUTH_BOTO_CONFIG=~/.config/gclient.boto 再拉取代码: fetch ios gclient sync gclient runhooks
CMake 跨平台编译
Apr 26, 2022
使用自定义的 toolchain 文件进行配置: CMAKE_TOOLCHAIN_FILE cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/toolchain.cmake 跨平台编译需要指定 sysroot 的位置,编译器和链接器才能正确找到 include 和 lib。 和 sysroot 配置相关的有三个变量: CMAKE_SYSROOT CMAKE_SYSROOT_COMPILE CMAKE_SYSROOT_LINK CMAKE_SYSROOT 除了传递 --sysroot 标志给编译器外,还会影响 find_* 命令的查找路径。 …
使用 Emscripten 编译 WASM 版本的 BoringSSL
Apr 22, 2022
需要先安装 go。 链接选项需要添加 -s INITIAL_MEMORY=48MB -s ALLOW_MEMORY_GROWTH=1 ,否则 wasm-ld 会提示内存太小而失败。 git clone https://github.com/google/boringssl.git cd boringssl emcmake cmake -S . -B build -G Ninja \ -DCMAKE_BUILD_TYPE="Release" \ -DCMAKE_INSTALL_PREFIX=$(pwd)/../vendor \ -DCMAKE_CXX_LINK_FLAGS="-s INITIAL_MEMORY=48MB -s ALLOW_MEMORY_GROWTH=1" \ -DOPENSSL_NO_ASM=ON emmake ninja -C build ninja -C build install
使用 Emscripten 编译 WASM 版本的 OpenSSL
Apr 21, 2022
安装 Emscripten 工具链: git clone --depth 1 https://github.com/cntrump/emscripten-toolchain.git cd emscripten-toolchain ./install.sh /opt/local 添加 Emscripten 到 PATH 系统环境变量中: export PATH=/opt/local/emsdk/emscripten:$PATH 开始编译 OpenSSL: git clone --depth 1 -b OpenSSL_1_1_1n https://github.com/openssl/openssl.git cd openssl emconfigure ./Configure linux-generic64 --prefix=$(pwd)/../system sed -i'.bak' 's|^CROSS_COMPILE.*$|CROSS_COMPILE=|g' Makefile emmake make -j build_generated libssl.a libcrypto.a mkdir -p ../system/include mkdir -p ../system/lib # 复制 include 和 lib cp -a include/openssl ../system/include cp libssl.a libcrypto.a ../system/lib 参考资料 wasm-ports/openssl.sh …