vsg-dev / vsgFramework

Framework for building VulkanScenGraph related projects together
MIT License
10 stars 7 forks source link

assimp is not integrated with vsgXchange #11

Closed rainergericke closed 1 year ago

rainergericke commented 2 years ago

Hi Robert,

I tried to build and install the complete vsg package with vsgFramework. To my surprise, I could not view foreign 3d files. It seems assimp ist downloaded and built but not considered in the link process. vsgconv --features does not have any assimp entries.

My configuration: rm -rf build export REPO=$HOME/Documents/GitHub/vsgFramework export PREFIX=$HOME/Soft/Packs/VSG rm -rf $PREFIX cmake -G "Ninja Multi-Config" -S $REPO -B build \ -DBUILD_vsgQt:BOOL=OFF \ -DASSIMP_WARNINGS_AS_ERRORS:BOOL=OFF cmake --build build --config Release cmake --install build --config Release --prefix $PREFIX cp -r $HOME/Documents/GitHub/vsgExamples/data $HOME/Soft/Packs/VSG

qtvsg doesn't work on the Mac (qt5 is Intel only, qt6 cannot be configured to support Vulkan and not supported by vsgFramework).

robertosfield commented 2 years ago

I'm look it this now. It looks like we'll need to add back in assimp as a dependency for vsgXchange. In vsgFramework/CMakeLists.txt we have:

FetchContent_MakeAvailable(vsgxchange assimp vsg osg2vsg osg)

FetchContent_MakeAvailable(vsgxchange)

Which hints that this is something I've dabbled with in the past. As assimp is optional this will need to done via a cmake var.

robertosfield commented 2 years ago

Withing vsgFramework I have tried to get vsgXchange to pick up on the locally built assip that was pulled in FetchContent, but while assimp builds vsgXchange doesn't find it.

My guess is that as CMake script to set up the vsgFramework build up dpesn't build and install, then move onto the next project configure, and assimp lib hasn't be explictly written to support usage within FetchContent it remains invisible to vsgXchange.

To get the VSG, osg2vsg, vsgXchange to work nice with vsgFrameork's FetchContent I had to add the librarians and alias to VSG etc. The additions look like:

# add definitions to enable building VulkanSceneGraph as part of submodule
add_library(vsg::vsg ALIAS vsg)
set(vsg_FOUND TRUE CACHE INTERNAL "vsg found.")
set(CMAKE_DISABLE_FIND_PACKAGE_vsg TRUE CACHE INTERNAL "Disable find_package(vsg) as it's not necessary.")

The Assimp project won't have to workaround to allow FetchContent usage so we may be stuck.

vsg-dev commented 2 years ago

To trick vsgFramework's vsgXchange build on finding assimp I've added the following hack to assimp block:

add_library(assimp::assimp ALIAS assimp)
set(assimp_FOUND TRUE CACHE INTERNAL "assimp found.")
set(CMAKE_DISABLE_FIND_PACKAGE_assimp TRUE CACHE INTERNAL "Disable

find_package(assimp) as it's not necessary.") set(assimp_VERSION "5.2.1")

This allows vsgXchange to find assimp and build it in. The hardwired version is something that I'll need to find another workaround for.

Message ID: @.***>

rainergericke commented 2 years ago

I could build vsg & co with vsfFrameworks now an Mac and Windows. Thanks.