Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake build error with first build when bundling in an external library #98

Open
rossant opened this issue May 9, 2024 · 2 comments
Open

Comments

@rossant
Copy link

rossant commented May 9, 2024

I'm on Ubuntu 24.04, I try to bundle msd-atlas-gen into my C/C++ library using cmake (and ninja for the multicore build process).

I'm probably doing something wrong as the first build fails with:

error: ‘buildShapeFromSvgPath’ was not declared in this scope
   82 |     buildShapeFromSvgPath(shape, svg_path);

but all subsequent (re)builds succeed, without doing any change in the code.

The code is:

#include "msdfgen-ext.h"
#include "msdfgen.h"
...
Shape shape;
buildShapeFromSvgPath(shape, svg_path);

This is part of my cmake

set(HAS_MSDF 1)

set(MSDFGEN_CORE_ONLY OFF)
set(MSDFGEN_BUILD_STANDALONE OFF)
set(MSDFGEN_USE_SKIA OFF)
set(MSDFGEN_DISABLE_SVG OFF)

set(MSDF_ATLAS_BUILD_STANDALONE OFF)
set(MSDF_ATLAS_USE_VCPKG OFF)
set(MSDF_ATLAS_USE_SKIA OFF)
set(MSDF_ATLAS_DYNAMIC_RUNTIME ON)
set(MSDF_ATLAS_MSDFGEN_EXTERNAL OFF)

set(BUILD_SHARED_LIBS ON)

# Freetype is required for msdf-atlas-gen
find_package(Freetype REQUIRED)

# tinyxml2
FetchContent_Declare(
    tinyxml2
    GIT_REPOSITORY https://github.com/leethomason/tinyxml2.git
    GIT_TAG 10.0.0
)
FetchContent_MakeAvailable(tinyxml2)

# MSDF atlas
FetchContent_Declare(
    msdfgen-atlas
    GIT_REPOSITORY https://github.com/Chlumsky/msdf-atlas-gen.git
    GIT_TAG master
)
FetchContent_MakeAvailable(msdfgen-atlas)

set(INCL_DIRS ${INCL_DIRS} ${msdfgen-atlas_SOURCE_DIR}/msdfgen ${FREETYPE_INCLUDE_DIR_ft2build})
set(LINK_LIBS ${LINK_LIBS} msdfgen::msdfgen-ext msdf-atlas-gen::msdf-atlas-gen ${FREETYPE_LIBRARIES})

Does anything stand out as obviously wrong above? Thanks! (and thanks for this great library ❤️ )

@Chlumsky
Copy link
Owner

The only thing I can tell you from looking at the 4 lines of code you posted is that buildShapeFromSvgPath only exists in the msdfgen namespace.

@rossant
Copy link
Author

rossant commented May 10, 2024

Yes I had tried msdfgen::buildShapeFromSvgPath and the same error occurs. Anyone else had the problem where a cmake build fails the first time but not subsequent times?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants