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

VulkanSceneGraph 1.0.0 ,1.0.3, 1.0.5 #16528

Merged
merged 42 commits into from
Jun 28, 2023
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
dc5f853
VulkanSceneGraph 1.0.0 inital configuration
psyinf Nov 20, 2022
244e106
Merge branch 'conan-io:master' into master
psyinf Mar 11, 2023
2d42472
style correction
psyinf Mar 11, 2023
c0a15dc
style correction
psyinf Mar 11, 2023
f9e643d
style correction
psyinf Mar 11, 2023
be2737e
added missing endline
psyinf Mar 11, 2023
31c96dc
Merge branch 'master' into master
psyinf Mar 11, 2023
eea9aff
Fixed/hacked license, fixed some warnings
psyinf Mar 12, 2023
1f2d199
reverted invalid change to shared-default option
psyinf Mar 12, 2023
c4d7c8d
Added version 1.3.0
psyinf Mar 15, 2023
7921829
Added new version to config.yml
psyinf Mar 17, 2023
f79735f
Cleaning up in preparation to conan 2.0 compatiblity
psyinf Apr 7, 2023
09fa2ec
Merge branch 'master' into master
psyinf May 10, 2023
d3dcd35
Merge branch 'master' into master
psyinf May 10, 2023
7ac286f
removed inlcude and fixed removal of cmake Find- and Config files in …
psyinf May 11, 2023
5027079
Fixed broken packaging
psyinf May 11, 2023
6695c65
Merge branch 'master' into master
psyinf May 12, 2023
6884d78
Apply suggestions from code review
psyinf May 16, 2023
ef06c8c
Update recipes/vsg/all/conanfile.py
psyinf May 17, 2023
a6ae2e0
Update recipes/vsg/all/conanfile.py
psyinf May 17, 2023
7229658
Update recipes/vsg/all/conanfile.py
psyinf May 17, 2023
2ebb28c
added package_type and minor clean-up
psyinf May 17, 2023
70166b3
Merge branch 'master' into master
AbrilRBS May 19, 2023
f1201de
Update recipes/vsg/all/conanfile.py
jcar87 May 19, 2023
2e01a2f
reworked former submodule handling
psyinf May 19, 2023
53be649
fixed indentation issue
psyinf May 19, 2023
0c36e01
EOL fix
psyinf May 19, 2023
2de2925
more EOL fixes
psyinf May 19, 2023
466aa4f
backed up from non-conforming conandata based approach
psyinf May 19, 2023
8388323
Merge branch 'master' into master
psyinf May 19, 2023
de29696
Merge branch 'master' into master
psyinf May 20, 2023
588bf3b
Update recipes/vsg/all/conanfile.py
AbrilRBS May 22, 2023
5b7a976
Merge branch 'master' into master
psyinf Jun 5, 2023
22dc1f9
preparing vsg 1.0.5
psyinf May 20, 2023
80ac048
removed glslang and therefore shadercompiler support for now
psyinf Jun 22, 2023
09dd853
linter/style fixes
psyinf Jun 22, 2023
32fa2f8
Merge branch 'master' into master
psyinf Jun 22, 2023
5b384d1
Merge branch 'master' into master
franramirez688 Jun 26, 2023
c099edb
Merge branch 'master' into master
psyinf Jun 26, 2023
499cfde
removed no longer needed imports
psyinf Jun 26, 2023
bb8f7a3
fixed some warnings
psyinf Jun 26, 2023
35aa9e3
Remove test_v1, simplify code
AbrilRBS Jun 28, 2023
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
7 changes: 7 additions & 0 deletions recipes/vsg/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
sources:
"1.0.0":
url: "https://github.com/vsg-dev/VulkanSceneGraph/archive/refs/tags/VulkanSceneGraph-1.0.0.tar.gz"
sha256: "5611284f4256893ea97a33f9e99f5ecc8bdda110cc9fb7770b291fb45e8f9cf6"
"1.0.3":
url: "https://github.com/vsg-dev/VulkanSceneGraph/archive/refs/tags/VulkanSceneGraph-1.0.3.tar.gz"
sha256: "84aa1d445ecdd2702843f8f01e760d4db32c2ab3fe8c5d6122f8a83b67a50e36"
127 changes: 127 additions & 0 deletions recipes/vsg/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.microsoft import check_min_vs, is_msvc_static_runtime, is_msvc
from conan.tools.files import get, copy, rm, rmdir, collect_libs
from conan.tools.build import check_min_cppstd
from conan.tools.scm import Version
from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake
import os

required_conan_version = ">=1.53.0"

class VsgConan(ConanFile):
name = "vsg"
description = "VulkanSceneGraph"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to provide a more meaningful description please?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've modified the PR here

license = "MIT"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://www.vulkanscenegraph.org"
topics = ("vulkan", "scenegraph", "graphics", "3d")
package_type = "library"
settings = "os", "arch", "compiler", "build_type"
options = {
psyinf marked this conversation as resolved.
Show resolved Hide resolved
"shared": [True, False],
"shader_compiler": [True, False],
"max_devices": [1,2,3,4],
"fPIC": [True, False],
}
default_options = {
"shared": False,
"shader_compiler": True,
"max_devices" : 1,
"fPIC": True,
}

@property
def _min_cppstd(self):
return 17

@property
def _compilers_minimum_version(self):
return {
"gcc": "7",
"clang": "7",
"apple-clang": "10",
}
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC

def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")

def requirements(self):
self.requires("vulkan-loader/1.3.204.0", transitive_headers=True)
AbrilRBS marked this conversation as resolved.
Show resolved Hide resolved

def validate(self):
if self.info.settings.compiler.cppstd:
check_min_cppstd(self, self._min_cppstd)
check_min_vs(self, 191)

if is_msvc_static_runtime(self):
raise ConanInvalidConfiguration(f"{self.name} does not support MSVC static runtime (MT/MTd) configurations, only dynamic runtime (MD/MDd) is supported")

if not is_msvc(self):
minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False)
if minimum_version and Version(self.info.settings.compiler.version) < minimum_version:
raise ConanInvalidConfiguration(
f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support."
)

def source(self):
get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True)
#Working around submodules
#TODO: semantic versioning
if self.version == "1.0.3":
self.run("git clone https://github.com/vsg-dev/glslang.git src/glslang")
psyinf marked this conversation as resolved.
Show resolved Hide resolved
self.run("cd src/glslang && git reset --hard e4075496f6895ce6b747a6690ba13fa3836a93e5")


def generate(self):
tc = CMakeToolchain(self)
if is_msvc(self):
tc.variables["USE_MSVC_RUNTIME_LIBRARY_DLL"] = False
tc.variables["BUILD_SHARED_LIBS"] = self.options.shared
tc.variables["VSG_SUPPORTS_ShaderCompiler"] = 1 if self.options.shader_compiler else 0
tc.variables["VSG_MAX_DEVICES"] = self.options.max_devices

tc.generate()

deps = CMakeDeps(self)

deps.generate()

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def package(self):
copy(self, pattern="LICENSE.md", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder)

cmake = CMake(self)
cmake.install()

rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
rmdir(self, os.path.join(self.package_folder, "share"))

rm(self, "*.la", os.path.join(self.package_folder, "lib"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it's a copy/paste from another recipe. Why would there be .la files in a CMake build?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, refactored in this PR

rm(self, "*.pdb", os.path.join(self.package_folder, "lib"))
rm(self, "*.pdb", os.path.join(self.package_folder, "bin"))
rm(self, "Find*.cmake", os.path.join(self.package_folder, "lib/cmake/vsg"))
rm(self, "*Config.cmake", os.path.join(self.package_folder, "lib/cmake/vsg"))
Comment on lines +102 to +103
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not just remove this cmake folder instead of these 2 lines? It doesn't seem to be used or exposed in package_info, so it's useless.

Copy link
Contributor Author

@psyinf psyinf Aug 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not just remove this cmake folder instead of these 2 lines? It doesn't seem to be used or exposed in package_info, so it's useless.

AFAIR other VSG packages such as vsgXchange need the vsg cmake package info. Seems I've hacked around this then in this PR. Maybe I need some guidance here on how to use the cmake files generated to be used in subsequent packages. ;-)

Copy link
Contributor

@SpaceIm SpaceIm Aug 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It depends on their official usage. Are they already included in official upstream CMake config file of just exposed in installation layout?
For the later you just have to fill cpp_info.buildirs with folder where these cmake files live. For the former, you have to provide path to each file in cmake_build_modules property.

I see these files:

-- Installing: /home/conan/w/prod-v2/BuildSingleReference/p/b/vsgb2759a9f31868/p/lib/cmake/vsg/FindVulkan.cmake
-- Installing: /home/conan/w/prod-v2/BuildSingleReference/p/b/vsgb2759a9f31868/p/lib/cmake/vsg/uninstall.cmake
-- Installing: /home/conan/w/prod-v2/BuildSingleReference/p/b/vsgb2759a9f31868/p/lib/cmake/vsg/vsgMacros.cmake
-- Installing: /home/conan/w/prod-v2/BuildSingleReference/p/b/vsgb2759a9f31868/p/lib/cmake/vsg/vsgTargets.cmake
-- Installing: /home/conan/w/prod-v2/BuildSingleReference/p/b/vsgb2759a9f31868/p/lib/cmake/vsg/vsgTargets-release.cmake
-- Installing: /home/conan/w/prod-v2/BuildSingleReference/p/b/vsgb2759a9f31868/p/lib/cmake/vsg/vsgConfig.cmake
-- Installing: /home/conan/w/prod-v2/BuildSingleReference/p/b/vsgb2759a9f31868/p/lib/cmake/vsg/vsgConfigVersion.cmake

I would say that the only file which would make sense to be kept is vsgMacros.cmake.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are correct. Can you point me to another recipe that shows how to tackle this correctly?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cern-root for example


def package_info(self):
self.cpp_info.libs = collect_libs(self)

self.cpp_info.set_property("cmake_file_name", "vsg")
self.cpp_info.set_property("cmake_target_name", "vsg::vsg")

if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.system_libs.append("pthread")

# TODO: to remove in conan v2 once cmake_find_package_* generators removed
self.cpp_info.filenames["cmake_find_package"] = "vsg"
self.cpp_info.filenames["cmake_find_package_multi"] = "vsg"
self.cpp_info.names["cmake_find_package"] = "VSG"
self.cpp_info.names["cmake_find_package_multi"] = "vsg"
9 changes: 9 additions & 0 deletions recipes/vsg/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.8)

project(test_package CXX) # if the project uses c++

find_package(vsg REQUIRED CONFIG)

add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE vsg::vsg)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
27 changes: 27 additions & 0 deletions recipes/vsg/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.cmake import cmake_layout, CMake
import os


# It will become the standard on Conan 2.x
class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv"
test_type = "explicit"

def requirements(self):
self.requires(self.tested_reference_str)

def layout(self):
cmake_layout(self)

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def test(self):
if can_run(self):
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package")
self.run(bin_path, env="conanrun")
34 changes: 34 additions & 0 deletions recipes/vsg/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

#include <vsg/core/Object.h>
#include <vsg/nodes/Node.h>
#include <vsg/core/ref_ptr.h>


#include <vsg/utils/CommandLine.h>

#include <iostream>
#include <vector>

int main(int argc, char** argv)
{
vsg::CommandLine arguments(&argc, argv);
auto numObjects = arguments.value(100u, {"---num-objects", "-n"});
if (arguments.errors()) return arguments.writeErrorMessages(std::cerr);

using Objects = std::vector<vsg::ref_ptr<vsg::Object>>;
Objects objects;
objects.reserve(numObjects);
for (unsigned int i = 0; i < numObjects; ++i)
{
objects.push_back(vsg::Node::create());
}

Objects copy_objects(numObjects);


copy_objects = objects;
copy_objects.clear();


return 0;
}
8 changes: 8 additions & 0 deletions recipes/vsg/all/test_v1_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.1)
project(test_package)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)

add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/
${CMAKE_CURRENT_BINARY_DIR}/test_package/)
19 changes: 19 additions & 0 deletions recipes/vsg/all/test_v1_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from conans import ConanFile, CMake
from conan.tools.build import cross_building
import os


# legacy validation with Conan 1.x
class TestPackageV1Conan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "cmake", "cmake_find_package_multi"

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def test(self):
if not cross_building(self):
bin_path = os.path.join("bin", "test_package")
self.run(bin_path, run_environment=True)
5 changes: 5 additions & 0 deletions recipes/vsg/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
versions:
"1.0.3":
folder: all
"1.0.0":
folder: all