Skip to content

Commit

Permalink
(conan-io#16528) VulkanSceneGraph 1.0.0 ,1.0.3, 1.0.5
Browse files Browse the repository at this point in the history
* VulkanSceneGraph 1.0.0 inital configuration

* style correction

* style correction

* style correction

* added missing endline

* Fixed/hacked license, fixed some warnings

* reverted invalid change to shared-default option

* Added version 1.3.0

*  attempt to handle submodules (dependencies didn't work properly)
* handling options
* MT builds are no longer supported

* Added new version to config.yml

* Cleaning up in preparation to conan 2.0 compatiblity

* removed inlcude and fixed removal of cmake Find- and Config files in package

* Fixed broken packaging

* Apply suggestions from code review

Co-authored-by: Francisco Ramírez <franchuti688@gmail.com>

* Update recipes/vsg/all/conanfile.py

Co-authored-by: Francisco Ramírez <franchuti688@gmail.com>

* Update recipes/vsg/all/conanfile.py

Co-authored-by: Francisco Ramírez <franchuti688@gmail.com>

* Update recipes/vsg/all/conanfile.py

Co-authored-by: Francisco Ramírez <franchuti688@gmail.com>

* added package_type and minor clean-up

* Update recipes/vsg/all/conanfile.py

* reworked former submodule handling

* VSG now uses checkout of a branch instead
* using scm facilities instead of self.run as proposed

* fixed indentation issue

* EOL fix

* more EOL fixes

* backed up from non-conforming conandata based approach

* Update recipes/vsg/all/conanfile.py

* preparing vsg 1.0.5

* removed glslang and therefore shadercompiler support for now

* linter/style fixes

* removed no longer needed imports

* fixed some warnings

* Remove test_v1, simplify code

---------

Co-authored-by: Francisco Ramírez <franchuti688@gmail.com>
Co-authored-by: Rubén Rincón Blanco <rubenrb@jfrog.com>
Co-authored-by: Luis Caro Campos <3535649+jcar87@users.noreply.github.com>
Co-authored-by: Rubén Rincón Blanco <git@rinconblanco.es>
  • Loading branch information
5 people authored and tannerbitz committed Jul 4, 2023
1 parent 6d04878 commit 166b695
Show file tree
Hide file tree
Showing 6 changed files with 195 additions and 0 deletions.
10 changes: 10 additions & 0 deletions recipes/vsg/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
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"
"1.0.5":
url: "https://github.com/vsg-dev/VulkanSceneGraph/archive/refs/tags/v1.0.5.tar.gz"
sha256: "ff58260fcb88d19d92c40a70bc40ff06abb1a8805568eb76862a036d13ada75b"
118 changes: 118 additions & 0 deletions recipes/vsg/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
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"
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 = {
"shared": [True, False],
"max_devices": [1,2,3,4],
"fPIC": [True, False],
}
default_options = {
"shared": False,
"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.239.0", transitive_headers=True)

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)

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"] = 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"))
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"))

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")
24 changes: 24 additions & 0 deletions recipes/vsg/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

#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(1u, {"---num-objects", "-n"});
if (arguments.errors()) return arguments.writeErrorMessages(std::cerr);

using Objects = std::vector<vsg::ref_ptr<vsg::Object>>;
Objects objects;
objects.push_back(vsg::Node::create());


return 0;
}
7 changes: 7 additions & 0 deletions recipes/vsg/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
versions:
"1.0.5":
folder: all
"1.0.3":
folder: all
"1.0.0":
folder: all

0 comments on commit 166b695

Please sign in to comment.