ThorVG Example 빌드 환경설정 (Windows / MSVC / Meson)
환경
- OS: Windows
- 컴파일러: MSVC (Visual Studio 18, cl.exe)
- 빌드 시스템: Meson + Ninja
- 패키지 매니저: vcpkg, chocolatey(pkg-config)
- 터미널: Visual Studio Developer shell (cl.exe, link.exe)
1. 환경설정 Step
1) 필요한 패키지 설치 확인
vcpkg list | findstr thorvg
vcpkg list | findstr sdl
- vcpkg로 설치한
thorvg는 pkg-config(.pc)도, CMake config(.cmake)도 생성하지 않음 → meson의dependency()가 못 찾음 - vcpkg로 설치한
sdl2는 CMake config(SDL2Config.cmake)는 제공 → cmake 방식으로는 인식 가능
vcpkg는 원래 CMake 통합 목적의 패키지 매니저라, meson 프로젝트와는 궁합이 완벽하지 않음.
2) thorvg를 별도로 소스에서 meson으로 빌드 & 설치 (pkg-config 지원 위해)
vcpkg의 thorvg 대신, thorvg 공식 소스를 meson으로 직접 빌드하면 .pc 파일이 생성되어 meson에서 바로 인식 가능.
git clone https://github.com/thorvg/thorvg.git
cd thorvg
meson setup build --prefix=C:/thorvg-install
meson compile -C build
meson install -C build
결과물:
C:\thorvg-install\bin\thorvg-1.dllC:\thorvg-install\lib\thorvg-1.libC:\thorvg-install\lib\pkgconfig\thorvg-1.pcC:\thorvg-install\include\thorvg-1\thorvg.h
3) 환경변수 설정
[System.Environment]::SetEnvironmentVariable('PKG_CONFIG_PATH', 'C:\thorvg-install\lib\pkgconfig', 'User')
이렇게 영구설정
4) meson setup 시 SDL2용 cmake_prefix_path 지정
cd C:\thorvg.example
meson setup builddir --wipe -Dcmake_prefix_path=C:\vcpkg\installed\x64-windows
thorvg-1→ PKG_CONFIG_PATH에서 pkg-config로 탐색sdl2→ cmake_prefix_path에서 CMake config로 탐색
정상 출력 확인:
Run-time dependency thorvg-1 found: YES 1.0.0
Run-time dependency sdl2 found: YES 2.32.10
Run-time dependency gl found: YES
Build targets in project: 60
5) 빌드
meson compile -C builddir
6) 실행 (DLL 복사)
빌드된 실행 파일들은 builddir\src 안에 생성됨. 실행에 필요한 dll을 같은 폴더로 복사:
cd C:\thorvg.example\builddir\src
copy C:\vcpkg\installed\x64-windows\bin\SDL2.dll .
copy C:\thorvg-install\bin\thorvg-1.dll .
실행:
.\Shapes.exe
매번 복사하기 번거로우면 PATH에 두 bin 폴더를 등록:
[System.Environment]::SetEnvironmentVariable('PATH', $env:PATH + ";C:\vcpkg\installed\x64-windows\bin;C:\thorvg-install\bin", 'User')
실행 결과
LottieExpressions

Stroke

댓글
Discussion 원문