← 블로그 목록

[과제] 1주차) 프로젝트 작업환경 구축 강윤석

@DaengDo
  • #과제

1주차 과제

멘토님이 1주차 과제를 내주셨다. ThorVG 작업환경을 로컬에 마련하고, example 구동하기까지이다. 발대식 전에 내 방에 있는 데스크톱에서는 프로젝트를 살펴보며 thorvg.example을 로컬호스트에 띄워봤지만.. 그때는 귀찮아서 ai 한테 짬을 때렸었다. 아직 내 윈도우 노트북에는 구축이 안되어 있으니 이번에는 차분히 하나하나 살펴가며 직접 설정해보았다.

thorvg 경로에 git clone https://github.com/thorvg/thorvg.git git clone https://github.com/thorvg/thorvg.example.git 으로 시작한다.

meson

readme 내 installation 문서를 보면 빌드 시스템이 meson을 사용하고 있다. meson 백엔드로 vs나 ninja 둘 중 아무거나 사용해도 되지만

image

나는 meson의 기본 백엔드 값인 ninja가 있으니 굳이 빌드할 때 옵션을 따로 줄 필요는 없다

image

만약 새로 설치해야 한다면 meson 공식 홈페이지 내 가이드 를 살펴보면 된다.

image

meson 최신 릴리즈 버전이 1.11.2 다. 현재 로컬 버전이 1.6인데

혹시 ThorVG는 meson 버전 의존도가 있나?

image

ai에 물어보니 ThorVG에는 meson 버전 의존도가 없다. 이대로 사용해도 괜찮을 것 같다. 답변에 CMake가 언급된 이유는 내가 CMake에 익숙해서 그것에 비유해 설명하라고 했기 때문이다.

추가적으로 vscode 내에서 meson의 syntax highlighting을 지원받으려면 Extensions 에 meson을 검색해서

image

이 친구를 활성화해줘야 한다.

image

ThorVG install

readme 문서를 따라서 meson setup builddir로 builddir 경로에 빌드 환경을 구성했다.

image

readme 안내를 따라 ninja -C builddir install 설치를 해준다.

image image

실행용 바이너리가 c/bin 에 위치한걸 확인할 수 있었다.

thorvg.example

예제 실행을 위해 thorvg.example 의 readme를 확인해봤다.

ThorVG와 SDL이 설치되어 있어야 한다. SDL이 무엇인지 찾아보니 화면에 픽셀 그리기, 사운드 재생, 입력 받기 같은 기본적인 멀티미디어 기능을 제공하는 라이브러리라고 한다.

내 로컬은 MSYS2 를 사용중이라 pacman -S mingw-w64-ucrt-x86_64-SDL2 로 SDL을 설치했다.

안내대로 meson setup builddirninja -C builddir을 시도해봤는데

PS C:\coding\thorvg\thorvg.example> ninja -C builddir
ninja: Entering directory `builddir'
[1/120] Compiling C++ object src/Intersects.exe.p/Intersects.cpp.obj
FAILED: src/Intersects.exe.p/Intersects.cpp.obj
"c++" "-Isrc\Intersects.exe.p" "-Isrc" "-I..\src" "-IC:/msys64/ucrt64/bin/../include/thorvg-1" "-IC:/msys64/ucrt64/bin/../include" "-IC:/msys64/ucrt64/bin/../include/SDL2" "-fdiagnostics-color=always" "-D_GLIBCXX_ASSERTIONS=1" "-D_FILE_OFFSET_BITS=64" "-Wall" "-Winvalid-pch" "-std=c++14" "-O3" "-g" "-DEXAMPLE_DIR=\"C:/coding/thorvg/thorvg.example/res\"" "-Dmain=SDL_main" "-DSDL_MAIN_HANDLED" -MD -MQ src/Intersects.exe.p/Intersects.cpp.obj -MF "src\Intersects.exe.p\Intersects.cpp.obj.d" -o src/Intersects.exe.p/Intersects.cpp.obj "-c" ../src/Intersects.cpp
../src/Intersects.cpp: In member function 'virtual bool UserExample::update(tvg::Canvas*, uint32_t)':
../src/Intersects.cpp:135:30: error: no matching function for call to 'tvg::Shape::intersects(int&, int&, int&, int&, bool)'
  135 |         if (shape->intersects(mx, my, mw, mh, true)) shape->opacity(127);
      |             ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from ../src/Example.h:30,
                 from ../src/Intersects.cpp:23:
C:/msys64/ucrt64/include/thorvg-1/thorvg.h:619:10: note: candidate: 'bool tvg::Paint::intersects(int32_t, int32_t, int32_t, int32_t)'
  619 |     bool intersects(int32_t x, int32_t y, int32_t w = 1, int32_t h = 1) noexcept;
      |          ^~~~~~~~~~
C:/msys64/ucrt64/include/thorvg-1/thorvg.h:619:10: note:   candidate expects 4 arguments, 5 provided
../src/Intersects.cpp:136:37: error: no matching function for call to 'tvg::Picture::intersects(int&, int&, int&, int&, bool)'
  136 |         else if (picture->intersects(mx, my, mw, mh, true)) picture->opacity(127);
      |                  ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
C:/msys64/ucrt64/include/thorvg-1/thorvg.h:619:10: note: candidate: 'bool tvg::Paint::intersects(int32_t, int32_t, int32_t, int32_t)'
  619 |     bool intersects(int32_t x, int32_t y, int32_t w = 1, int32_t h = 1) noexcept;
      |          ^~~~~~~~~~
C:/msys64/ucrt64/include/thorvg-1/thorvg.h:619:10: note:   candidate expects 4 arguments, 5 provided
../src/Intersects.cpp:137:34: error: no matching function for call to 'tvg::Text::intersects(int&, int&, int&, int&, bool)'
  137 |         else if (text->intersects(mx, my, mw, mh, true)) text->opacity(127);
      |                  ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
C:/msys64/ucrt64/include/thorvg-1/thorvg.h:619:10: note: candidate: 'bool tvg::Paint::intersects(int32_t, int32_t, int32_t, int32_t)'
  619 |     bool intersects(int32_t x, int32_t y, int32_t w = 1, int32_t h = 1) noexcept;
      |          ^~~~~~~~~~
C:/msys64/ucrt64/include/thorvg-1/thorvg.h:619:10: note:   candidate expects 4 arguments, 5 provided
../src/Intersects.cpp:138:35: error: no matching function for call to 'tvg::Picture::intersects(int&, int&, int&, int&, bool)'
  138 |         else if (tiger->intersects(mx, my, mw, mh, true)) tiger->opacity(127);
      |                  ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
C:/msys64/ucrt64/include/thorvg-1/thorvg.h:619:10: note: candidate: 'bool tvg::Paint::intersects(int32_t, int32_t, int32_t, int32_t)'
  619 |     bool intersects(int32_t x, int32_t y, int32_t w = 1, int32_t h = 1) noexcept;
      |          ^~~~~~~~~~
C:/msys64/ucrt64/include/thorvg-1/thorvg.h:619:10: note:   candidate expects 4 arguments, 5 provided
[34/120] Compiling C++ object src/MultiCanvas.exe.p/MultiCanvas.cpp.obj
ninja: build stopped: subcommand failed.

뭐지…? 뭔가 candidate expects 4 arguments, 5 provided 이걸봐서는 함수 인자가 안맞는거같은데???

알고보니 thorvg 를 6월 29일에 포크해두고 thorvg.example을 오늘 포크했더니 버전이 안맞고 있었다.

thorvg 를 git pull 하고 builddir을 지우고 다시 설치를 진행했다.

PS C:\coding\thorvg\thorvg.example> ninja -C builddir
ninja: Entering directory `builddir'
[120/120] Linking target src/LottieExtension.exe

다행히 이번에는 제대로 진행이 되었다.

Examples

Opacity.exe 예제를 실행해봤다.

image

테스트로 한번 색을 바꿔서 다시 빌드해봤다.

/************************************************************************/
/* ThorVG Drawing Contents                                              */
/************************************************************************/

struct UserExample : tvgexam::Example
{
    bool content(tvg::Canvas* canvas, uint32_t w, uint32_t h) override
    {
        //Create a Scene
        auto scene = tvg::Scene::gen();
        scene->opacity(175);              //Apply opacity to scene (0 - 255)

        //Prepare Circle
        auto shape1 = tvg::Shape::gen();
        shape1->appendCircle(400, 400, 250, 250);
        // shape1->fill(255, 255, 0);
        shape1->fill(255, 0, 255); // 위의 노란색을 보라색으로 변경
        scene->add(shape1);
image

댓글

Discussion 원문