🔧 Use conan packages instead of cmake external projects

This commit is contained in:
Edgar 2024-01-24 13:25:24 +01:00
parent 46b383934d
commit 564b7510c7
No known key found for this signature in database
GPG key ID: 3C2E1F2C1C353131
4 changed files with 37 additions and 29 deletions

View file

@ -6,8 +6,6 @@
# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
#
macro(TARGET_STEAMWORKS)
add_dependency_external_projects(steamworks)
find_package(Steamworks REQUIRED)
target_include_directories(${TARGET_NAME} PRIVATE ${STEAMWORKS_INCLUDE_DIRS})
target_link_libraries(${TARGET_NAME} ${STEAMWORKS_LIBRARIES})
target_link_libraries(${TARGET_NAME} Steam::Works)
endmacro()

View file

@ -7,7 +7,9 @@ class Overte(ConanFile):
name = "Overte"
settings = "os", "compiler", "build_type", "arch"
generators = "CMakeToolchain", "CMakeDeps"
options = {"with_qt": [True, False]}
default_options = {
"with_qt": False,
"sdl*:alsa": "False",
"sdl*:pulse": "False",
"sdl*:wayland": "False",
@ -40,10 +42,13 @@ class Overte(ConanFile):
self.folders.generators = os.path.join(self.folders.build, "generators")
def requirements(self):
# self.requires("shaderc/2021.1") # Broken
# self.requires("crashpad/cci.20220219") # Broken
self.requires("bullet3/3.25")
self.requires("draco/1.3.5")
self.requires("discord-rpc/3.4.0@anotherfoxguy/stable")
self.requires("draco/1.3.5")
self.requires("etc2comp/cci.20170424")
self.requires("gifcreator/2016.11@overte/stable")
self.requires("glad/0.1.36")
self.requires("gli/cci.20210515")
self.requires("glm/cci.20230113")
@ -52,24 +57,31 @@ class Overte(ConanFile):
self.requires("libnode/18.17.1@overte/stable")
self.requires("nlohmann_json/3.11.2")
self.requires("nvidia-texture-tools/2023.01@overte/stable")
self.requires("onetbb/2021.10.0")
self.requires("openexr/3.1.9")
self.requires("openssl/1.1.1w")
self.requires("openvr/2.2.3@overte/stable")
self.requires("opus/1.4")
self.requires("polyvox/0.2.1@overte/stable")
self.requires("quazip/1.4@overte/stable")
self.requires("sdl/2.26.5")
#self.requires("qt/5.15.10", force=True)
self.requires("scribe/2019.02@overte/stable")
#self.requires("shaderc/2021.1") # Broken
self.requires("sdl/2.26.5")
self.requires("spirv-cross/cci.20211113")
self.requires("spirv-tools/2021.4")
self.requires("onetbb/2021.10.0")
self.requires("steamworks/158a@overte/prebuild")
self.requires("v-hacd/4.1.0")
self.requires("vulkan-memory-allocator/3.0.1")
self.requires("webrtc/2021.01.05@overte/prebuild")
self.requires("zlib/1.2.13")
if self.settings.os == "Windows":
self.requires("neuron/12.2@overte/prebuild")
self.requires("ovr-skd/1.35.0@overte/prebuild")
self.requires("ovr-platform-skd/1.10.0@overte/prebuild")
if self.options.with_qt:
self.requires("qt/5.15.10", force=True)
def generate(self):
bindirs = []
for dep in self.dependencies.values():
@ -77,7 +89,7 @@ class Overte(ConanFile):
save(
self,
os.path.join(self.build_folder, "cmake", "ConanBinDirs.cmake"),
'set(CONAN_BIN_DIRS "%s")' % ";".join(bindirs).replace('\\', '/'),
'set(CONAN_BIN_DIRS "%s")' % ";".join(bindirs).replace("\\", "/"),
)
toolspath = """
@ -86,10 +98,14 @@ class Overte(ConanFile):
set(SPIRV_CROSS_DIR "%s")
set(SPIRV_TOOLS_DIR "%s")
""" % (
";".join(self.dependencies["glslang"].cpp_info.bindirs).replace('\\', '/'),
self.dependencies["scribe"].package_folder.replace('\\', '/'),
";".join(self.dependencies["spirv-cross"].cpp_info.bindirs).replace('\\', '/'),
";".join(self.dependencies["spirv-tools"].cpp_info.bindirs).replace('\\', '/'),
";".join(self.dependencies["glslang"].cpp_info.bindirs).replace("\\", "/"),
self.dependencies["scribe"].package_folder.replace("\\", "/"),
";".join(self.dependencies["spirv-cross"].cpp_info.bindirs).replace(
"\\", "/"
),
";".join(self.dependencies["spirv-tools"].cpp_info.bindirs).replace(
"\\", "/"
),
)
save(
self,

View file

@ -195,16 +195,15 @@ endif()
if (WIN32)
# These are external plugins, but we need to do the 'add dependency' here so that their
# binary directories get added to the fixup path
if (USE_SIXENSE)
add_dependency_external_projects(sixense)
find_package(sixense REQUIRED)
target_link_libraries(${TARGET_NAME} Sixense::Sixense)
endif ()
add_dependency_external_projects(neuron)
add_dependency_external_projects(wasapi)
add_dependency_external_projects(steamworks)
find_package(neuron REQUIRED)
find_package(steamworks REQUIRED)
target_link_libraries(${TARGET_NAME} Neuron::Datareader Steam::Works)
endif()
# disable /OPT:REF and /OPT:ICF for the Debug builds
@ -474,9 +473,8 @@ if (WIN32)
package_libraries_for_deployment()
endif()
add_dependency_external_projects(GifCreator)
find_package(GifCreator REQUIRED)
target_include_directories(${TARGET_NAME} PUBLIC ${GIFCREATOR_INCLUDE_DIRS})
target_link_libraries(${TARGET_NAME} GifCreator::GifCreator)
# tell CMake to exclude ui_console.h for policy CMP0071
set_property(SOURCE ui_console.h PROPERTY SKIP_AUTOMOC ON)

View file

@ -26,14 +26,10 @@ if (WIN32 AND (NOT USE_GLES))
include_hifi_library_headers(octree)
include_hifi_library_headers(script-engine)
add_dependency_external_projects(LibOVR)
find_package(LibOVR REQUIRED)
target_include_directories(${TARGET_NAME} PRIVATE ${LIBOVR_INCLUDE_DIRS})
target_link_libraries(${TARGET_NAME} ${LIBOVR_LIBRARIES})
find_package(OVR REQUIRED)
find_package(OVRPlatform REQUIRED)
target_link_libraries(${TARGET_NAME} OVR::SDK OVR::Platform)
target_link_libraries(${TARGET_NAME} Winmm.lib)
add_dependency_external_projects(LibOVRPlatform)
find_package(LibOVRPlatform REQUIRED)
target_include_directories(${TARGET_NAME} PRIVATE ${LIBOVRPLATFORM_INCLUDE_DIRS})
target_link_libraries(${TARGET_NAME} ${LIBOVRPLATFORM_LIBRARIES})
endif()