Merge branch 'main' of github.com:taurusxin/ncmdump

This commit is contained in:
overwri 2024-02-08 05:56:39 +08:00
commit ff2dd888d8
5 changed files with 85 additions and 55 deletions

View File

@ -11,6 +11,8 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
uses: msys2/setup-msys2@v2
@ -19,11 +21,66 @@ jobs:
update: true
install: git mingw-w64-ucrt-x86_64-toolchain
- name: Configure build
run: cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -B build
- name: Build
run: mingw32-make win32
run: cmake --build build -j 4
- name: Upload artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: ncmdump-artifacts
path: ncmdump.exe
name: Windows amd64 Build
path: build/ncmdump.exe
build_on_linux:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake
- name: Configure build
run: cmake -DCMAKE_BUILD_TYPE=Release -B build
- name: Build
run: cmake --build build -j 4
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: Linux amd64 Build
path: build/ncmdump
build_on_macos:
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
run: |
brew update
brew install git cmake
- name: Configure build
run: cmake -DCMAKE_BUILD_TYPE=Release -B build
- name: Build
run: cmake --build build -j 4
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: macOS amd64 Build
path: build/ncmdump

4
.gitignore vendored
View File

@ -2,4 +2,6 @@
ncmdump
.vscode
.idea
.idea
build

2
.gitmodules vendored
View File

@ -1,3 +1,3 @@
[submodule "taglib"]
path = taglib
url = git@github.com:taglib/taglib.git
url = https://github.com/taglib/taglib.git

View File

@ -5,8 +5,6 @@ project(ncmdump LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_BUILD_TYPE Release)
option(BUILD_WIN32_STATIC "Build the program statically on Windows" ON)
FILE(GLOB HEADERS ./*.h)

View File

@ -41,63 +41,36 @@ ncmdump file1 file2...
ncmdump -d folder
```
## 依赖库及不同平台编译方法
## 编译项目
### 依赖库
* taglib
### Linux / macOS
克隆本仓库
```shell
# CentOS
yum install taglib-devel
make linux
# Ubuntu / Debian
apt install libtag1-dev
make linux
# macOS with Intel chip
brew install taglib
make macos-intel
# macOS with Apple Silicon (M1 / M2)
brew install taglib
make macos-arm64
git clone https://github.com/taurusxin/ncmdump.git
```
注意Linux / macOS 为动态库支持Linux 下静态编译需要手动编译 taglib 静态库macOS 原生库不支持静态链接
### Windows
#### MinGW
~~因为部分代码(例如常量引用等)在 msvc 下面编译不通过,本项目需要使用 MinGW 编译~~
已经修改部分代码使得支持 msvc 编译,详见下面的 Visual Studio 部分
下载 mingw-w64 的 Windows 版本,这里推荐从 [winlibs](https://winlibs.com/) 这个网站下载,编译器版本始终跟随上游保持最新
将 mingw64/bin 添加到系统环境变量
taglib 在 Windows 下已经编译好放在项目内,直接执行
更新子模块
```shell
mingw32-make win32
cd ncmdump
git submodule update --init --recursive
```
生成的二进制程序为静态链接版本,可脱离运行库运行在裸机上
#### msys2
使用 CMake 配置项目。Windows 下若使用 GNU 套件,推荐使用 [msys2](https://www.msys2.org/) 或者 [winlibs](https://winlibs.com/)
```shell
pacman -Syu
git clone https://github.com/taurusxin/ncmdump && cd ncmdump
make win32
# Windows MinGW
cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -B build
# Windows MSVC
cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=Release -B build --config Release
# Linux / macOS
cmake -DCMAKE_BUILD_TYPE=Release -B build
```
#### Visual Studio
编译项目
注意**VS的源代码还未上传请先使用 MinGW 编译**
使用 git 切换到 msvc 分支,使用 Visual Studio 打开 ncmdump.sln编译即可
```shell
cmake --build build --target all -j 8
```