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

Add VulkanSceneGraph and vsgXchange #28730

Merged
merged 40 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
d1b4cc3
Add VulkanSceneGraph
jeongseok-meta Jan 1, 2025
1544322
Ignore vulkan version check
jeongseok-meta Jan 1, 2025
68f8f19
Add libvulkan-headers and libvulkan-loader
jeongseok-meta Jan 1, 2025
92398dd
Add glslang and pkgconfig
jeongseok-meta Jan 1, 2025
e4cb8b0
Add libxcb
jeongseok-meta Jan 1, 2025
c42a77a
Add xcb-proto
jeongseok-meta Jan 1, 2025
92f9925
Add libxcb to build dep
jeongseok-meta Jan 1, 2025
9e2a8a4
Add xorg-xproto
jeongseok-meta Jan 1, 2025
2c762f5
Fix install command
jeongseok-meta Jan 1, 2025
e831cce
Enable osx and win
jeongseok-meta Jan 1, 2025
ab3080d
Fix bld.bat multiline syntax
jeongseok-meta Jan 1, 2025
3b109bf
Add libvulkan-loader to req.run
jeongseok-meta Jan 1, 2025
5a8738d
Add vsgXchange
jeongseok-meta Jan 1, 2025
551fd3a
Fix patch
jeongseok-meta Jan 1, 2025
13a904c
Fix bld.bat
jeongseok-meta Jan 1, 2025
6eee864
Add vulkan deps
jeongseok-meta Jan 1, 2025
c54ddd7
Add pkgconfig
jeongseok-meta Jan 1, 2025
483cec9
Fix prefix paths for win
jeongseok-meta Jan 1, 2025
769232c
Add missing deps for vsgXchange
jeongseok-meta Jan 1, 2025
9065f51
Add libcurl
jeongseok-meta Jan 1, 2025
ee043e8
Update meta.yaml
jeongseok-meta Jan 1, 2025
c7aeb95
Add libcurl.dll to missing_dso_whitelist
jeongseok-meta Jan 1, 2025
626a8b8
Use CMAKE_ARGS in bld.bat
jeongseok-meta Jan 2, 2025
94177df
Merge branch 'main' into vulkanscenegraph
jeongseok-meta Jan 4, 2025
dc1b673
Merge branch 'main' into vulkanscenegraph
jeongseok-meta Jan 7, 2025
a60540e
Add more tests
jeongseok-meta Jan 14, 2025
798b338
Add helloworld test program
jeongseok-meta Jan 14, 2025
a3c9bc0
Add test for running executable
jeongseok-meta Jan 14, 2025
100d0a7
Add libvulkan-headers to reqs/run
jeongseok-meta Jan 14, 2025
4ea2348
Add optional deps for vsgxchange: freetype, libcurl
jeongseok-meta Jan 14, 2025
8028796
Add libxcb to reqs/run
jeongseok-meta Jan 14, 2025
77526d9
Fix test program cmake
jeongseok-meta Jan 14, 2025
05dc023
Add libxcb to test reqs
jeongseok-meta Jan 14, 2025
8e602a8
Add xorg-xproto to reqs/run
jeongseok-meta Jan 14, 2025
5990b75
Fix cmake for test program
jeongseok-meta Jan 14, 2025
e8d4a8d
Add libvulkan-loader to reqs/run
jeongseok-meta Jan 14, 2025
e31bc39
Attempt to resolve export warning
jeongseok-meta Jan 14, 2025
3c41a43
Attempt to fix executable test
jeongseok-meta Jan 14, 2025
3c44ac5
Remove the running vsgconv
jeongseok-meta Jan 14, 2025
484103e
Remove running vsgconv.exe for the same reason:
jeongseok-meta Jan 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions recipes/VulkanSceneGraph/bld.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@echo on

cmake %SRC_DIR% ^
%CMAKE_ARGS% ^
-B build ^
-DBUILD_SHARED_LIBS=ON

cmake --build build --parallel --config Release
if errorlevel 1 exit 1

cmake --install build --config Release
if errorlevel 1 exit 1
14 changes: 14 additions & 0 deletions recipes/VulkanSceneGraph/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

set -exo pipefail

cmake $SRC_DIR \
${CMAKE_ARGS} \
-G Ninja \
-B build \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Release

cmake --build build --parallel

cmake --install build --strip
63 changes: 63 additions & 0 deletions recipes/VulkanSceneGraph/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{% set name = "VulkanSceneGraph" %}
{% set version = "1.1.8" %}

package:
name: {{ name|lower }}
version: {{ version }}

source:
- url: /~https://github.com/vsg-dev/VulkanSceneGraph/archive/v{{ version }}.tar.gz
sha256: 94a3cebdfddf4759d17bbf0cc9f3278851eb899bdc660eb4681960e4cdd2ad6a
patches:
- patches/ignore-vulkan-version.patch

build:
number: 0
run_exports:
- {{ pin_subpackage('vulkanscenegraph', max_pin='x.x') }}

requirements:
build:
- {{ compiler('cxx') }}
- {{ stdlib('c') }}
- cmake
- ninja # [not win]
- pkgconfig # [linux]
host:
- glslang
- libvulkan-headers
- libvulkan-loader
- libxcb # [linux]
- xorg-xproto # [linux]
run:
- libvulkan-headers
- libvulkan-loader
- libxcb # [linux]
- xorg-xproto # [linux]

test:
commands:
- test -f $PREFIX/include/vsg/all.h # [not win]
- test -f $PREFIX/lib/libvsg${SHLIB_EXT} # [not win]
- test -f $PREFIX/lib/cmake/vsg/vsgConfig.cmake # [not win]
- if not exist %PREFIX%\\Library\\include\\vsg\\all.h exit 1 # [win]
- if not exist %PREFIX%\\Library\\lib\\vsg.lib exit 1 # [win]
- if not exist %PREFIX%\\Library\\bin\\vsg-14.dll exit 1 # [win]
- if not exist %PREFIX%\\Library\\lib\\cmake\\vsg\\vsgConfig.cmake exit 1 # [win]
downstreams:
- vsgxchange

about:
home: https://vsg-dev.github.io/vsg-dev.io/
summary: Vulkan & C++17 based Scene Graph Project
description: |
VulkanSceneGraph (VSG), is a modern, cross platform, high performance scene
graph library built upon Vulkan graphics/compute API. The software is
written in C++17, and follows the CppCoreGuidelines and FOSS Best Practices.
license: MIT
license_file: LICENSE.md
dev_url: /~https://github.com/vsg-dev/VulkanSceneGraph

extra:
recipe-maintainers:
- jeongseok-meta
13 changes: 13 additions & 0 deletions recipes/VulkanSceneGraph/patches/ignore-vulkan-version.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a75f15d8..6a7a0c91 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,7 +7,7 @@ project(vsg
)
set(VSG_SOVERSION 14)
SET(VSG_RELEASE_CANDIDATE 0)
-set(Vulkan_MIN_VERSION 1.1.70.0)
+set(Vulkan_MIN_VERSION )

set(VSG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" CACHE INTERNAL "Root source directory of VulkanSceneGraph.")
set(VSG_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}" CACHE INTERNAL "Root binary directory of VulkanSceneGraph.")
12 changes: 12 additions & 0 deletions recipes/vsgXchange/bld.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@echo on

cmake %SRC_DIR% ^
%CMAKE_ARGS% ^
-B build ^
-DBUILD_SHARED_LIBS=ON

cmake --build build --parallel --config Release
if errorlevel 1 exit 1

cmake --install build --config Release
if errorlevel 1 exit 1
14 changes: 14 additions & 0 deletions recipes/vsgXchange/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

set -exo pipefail

cmake $SRC_DIR \
${CMAKE_ARGS} \
-G Ninja \
-B build \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Release

cmake --build build --parallel

cmake --install build --strip
62 changes: 62 additions & 0 deletions recipes/vsgXchange/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{% set name = "vsgXchange" %}
{% set version = "1.1.4" %}

package:
name: {{ name|lower }}
version: {{ version }}

source:
- url: /~https://github.com/vsg-dev/vsgXchange/archive/v{{ version }}.tar.gz
sha256: 0b79369ddcb3676b6998a6660fcf938314ae34eea9fbababf8471e0b94502597

build:
number: 0
run_exports:
- {{ pin_subpackage('vsgxchange', max_pin='x.x') }}

requirements:
build:
- {{ compiler('cxx') }}
- {{ stdlib('c') }}
- cmake
- ninja # [not win]
- pkgconfig # [linux]
host:
- freetype
- libcurl
- libvulkan-headers
- libvulkan-loader
- vulkanscenegraph
run:
- libvulkan-loader
- vulkanscenegraph

test:
commands:
- test -f $PREFIX/include/vsgXchange/all.h # [not win]
- test -f $PREFIX/lib/libvsgXchange${SHLIB_EXT} # [not win]
- test -f $PREFIX/lib/cmake/vsgXchange/vsgXchangeConfig.cmake # [not win]
- if not exist %PREFIX%\\Library\\include\\vsgXchange\\all.h exit 1 # [win]
- if not exist %PREFIX%\\Library\\lib\\vsgXchange.lib exit 1 # [win]
- if not exist %PREFIX%\\Library\\bin\\vsgXchange.dll exit 1 # [win]
- if not exist %PREFIX%\\Library\\bin\\vsgconv.exe exit 1 # [win]
- if not exist %PREFIX%\\Library\\lib\\cmake\\vsgXchange\\vsgXchangeConfig.cmake exit 1 # [win]
requires:
- {{ compiler("c") }}
- {{ compiler("cxx") }}
- cmake
- ninja # [not win]
- pkgconfig # [linux]
files:
- tests/

about:
home: https://vsg-dev.github.io/vsg-dev.io/
summary: Utility library for converting data+materials to/from VulkanSceneGraph
license: MIT
license_file: LICENSE.md
dev_url: /~https://github.com/vsg-dev/vsgXchange

extra:
recipe-maintainers:
- jeongseok-meta
10 changes: 10 additions & 0 deletions recipes/vsgXchange/run_test.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@echo on

cmake tests ^
%CMAKE_ARGS% ^
-B tests/build ^
-DBUILD_SHARED_LIBS=ON
if errorlevel 1 exit 1

cmake --build tests/build --parallel --config Release
if errorlevel 1 exit 1
12 changes: 12 additions & 0 deletions recipes/vsgXchange/run_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

set -exo pipefail

cmake tests \
${CMAKE_ARGS} \
-G Ninja \
-B tests/build \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Release

cmake --build tests/build --parallel
13 changes: 13 additions & 0 deletions recipes/vsgXchange/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cmake_minimum_required(VERSION 3.7)

project(vsghelloworld)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

find_package(vsg CONFIG REQUIRED)
find_package(vsgXchange CONFIG REQUIRED)

add_executable(vsghelloworld main.cpp)
target_link_libraries(vsghelloworld PRIVATE vsg::vsg vsgXchange::vsgXchange)
91 changes: 91 additions & 0 deletions recipes/vsgXchange/tests/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#include <vsg/all.h>
#include <vsgXchange/all.h>

#include <iostream>

int main(int argc, char** argv)
{
// set up defaults and read command line arguments to override them
vsg::CommandLine arguments(&argc, argv);

// set up vsg::Options to pass in filepaths, ReaderWriters and other IO related options to use when reading and writing files.
auto options = vsg::Options::create(vsgXchange::all::create());
options->fileCache = vsg::getEnv("VSG_FILE_CACHE");
options->paths = vsg::getEnvPaths("VSG_FILE_PATH");
arguments.read(options);

vsg::Path filename = "models/openstreetmap.vsgt";
if (argc > 1) filename = arguments[1];

if (arguments.errors()) return arguments.writeErrorMessages(std::cerr);

// load the scene graph
vsg::ref_ptr<vsg::Node> vsg_scene = vsg::read_cast<vsg::Node>(filename, options);
if (!vsg_scene) return 0;

// create the viewer and assign window(s) to it
auto windowTraits = vsg::WindowTraits::create();
windowTraits->windowTitle = "Hello World";
auto viewer = vsg::Viewer::create();
auto window = vsg::Window::create(windowTraits);
if (!window)
{
std::cout << "Could not create window." << std::endl;
return 1;
}

viewer->addWindow(window);

// compute the bounds of the scene graph to help position camera
vsg::ComputeBounds computeBounds;
vsg_scene->accept(computeBounds);
vsg::dvec3 centre = (computeBounds.bounds.min + computeBounds.bounds.max) * 0.5;
double radius = vsg::length(computeBounds.bounds.max - computeBounds.bounds.min) * 0.6;
double nearFarRatio = 0.001;

// set up the camera
auto lookAt = vsg::LookAt::create(centre + vsg::dvec3(0.0, -radius * 3.5, 0.0), centre, vsg::dvec3(0.0, 0.0, 1.0));

vsg::ref_ptr<vsg::ProjectionMatrix> perspective;
auto ellipsoidModel = vsg_scene->getRefObject<vsg::EllipsoidModel>("EllipsoidModel");
if (ellipsoidModel)
{
double horizonMountainHeight = 0.0;
perspective = vsg::EllipsoidPerspective::create(lookAt, ellipsoidModel, 30.0, static_cast<double>(window->extent2D().width) / static_cast<double>(window->extent2D().height), nearFarRatio, horizonMountainHeight);
}
else
{
perspective = vsg::Perspective::create(30.0, static_cast<double>(window->extent2D().width) / static_cast<double>(window->extent2D().height), nearFarRatio * radius, radius * 4.5);
}

auto camera = vsg::Camera::create(perspective, lookAt, vsg::ViewportState::create(window->extent2D()));

// add close handler to respond to the close window button and pressing escape
viewer->addEventHandler(vsg::CloseHandler::create(viewer));

// add trackball to control the Camera
viewer->addEventHandler(vsg::Trackball::create(camera, ellipsoidModel));

// add the CommandGraph to render the scene
auto commandGraph = vsg::createCommandGraphForView(window, camera, vsg_scene);
viewer->assignRecordAndSubmitTaskAndPresentation({commandGraph});

// compile all Vulkan objects and transfer image, vertex and primitive data to GPU
viewer->compile();

// rendering main loop
while (viewer->advanceToNextFrame())
{
// pass any events into EventHandlers assigned to the Viewer
viewer->handleEvents();

viewer->update();

viewer->recordAndSubmit();

viewer->present();
}

// clean up done automatically thanks to ref_ptr<>
return 0;
}
Loading