From cc3cad49add4f8e5c9861407c5b5cdbcdd3432e9 Mon Sep 17 00:00:00 2001 From: werto87 Date: Mon, 5 Jul 2021 09:57:18 +0200 Subject: [PATCH 01/88] init --- recipes/emsdk_installer/README.md | 1 + recipes/emsdk_installer/all/conandata.yml | 4 + recipes/emsdk_installer/all/conanfile.py | 121 ++++++++++++++++++ .../all/test_package/CMakeLists.txt | 11 ++ .../all/test_package/conanfile.py | 18 +++ .../all/test_package/test_package.cpp | 8 ++ recipes/emsdk_installer/config.yml | 3 + 7 files changed, 166 insertions(+) create mode 100644 recipes/emsdk_installer/README.md create mode 100644 recipes/emsdk_installer/all/conandata.yml create mode 100644 recipes/emsdk_installer/all/conanfile.py create mode 100644 recipes/emsdk_installer/all/test_package/CMakeLists.txt create mode 100644 recipes/emsdk_installer/all/test_package/conanfile.py create mode 100644 recipes/emsdk_installer/all/test_package/test_package.cpp create mode 100644 recipes/emsdk_installer/config.yml diff --git a/recipes/emsdk_installer/README.md b/recipes/emsdk_installer/README.md new file mode 100644 index 0000000000000..6cb36470efcea --- /dev/null +++ b/recipes/emsdk_installer/README.md @@ -0,0 +1 @@ +# conan_emsdk_installer diff --git a/recipes/emsdk_installer/all/conandata.yml b/recipes/emsdk_installer/all/conandata.yml new file mode 100644 index 0000000000000..cd0a6b105e6eb --- /dev/null +++ b/recipes/emsdk_installer/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + 2.0.10: + url: https://github.com/emscripten-core/emsdk/archive/refs/tags/2.0.10.tar.gz + sha256: 297b7dc39eba6757e4b280254129ebac05dab6a65d96d77eaab1d67ef5e7338a diff --git a/recipes/emsdk_installer/all/conanfile.py b/recipes/emsdk_installer/all/conanfile.py new file mode 100644 index 0000000000000..f03c47e17d863 --- /dev/null +++ b/recipes/emsdk_installer/all/conanfile.py @@ -0,0 +1,121 @@ +from conans import ConanFile, tools +import os + + +class EmSDKInstallerConan(ConanFile): + name = "emsdk_installer" + description = "Emscripten is an Open Source LLVM to JavaScript compiler" + url = "https://github.com/bincrafters/conan-emsdk_installer" + homepage = "https://github.com/kripken/emscripten" + topics = ("conan", "emsdk", "emscripten", "installer", "sdk") + license = "MIT" + + short_paths = True + _source_subfolder = "source_subfolder" + + def source(self): + tools.get(**self.conan_data["sources"][self.version]) + extracted_folder = "emsdk-%s" % self.version + os.rename(extracted_folder, self._source_subfolder) + + def _run(self, command): + self.output.info(command) + self.run(command) + + @staticmethod + def _create_dummy_file(directory): + if not os.path.isdir(directory): + os.makedirs(directory) + with open(os.path.join(directory, "dummy"), "w") as f: + f.write("\n") + + @staticmethod + def _touch(filename): + if not os.path.isfile(filename): + with open(filename, "w") as f: + f.write("\n") + + @staticmethod + def _chmod_plus_x(filename): + if os.name == 'posix': + os.chmod(filename, os.stat(filename).st_mode | 0o111) + + def build(self): + with tools.chdir(self._source_subfolder): + emsdk = 'emsdk.bat' if os.name == 'nt' else './emsdk' + if os.path.isfile("python_selector"): + self._chmod_plus_x("python_selector") + self._chmod_plus_x('emsdk') + self._run('%s update' % emsdk) + if os.path.isfile("python_selector"): + self._chmod_plus_x("python_selector") + self._chmod_plus_x('emsdk') + + self._run('%s install %s' % (emsdk, self.version)) + self._run('%s activate %s --embedded' % (emsdk, self.version)) + + def package(self): + self.copy(pattern="LICENSE", dst="licenses", + src=self._source_subfolder) + self.copy(pattern='*', dst='.', src=self._source_subfolder) + emsdk = self.package_folder + emscripten = os.path.join(emsdk, 'upstream', 'emscripten') + toolchain = os.path.join( + emscripten, 'cmake', 'Modules', 'Platform', 'Emscripten.cmake') + # allow to find conan libraries + tools.replace_in_file(toolchain, + "set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)", + "set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)") + tools.replace_in_file(toolchain, + "set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)", + "set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)") + tools.replace_in_file(toolchain, + "set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)", + "set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH)") + + def _define_tool_var(self, name, value): + suffix = '.bat' if os.name == 'nt' else '' + path = os.path.join(self.package_folder, 'upstream', + 'emscripten', '%s%s' % (value, suffix)) + self._chmod_plus_x(path) + self.output.info('Creating %s environment variable: %s' % (name, path)) + return path + + def package_info(self): + emsdk = self.package_folder + em_config = os.path.join(emsdk, '.emscripten') + emscripten = os.path.join(emsdk, 'upstream', 'emscripten') + em_cache = os.path.join(emsdk, '.emscripten_cache') + toolchain = os.path.join( + emscripten, 'cmake', 'Modules', 'Platform', 'Emscripten.cmake') + + self.output.info('Appending PATH environment variable: %s' % emsdk) + self.env_info.PATH.append(emsdk) + + self.output.info( + 'Appending PATH environment variable: %s' % emscripten) + self.env_info.PATH.append(emscripten) + + self.output.info('Creating EMSDK environment variable: %s' % emsdk) + self.env_info.EMSDK = emsdk + + self.output.info( + 'Creating EMSCRIPTEN environment variable: %s' % emscripten) + self.env_info.EMSCRIPTEN = emscripten + + self.output.info( + 'Creating EM_CONFIG environment variable: %s' % em_config) + self.env_info.EM_CONFIG = em_config + + self.output.info( + 'Creating EM_CACHE environment variable: %s' % em_cache) + self.env_info.EM_CACHE = em_cache + + self.output.info( + 'Creating CONAN_CMAKE_TOOLCHAIN_FILE environment variable: %s' % toolchain) + self.env_info.CONAN_CMAKE_TOOLCHAIN_FILE = toolchain + + self.env_info.CC = self._define_tool_var('CC', 'emcc') + self.env_info.CXX = self._define_tool_var('CXX', 'em++') + self.env_info.RANLIB = self._define_tool_var('RANLIB', 'emranlib') + self.env_info.AR = self._define_tool_var('AR', 'emar') diff --git a/recipes/emsdk_installer/all/test_package/CMakeLists.txt b/recipes/emsdk_installer/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..b9a55de6b8d04 --- /dev/null +++ b/recipes/emsdk_installer/all/test_package/CMakeLists.txt @@ -0,0 +1,11 @@ +project(test_package) +cmake_minimum_required(VERSION 3.1) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + + +file(GLOB SOURCE_FILES *.cpp) + +add_executable(${PROJECT_NAME} ${SOURCE_FILES}) +target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) diff --git a/recipes/emsdk_installer/all/test_package/conanfile.py b/recipes/emsdk_installer/all/test_package/conanfile.py new file mode 100644 index 0000000000000..24e2c9c5b2592 --- /dev/null +++ b/recipes/emsdk_installer/all/test_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools, RunEnvironment +import os + + +class TestPackageConan(ConanFile): + settings = "os", "build_type", "arch", "compiler" + generators = "cmake" + + def build(self): + cmake = CMake(self, generator='MinGW Makefiles' if os.name == 'nt' else 'Unix Makefiles', parallel=False) + cmake.definitions["CONAN_DISABLE_CHECK_COMPILER"] = True + cmake.configure() + cmake.build() + #self.run("cmake --build %s --config Release" % self.build_folder) + + def test(self): + test_file = os.path.join(self.build_folder, "bin", "test_package.js") + self.run('node %s' % test_file, run_environment=True) diff --git a/recipes/emsdk_installer/all/test_package/test_package.cpp b/recipes/emsdk_installer/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..b3ea0727337e4 --- /dev/null +++ b/recipes/emsdk_installer/all/test_package/test_package.cpp @@ -0,0 +1,8 @@ +#include +#include + +int main() +{ + std::cout << "Bincrafters\n"; + return EXIT_SUCCESS; +} diff --git a/recipes/emsdk_installer/config.yml b/recipes/emsdk_installer/config.yml new file mode 100644 index 0000000000000..4cc5ca08ec8be --- /dev/null +++ b/recipes/emsdk_installer/config.yml @@ -0,0 +1,3 @@ +versions: + "2.0.10": + folder: all From 4fbbf62fcbac8d91dbe82181d371af23716e55a2 Mon Sep 17 00:00:00 2001 From: werto87 Date: Mon, 5 Jul 2021 10:07:34 +0200 Subject: [PATCH 02/88] hook fixes --- recipes/emsdk_installer/all/conanfile.py | 2 +- recipes/emsdk_installer/all/test_package/CMakeLists.txt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/recipes/emsdk_installer/all/conanfile.py b/recipes/emsdk_installer/all/conanfile.py index f03c47e17d863..4bc1f0fd0beb1 100644 --- a/recipes/emsdk_installer/all/conanfile.py +++ b/recipes/emsdk_installer/all/conanfile.py @@ -5,7 +5,7 @@ class EmSDKInstallerConan(ConanFile): name = "emsdk_installer" description = "Emscripten is an Open Source LLVM to JavaScript compiler" - url = "https://github.com/bincrafters/conan-emsdk_installer" + url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/kripken/emscripten" topics = ("conan", "emsdk", "emscripten", "installer", "sdk") license = "MIT" diff --git a/recipes/emsdk_installer/all/test_package/CMakeLists.txt b/recipes/emsdk_installer/all/test_package/CMakeLists.txt index b9a55de6b8d04..b9334e3b5dc13 100644 --- a/recipes/emsdk_installer/all/test_package/CMakeLists.txt +++ b/recipes/emsdk_installer/all/test_package/CMakeLists.txt @@ -1,5 +1,6 @@ +cmake_minimum_required(VERSION 3.1.2) project(test_package) -cmake_minimum_required(VERSION 3.1) + include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup() From a864958413453179ea4b2452e03b82153f46b399 Mon Sep 17 00:00:00 2001 From: werto87 Date: Wed, 7 Jul 2021 18:19:00 +0200 Subject: [PATCH 03/88] fixing changes on two recipe problem --- recipes/emsdk_installer/all/conanfile.py | 15 +++++++++------ .../all/test_package/CMakeLists.txt | 2 +- .../emsdk_installer/all/test_package/conanfile.py | 3 ++- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/recipes/emsdk_installer/all/conanfile.py b/recipes/emsdk_installer/all/conanfile.py index 4bc1f0fd0beb1..67ddc50d5d76b 100644 --- a/recipes/emsdk_installer/all/conanfile.py +++ b/recipes/emsdk_installer/all/conanfile.py @@ -57,9 +57,10 @@ def build(self): def package(self): self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - self.copy(pattern='*', dst='.', src=self._source_subfolder) + self.copy(pattern='*', dst='bin', + src=self._source_subfolder, excludes=('*.pc', '*Find*.cmake')) emsdk = self.package_folder - emscripten = os.path.join(emsdk, 'upstream', 'emscripten') + emscripten = os.path.join(emsdk, 'bin', 'upstream', 'emscripten') toolchain = os.path.join( emscripten, 'cmake', 'Modules', 'Platform', 'Emscripten.cmake') # allow to find conan libraries @@ -75,7 +76,7 @@ def package(self): def _define_tool_var(self, name, value): suffix = '.bat' if os.name == 'nt' else '' - path = os.path.join(self.package_folder, 'upstream', + path = os.path.join(self.package_folder, 'bin', 'upstream', 'emscripten', '%s%s' % (value, suffix)) self._chmod_plus_x(path) self.output.info('Creating %s environment variable: %s' % (name, path)) @@ -83,9 +84,9 @@ def _define_tool_var(self, name, value): def package_info(self): emsdk = self.package_folder - em_config = os.path.join(emsdk, '.emscripten') - emscripten = os.path.join(emsdk, 'upstream', 'emscripten') - em_cache = os.path.join(emsdk, '.emscripten_cache') + em_config = os.path.join(emsdk, 'bin', '.emscripten') + emscripten = os.path.join(emsdk, 'bin', 'upstream', 'emscripten') + em_cache = os.path.join(emsdk, 'bin', '.emscripten_cache') toolchain = os.path.join( emscripten, 'cmake', 'Modules', 'Platform', 'Emscripten.cmake') @@ -119,3 +120,5 @@ def package_info(self): self.env_info.CXX = self._define_tool_var('CXX', 'em++') self.env_info.RANLIB = self._define_tool_var('RANLIB', 'emranlib') self.env_info.AR = self._define_tool_var('AR', 'emar') + self.cpp_info.builddirs = ['bin/releases/src/', 'bin/upstream/emscripten/cmake/Modules/', 'bin/upstream/emscripten/cmake/Modules/Platform/', 'bin/upstream/emscripten/system/lib/libunwind/cmake/Modules/', + 'bin/upstream/emscripten/system/lib/libunwind/cmake/', 'bin/upstream/emscripten/tests/cmake/target_library/', 'bin/upstream/lib/cmake/llvm/'] diff --git a/recipes/emsdk_installer/all/test_package/CMakeLists.txt b/recipes/emsdk_installer/all/test_package/CMakeLists.txt index b9334e3b5dc13..1b0e8ad545d43 100644 --- a/recipes/emsdk_installer/all/test_package/CMakeLists.txt +++ b/recipes/emsdk_installer/all/test_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1.2) +cmake_minimum_required(VERSION 3.20) project(test_package) diff --git a/recipes/emsdk_installer/all/test_package/conanfile.py b/recipes/emsdk_installer/all/test_package/conanfile.py index 24e2c9c5b2592..244354daf55fa 100644 --- a/recipes/emsdk_installer/all/test_package/conanfile.py +++ b/recipes/emsdk_installer/all/test_package/conanfile.py @@ -7,7 +7,8 @@ class TestPackageConan(ConanFile): generators = "cmake" def build(self): - cmake = CMake(self, generator='MinGW Makefiles' if os.name == 'nt' else 'Unix Makefiles', parallel=False) + cmake = CMake(self, generator='MinGW Makefiles' if os.name == + 'nt' else 'Unix Makefiles', parallel=False) cmake.definitions["CONAN_DISABLE_CHECK_COMPILER"] = True cmake.configure() cmake.build() From e9fd81741b368e9defaae855eaa8864fb14a00f1 Mon Sep 17 00:00:00 2001 From: werto87 Date: Wed, 7 Jul 2021 18:21:41 +0200 Subject: [PATCH 04/88] removed readme --- recipes/emsdk_installer/README.md | 1 - 1 file changed, 1 deletion(-) delete mode 100644 recipes/emsdk_installer/README.md diff --git a/recipes/emsdk_installer/README.md b/recipes/emsdk_installer/README.md deleted file mode 100644 index 6cb36470efcea..0000000000000 --- a/recipes/emsdk_installer/README.md +++ /dev/null @@ -1 +0,0 @@ -# conan_emsdk_installer From 0a01d5e9d7a61853fe0496c2afa92bc8405db711 Mon Sep 17 00:00:00 2001 From: werto87 Date: Wed, 7 Jul 2021 18:37:11 +0200 Subject: [PATCH 05/88] wip cmake version --- recipes/emsdk_installer/all/test_package/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/emsdk_installer/all/test_package/CMakeLists.txt b/recipes/emsdk_installer/all/test_package/CMakeLists.txt index 1b0e8ad545d43..e2bf4f5b40b6f 100644 --- a/recipes/emsdk_installer/all/test_package/CMakeLists.txt +++ b/recipes/emsdk_installer/all/test_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.20) +cmake_minimum_required(VERSION 3.18.2) project(test_package) From ad375038e31379287712b39a56af8e7631598f28 Mon Sep 17 00:00:00 2001 From: werto87 Date: Sat, 10 Jul 2021 11:40:46 +0200 Subject: [PATCH 06/88] try to fix build error adding test_type --- recipes/emsdk_installer/all/test_package/conanfile.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/recipes/emsdk_installer/all/test_package/conanfile.py b/recipes/emsdk_installer/all/test_package/conanfile.py index 244354daf55fa..bfcef2ef27f66 100644 --- a/recipes/emsdk_installer/all/test_package/conanfile.py +++ b/recipes/emsdk_installer/all/test_package/conanfile.py @@ -1,10 +1,13 @@ from conans import ConanFile, CMake, tools, RunEnvironment import os +required_conan_version = ">=1.36.0" + class TestPackageConan(ConanFile): settings = "os", "build_type", "arch", "compiler" generators = "cmake" + test_type = "build_requires" def build(self): cmake = CMake(self, generator='MinGW Makefiles' if os.name == From 4b013be48dafbe1e3a9a41968fca502b99e73289 Mon Sep 17 00:00:00 2001 From: werto87 Date: Sun, 11 Jul 2021 11:15:21 +0200 Subject: [PATCH 07/88] run build and test if os is Emscripten --- .../all/test_package/CMakeLists.txt | 8 ++++++++ .../all/test_package/conanfile.py | 17 ++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/recipes/emsdk_installer/all/test_package/CMakeLists.txt b/recipes/emsdk_installer/all/test_package/CMakeLists.txt index e2bf4f5b40b6f..778f88dda6014 100644 --- a/recipes/emsdk_installer/all/test_package/CMakeLists.txt +++ b/recipes/emsdk_installer/all/test_package/CMakeLists.txt @@ -10,3 +10,11 @@ file(GLOB SOURCE_FILES *.cpp) add_executable(${PROJECT_NAME} ${SOURCE_FILES}) target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) + + +#print all variables used in cmake +get_cmake_property(_variableNames VARIABLES) +list (SORT _variableNames) +foreach (_variableName ${_variableNames}) + message(STATUS "${_variableName}=${${_variableName}}") +endforeach() \ No newline at end of file diff --git a/recipes/emsdk_installer/all/test_package/conanfile.py b/recipes/emsdk_installer/all/test_package/conanfile.py index bfcef2ef27f66..d65da8739a063 100644 --- a/recipes/emsdk_installer/all/test_package/conanfile.py +++ b/recipes/emsdk_installer/all/test_package/conanfile.py @@ -10,13 +10,16 @@ class TestPackageConan(ConanFile): test_type = "build_requires" def build(self): - cmake = CMake(self, generator='MinGW Makefiles' if os.name == - 'nt' else 'Unix Makefiles', parallel=False) - cmake.definitions["CONAN_DISABLE_CHECK_COMPILER"] = True - cmake.configure() - cmake.build() + if self.settings.os == "Emscripten": + cmake = CMake(self, generator='MinGW Makefiles' if os.name == + 'nt' else 'Unix Makefiles', parallel=False) + cmake.definitions["CONAN_DISABLE_CHECK_COMPILER"] = True + cmake.configure() + cmake.build() #self.run("cmake --build %s --config Release" % self.build_folder) def test(self): - test_file = os.path.join(self.build_folder, "bin", "test_package.js") - self.run('node %s' % test_file, run_environment=True) + if self.settings.os == "Emscripten": + test_file = os.path.join( + self.build_folder, "bin", "test_package.js") + self.run('node %s' % test_file, run_environment=True) From da2172959908b043ad2216bcd4b1435d2457317e Mon Sep 17 00:00:00 2001 From: werto87 Date: Sun, 11 Jul 2021 11:18:06 +0200 Subject: [PATCH 08/88] removed verbose print cmake --- recipes/emsdk_installer/all/test_package/CMakeLists.txt | 8 -------- 1 file changed, 8 deletions(-) diff --git a/recipes/emsdk_installer/all/test_package/CMakeLists.txt b/recipes/emsdk_installer/all/test_package/CMakeLists.txt index 778f88dda6014..e2bf4f5b40b6f 100644 --- a/recipes/emsdk_installer/all/test_package/CMakeLists.txt +++ b/recipes/emsdk_installer/all/test_package/CMakeLists.txt @@ -10,11 +10,3 @@ file(GLOB SOURCE_FILES *.cpp) add_executable(${PROJECT_NAME} ${SOURCE_FILES}) target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) - - -#print all variables used in cmake -get_cmake_property(_variableNames VARIABLES) -list (SORT _variableNames) -foreach (_variableName ${_variableNames}) - message(STATUS "${_variableName}=${${_variableName}}") -endforeach() \ No newline at end of file From 54f0974690e192b8c4287c9d9e3fc32386588c86 Mon Sep 17 00:00:00 2001 From: jgsogo Date: Mon, 12 Jul 2021 18:47:48 +0200 Subject: [PATCH 09/88] [corrade] Add components + build_module + modernize --- .../all/cmake/conan-corrade-vars.cmake | 61 ++++++++ recipes/corrade/all/conanfile.py | 135 ++++++++++-------- .../corrade/all/test_package/CMakeLists.txt | 6 +- recipes/corrade/all/test_package/conanfile.py | 8 +- 4 files changed, 139 insertions(+), 71 deletions(-) create mode 100644 recipes/corrade/all/cmake/conan-corrade-vars.cmake diff --git a/recipes/corrade/all/cmake/conan-corrade-vars.cmake b/recipes/corrade/all/cmake/conan-corrade-vars.cmake new file mode 100644 index 0000000000000..c098a20adb237 --- /dev/null +++ b/recipes/corrade/all/cmake/conan-corrade-vars.cmake @@ -0,0 +1,61 @@ + +# Here we are reproducing the variables and call performed by the FindCorrade.cmake provided by the library + +# Read flags from configuration +file(READ "${CMAKE_CURRENT_LIST_DIR}/../../include/Corrade/configure.h" _corradeConfigure) +string(REGEX REPLACE ";" "\\\\;" _corradeConfigure "${_corradeConfigure}") +string(REGEX REPLACE "\n" ";" _corradeConfigure "${_corradeConfigure}") +set(_corradeFlags + MSVC2015_COMPATIBILITY + MSVC2017_COMPATIBILITY + MSVC2019_COMPATIBILITY + BUILD_DEPRECATED + BUILD_STATIC + BUILD_STATIC_UNIQUE_GLOBALS + BUILD_MULTITHREADED + TARGET_UNIX + TARGET_APPLE + TARGET_IOS + TARGET_IOS_SIMULATOR + TARGET_WINDOWS + TARGET_WINDOWS_RT + TARGET_EMSCRIPTEN + TARGET_ANDROID + # TARGET_X86 etc and TARGET_LIBCXX are not exposed to CMake as the meaning + # is unclear on platforms with multi-arch binaries or when mixing different + # STL implementations. TARGET_GCC etc are figured out via UseCorrade.cmake, + # as the compiler can be different when compiling the lib & when using it. + PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT + TESTSUITE_TARGET_XCTEST + UTILITY_USE_ANSI_COLORS) +foreach(_corradeFlag ${_corradeFlags}) + list(FIND _corradeConfigure "#define CORRADE_${_corradeFlag}" _corrade_${_corradeFlag}) + if(NOT _corrade_${_corradeFlag} EQUAL -1) + set(CORRADE_${_corradeFlag} 1) + endif() +endforeach() + + +# Corrade::rc, a target with just an executable +if(NOT TARGET Corrade::rc) + if(CMAKE_CROSSCOMPILING) + find_program(CORRADE_RC_PROGRAM + NAMES corrade-rc + PATHS ENV + PATH NO_DEFAULT_PATH) + else() + find_program(CORRADE_RC_PROGRAM + NAMES corrade-rc + PATHS "${CMAKE_CURRENT_LIST_DIR}/../../bin/" + NO_DEFAULT_PATH) + endif() + + get_filename_component(CORRADE_RC_PROGRAM "${CORRADE_RC_PROGRAM}" ABSOLUTE) + + add_executable(Corrade::rc IMPORTED) + set_property(TARGET Corrade::rc PROPERTY IMPORTED_LOCATION ${CORRADE_RC_PROGRAM}) +endif() + +# Include and declare other build modules +include("${CMAKE_CURRENT_LIST_DIR}/UseCorrade.cmake") +set(CORRADE_LIB_SUFFIX_MODULE "${CMAKE_CURRENT_LIST_DIR}/CorradeLibSuffix.cmake") diff --git a/recipes/corrade/all/conanfile.py b/recipes/corrade/all/conanfile.py index c1afaeaaa67eb..136fc450dc442 100644 --- a/recipes/corrade/all/conanfile.py +++ b/recipes/corrade/all/conanfile.py @@ -2,6 +2,8 @@ from conans.errors import ConanInvalidConfiguration import os +required_conan_version = ">=1.33.0" + class CorradeConan(ConanFile): name = "corrade" @@ -10,7 +12,7 @@ class CorradeConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://magnum.graphics/corrade" license = "MIT" - exports_sources = ["CMakeLists.txt"] + exports_sources = ["CMakeLists.txt", "cmake/*"] generators = "cmake" short_paths = True _cmake = None @@ -45,29 +47,36 @@ def config_options(self): del self.options.fPIC def configure(self): - if self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) < 14: - raise ConanInvalidConfiguration("Corrade requires Visual Studio version 14 or greater") - if tools.cross_building(self): - self.output.warn("This Corrade recipe could not be prepared for cross building") if self.options.shared: del self.options.fPIC + def validate(self): + if self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) < 14: + raise ConanInvalidConfiguration("Corrade requires Visual Studio version 14 or greater") + + if not self.options.with_utility and (self.options.with_testsuite or self.options.with_interconnect or self.options.with_pluginmanager): + raise ConanInvalidConfiguration("Component 'utility' is required for 'test_suite', 'interconnect' and 'plugin_manager'") + def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = self.name + "-" + self.version - os.rename(extracted_dir, self._source_subfolder) + tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + + def build_requirements(self): + if hasattr(self, 'settings_build') and tools.cross_building(self.settings, skip_x64_x86=True): + self.build_requires("corrade/{}".format(self.version)) def _configure_cmake(self): if not self._cmake: self._cmake = CMake(self) self._cmake.definitions["BUILD_STATIC"] = not self.options.shared - self._cmake.definitions["BUILD_DEPRECARED"] = self.options["build_deprecated"] - self._cmake.definitions["WITH_INTERCONNECT"] = self.options["with_interconnect"] - self._cmake.definitions["WITH_MAIN"] = self.options["with_main"] - self._cmake.definitions["WITH_PLUGINMANAGER"] = self.options["with_pluginmanager"] - self._cmake.definitions["WITH_TESTSUITE"] = self.options["with_testsuite"] - self._cmake.definitions["WITH_UTILITY"] = self.options["with_utility"] - self._cmake.definitions["WITH_RC"] = "ON" + self._cmake.definitions["BUILD_STATIC_PIC"] = self.options.get_safe("fPIC", False) + + self._cmake.definitions["BUILD_DEPRECARED"] = self.options.build_deprecated + self._cmake.definitions["WITH_INTERCONNECT"] = self.options.with_interconnect + self._cmake.definitions["WITH_MAIN"] = self.options.with_main + self._cmake.definitions["WITH_PLUGINMANAGER"] = self.options.with_pluginmanager + self._cmake.definitions["WITH_TESTSUITE"] = self.options.with_testsuite + self._cmake.definitions["WITH_UTILITY"] = self.options.with_utility + self._cmake.definitions["WITH_RC"] = self.options.with_utility # Corrade uses suffix on the resulting "lib"-folder when running cmake.install() # Set it explicitly to empty, else Corrade might set it implicitly (eg. to "64") @@ -82,11 +91,6 @@ def _configure_cmake(self): return self._cmake - - def build_requirements(self): - if hasattr(self, 'settings_build') and tools.cross_building(self.settings, skip_x64_x86=True): - self.build_requires("corrade/{}".format(self.version)) - def build(self): cmake = self._configure_cmake() cmake.build() @@ -97,54 +101,59 @@ def package(self): cmake.install() share_cmake = os.path.join(self.package_folder, "share", "cmake", "Corrade") - self.copy("UseCorrade.cmake", src=share_cmake, dst=os.path.join(self.package_folder, "lib", "cmake", "Corrade")) - self.copy("CorradeLibSuffix.cmake", src=share_cmake, dst=os.path.join(self.package_folder, "lib", "cmake", "Corrade")) + self.copy("UseCorrade.cmake", src=share_cmake, dst=os.path.join(self.package_folder, "lib", "cmake")) + self.copy("CorradeLibSuffix.cmake", src=share_cmake, dst=os.path.join(self.package_folder, "lib", "cmake")) + self.copy(pattern="*.cmake", dst=os.path.join("lib", "cmake"), src=os.path.join(self.source_folder, "cmake")) tools.rmdir(os.path.join(self.package_folder, "share")) - def _sort_libs(self, correct_order, libs, lib_suffix="", reverse_result=False): - # Add suffix for correct string matching - correct_order[:] = [s.__add__(lib_suffix) for s in correct_order] - - result = [] - for expectedLib in correct_order: - for lib in libs: - if expectedLib == lib: - result.append(lib) - - if reverse_result: - # Linking happens in reversed order - result.reverse() - return result - def package_info(self): self.cpp_info.names["cmake_find_package"] = "Corrade" self.cpp_info.names["cmake_find_package_multi"] = "Corrade" - self.cpp_info.builddirs.append(os.path.join("lib", "cmake")) - self.cpp_info.build_modules.append(os.path.join("lib", "cmake", "Corrade", "UseCorrade.cmake")) - self.cpp_info.build_modules.append(os.path.join("lib", "cmake", "Corrade", "CorradeLibSuffix.cmake")) - - # See dependency order here: https://doc.magnum.graphics/magnum/custom-buildsystems.html - allLibs = [ - #1 - "CorradeMain", - "CorradeUtility", - "CorradeContainers", - #2 - "CorradeInterconnect", - "CorradePluginManager", - "CorradeTestSuite", - ] - - # Sort all built libs according to above, and reverse result for correct link order suffix = "-d" if self.settings.build_type == "Debug" else "" - builtLibs = tools.collect_libs(self) - self.cpp_info.libs = self._sort_libs(allLibs, builtLibs, suffix, True) - if self.settings.os == "Linux": - self.cpp_info.system_libs = ["m", "dl"] - - self.cpp_info.builddirs = [os.path.join(self.package_folder, "lib", "cmake", "Corrade")] - bindir = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bindir)) - self.env_info.PATH.append(bindir) + # The FindCorrade.cmake file provided by the library populates some extra stuff + self.cpp_info.components["_corrade"].build_modules.append(os.path.join("lib", "cmake", "conan-corrade-vars.cmake")) + + if self.options.with_main: + self.cpp_info.components["main"].names["cmake_find_package"] = "Main" + self.cpp_info.components["main"].names["cmake_find_package_multi"] = "Main" + if self.settings.os == "Windows": + self.cpp_info.components["main"].libs = ["CorradeMain" + suffix] + self.cpp_info.components["main"].requires = ["_corrade"] + + if self.options.with_utility: + self.cpp_info.components["utility"].names["cmake_find_package"] = "Utility" + self.cpp_info.components["utility"].names["cmake_find_package_multi"] = "Utility" + self.cpp_info.components["utility"].libs = ["CorradeUtility" + suffix] + if self.settings.os == "Linux": + self.cpp_info.components["utility"].system_libs = ["m", "dl"] + self.cpp_info.components["utility"].requires = ["_corrade"] + + # This one is statically linked into utility + #self.cpp_info.components["containers"].names["cmake_find_package"] = "Containers" + #self.cpp_info.components["containers"].names["cmake_find_package_multi"] = "Containers" + #self.cpp_info.components["containers"].libs = ["CorradeContainers" + suffix] + + if self.options.with_interconnect: + self.cpp_info.components["interconnect"].names["cmake_find_package"] = "Interconnect" + self.cpp_info.components["interconnect"].names["cmake_find_package_multi"] = "Interconnect" + self.cpp_info.components["interconnect"].libs = ["CorradeInterconnect" + suffix] + self.cpp_info.components["interconnect"].requires = ["utility"] + + if self.options.with_pluginmanager: + self.cpp_info.components["plugin_manager"].names["cmake_find_package"] = "PluginManager" + self.cpp_info.components["plugin_manager"].names["cmake_find_package_multi"] = "PluginManager" + self.cpp_info.components["plugin_manager"].libs = ["CorradePluginManager" + suffix] + self.cpp_info.components["plugin_manager"].requires = ["utility"] + + if self.options.with_testsuite: + self.cpp_info.components["test_suite"].names["cmake_find_package"] = "TestSuite" + self.cpp_info.components["test_suite"].names["cmake_find_package_multi"] = "TestSuite" + self.cpp_info.components["test_suite"].libs = ["CorradeTestSuite" + suffix] + self.cpp_info.components["test_suite"].requires = ["utility"] + + if self.options.with_utility: + bindir = os.path.join(self.package_folder, "bin") + self.output.info("Appending PATH environment variable: {}".format(bindir)) + self.env_info.PATH.append(bindir) diff --git a/recipes/corrade/all/test_package/CMakeLists.txt b/recipes/corrade/all/test_package/CMakeLists.txt index e6e36e8f483fb..951d74740bdd6 100644 --- a/recipes/corrade/all/test_package/CMakeLists.txt +++ b/recipes/corrade/all/test_package/CMakeLists.txt @@ -2,10 +2,12 @@ cmake_minimum_required(VERSION 3.1) project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +conan_basic_setup(TARGETS) + +find_package(Corrade REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} Corrade::Utility) set_target_properties(${PROJECT_NAME} PROPERTIES diff --git a/recipes/corrade/all/test_package/conanfile.py b/recipes/corrade/all/test_package/conanfile.py index 6efa898293411..3da371b660e0a 100644 --- a/recipes/corrade/all/test_package/conanfile.py +++ b/recipes/corrade/all/test_package/conanfile.py @@ -4,18 +4,14 @@ class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + generators = "cmake", "cmake_find_package" def build(self): cmake = CMake(self) - if self.settings.compiler == "Visual Studio": - cmake.definitions["CORRADE_MSVC2015_COMPATIBILITY"] = "ON" if self.settings.compiler.version == "14" else "OFF" - cmake.definitions["CORRADE_MSVC2017_COMPATIBILITY"] = "ON" if self.settings.compiler.version == "15" else "OFF" - cmake.definitions["CORRADE_MSVC2019_COMPATIBILITY"] = "ON" if self.settings.compiler.version == "16" else "OFF" cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self.settings): + if not tools.cross_building(self): bin_path = os.path.join("bin", "test_package") self.run(bin_path, run_environment=True) From 022b63fd908376278f3f1b39970a10f251a9100f Mon Sep 17 00:00:00 2001 From: jgsogo Date: Mon, 12 Jul 2021 19:55:55 +0200 Subject: [PATCH 10/88] [magnum] Draft recipe --- recipes/magnum/all/CMakeLists.txt | 7 ++ recipes/magnum/all/conandata.yml | 8 ++ recipes/magnum/all/conanfile.py | 97 +++++++++++++++++++ .../magnum/all/test_package/CMakeLists.txt | 17 ++++ recipes/magnum/all/test_package/conanfile.py | 17 ++++ .../magnum/all/test_package/test_package.cpp | 19 ++++ recipes/magnum/config.yml | 3 + 7 files changed, 168 insertions(+) create mode 100644 recipes/magnum/all/CMakeLists.txt create mode 100644 recipes/magnum/all/conandata.yml create mode 100644 recipes/magnum/all/conanfile.py create mode 100644 recipes/magnum/all/test_package/CMakeLists.txt create mode 100644 recipes/magnum/all/test_package/conanfile.py create mode 100644 recipes/magnum/all/test_package/test_package.cpp create mode 100644 recipes/magnum/config.yml diff --git a/recipes/magnum/all/CMakeLists.txt b/recipes/magnum/all/CMakeLists.txt new file mode 100644 index 0000000000000..c986d294c7547 --- /dev/null +++ b/recipes/magnum/all/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(cmake_wrapper) + +include(conanbuildinfo.cmake) +conan_basic_setup() + +add_subdirectory("source_subfolder") diff --git a/recipes/magnum/all/conandata.yml b/recipes/magnum/all/conandata.yml new file mode 100644 index 0000000000000..3c066d6a4de89 --- /dev/null +++ b/recipes/magnum/all/conandata.yml @@ -0,0 +1,8 @@ +sources: + "2020.06": + url: "https://github.com/mosra/magnum/archive/refs/tags/v2020.06.tar.gz" + sha256: "98dfe802e56614e4e6bf750d9b693de46a5ed0c6eb479b0268f1a20bf34268bf" +#patches: +# "2020.06": +# - patch_file: "patches/0001-remove_register_classifier.patch" +# base_path: "source_subfolder" \ No newline at end of file diff --git a/recipes/magnum/all/conanfile.py b/recipes/magnum/all/conanfile.py new file mode 100644 index 0000000000000..57de1418548f9 --- /dev/null +++ b/recipes/magnum/all/conanfile.py @@ -0,0 +1,97 @@ +from conans import ConanFile, CMake, tools +from conans.errors import ConanInvalidConfiguration +import os + +required_conan_version = ">=1.33.0" + + +class MagnumConan(ConanFile): + name = "magnum" + description = "Magnum — Lightweight and modular C++11/C++14 graphics middleware for games and data visualization" + license = "MIT" + topics = ("conan", "corrade", "graphics", "rendering", "3d", "2d", "opengl") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://magnum.graphics" + + settings = "os", "compiler", "build_type", "arch" + + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + generators = "cmake", "cmake_find_package" + exports_sources = ["CMakeLists.txt", "patches/*"] + + _cmake = None + + @property + def _source_subfolder(self): + return "source_subfolder" + + def source(self): + tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), + 'set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/modules/" ${CMAKE_MODULE_PATH})', + "") + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + del self.options.fPIC + + def requirements(self): + self.requires("corrade/{}".format(self.version)) + self.requires("opengl/system") + + def build_requirements(self): + self.build_requires("corrade/{}".format(self.version)) + + def validate(self): + if self.options.shared and not self.options["corrade"].shared: + # To fix issue with resource management, see here: https://github.com/mosra/magnum/issues/304#issuecomment-451768389 + raise ConanInvalidConfiguration("If using 'shared=True', corrado should be shared as well") + + def _configure_cmake(self): + if self._cmake: + return self._cmake + + self._cmake = CMake(self) + self._cmake.definitions["BUILD_STATIC"] = not self.options.shared + self._cmake.definitions["BUILD_STATIC_PIC"] = self.options.get_safe("fPIC", False) + self._cmake.definitions["LIB_SUFFIX"] = "" + self._cmake.definitions["BUILD_TESTS"] = False + + self._cmake.configure() + return self._cmake + + def _patch_sources(self): + for patch in self.conan_data.get("patches", {}).get(self.version, []): + tools.patch(**patch) + + def build(self): + self._patch_sources() + + cm = self._configure_cmake() + cm.build() + + def package(self): + cm = self._configure_cmake() + cm.install() + + #tools.rmdir(os.path.join(self.package_folder, "cmake")) + #tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + #tools.rmdir(os.path.join(self.package_folder, "share")) + + self.copy("COPYING", src=self._source_subfolder, dst="licenses") + + def package_info(self): + self.cpp_info.names["cmake_find_package"] = "Magnum" + self.cpp_info.names["cmake_find_package_multi"] = "Magnum" + self.cpp_info.libs = tools.collect_libs(self) diff --git a/recipes/magnum/all/test_package/CMakeLists.txt b/recipes/magnum/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..3f6b870dd6b95 --- /dev/null +++ b/recipes/magnum/all/test_package/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(Magnum REQUIRED) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} Magnum::Magnum) + +set_target_properties(${PROJECT_NAME} + PROPERTIES + CXX_STANDARD 11 + CXX_STANDARD_REQUIRED ON + CXX_EXTENSIONS OFF +) diff --git a/recipes/magnum/all/test_package/conanfile.py b/recipes/magnum/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3da371b660e0a --- /dev/null +++ b/recipes/magnum/all/test_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/magnum/all/test_package/test_package.cpp b/recipes/magnum/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..e2492e0f85be5 --- /dev/null +++ b/recipes/magnum/all/test_package/test_package.cpp @@ -0,0 +1,19 @@ +#include +#include "Magnum/Math/Vector.h" +#include "Magnum/Math/StrictWeakOrdering.h" + + +// TODO: We should test here using Windowless applications + +int main() { + const Magnum::Math::Vector<2, Magnum::Float> v2a{1.0f, 2.0f}; + const Magnum::Math::Vector<2, Magnum::Float> v2b{2.0f, 3.0f}; + const Magnum::Math::Vector<2, Magnum::Float> v2c{1.0f, 3.0f}; + + Magnum::Math::StrictWeakOrdering o; + if (o(v2a, v2b)) { + std::cout << "Magnum working"; + } + return 0; +} + diff --git a/recipes/magnum/config.yml b/recipes/magnum/config.yml new file mode 100644 index 0000000000000..93230781a72ea --- /dev/null +++ b/recipes/magnum/config.yml @@ -0,0 +1,3 @@ +versions: + "2020.06": + folder: all From e94a85201b058f0526d79b7664ac75c37b6e43fe Mon Sep 17 00:00:00 2001 From: jgsogo Date: Mon, 12 Jul 2021 20:09:08 +0200 Subject: [PATCH 11/88] explicit components name for pkg_config --- recipes/corrade/all/conanfile.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/recipes/corrade/all/conanfile.py b/recipes/corrade/all/conanfile.py index 136fc450dc442..cd81b1eed8de5 100644 --- a/recipes/corrade/all/conanfile.py +++ b/recipes/corrade/all/conanfile.py @@ -118,6 +118,7 @@ def package_info(self): if self.options.with_main: self.cpp_info.components["main"].names["cmake_find_package"] = "Main" self.cpp_info.components["main"].names["cmake_find_package_multi"] = "Main" + self.cpp_info.components["main"].names["pkg_config"] = "corrade_main" if self.settings.os == "Windows": self.cpp_info.components["main"].libs = ["CorradeMain" + suffix] self.cpp_info.components["main"].requires = ["_corrade"] @@ -125,6 +126,7 @@ def package_info(self): if self.options.with_utility: self.cpp_info.components["utility"].names["cmake_find_package"] = "Utility" self.cpp_info.components["utility"].names["cmake_find_package_multi"] = "Utility" + self.cpp_info.components["utility"].names["pkg_config"] = "corrade_utility" self.cpp_info.components["utility"].libs = ["CorradeUtility" + suffix] if self.settings.os == "Linux": self.cpp_info.components["utility"].system_libs = ["m", "dl"] @@ -138,18 +140,21 @@ def package_info(self): if self.options.with_interconnect: self.cpp_info.components["interconnect"].names["cmake_find_package"] = "Interconnect" self.cpp_info.components["interconnect"].names["cmake_find_package_multi"] = "Interconnect" + self.cpp_info.components["interconnect"].names["pkg_config"] = "corrade_interconnect" self.cpp_info.components["interconnect"].libs = ["CorradeInterconnect" + suffix] self.cpp_info.components["interconnect"].requires = ["utility"] if self.options.with_pluginmanager: self.cpp_info.components["plugin_manager"].names["cmake_find_package"] = "PluginManager" self.cpp_info.components["plugin_manager"].names["cmake_find_package_multi"] = "PluginManager" + self.cpp_info.components["plugin_manager"].names["pkg_config"] = "corrade_plugin_manager" self.cpp_info.components["plugin_manager"].libs = ["CorradePluginManager" + suffix] self.cpp_info.components["plugin_manager"].requires = ["utility"] if self.options.with_testsuite: self.cpp_info.components["test_suite"].names["cmake_find_package"] = "TestSuite" self.cpp_info.components["test_suite"].names["cmake_find_package_multi"] = "TestSuite" + self.cpp_info.components["test_suite"].names["pkg_config"] = "corrade_test_suite" self.cpp_info.components["test_suite"].libs = ["CorradeTestSuite" + suffix] self.cpp_info.components["test_suite"].requires = ["utility"] From 0e2f861832bcaa759aa6e496ae426f35a8b79cda Mon Sep 17 00:00:00 2001 From: jgsogo Date: Tue, 13 Jul 2021 16:27:22 +0200 Subject: [PATCH 12/88] pkg_config - avoid conflicts in filesystem --- recipes/corrade/all/conanfile.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/recipes/corrade/all/conanfile.py b/recipes/corrade/all/conanfile.py index cd81b1eed8de5..078bf4211c0e7 100644 --- a/recipes/corrade/all/conanfile.py +++ b/recipes/corrade/all/conanfile.py @@ -118,7 +118,6 @@ def package_info(self): if self.options.with_main: self.cpp_info.components["main"].names["cmake_find_package"] = "Main" self.cpp_info.components["main"].names["cmake_find_package_multi"] = "Main" - self.cpp_info.components["main"].names["pkg_config"] = "corrade_main" if self.settings.os == "Windows": self.cpp_info.components["main"].libs = ["CorradeMain" + suffix] self.cpp_info.components["main"].requires = ["_corrade"] @@ -126,7 +125,6 @@ def package_info(self): if self.options.with_utility: self.cpp_info.components["utility"].names["cmake_find_package"] = "Utility" self.cpp_info.components["utility"].names["cmake_find_package_multi"] = "Utility" - self.cpp_info.components["utility"].names["pkg_config"] = "corrade_utility" self.cpp_info.components["utility"].libs = ["CorradeUtility" + suffix] if self.settings.os == "Linux": self.cpp_info.components["utility"].system_libs = ["m", "dl"] @@ -140,21 +138,18 @@ def package_info(self): if self.options.with_interconnect: self.cpp_info.components["interconnect"].names["cmake_find_package"] = "Interconnect" self.cpp_info.components["interconnect"].names["cmake_find_package_multi"] = "Interconnect" - self.cpp_info.components["interconnect"].names["pkg_config"] = "corrade_interconnect" self.cpp_info.components["interconnect"].libs = ["CorradeInterconnect" + suffix] self.cpp_info.components["interconnect"].requires = ["utility"] if self.options.with_pluginmanager: self.cpp_info.components["plugin_manager"].names["cmake_find_package"] = "PluginManager" self.cpp_info.components["plugin_manager"].names["cmake_find_package_multi"] = "PluginManager" - self.cpp_info.components["plugin_manager"].names["pkg_config"] = "corrade_plugin_manager" self.cpp_info.components["plugin_manager"].libs = ["CorradePluginManager" + suffix] self.cpp_info.components["plugin_manager"].requires = ["utility"] if self.options.with_testsuite: self.cpp_info.components["test_suite"].names["cmake_find_package"] = "TestSuite" self.cpp_info.components["test_suite"].names["cmake_find_package_multi"] = "TestSuite" - self.cpp_info.components["test_suite"].names["pkg_config"] = "corrade_test_suite" self.cpp_info.components["test_suite"].libs = ["CorradeTestSuite" + suffix] self.cpp_info.components["test_suite"].requires = ["utility"] @@ -162,3 +157,7 @@ def package_info(self): bindir = os.path.join(self.package_folder, "bin") self.output.info("Appending PATH environment variable: {}".format(bindir)) self.env_info.PATH.append(bindir) + + # pkg_config: Add more explicit naming to generated files (avoid filesystem collision). + for key, cmp in self.cpp_info.components.items(): + self.cpp_info.components[key].names["pkg_config"] = "{}_{}".format(self.name, key) From c3a1d988d3ddab60ed0f5e1ded6b3533b239e010 Mon Sep 17 00:00:00 2001 From: werto87 Date: Wed, 14 Jul 2021 14:25:06 +0200 Subject: [PATCH 13/88] Update recipes/emsdk_installer/all/conanfile.py Co-authored-by: Michael Keck --- recipes/emsdk_installer/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/emsdk_installer/all/conanfile.py b/recipes/emsdk_installer/all/conanfile.py index 67ddc50d5d76b..9a88fa4c4477e 100644 --- a/recipes/emsdk_installer/all/conanfile.py +++ b/recipes/emsdk_installer/all/conanfile.py @@ -3,7 +3,7 @@ class EmSDKInstallerConan(ConanFile): - name = "emsdk_installer" + name = "emsdk" description = "Emscripten is an Open Source LLVM to JavaScript compiler" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/kripken/emscripten" From 8b022c19ccfacfb11278fe9f81198a858b6e0a9a Mon Sep 17 00:00:00 2001 From: werto87 Date: Wed, 14 Jul 2021 14:25:31 +0200 Subject: [PATCH 14/88] Update recipes/emsdk_installer/all/conanfile.py Co-authored-by: Anonymous Maarten --- recipes/emsdk_installer/all/conanfile.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/recipes/emsdk_installer/all/conanfile.py b/recipes/emsdk_installer/all/conanfile.py index 9a88fa4c4477e..66de54936d741 100644 --- a/recipes/emsdk_installer/all/conanfile.py +++ b/recipes/emsdk_installer/all/conanfile.py @@ -14,9 +14,8 @@ class EmSDKInstallerConan(ConanFile): _source_subfolder = "source_subfolder" def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_folder = "emsdk-%s" % self.version - os.rename(extracted_folder, self._source_subfolder) + tools.get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) def _run(self, command): self.output.info(command) From e3ef04e1dfdf3137ce193fd9f1c92c565d60ced9 Mon Sep 17 00:00:00 2001 From: werto87 Date: Wed, 14 Jul 2021 14:26:42 +0200 Subject: [PATCH 15/88] Update recipes/emsdk_installer/all/conanfile.py Co-authored-by: Anonymous Maarten --- recipes/emsdk_installer/all/conanfile.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/recipes/emsdk_installer/all/conanfile.py b/recipes/emsdk_installer/all/conanfile.py index 66de54936d741..e7586d64125b9 100644 --- a/recipes/emsdk_installer/all/conanfile.py +++ b/recipes/emsdk_installer/all/conanfile.py @@ -31,8 +31,7 @@ def _create_dummy_file(directory): @staticmethod def _touch(filename): if not os.path.isfile(filename): - with open(filename, "w") as f: - f.write("\n") + tools.save(filename, "\n") @staticmethod def _chmod_plus_x(filename): From a75f3ea3ccbefa974dcb12c56a2c0a77451f99be Mon Sep 17 00:00:00 2001 From: werto87 Date: Wed, 14 Jul 2021 14:27:16 +0200 Subject: [PATCH 16/88] Update recipes/emsdk_installer/all/conanfile.py Co-authored-by: Anonymous Maarten --- recipes/emsdk_installer/all/conanfile.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/recipes/emsdk_installer/all/conanfile.py b/recipes/emsdk_installer/all/conanfile.py index e7586d64125b9..32f52067a2dd5 100644 --- a/recipes/emsdk_installer/all/conanfile.py +++ b/recipes/emsdk_installer/all/conanfile.py @@ -11,7 +11,12 @@ class EmSDKInstallerConan(ConanFile): license = "MIT" short_paths = True - _source_subfolder = "source_subfolder" + @property + def _source_subfolder(self): + return "source_subfolder" + + def package_id(self): + del self.info.settings.os def source(self): tools.get(**self.conan_data["sources"][self.version], From 3843aaa5cd7ee0859c429f1a37555785c0d499d0 Mon Sep 17 00:00:00 2001 From: werto87 Date: Wed, 14 Jul 2021 14:27:59 +0200 Subject: [PATCH 17/88] Update recipes/emsdk_installer/all/test_package/CMakeLists.txt Co-authored-by: Anonymous Maarten --- recipes/emsdk_installer/all/test_package/CMakeLists.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/recipes/emsdk_installer/all/test_package/CMakeLists.txt b/recipes/emsdk_installer/all/test_package/CMakeLists.txt index e2bf4f5b40b6f..f4915287d39a2 100644 --- a/recipes/emsdk_installer/all/test_package/CMakeLists.txt +++ b/recipes/emsdk_installer/all/test_package/CMakeLists.txt @@ -6,7 +6,5 @@ include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup() -file(GLOB SOURCE_FILES *.cpp) - -add_executable(${PROJECT_NAME} ${SOURCE_FILES}) +add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) From 05b5ccfb65bb913f929c4fd8ea99ad55c9359249 Mon Sep 17 00:00:00 2001 From: werto87 Date: Wed, 14 Jul 2021 14:28:09 +0200 Subject: [PATCH 18/88] Update recipes/emsdk_installer/all/test_package/conanfile.py Co-authored-by: Anonymous Maarten --- recipes/emsdk_installer/all/test_package/conanfile.py | 1 - 1 file changed, 1 deletion(-) diff --git a/recipes/emsdk_installer/all/test_package/conanfile.py b/recipes/emsdk_installer/all/test_package/conanfile.py index d65da8739a063..61730675f7523 100644 --- a/recipes/emsdk_installer/all/test_package/conanfile.py +++ b/recipes/emsdk_installer/all/test_package/conanfile.py @@ -16,7 +16,6 @@ def build(self): cmake.definitions["CONAN_DISABLE_CHECK_COMPILER"] = True cmake.configure() cmake.build() - #self.run("cmake --build %s --config Release" % self.build_folder) def test(self): if self.settings.os == "Emscripten": From 6737ff889e1854a9c88c6fe4050a94b89350f81e Mon Sep 17 00:00:00 2001 From: werto87 Date: Wed, 14 Jul 2021 14:36:52 +0200 Subject: [PATCH 19/88] Update recipes/emsdk_installer/all/conanfile.py Co-authored-by: Anonymous Maarten --- recipes/emsdk_installer/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/emsdk_installer/all/conanfile.py b/recipes/emsdk_installer/all/conanfile.py index 32f52067a2dd5..5a3f91fcf2cce 100644 --- a/recipes/emsdk_installer/all/conanfile.py +++ b/recipes/emsdk_installer/all/conanfile.py @@ -78,7 +78,7 @@ def package(self): "set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH)") def _define_tool_var(self, name, value): - suffix = '.bat' if os.name == 'nt' else '' + suffix = '.bat' if self.settings.os == "Windows" path = os.path.join(self.package_folder, 'bin', 'upstream', 'emscripten', '%s%s' % (value, suffix)) self._chmod_plus_x(path) From 233341f58b5d40bc683ba28c6484ee74cc50f19b Mon Sep 17 00:00:00 2001 From: werto87 Date: Wed, 14 Jul 2021 14:37:13 +0200 Subject: [PATCH 20/88] Update recipes/emsdk_installer/all/conanfile.py Co-authored-by: Anonymous Maarten --- recipes/emsdk_installer/all/conanfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/emsdk_installer/all/conanfile.py b/recipes/emsdk_installer/all/conanfile.py index 5a3f91fcf2cce..32ae7962f9556 100644 --- a/recipes/emsdk_installer/all/conanfile.py +++ b/recipes/emsdk_installer/all/conanfile.py @@ -9,6 +9,7 @@ class EmSDKInstallerConan(ConanFile): homepage = "https://github.com/kripken/emscripten" topics = ("conan", "emsdk", "emscripten", "installer", "sdk") license = "MIT" + settings = "os" short_paths = True @property From 9b06f4eee6b4c0c0390ea60871db8463e5f4dc27 Mon Sep 17 00:00:00 2001 From: werto87 Date: Wed, 14 Jul 2021 14:45:12 +0200 Subject: [PATCH 21/88] Update recipes/emsdk_installer/all/conanfile.py Co-authored-by: Anonymous Maarten --- recipes/emsdk_installer/all/conanfile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/emsdk_installer/all/conanfile.py b/recipes/emsdk_installer/all/conanfile.py index 32ae7962f9556..eb58eccbb96f5 100644 --- a/recipes/emsdk_installer/all/conanfile.py +++ b/recipes/emsdk_installer/all/conanfile.py @@ -2,6 +2,8 @@ import os +required_conan_version = ">=1.33.0" + class EmSDKInstallerConan(ConanFile): name = "emsdk" description = "Emscripten is an Open Source LLVM to JavaScript compiler" From 828c57be9c95bae58b38fcbbc4e83ad257941bcd Mon Sep 17 00:00:00 2001 From: werto87 Date: Wed, 14 Jul 2021 14:45:24 +0200 Subject: [PATCH 22/88] Update recipes/emsdk_installer/all/conanfile.py Co-authored-by: Anonymous Maarten --- recipes/emsdk_installer/all/conanfile.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/recipes/emsdk_installer/all/conanfile.py b/recipes/emsdk_installer/all/conanfile.py index eb58eccbb96f5..ec8cd5ca8b66b 100644 --- a/recipes/emsdk_installer/all/conanfile.py +++ b/recipes/emsdk_installer/all/conanfile.py @@ -31,10 +31,7 @@ def _run(self, command): @staticmethod def _create_dummy_file(directory): - if not os.path.isdir(directory): - os.makedirs(directory) - with open(os.path.join(directory, "dummy"), "w") as f: - f.write("\n") + tools.save(os.path.join(directory, "dummy"), "\n") @staticmethod def _touch(filename): From 1676d2e3884e0d0658bcfeca565b59d6f12cb7b7 Mon Sep 17 00:00:00 2001 From: werto87 Date: Wed, 14 Jul 2021 15:07:58 +0200 Subject: [PATCH 23/88] rename emsdk_installer into emsdk --- recipes/{emsdk_installer => emsdk}/all/conandata.yml | 0 recipes/{emsdk_installer => emsdk}/all/conanfile.py | 0 .../{emsdk_installer => emsdk}/all/test_package/CMakeLists.txt | 0 recipes/{emsdk_installer => emsdk}/all/test_package/conanfile.py | 0 .../{emsdk_installer => emsdk}/all/test_package/test_package.cpp | 0 recipes/{emsdk_installer => emsdk}/config.yml | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename recipes/{emsdk_installer => emsdk}/all/conandata.yml (100%) rename recipes/{emsdk_installer => emsdk}/all/conanfile.py (100%) rename recipes/{emsdk_installer => emsdk}/all/test_package/CMakeLists.txt (100%) rename recipes/{emsdk_installer => emsdk}/all/test_package/conanfile.py (100%) rename recipes/{emsdk_installer => emsdk}/all/test_package/test_package.cpp (100%) rename recipes/{emsdk_installer => emsdk}/config.yml (100%) diff --git a/recipes/emsdk_installer/all/conandata.yml b/recipes/emsdk/all/conandata.yml similarity index 100% rename from recipes/emsdk_installer/all/conandata.yml rename to recipes/emsdk/all/conandata.yml diff --git a/recipes/emsdk_installer/all/conanfile.py b/recipes/emsdk/all/conanfile.py similarity index 100% rename from recipes/emsdk_installer/all/conanfile.py rename to recipes/emsdk/all/conanfile.py diff --git a/recipes/emsdk_installer/all/test_package/CMakeLists.txt b/recipes/emsdk/all/test_package/CMakeLists.txt similarity index 100% rename from recipes/emsdk_installer/all/test_package/CMakeLists.txt rename to recipes/emsdk/all/test_package/CMakeLists.txt diff --git a/recipes/emsdk_installer/all/test_package/conanfile.py b/recipes/emsdk/all/test_package/conanfile.py similarity index 100% rename from recipes/emsdk_installer/all/test_package/conanfile.py rename to recipes/emsdk/all/test_package/conanfile.py diff --git a/recipes/emsdk_installer/all/test_package/test_package.cpp b/recipes/emsdk/all/test_package/test_package.cpp similarity index 100% rename from recipes/emsdk_installer/all/test_package/test_package.cpp rename to recipes/emsdk/all/test_package/test_package.cpp diff --git a/recipes/emsdk_installer/config.yml b/recipes/emsdk/config.yml similarity index 100% rename from recipes/emsdk_installer/config.yml rename to recipes/emsdk/config.yml From 2f34c8cfe4c50b566afb4d7ef2b216fdbda4f05e Mon Sep 17 00:00:00 2001 From: werto87 Date: Wed, 14 Jul 2021 15:25:16 +0200 Subject: [PATCH 24/88] fixed missing else --- recipes/emsdk/all/conanfile.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/recipes/emsdk/all/conanfile.py b/recipes/emsdk/all/conanfile.py index ec8cd5ca8b66b..2199fc7cc5865 100644 --- a/recipes/emsdk/all/conanfile.py +++ b/recipes/emsdk/all/conanfile.py @@ -4,6 +4,7 @@ required_conan_version = ">=1.33.0" + class EmSDKInstallerConan(ConanFile): name = "emsdk" description = "Emscripten is an Open Source LLVM to JavaScript compiler" @@ -14,6 +15,7 @@ class EmSDKInstallerConan(ConanFile): settings = "os" short_paths = True + @property def _source_subfolder(self): return "source_subfolder" @@ -78,7 +80,7 @@ def package(self): "set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH)") def _define_tool_var(self, name, value): - suffix = '.bat' if self.settings.os == "Windows" + suffix = '.bat' if self.settings.os == "Windows" else '' path = os.path.join(self.package_folder, 'bin', 'upstream', 'emscripten', '%s%s' % (value, suffix)) self._chmod_plus_x(path) From e86380a9da6a2c331d584dcd62357dca97e3f975 Mon Sep 17 00:00:00 2001 From: werto87 Date: Wed, 14 Jul 2021 15:33:00 +0200 Subject: [PATCH 25/88] progpergate renaming --- recipes/emsdk/all/conanfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/emsdk/all/conanfile.py b/recipes/emsdk/all/conanfile.py index 2199fc7cc5865..6cbdea991395f 100644 --- a/recipes/emsdk/all/conanfile.py +++ b/recipes/emsdk/all/conanfile.py @@ -5,12 +5,12 @@ required_conan_version = ">=1.33.0" -class EmSDKInstallerConan(ConanFile): +class EmSDKConan(ConanFile): name = "emsdk" description = "Emscripten is an Open Source LLVM to JavaScript compiler" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/kripken/emscripten" - topics = ("conan", "emsdk", "emscripten", "installer", "sdk") + topics = ("conan", "emsdk", "emscripten", "sdk") license = "MIT" settings = "os" From 3fbda29e99bc8f17fd2a91aca5d915609a62354a Mon Sep 17 00:00:00 2001 From: werto87 Date: Wed, 14 Jul 2021 19:10:14 +0200 Subject: [PATCH 26/88] remove _run print --- recipes/emsdk/all/conanfile.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/recipes/emsdk/all/conanfile.py b/recipes/emsdk/all/conanfile.py index 6cbdea991395f..dc273534ff991 100644 --- a/recipes/emsdk/all/conanfile.py +++ b/recipes/emsdk/all/conanfile.py @@ -1,6 +1,6 @@ from conans import ConanFile, tools import os - +from conans.errors import ConanInvalidConfiguration required_conan_version = ">=1.33.0" @@ -16,7 +16,7 @@ class EmSDKConan(ConanFile): short_paths = True - @property + @ property def _source_subfolder(self): return "source_subfolder" @@ -27,20 +27,16 @@ def source(self): tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) - def _run(self, command): - self.output.info(command) - self.run(command) - - @staticmethod + @ staticmethod def _create_dummy_file(directory): tools.save(os.path.join(directory, "dummy"), "\n") - @staticmethod + @ staticmethod def _touch(filename): if not os.path.isfile(filename): tools.save(filename, "\n") - @staticmethod + @ staticmethod def _chmod_plus_x(filename): if os.name == 'posix': os.chmod(filename, os.stat(filename).st_mode | 0o111) @@ -51,13 +47,13 @@ def build(self): if os.path.isfile("python_selector"): self._chmod_plus_x("python_selector") self._chmod_plus_x('emsdk') - self._run('%s update' % emsdk) + self.run('%s update' % emsdk) if os.path.isfile("python_selector"): self._chmod_plus_x("python_selector") self._chmod_plus_x('emsdk') - self._run('%s install %s' % (emsdk, self.version)) - self._run('%s activate %s --embedded' % (emsdk, self.version)) + self.run('%s install %s' % (emsdk, self.version)) + self.run('%s activate %s --embedded' % (emsdk, self.version)) def package(self): self.copy(pattern="LICENSE", dst="licenses", From 5b23572a80dfb813705d5055e98250405ccf0a58 Mon Sep 17 00:00:00 2001 From: werto87 Date: Wed, 14 Jul 2021 19:11:06 +0200 Subject: [PATCH 27/88] removed not used import --- recipes/emsdk/all/conanfile.py | 1 - 1 file changed, 1 deletion(-) diff --git a/recipes/emsdk/all/conanfile.py b/recipes/emsdk/all/conanfile.py index dc273534ff991..33496f02602a1 100644 --- a/recipes/emsdk/all/conanfile.py +++ b/recipes/emsdk/all/conanfile.py @@ -1,6 +1,5 @@ from conans import ConanFile, tools import os -from conans.errors import ConanInvalidConfiguration required_conan_version = ">=1.33.0" From a951ef38c6df39682072b8ae79457615f7bb4dab Mon Sep 17 00:00:00 2001 From: "Javier G. Sogo" Date: Fri, 16 Jul 2021 23:10:16 +0200 Subject: [PATCH 28/88] sdl2 in Linux --- recipes/magnum/all/conanfile.py | 23 +++++++++++++++++++++-- recipes/sdl/all/conanfile.py | 4 ++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/recipes/magnum/all/conanfile.py b/recipes/magnum/all/conanfile.py index 57de1418548f9..7a9c98ec653e4 100644 --- a/recipes/magnum/all/conanfile.py +++ b/recipes/magnum/all/conanfile.py @@ -18,10 +18,12 @@ class MagnumConan(ConanFile): options = { "shared": [True, False], "fPIC": [True, False], + "sdl2_application": [True, False], } default_options = { "shared": False, "fPIC": True, + "sdl2_application": True, } generators = "cmake", "cmake_find_package" exports_sources = ["CMakeLists.txt", "patches/*"] @@ -48,7 +50,9 @@ def configure(self): def requirements(self): self.requires("corrade/{}".format(self.version)) - self.requires("opengl/system") + #self.requires("opengl/system") + if self.options.sdl2_application: + self.requires("sdl/2.0.14") def build_requirements(self): self.build_requires("corrade/{}".format(self.version)) @@ -68,6 +72,8 @@ def _configure_cmake(self): self._cmake.definitions["LIB_SUFFIX"] = "" self._cmake.definitions["BUILD_TESTS"] = False + self._cmake.definitions["WITH_SDL2APPLICATION"] = self.options.sdl2_application + self._cmake.configure() return self._cmake @@ -94,4 +100,17 @@ def package(self): def package_info(self): self.cpp_info.names["cmake_find_package"] = "Magnum" self.cpp_info.names["cmake_find_package_multi"] = "Magnum" - self.cpp_info.libs = tools.collect_libs(self) + + self.cpp_info.components["_core"].libs = ["Magnum", "MagnumDebugTools", "MagnumGL", + "MagnumMeshTools", "MagnumPrimitives", + "MagnumSceneGraph", "MagnumShaders", + "MagnumText", "MagnumTextureTool", + "MagnumTrade"] + + if self.options.sdl2_application: + self.cpp_info.components["application"].names["cmake_find_package"] = "Application" + self.cpp_info.components["application"].names["cmake_find_package_multi"] = "Application" + self.cpp_info.components["application"].libs = ["MagnumSdl2Application"] + self.cpp_info.components["application"].requires = ["_core", "sdl::sdl"] + + #self.cpp_info.libs = tools.collect_libs(self) diff --git a/recipes/sdl/all/conanfile.py b/recipes/sdl/all/conanfile.py index 0c3a921ac814a..d4e206afb845b 100644 --- a/recipes/sdl/all/conanfile.py +++ b/recipes/sdl/all/conanfile.py @@ -110,8 +110,8 @@ def configure(self): del self.settings.compiler.cppstd if self.settings.os == "Macos" and not self.options.iconv: raise ConanInvalidConfiguration("On macOS iconv can't be disabled") - if self.settings.os == "Linux": - raise ConanInvalidConfiguration("Linux not supported yet") + #if self.settings.os == "Linux": + # raise ConanInvalidConfiguration("Linux not supported yet") def requirements(self): if self.options.get_safe("iconv", False): From 282d5714b80b81a5f20ce1e8fda3bb0b809816b3 Mon Sep 17 00:00:00 2001 From: "Javier G. Sogo" Date: Sat, 17 Jul 2021 00:02:23 +0200 Subject: [PATCH 29/88] options and components --- recipes/magnum/all/conanfile.py | 126 ++++++++++++++++++++++++++++++-- 1 file changed, 118 insertions(+), 8 deletions(-) diff --git a/recipes/magnum/all/conanfile.py b/recipes/magnum/all/conanfile.py index 7a9c98ec653e4..ac8def4660c02 100644 --- a/recipes/magnum/all/conanfile.py +++ b/recipes/magnum/all/conanfile.py @@ -19,11 +19,35 @@ class MagnumConan(ConanFile): "shared": [True, False], "fPIC": [True, False], "sdl2_application": [True, False], + + "with_audio": [True, False], + "with_debugtools": [True, False], + "with_meshtools": [True, False], + "with_gl": [True, False], + "with_primitives": [True, False], + "with_scenegraph": [True, False], + "with_shaders": [True, False], + "with_text": [True, False], + "with_texturetools": [True, False], + "with_trade": [True, False], + "with_vk": [True, False], } default_options = { "shared": False, "fPIC": True, "sdl2_application": True, + + "with_audio": False, + "with_debugtools": True, + "with_meshtools": True, + "with_gl": True, + "with_primitives": True, + "with_scenegraph": True, + "with_shaders": True, + "with_text": True, + "with_texturetools": True, + "with_trade": True, + "with_vk": False, } generators = "cmake", "cmake_find_package" exports_sources = ["CMakeLists.txt", "patches/*"] @@ -74,6 +98,18 @@ def _configure_cmake(self): self._cmake.definitions["WITH_SDL2APPLICATION"] = self.options.sdl2_application + self._cmake.definitions["WITH_AUDIO"] = self.options.with_audio + self._cmake.definitions["WITH_DEBUGTOOLS"] = self.options.with_debugtools + self._cmake.definitions["WITH_MESHTOOLS"] = self.options.with_meshtools + self._cmake.definitions["WITH_GL"] = self.options.with_gl + self._cmake.definitions["WITH_PRIMITIVES"] = self.options.with_primitives + self._cmake.definitions["WITH_SCENEGRAPH"] = self.options.with_scenegraph + self._cmake.definitions["WITH_SHADERS"] = self.options.with_shaders + self._cmake.definitions["WITH_TEXT"] = self.options.with_text + self._cmake.definitions["WITH_TEXTURETOOLS"] = self.options.with_texturetools + self._cmake.definitions["WITH_TRADE"] = self.options.with_trade + self._cmake.definitions["WITH_VK"] = self.options.with_vk + self._cmake.configure() return self._cmake @@ -101,16 +137,90 @@ def package_info(self): self.cpp_info.names["cmake_find_package"] = "Magnum" self.cpp_info.names["cmake_find_package_multi"] = "Magnum" - self.cpp_info.components["_core"].libs = ["Magnum", "MagnumDebugTools", "MagnumGL", - "MagnumMeshTools", "MagnumPrimitives", - "MagnumSceneGraph", "MagnumShaders", - "MagnumText", "MagnumTextureTool", - "MagnumTrade"] + # Magnum contains just the main library + self.cpp_info.components["magnum_main"].names["cmake_find_package"] = "Magnum" + self.cpp_info.components["magnum_main"].names["cmake_find_package_multi"] = "Magnum" + self.cpp_info.components["magnum_main"].libs = ["Magnum"] + self.cpp_info.components["magnum_main"].requires = ["corrade::utility"] + # Animation + # Math + # Platform if self.options.sdl2_application: self.cpp_info.components["application"].names["cmake_find_package"] = "Application" self.cpp_info.components["application"].names["cmake_find_package_multi"] = "Application" self.cpp_info.components["application"].libs = ["MagnumSdl2Application"] - self.cpp_info.components["application"].requires = ["_core", "sdl::sdl"] - - #self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.components["application"].requires = ["magnum_main", "sdl::sdl"] + + # Audio + # TODO: Here there is a target + + # DebugTools + if self.options.with_debugtools: + self.cpp_info.components["debugtools"].names["cmake_find_package"] = "DebugTools" + self.cpp_info.components["debugtools"].names["cmake_find_package_multi"] = "DebugTools" + self.cpp_info.components["debugtools"].libs = ["MagnumDebugTools"] + self.cpp_info.components["debugtools"].requires = ["magnum_main"] + if self.options["corrade"].with_testsuite and self.options.with_trade: + self.cpp_info.components["debugtools"].requires += ["corrade::test_suite", "trade"] + + # GL + if self.options.with_gl: + self.cpp_info.components["gl"].names["cmake_find_package"] = "GL" + self.cpp_info.components["gl"].names["cmake_find_package_multi"] = "GL" + self.cpp_info.components["gl"].libs = ["MagnumGL"] + self.cpp_info.components["gl"].requires = ["magnum_main", "opengl::opengl"] + + # MeshTools + if self.options.with_meshtools: + self.cpp_info.components["meshtools"].names["cmake_find_package"] = "MeshTools" + self.cpp_info.components["meshtools"].names["cmake_find_package_multi"] = "MeshTools" + self.cpp_info.components["meshtools"].libs = ["MagnumMeshTools"] + self.cpp_info.components["meshtools"].requires = ["magnum_main", "trade", "gl"] + + # Primitives + if self.options.with_primitives: + self.cpp_info.components["primitives"].names["cmake_find_package"] = "Primitives" + self.cpp_info.components["primitives"].names["cmake_find_package_multi"] = "Primitives" + self.cpp_info.components["primitives"].libs = ["MagnumPrimitives"] + self.cpp_info.components["primitives"].requires = ["magnum_main", "meshtools", "trade"] + + # SceneGraph + if self.options.with_scenegraph: + self.cpp_info.components["scenegraph"].names["cmake_find_package"] = "SceneGraph" + self.cpp_info.components["scenegraph"].names["cmake_find_package_multi"] = "SceneGraph" + self.cpp_info.components["scenegraph"].libs = ["MagnumSceneGraph"] + self.cpp_info.components["scenegraph"].requires = ["magnum_main"] + + # Shaders + if self.options.with_scenegraph: + self.cpp_info.components["shaders"].names["cmake_find_package"] = "Shaders" + self.cpp_info.components["shaders"].names["cmake_find_package_multi"] = "Shaders" + self.cpp_info.components["shaders"].libs = ["MagnumShaders"] + self.cpp_info.components["shaders"].requires = ["magnum_main", "gl"] + + # Text + if self.options.with_text: + self.cpp_info.components["text"].names["cmake_find_package"] = "Text" + self.cpp_info.components["text"].names["cmake_find_package_multi"] = "Text" + self.cpp_info.components["text"].libs = ["MagnumText"] + self.cpp_info.components["text"].requires = ["magnum_main", "texturetools", "corrade::plugin_manager", "gl"] + + # TextureTools + if self.options.with_texturetools: + self.cpp_info.components["texturetools"].names["cmake_find_package"] = "TextureTools" + self.cpp_info.components["texturetools"].names["cmake_find_package_multi"] = "TextureTools" + self.cpp_info.components["texturetools"].libs = ["MagnumTextureTool"] + self.cpp_info.components["texturetools"].requires = ["magnum_main"] + if self.options.with_gl: + self.cpp_info.components["texturetools"].requires += ["gl"] + + # Trade + if self.options.with_trade: + self.cpp_info.components["trade"].names["cmake_find_package"] = "Trade" + self.cpp_info.components["trade"].names["cmake_find_package_multi"] = "Trade" + self.cpp_info.components["trade"].libs = ["MagnumTrade"] + self.cpp_info.components["trade"].requires = ["magnum_main", "corrade::plugin_manager"] + + # VK + # TODO: target here, disabled by default From 45143f742e47f7a17a0d1b51f72640eeed5e61a9 Mon Sep 17 00:00:00 2001 From: "Javier G. Sogo" Date: Sat, 17 Jul 2021 00:10:04 +0200 Subject: [PATCH 30/88] optional opengl --- recipes/magnum/all/conanfile.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipes/magnum/all/conanfile.py b/recipes/magnum/all/conanfile.py index ac8def4660c02..883e09117576e 100644 --- a/recipes/magnum/all/conanfile.py +++ b/recipes/magnum/all/conanfile.py @@ -74,7 +74,8 @@ def configure(self): def requirements(self): self.requires("corrade/{}".format(self.version)) - #self.requires("opengl/system") + if self.options.with_gl: + self.requires("opengl/system") if self.options.sdl2_application: self.requires("sdl/2.0.14") From e39f0c9f979eed6e576ad0d9102d787e1741507d Mon Sep 17 00:00:00 2001 From: "Javier G. Sogo" Date: Sat, 17 Jul 2021 00:28:05 +0200 Subject: [PATCH 31/88] fix typo --- recipes/magnum/all/conanfile.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/recipes/magnum/all/conanfile.py b/recipes/magnum/all/conanfile.py index 883e09117576e..6bcf82c118f56 100644 --- a/recipes/magnum/all/conanfile.py +++ b/recipes/magnum/all/conanfile.py @@ -148,13 +148,21 @@ def package_info(self): # Math # Platform if self.options.sdl2_application: + self.cpp_info.components["sdl2_application"].names["cmake_find_package"] = "Sdl2Application" + self.cpp_info.components["sdl2_application"].names["cmake_find_package_multi"] = "Sdl2Application" + self.cpp_info.components["sdl2_application"].libs = ["MagnumSdl2Application"] + self.cpp_info.components["sdl2_application"].requires = ["magnum_main", "sdl::sdl"] + if self.options.with_gl: + self.cpp_info.components["sdl2_application"].requires += ["gl"] + + # If there is only one application, here it is an alias self.cpp_info.components["application"].names["cmake_find_package"] = "Application" self.cpp_info.components["application"].names["cmake_find_package_multi"] = "Application" - self.cpp_info.components["application"].libs = ["MagnumSdl2Application"] - self.cpp_info.components["application"].requires = ["magnum_main", "sdl::sdl"] + self.cpp_info.components["application"].requires = ["sdl2_application"] + # Audio - # TODO: Here there is a target + # TODO: Here there is a target (false by default) # DebugTools if self.options.with_debugtools: @@ -211,7 +219,7 @@ def package_info(self): if self.options.with_texturetools: self.cpp_info.components["texturetools"].names["cmake_find_package"] = "TextureTools" self.cpp_info.components["texturetools"].names["cmake_find_package_multi"] = "TextureTools" - self.cpp_info.components["texturetools"].libs = ["MagnumTextureTool"] + self.cpp_info.components["texturetools"].libs = ["MagnumTextureTools"] self.cpp_info.components["texturetools"].requires = ["magnum_main"] if self.options.with_gl: self.cpp_info.components["texturetools"].requires += ["gl"] From 3955fccbe2622ab2c0cc796400c379ac1af2207e Mon Sep 17 00:00:00 2001 From: "Javier G. Sogo" Date: Sat, 17 Jul 2021 10:51:15 +0200 Subject: [PATCH 32/88] recipe for magnum-plugins --- recipes/magnum-plugins/all/CMakeLists.txt | 13 +++ recipes/magnum-plugins/all/conandata.yml | 8 ++ recipes/magnum-plugins/all/conanfile.py | 108 ++++++++++++++++++++++ recipes/magnum-plugins/config.yml | 3 + 4 files changed, 132 insertions(+) create mode 100644 recipes/magnum-plugins/all/CMakeLists.txt create mode 100644 recipes/magnum-plugins/all/conandata.yml create mode 100644 recipes/magnum-plugins/all/conanfile.py create mode 100644 recipes/magnum-plugins/config.yml diff --git a/recipes/magnum-plugins/all/CMakeLists.txt b/recipes/magnum-plugins/all/CMakeLists.txt new file mode 100644 index 0000000000000..7d0a09dc79caf --- /dev/null +++ b/recipes/magnum-plugins/all/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.1) +project(cmake_wrapper) + +include(conanbuildinfo.cmake) +conan_basic_setup() + +# The original project uses the path to the 'magnum' package, in Conan we cannot modify existing package +set(MAGNUM_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/Magnum) +set(MAGNUM_EXTERNAL_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/MagnumExternal) +set(MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/MagnumPlugins) + + +add_subdirectory("source_subfolder") diff --git a/recipes/magnum-plugins/all/conandata.yml b/recipes/magnum-plugins/all/conandata.yml new file mode 100644 index 0000000000000..d2a126ffc8a14 --- /dev/null +++ b/recipes/magnum-plugins/all/conandata.yml @@ -0,0 +1,8 @@ +sources: + "2020.06": + url: "https://github.com/mosra/magnum-plugins/archive/refs/tags/v2020.06.tar.gz" + sha256: "8650cab43570c826d2557d5b42459150d253316f7f734af8b3e7d0883510b40a" +#patches: +# "2020.06": +# - patch_file: "patches/0001-remove_register_classifier.patch" +# base_path: "source_subfolder" \ No newline at end of file diff --git a/recipes/magnum-plugins/all/conanfile.py b/recipes/magnum-plugins/all/conanfile.py new file mode 100644 index 0000000000000..77e2a26831da0 --- /dev/null +++ b/recipes/magnum-plugins/all/conanfile.py @@ -0,0 +1,108 @@ +from conans import ConanFile, CMake, tools +from conans.errors import ConanInvalidConfiguration +import os + +required_conan_version = ">=1.33.0" + + +class MagnumConan(ConanFile): + name = "magnum-plugins" + description = "Plugins for the Magnum C++11/C++14 graphics engine" + license = "MIT" + topics = ("conan", "magnum", "graphics", "rendering", "3d", "2d", "opengl") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://magnum.graphics" + + settings = "os", "compiler", "build_type", "arch" + + options = { + "shared": [True, False], + "fPIC": [True, False], + + "with_stbimageimporter": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + + "with_stbimageimporter": True, + } + generators = "cmake", "cmake_find_package" + exports_sources = ["CMakeLists.txt", "patches/*"] + + _cmake = None + + @property + def _source_subfolder(self): + return "source_subfolder" + + def source(self): + tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), + 'set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/modules/" ${CMAKE_MODULE_PATH})', + "") + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + del self.options.fPIC + + def requirements(self): + self.requires("magnum/{}".format(self.version)) + + #def build_requirements(self): + # self.build_requires("corrade/{}".format(self.version)) + + def validate(self): + if self.options.with_stbimageimporter: + if not self.options["magnum"].with_trade: + raise ConanInvalidConfiguration("Magnum Trade is required for plugin 'stbimageimporter'") + + def _configure_cmake(self): + if self._cmake: + return self._cmake + + self._cmake = CMake(self) + self._cmake.definitions["BUILD_STATIC"] = not self.options.shared + self._cmake.definitions["BUILD_STATIC_PIC"] = self.options.get_safe("fPIC", False) + self._cmake.definitions["BUILD_PLUGINS_STATIC"] = not self.options.shared + self._cmake.definitions["LIB_SUFFIX"] = "" + self._cmake.definitions["BUILD_TESTS"] = False + + self._cmake.definitions["WITH_STBIMAGEIMPORTER"] = self.options.with_stbimageimporter + + self._cmake.configure() + return self._cmake + + def _patch_sources(self): + for patch in self.conan_data.get("patches", {}).get(self.version, []): + tools.patch(**patch) + + def build(self): + self._patch_sources() + + cm = self._configure_cmake() + cm.build() + + def package(self): + cm = self._configure_cmake() + cm.install() + + #tools.rmdir(os.path.join(self.package_folder, "cmake")) + #tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + #tools.rmdir(os.path.join(self.package_folder, "share")) + + self.copy("COPYING", src=self._source_subfolder, dst="licenses") + + def package_info(self): + self.cpp_info.names["cmake_find_package"] = "MagnumPlugins" + self.cpp_info.names["cmake_find_package_multi"] = "MagnumPlugins" + + if self.options.with_stbimageimporter: + self.cpp_info.components["stbimageimporter"].names["cmake_find_package"] = "StbImageImporter" + self.cpp_info.components["stbimageimporter"].names["cmake_find_package_multi"] = "StbImageImporter" + self.cpp_info.components["stbimageimporter"].libs = ["StbImageImporter"] + self.cpp_info.components["stbimageimporter"].requires = ["magnum::trade"] diff --git a/recipes/magnum-plugins/config.yml b/recipes/magnum-plugins/config.yml new file mode 100644 index 0000000000000..93230781a72ea --- /dev/null +++ b/recipes/magnum-plugins/config.yml @@ -0,0 +1,3 @@ +versions: + "2020.06": + folder: all From 48b309c03e2c124677a1a95b10a750b4d04a479f Mon Sep 17 00:00:00 2001 From: "Javier G. Sogo" Date: Sat, 17 Jul 2021 11:44:34 +0200 Subject: [PATCH 33/88] add more variables, shared by default --- recipes/magnum-plugins/all/CMakeLists.txt | 32 ++++++++++++++++++++--- recipes/magnum-plugins/all/conanfile.py | 2 +- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/recipes/magnum-plugins/all/CMakeLists.txt b/recipes/magnum-plugins/all/CMakeLists.txt index 7d0a09dc79caf..e23e4efa201e4 100644 --- a/recipes/magnum-plugins/all/CMakeLists.txt +++ b/recipes/magnum-plugins/all/CMakeLists.txt @@ -5,9 +5,35 @@ include(conanbuildinfo.cmake) conan_basic_setup() # The original project uses the path to the 'magnum' package, in Conan we cannot modify existing package -set(MAGNUM_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/Magnum) -set(MAGNUM_EXTERNAL_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/MagnumExternal) -set(MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/MagnumPlugins) +set(MAGNUM_PLUGINS_DEBUG_BINARY_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/magnum-d) +set(MAGNUM_PLUGINS_DEBUG_LIBRARY_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/magnum-d) +set(MAGNUM_PLUGINS_RELEASE_BINARY_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/magnum) +set(MAGNUM_PLUGINS_RELEASE_LIBRARY_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/magnum) +set(MAGNUM_PLUGINS_FONT_DEBUG_BINARY_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_BINARY_INSTALL_DIR}/fonts) +set(MAGNUM_PLUGINS_FONT_DEBUG_LIBRARY_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_LIBRARY_INSTALL_DIR}/fonts) +set(MAGNUM_PLUGINS_FONT_RELEASE_BINARY_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_BINARY_INSTALL_DIR}/fonts) +set(MAGNUM_PLUGINS_FONT_RELEASE_LIBRARY_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_LIBRARY_INSTALL_DIR}/fonts) +set(MAGNUM_PLUGINS_FONTCONVERTER_DEBUG_BINARY_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_BINARY_INSTALL_DIR}/fontconverters) +set(MAGNUM_PLUGINS_FONTCONVERTER_RELEASE_LIBRARY_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_LIBRARY_INSTALL_DIR}/fontconverters) +set(MAGNUM_PLUGINS_IMAGECONVERTER_DEBUG_BINARY_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_BINARY_INSTALL_DIR}/imageconverters) +set(MAGNUM_PLUGINS_IMAGECONVERTER_DEBUG_LIBRARY_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_LIBRARY_INSTALL_DIR}/imageconverters) +set(MAGNUM_PLUGINS_IMAGECONVERTER_RELEASE_LIBRARY_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_LIBRARY_INSTALL_DIR}/imageconverters) +set(MAGNUM_PLUGINS_IMAGECONVERTER_RELEASE_BINARY_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_BINARY_INSTALL_DIR}/imageconverters) +set(MAGNUM_PLUGINS_IMPORTER_DEBUG_BINARY_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_BINARY_INSTALL_DIR}/importers) +set(MAGNUM_PLUGINS_IMPORTER_DEBUG_LIBRARY_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_LIBRARY_INSTALL_DIR}/importers) +set(MAGNUM_PLUGINS_IMPORTER_RELEASE_BINARY_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_BINARY_INSTALL_DIR}/importers) +set(MAGNUM_PLUGINS_IMPORTER_RELEASE_LIBRARY_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_LIBRARY_INSTALL_DIR}/importers) +set(MAGNUM_PLUGINS_SCENECONVERTER_DEBUG_BINARY_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_BINARY_INSTALL_DIR}/sceneconverters) +set(MAGNUM_PLUGINS_SCENECONVERTER_DEBUG_LIBRARY_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_LIBRARY_INSTALL_DIR}/sceneconverters) +set(MAGNUM_PLUGINS_SCENECONVERTER_RELEASE_LIBRARY_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_LIBRARY_INSTALL_DIR}/sceneconverters) +set(MAGNUM_PLUGINS_SCENECONVERTER_RELEASE_BINARY_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_BINARY_INSTALL_DIR}/sceneconverters) +set(MAGNUM_PLUGINS_AUDIOIMPORTER_DEBUG_BINARY_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_BINARY_INSTALL_DIR}/audioimporters) +set(MAGNUM_PLUGINS_AUDIOIMPORTER_DEBUG_LIBRARY_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_LIBRARY_INSTALL_DIR}/audioimporters) +set(MAGNUM_PLUGINS_AUDIOIMPORTER_RELEASE_BINARY_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_BINARY_INSTALL_DIR}/audioimporters) +set(MAGNUM_PLUGINS_AUDIOIMPORTER_RELEASE_LIBRARY_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_LIBRARY_INSTALL_DIR}/audioimporters) +set(MAGNUM_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/Magnum) +set(MAGNUM_EXTERNAL_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/MagnumExternal) +set(MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/MagnumPlugins) add_subdirectory("source_subfolder") diff --git a/recipes/magnum-plugins/all/conanfile.py b/recipes/magnum-plugins/all/conanfile.py index 77e2a26831da0..0cda6f6c89430 100644 --- a/recipes/magnum-plugins/all/conanfile.py +++ b/recipes/magnum-plugins/all/conanfile.py @@ -22,7 +22,7 @@ class MagnumConan(ConanFile): "with_stbimageimporter": [True, False], } default_options = { - "shared": False, + "shared": True, "fPIC": True, "with_stbimageimporter": True, From fca187ed04c6c04d5316c3e08c38231724bf369b Mon Sep 17 00:00:00 2001 From: "Javier G. Sogo" Date: Sat, 17 Jul 2021 12:23:29 +0200 Subject: [PATCH 34/88] builtin plugins --- recipes/magnum-plugins/all/conanfile.py | 11 +++++++--- recipes/magnum/all/conanfile.py | 27 +++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/recipes/magnum-plugins/all/conanfile.py b/recipes/magnum-plugins/all/conanfile.py index 0cda6f6c89430..dd0cb0faaad37 100644 --- a/recipes/magnum-plugins/all/conanfile.py +++ b/recipes/magnum-plugins/all/conanfile.py @@ -18,6 +18,8 @@ class MagnumConan(ConanFile): options = { "shared": [True, False], "fPIC": [True, False], + + "with_assimpimporter": [True, False], "with_stbimageimporter": [True, False], } @@ -25,6 +27,8 @@ class MagnumConan(ConanFile): "shared": True, "fPIC": True, + "with_assimpimporter": True, + "with_stbimageimporter": True, } generators = "cmake", "cmake_find_package" @@ -57,9 +61,8 @@ def requirements(self): # self.build_requires("corrade/{}".format(self.version)) def validate(self): - if self.options.with_stbimageimporter: - if not self.options["magnum"].with_trade: - raise ConanInvalidConfiguration("Magnum Trade is required for plugin 'stbimageimporter'") + if not self.options["magnum"].with_trade: + raise ConanInvalidConfiguration("Magnum Trade is required") def _configure_cmake(self): if self._cmake: @@ -72,6 +75,8 @@ def _configure_cmake(self): self._cmake.definitions["LIB_SUFFIX"] = "" self._cmake.definitions["BUILD_TESTS"] = False + self._cmake.definitions["WITH_ASSIMPIMPORTER"] = self.options.with_assimpimporter + self._cmake.definitions["WITH_STBIMAGEIMPORTER"] = self.options.with_stbimageimporter self._cmake.configure() diff --git a/recipes/magnum/all/conanfile.py b/recipes/magnum/all/conanfile.py index 6bcf82c118f56..8276cc638c520 100644 --- a/recipes/magnum/all/conanfile.py +++ b/recipes/magnum/all/conanfile.py @@ -31,6 +31,9 @@ class MagnumConan(ConanFile): "with_texturetools": [True, False], "with_trade": [True, False], "with_vk": [True, False], + + "with_anyimageimporter": [True, False], + "with_anyimageconverter": [True, False], } default_options = { "shared": False, @@ -48,6 +51,9 @@ class MagnumConan(ConanFile): "with_texturetools": True, "with_trade": True, "with_vk": False, + + "with_anyimageimporter": True, + "with_anyimageconverter": True, } generators = "cmake", "cmake_find_package" exports_sources = ["CMakeLists.txt", "patches/*"] @@ -111,6 +117,11 @@ def _configure_cmake(self): self._cmake.definitions["WITH_TRADE"] = self.options.with_trade self._cmake.definitions["WITH_VK"] = self.options.with_vk + ##### Plugins related ##### + self._cmake.definitions["BUILD_PLUGINS_STATIC"] = not self.options.shared # TODO: Different option + self._cmake.definitions["WITH_ANYIMAGEIMPORTER"] = self.options.with_anyimageimporter + self._cmake.definitions["WITH_ANYIMAGECONVERTER"] = self.options.with_anyimageconverter + self._cmake.configure() return self._cmake @@ -233,3 +244,19 @@ def package_info(self): # VK # TODO: target here, disabled by default + + ######## PLUGINS ######## + # TODO: If shared, there are no libraries to link with + if self.options.with_anyimageimporter: + self.cpp_info.components["anyimageimporter"].names["cmake_find_package"] = "AnyImageImporter" + self.cpp_info.components["anyimageimporter"].names["cmake_find_package_multi"] = "AnyImageImporter" + self.cpp_info.components["anyimageimporter"].libs = ["AnyImageImporter"] + self.cpp_info.components["anyimageimporter"].libdirs = [os.path.join(self.package_folder, 'lib', 'magnum', 'importers')] + self.cpp_info.components["anyimageimporter"].requires = ["trade"] + + if self.options.with_anyimageconverter: + self.cpp_info.components["anyimageconverter"].names["cmake_find_package"] = "AnyImageConverter" + self.cpp_info.components["anyimageconverter"].names["cmake_find_package_multi"] = "AnyImageConverter" + self.cpp_info.components["anyimageconverter"].libs = ["AnyImageConverter"] + self.cpp_info.components["anyimageconverter"].libdirs = [os.path.join(self.package_folder, 'lib', 'magnum', 'imageconverters')] + self.cpp_info.components["anyimageconverter"].requires = ["trade"] From ba6ceb49703005d308f6bfe020fdf5fdf92dd0b2 Mon Sep 17 00:00:00 2001 From: "Javier G. Sogo" Date: Sat, 17 Jul 2021 12:42:06 +0200 Subject: [PATCH 35/88] assimpimporter plugin --- recipes/magnum-plugins/all/conanfile.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/recipes/magnum-plugins/all/conanfile.py b/recipes/magnum-plugins/all/conanfile.py index dd0cb0faaad37..e8da1cd6bbbea 100644 --- a/recipes/magnum-plugins/all/conanfile.py +++ b/recipes/magnum-plugins/all/conanfile.py @@ -45,6 +45,13 @@ def source(self): tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), 'set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/modules/" ${CMAKE_MODULE_PATH})', "") + assimp_importer_cmake_file = os.path.join(self._source_subfolder, "src", "MagnumPlugins", "AssimpImporter", "CMakeLists.txt") + tools.replace_in_file(assimp_importer_cmake_file, + "find_package(Assimp REQUIRED)", + "find_package(assimp REQUIRED)") + tools.replace_in_file(assimp_importer_cmake_file, + "Assimp::Assimp", + "assimp::assimp") def config_options(self): if self.settings.os == "Windows": @@ -56,6 +63,8 @@ def configure(self): def requirements(self): self.requires("magnum/{}".format(self.version)) + if self.options.with_assimpimporter: + self.requires("assimp/5.0.1") #def build_requirements(self): # self.build_requires("corrade/{}".format(self.version)) @@ -111,3 +120,9 @@ def package_info(self): self.cpp_info.components["stbimageimporter"].names["cmake_find_package_multi"] = "StbImageImporter" self.cpp_info.components["stbimageimporter"].libs = ["StbImageImporter"] self.cpp_info.components["stbimageimporter"].requires = ["magnum::trade"] + + if self.options.with_assimpimporter: + self.cpp_info.components["assimpimporter"].names["cmake_find_package"] = "AssimpImporter" + self.cpp_info.components["assimpimporter"].names["cmake_find_package_multi"] = "AssimpImporter" + self.cpp_info.components["assimpimporter"].libs = ["AssimpImporter"] + self.cpp_info.components["assimpimporter"].requires = ["magnum::trade", "assimp::assimp"] From d9c2df08984bd5abdc1657a046780da8bd930591 Mon Sep 17 00:00:00 2001 From: "Javier G. Sogo" Date: Sat, 17 Jul 2021 13:14:53 +0200 Subject: [PATCH 36/88] Add more components and plugins --- recipes/magnum/all/conanfile.py | 80 ++++++++++++++++++++++++++++++++- 1 file changed, 79 insertions(+), 1 deletion(-) diff --git a/recipes/magnum/all/conanfile.py b/recipes/magnum/all/conanfile.py index 8276cc638c520..80e0930d88e4d 100644 --- a/recipes/magnum/all/conanfile.py +++ b/recipes/magnum/all/conanfile.py @@ -32,8 +32,17 @@ class MagnumConan(ConanFile): "with_trade": [True, False], "with_vk": [True, False], + # WITH_ANYAUDIOIMPORTER "with_anyimageimporter": [True, False], "with_anyimageconverter": [True, False], + "with_anysceneconverter": [True, False], + "with_anysceneimporter": [True, False], + "with_magnumfont": [True, False], + "with_magnumfontconverter": [True, False], + "with_objimporter": [True, False], + "with_tgaimageconverter": [True, False], + "with_tgaimporter": [True, False], + #"with_wavaudioimporter": [True, False], } default_options = { "shared": False, @@ -54,6 +63,13 @@ class MagnumConan(ConanFile): "with_anyimageimporter": True, "with_anyimageconverter": True, + "with_anysceneconverter": True, + "with_anysceneimporter": True, + "with_magnumfont": True, + "with_magnumfontconverter": True, + "with_objimporter": True, + "with_tgaimageconverter": True, + "with_tgaimporter": True, } generators = "cmake", "cmake_find_package" exports_sources = ["CMakeLists.txt", "patches/*"] @@ -93,6 +109,9 @@ def validate(self): # To fix issue with resource management, see here: https://github.com/mosra/magnum/issues/304#issuecomment-451768389 raise ConanInvalidConfiguration("If using 'shared=True', corrado should be shared as well") + if self.options.with_magnumfontconverter and not self.options.with_tgaimageconverter: + raise ConanInvalidConfiguration("magnumfontconverter requires tgaimageconverter") + def _configure_cmake(self): if self._cmake: return self._cmake @@ -121,7 +140,14 @@ def _configure_cmake(self): self._cmake.definitions["BUILD_PLUGINS_STATIC"] = not self.options.shared # TODO: Different option self._cmake.definitions["WITH_ANYIMAGEIMPORTER"] = self.options.with_anyimageimporter self._cmake.definitions["WITH_ANYIMAGECONVERTER"] = self.options.with_anyimageconverter - + self._cmake.definitions["WITH_ANYSCENECONVERTER"] = self.options.with_anysceneconverter + self._cmake.definitions["WITH_ANYSCENEIMPORTER"] = self.options.with_anysceneconverter + self._cmake.definitions["WITH_MAGNUMFONT"] = self.options.with_anysceneconverter + self._cmake.definitions["WITH_MAGNUMFONTCONVERTER"] = self.options.with_anysceneconverter + self._cmake.definitions["WITH_OBJIMPORTER"] = self.options.with_objimporter + self._cmake.definitions["WITH_TGAIMAGECONVERTER"] = self.options.with_tgaimageconverter + self._cmake.definitions["WITH_TGAIMPORTER"] = self.options.with_tgaimporter + self._cmake.configure() return self._cmake @@ -260,3 +286,55 @@ def package_info(self): self.cpp_info.components["anyimageconverter"].libs = ["AnyImageConverter"] self.cpp_info.components["anyimageconverter"].libdirs = [os.path.join(self.package_folder, 'lib', 'magnum', 'imageconverters')] self.cpp_info.components["anyimageconverter"].requires = ["trade"] + + if self.options.with_anysceneconverter: + self.cpp_info.components["anysceneconverter"].names["cmake_find_package"] = "AnySceneConverter" + self.cpp_info.components["anysceneconverter"].names["cmake_find_package_multi"] = "AnySceneConverter" + self.cpp_info.components["anysceneconverter"].libs = ["AnySceneConverter"] + self.cpp_info.components["anysceneconverter"].libdirs = [os.path.join(self.package_folder, 'lib', 'magnum', 'sceneconverters')] + self.cpp_info.components["anysceneconverter"].requires = ["trade"] + + if self.options.with_anysceneimporter: + self.cpp_info.components["anysceneimporter"].names["cmake_find_package"] = "AnySceneImporter" + self.cpp_info.components["anysceneimporter"].names["cmake_find_package_multi"] = "AnySceneImporter" + self.cpp_info.components["anysceneimporter"].libs = ["AnySceneImporter"] + self.cpp_info.components["anysceneimporter"].libdirs = [os.path.join(self.package_folder, 'lib', 'magnum', 'importers')] + self.cpp_info.components["anysceneimporter"].requires = ["trade"] + + if self.options.with_magnumfont: + self.cpp_info.components["magnumfont"].names["cmake_find_package"] = "MagnumFont" + self.cpp_info.components["magnumfont"].names["cmake_find_package_multi"] = "MagnumFont" + self.cpp_info.components["magnumfont"].libs = ["MagnumFont"] + self.cpp_info.components["magnumfont"].libdirs = [os.path.join(self.package_folder, 'lib', 'magnum', 'fonts')] + self.cpp_info.components["magnumfont"].requires = ["magnum_main", "trade", "text"] + + if self.options.with_magnumfontconverter: + self.cpp_info.components["magnumfontconverter"].names["cmake_find_package"] = "MagnumFontConverter" + self.cpp_info.components["magnumfontconverter"].names["cmake_find_package_multi"] = "MagnumFontConverter" + self.cpp_info.components["magnumfontconverter"].libs = ["MagnumFontConverter"] + self.cpp_info.components["magnumfontconverter"].libdirs = [os.path.join(self.package_folder, 'lib', 'magnum', 'fontconverters')] + self.cpp_info.components["magnumfontconverter"].requires = ["magnum_main", "trade", "text"] + if not self.options.shared: + self.cpp_info.components["magnumfontconverter"].requires += ["tgaimageconverter"] + + if self.options.with_objimporter: + self.cpp_info.components["objimporter"].names["cmake_find_package"] = "ObjImporter" + self.cpp_info.components["objimporter"].names["cmake_find_package_multi"] = "ObjImporter" + self.cpp_info.components["objimporter"].libs = ["ObjImporter"] + self.cpp_info.components["objimporter"].libdirs = [os.path.join(self.package_folder, 'lib', 'magnum', 'importers')] + self.cpp_info.components["objimporter"].requires = ["trade", "meshtools"] + + if self.options.with_tgaimageconverter: + self.cpp_info.components["tgaimageconverter"].names["cmake_find_package"] = "TgaImageConverter" + self.cpp_info.components["tgaimageconverter"].names["cmake_find_package_multi"] = "TgaImageConverter" + self.cpp_info.components["tgaimageconverter"].libs = ["TgaImageConverter"] + self.cpp_info.components["tgaimageconverter"].libdirs = [os.path.join(self.package_folder, 'lib', 'magnum', 'imageconverters')] + self.cpp_info.components["tgaimageconverter"].requires = ["trade"] + + if self.options.with_tgaimporter: + self.cpp_info.components["tgaimporter"].names["cmake_find_package"] = "TgaImporter" + self.cpp_info.components["tgaimporter"].names["cmake_find_package_multi"] = "TgaImporter" + self.cpp_info.components["tgaimporter"].libs = ["TgaImporter"] + self.cpp_info.components["tgaimporter"].libdirs = [os.path.join(self.package_folder, 'lib', 'magnum', 'importers')] + self.cpp_info.components["tgaimporter"].requires = ["trade"] + From 19a0330cb23813352b4a655bf86b2e7356337905 Mon Sep 17 00:00:00 2001 From: "Javier G. Sogo" Date: Sat, 17 Jul 2021 13:20:59 +0200 Subject: [PATCH 37/88] option for shared_plugins (default true) --- recipes/magnum/all/conanfile.py | 53 ++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/recipes/magnum/all/conanfile.py b/recipes/magnum/all/conanfile.py index 80e0930d88e4d..1cce29d3413c7 100644 --- a/recipes/magnum/all/conanfile.py +++ b/recipes/magnum/all/conanfile.py @@ -32,6 +32,8 @@ class MagnumConan(ConanFile): "with_trade": [True, False], "with_vk": [True, False], + # Options related to plugins + "shared_plugins": [True, False], # WITH_ANYAUDIOIMPORTER "with_anyimageimporter": [True, False], "with_anyimageconverter": [True, False], @@ -61,6 +63,7 @@ class MagnumConan(ConanFile): "with_trade": True, "with_vk": False, + "shared_plugins": True, "with_anyimageimporter": True, "with_anyimageconverter": True, "with_anysceneconverter": True, @@ -137,7 +140,7 @@ def _configure_cmake(self): self._cmake.definitions["WITH_VK"] = self.options.with_vk ##### Plugins related ##### - self._cmake.definitions["BUILD_PLUGINS_STATIC"] = not self.options.shared # TODO: Different option + self._cmake.definitions["BUILD_PLUGINS_STATIC"] = not self.options.shared_plugins self._cmake.definitions["WITH_ANYIMAGEIMPORTER"] = self.options.with_anyimageimporter self._cmake.definitions["WITH_ANYIMAGECONVERTER"] = self.options.with_anyimageconverter self._cmake.definitions["WITH_ANYSCENECONVERTER"] = self.options.with_anysceneconverter @@ -276,65 +279,73 @@ def package_info(self): if self.options.with_anyimageimporter: self.cpp_info.components["anyimageimporter"].names["cmake_find_package"] = "AnyImageImporter" self.cpp_info.components["anyimageimporter"].names["cmake_find_package_multi"] = "AnyImageImporter" - self.cpp_info.components["anyimageimporter"].libs = ["AnyImageImporter"] - self.cpp_info.components["anyimageimporter"].libdirs = [os.path.join(self.package_folder, 'lib', 'magnum', 'importers')] + if not self.options.shared_plugins: + self.cpp_info.components["anyimageimporter"].libs = ["AnyImageImporter"] + self.cpp_info.components["anyimageimporter"].libdirs = [os.path.join(self.package_folder, 'lib', 'magnum', 'importers')] self.cpp_info.components["anyimageimporter"].requires = ["trade"] if self.options.with_anyimageconverter: self.cpp_info.components["anyimageconverter"].names["cmake_find_package"] = "AnyImageConverter" self.cpp_info.components["anyimageconverter"].names["cmake_find_package_multi"] = "AnyImageConverter" - self.cpp_info.components["anyimageconverter"].libs = ["AnyImageConverter"] - self.cpp_info.components["anyimageconverter"].libdirs = [os.path.join(self.package_folder, 'lib', 'magnum', 'imageconverters')] + if not self.options.shared_plugins: + self.cpp_info.components["anyimageconverter"].libs = ["AnyImageConverter"] + self.cpp_info.components["anyimageconverter"].libdirs = [os.path.join(self.package_folder, 'lib', 'magnum', 'imageconverters')] self.cpp_info.components["anyimageconverter"].requires = ["trade"] if self.options.with_anysceneconverter: self.cpp_info.components["anysceneconverter"].names["cmake_find_package"] = "AnySceneConverter" self.cpp_info.components["anysceneconverter"].names["cmake_find_package_multi"] = "AnySceneConverter" - self.cpp_info.components["anysceneconverter"].libs = ["AnySceneConverter"] - self.cpp_info.components["anysceneconverter"].libdirs = [os.path.join(self.package_folder, 'lib', 'magnum', 'sceneconverters')] + if not self.options.shared_plugins: + self.cpp_info.components["anysceneconverter"].libs = ["AnySceneConverter"] + self.cpp_info.components["anysceneconverter"].libdirs = [os.path.join(self.package_folder, 'lib', 'magnum', 'sceneconverters')] self.cpp_info.components["anysceneconverter"].requires = ["trade"] if self.options.with_anysceneimporter: self.cpp_info.components["anysceneimporter"].names["cmake_find_package"] = "AnySceneImporter" self.cpp_info.components["anysceneimporter"].names["cmake_find_package_multi"] = "AnySceneImporter" - self.cpp_info.components["anysceneimporter"].libs = ["AnySceneImporter"] - self.cpp_info.components["anysceneimporter"].libdirs = [os.path.join(self.package_folder, 'lib', 'magnum', 'importers')] + if not self.options.shared_plugins: + self.cpp_info.components["anysceneimporter"].libs = ["AnySceneImporter"] + self.cpp_info.components["anysceneimporter"].libdirs = [os.path.join(self.package_folder, 'lib', 'magnum', 'importers')] self.cpp_info.components["anysceneimporter"].requires = ["trade"] if self.options.with_magnumfont: self.cpp_info.components["magnumfont"].names["cmake_find_package"] = "MagnumFont" self.cpp_info.components["magnumfont"].names["cmake_find_package_multi"] = "MagnumFont" - self.cpp_info.components["magnumfont"].libs = ["MagnumFont"] - self.cpp_info.components["magnumfont"].libdirs = [os.path.join(self.package_folder, 'lib', 'magnum', 'fonts')] + if not self.options.shared_plugins: + self.cpp_info.components["magnumfont"].libs = ["MagnumFont"] + self.cpp_info.components["magnumfont"].libdirs = [os.path.join(self.package_folder, 'lib', 'magnum', 'fonts')] self.cpp_info.components["magnumfont"].requires = ["magnum_main", "trade", "text"] if self.options.with_magnumfontconverter: self.cpp_info.components["magnumfontconverter"].names["cmake_find_package"] = "MagnumFontConverter" self.cpp_info.components["magnumfontconverter"].names["cmake_find_package_multi"] = "MagnumFontConverter" - self.cpp_info.components["magnumfontconverter"].libs = ["MagnumFontConverter"] - self.cpp_info.components["magnumfontconverter"].libdirs = [os.path.join(self.package_folder, 'lib', 'magnum', 'fontconverters')] + if not self.options.shared_plugins: + self.cpp_info.components["magnumfontconverter"].libs = ["MagnumFontConverter"] + self.cpp_info.components["magnumfontconverter"].libdirs = [os.path.join(self.package_folder, 'lib', 'magnum', 'fontconverters')] self.cpp_info.components["magnumfontconverter"].requires = ["magnum_main", "trade", "text"] - if not self.options.shared: + if not self.options.shared_plugins: self.cpp_info.components["magnumfontconverter"].requires += ["tgaimageconverter"] if self.options.with_objimporter: self.cpp_info.components["objimporter"].names["cmake_find_package"] = "ObjImporter" self.cpp_info.components["objimporter"].names["cmake_find_package_multi"] = "ObjImporter" - self.cpp_info.components["objimporter"].libs = ["ObjImporter"] - self.cpp_info.components["objimporter"].libdirs = [os.path.join(self.package_folder, 'lib', 'magnum', 'importers')] + if not self.options.shared_plugins: + self.cpp_info.components["objimporter"].libs = ["ObjImporter"] + self.cpp_info.components["objimporter"].libdirs = [os.path.join(self.package_folder, 'lib', 'magnum', 'importers')] self.cpp_info.components["objimporter"].requires = ["trade", "meshtools"] if self.options.with_tgaimageconverter: self.cpp_info.components["tgaimageconverter"].names["cmake_find_package"] = "TgaImageConverter" self.cpp_info.components["tgaimageconverter"].names["cmake_find_package_multi"] = "TgaImageConverter" - self.cpp_info.components["tgaimageconverter"].libs = ["TgaImageConverter"] - self.cpp_info.components["tgaimageconverter"].libdirs = [os.path.join(self.package_folder, 'lib', 'magnum', 'imageconverters')] + if not self.options.shared_plugins: + self.cpp_info.components["tgaimageconverter"].libs = ["TgaImageConverter"] + self.cpp_info.components["tgaimageconverter"].libdirs = [os.path.join(self.package_folder, 'lib', 'magnum', 'imageconverters')] self.cpp_info.components["tgaimageconverter"].requires = ["trade"] if self.options.with_tgaimporter: self.cpp_info.components["tgaimporter"].names["cmake_find_package"] = "TgaImporter" self.cpp_info.components["tgaimporter"].names["cmake_find_package_multi"] = "TgaImporter" - self.cpp_info.components["tgaimporter"].libs = ["TgaImporter"] - self.cpp_info.components["tgaimporter"].libdirs = [os.path.join(self.package_folder, 'lib', 'magnum', 'importers')] + if not self.options.shared_plugins: + self.cpp_info.components["tgaimporter"].libs = ["TgaImporter"] + self.cpp_info.components["tgaimporter"].libdirs = [os.path.join(self.package_folder, 'lib', 'magnum', 'importers')] self.cpp_info.components["tgaimporter"].requires = ["trade"] - From 8c064134ddd24f03fcc1d36b713a3a39349dc35d Mon Sep 17 00:00:00 2001 From: "Javier G. Sogo" Date: Sat, 17 Jul 2021 13:45:02 +0200 Subject: [PATCH 38/88] options for all plugins --- recipes/magnum-plugins/all/conanfile.py | 98 ++++++++++++++++++++++--- 1 file changed, 88 insertions(+), 10 deletions(-) diff --git a/recipes/magnum-plugins/all/conanfile.py b/recipes/magnum-plugins/all/conanfile.py index e8da1cd6bbbea..86302707d67f7 100644 --- a/recipes/magnum-plugins/all/conanfile.py +++ b/recipes/magnum-plugins/all/conanfile.py @@ -18,18 +18,70 @@ class MagnumConan(ConanFile): options = { "shared": [True, False], "fPIC": [True, False], + "shared_plugins": [True, False], "with_assimpimporter": [True, False], - + "with_basisimageconverter": [True, False], + "with_basisimporter": [True, False], + "with_ddsimporter": [True, False], + "with_devilimageimporter": [True, False], + "with_drflacaudioimporter": [True, False], + "with_drmp3audioimporter": [True, False], + "with_drwavaudioimporter": [True, False], + "with_faad2audioimporter": [True, False], + "with_freetypefont": [True, False], + "with_harfbuzzfont": [True, False], + "with_icoimporter": [True, False], + "with_jpegimageconverter": [True, False], + "with_jpegimporter": [True, False], + "with_meshoptimizersceneconverter": [True, False], + "with_miniexrimageconverter": [True, False], + "with_opengeximporter": [True, False], + "with_pngimageconverter": [True, False], + "with_pngimporter": [True, False], + "with_primitiveimporter": [True, False], + "with_stanfordimporter": [True, False], + "with_stanfordsceneconverter": [True, False], + "with_stbimageconverter": [True, False], "with_stbimageimporter": [True, False], + "with_stbtruetypefont": [True, False], + "with_stbvorbisaudioimporter": [True, False], + "with_stlimporter": [True, False], + "with_tinygltfimporter": [True, False], } default_options = { - "shared": True, + "shared": False, "fPIC": True, + "shared_plugins": True, "with_assimpimporter": True, - + "with_basisimageconverter": True, + "with_basisimporter": True, + "with_ddsimporter": True, + "with_devilimageimporter": True, + "with_drflacaudioimporter": True, + "with_drmp3audioimporter": True, + "with_drwavaudioimporter": True, + "with_faad2audioimporter": True, + "with_freetypefont": True, + "with_harfbuzzfont": True, + "with_icoimporter": True, + "with_jpegimageconverter": True, + "with_jpegimporter": True, + "with_meshoptimizersceneconverter": True, + "with_miniexrimageconverter": True, + "with_opengeximporter": True, + "with_pngimageconverter": True, + "with_pngimporter": True, + "with_primitiveimporter": True, + "with_stanfordimporter": True, + "with_stanfordsceneconverter": True, + "with_stbimageconverter": True, "with_stbimageimporter": True, + "with_stbtruetypefont": True, + "with_stbvorbisaudioimporter": True, + "with_stlimporter": True, + "with_tinygltfimporter": True, } generators = "cmake", "cmake_find_package" exports_sources = ["CMakeLists.txt", "patches/*"] @@ -80,13 +132,38 @@ def _configure_cmake(self): self._cmake = CMake(self) self._cmake.definitions["BUILD_STATIC"] = not self.options.shared self._cmake.definitions["BUILD_STATIC_PIC"] = self.options.get_safe("fPIC", False) - self._cmake.definitions["BUILD_PLUGINS_STATIC"] = not self.options.shared + self._cmake.definitions["BUILD_PLUGINS_STATIC"] = not self.options.shared_plugins self._cmake.definitions["LIB_SUFFIX"] = "" self._cmake.definitions["BUILD_TESTS"] = False self._cmake.definitions["WITH_ASSIMPIMPORTER"] = self.options.with_assimpimporter - + self._cmake.definitions["WITH_BASISIMAGECONVERTER"] = self.options.with_basisimageconverter + self._cmake.definitions["WITH_BASISIMPORTER"] = self.options.with_basisimporter + self._cmake.definitions["WITH_DDSIMPORTER"] = self.options.with_ddsimporter + self._cmake.definitions["WITH_DEVILIMAGEIMPORTER"] = self.options.with_devilimageimporter + self._cmake.definitions["WITH_DRFLACAUDIOIMPORTER"] = self.options.with_drflacaudioimporter + self._cmake.definitions["WITH_DRMP3AUDIOIMPORTER"] = self.options.with_drmp3audioimporter + self._cmake.definitions["WITH_DRWAVAUDIOIMPORTER"] = self.options.with_drwavaudioimporter + self._cmake.definitions["WITH_FAAD2AUDIOIMPORTER"] = self.options.with_faad2audioimporter + self._cmake.definitions["WITH_FREETYPEFONT"] = self.options.with_freetypefont + self._cmake.definitions["WITH_HARFBUZZFONT"] = self.options.with_harfbuzzfont + self._cmake.definitions["WITH_ICOIMPORTER"] = self.options.with_icoimporter + self._cmake.definitions["WITH_JPEGIMAGECONVERTER"] = self.options.with_jpegimageconverter + self._cmake.definitions["WITH_JPEGIMPORTER"] = self.options.with_jpegimporter + self._cmake.definitions["WITH_MESHOPTIMIZERSCENECONVERTER"] = self.options.with_meshoptimizersceneconverter + self._cmake.definitions["WITH_MINIEXRIMAGECONVERTER"] = self.options.with_miniexrimageconverter + self._cmake.definitions["WITH_OPENGEXIMPORTER"] = self.options.with_opengeximporter + self._cmake.definitions["WITH_PNGIMAGECONVERTER"] = self.options.with_pngimageconverter + self._cmake.definitions["WITH_PNGIMPORTER"] = self.options.with_pngimporter + self._cmake.definitions["WITH_PRIMITIVEIMPORTER"] = self.options.with_primitiveimporter + self._cmake.definitions["WITH_STANFORDIMPORTER"] = self.options.with_stanfordimporter + self._cmake.definitions["WITH_STANFORDSCENECONVERTER"] = self.options.with_stanfordsceneconverter + self._cmake.definitions["WITH_STBIMAGECONVERTER"] = self.options.with_stbimageconverter self._cmake.definitions["WITH_STBIMAGEIMPORTER"] = self.options.with_stbimageimporter + self._cmake.definitions["WITH_STBTRUETYPEFONT"] = self.options.with_stbtruetypefont + self._cmake.definitions["WITH_STBVORBISAUDIOIMPORTER"] = self.options.with_stbvorbisaudioimporter + self._cmake.definitions["WITH_STLIMPORTER"] = self.options.with_stlimporter + self._cmake.definitions["WITH_TINYGLTFIMPORTER"] = self.options.with_tinygltfimporter self._cmake.configure() return self._cmake @@ -115,14 +192,15 @@ def package_info(self): self.cpp_info.names["cmake_find_package"] = "MagnumPlugins" self.cpp_info.names["cmake_find_package_multi"] = "MagnumPlugins" + if self.options.with_assimpimporter: + self.cpp_info.components["assimpimporter"].names["cmake_find_package"] = "AssimpImporter" + self.cpp_info.components["assimpimporter"].names["cmake_find_package_multi"] = "AssimpImporter" + self.cpp_info.components["assimpimporter"].libs = ["AssimpImporter"] + self.cpp_info.components["assimpimporter"].requires = ["magnum::trade", "assimp::assimp"] + if self.options.with_stbimageimporter: self.cpp_info.components["stbimageimporter"].names["cmake_find_package"] = "StbImageImporter" self.cpp_info.components["stbimageimporter"].names["cmake_find_package_multi"] = "StbImageImporter" self.cpp_info.components["stbimageimporter"].libs = ["StbImageImporter"] self.cpp_info.components["stbimageimporter"].requires = ["magnum::trade"] - if self.options.with_assimpimporter: - self.cpp_info.components["assimpimporter"].names["cmake_find_package"] = "AssimpImporter" - self.cpp_info.components["assimpimporter"].names["cmake_find_package_multi"] = "AssimpImporter" - self.cpp_info.components["assimpimporter"].libs = ["AssimpImporter"] - self.cpp_info.components["assimpimporter"].requires = ["magnum::trade", "assimp::assimp"] From bde04852bf0bcca825ecf8cd0ef2001b8342c6a2 Mon Sep 17 00:00:00 2001 From: "Javier G. Sogo" Date: Sat, 17 Jul 2021 14:11:30 +0200 Subject: [PATCH 39/88] activate more plugins --- recipes/magnum-plugins/all/conanfile.py | 96 +++++++++++++++++++------ 1 file changed, 73 insertions(+), 23 deletions(-) diff --git a/recipes/magnum-plugins/all/conanfile.py b/recipes/magnum-plugins/all/conanfile.py index 86302707d67f7..85aa2555daac7 100644 --- a/recipes/magnum-plugins/all/conanfile.py +++ b/recipes/magnum-plugins/all/conanfile.py @@ -55,33 +55,33 @@ class MagnumConan(ConanFile): "shared_plugins": True, "with_assimpimporter": True, - "with_basisimageconverter": True, - "with_basisimporter": True, + "with_basisimageconverter": False, + "with_basisimporter": False, "with_ddsimporter": True, - "with_devilimageimporter": True, - "with_drflacaudioimporter": True, - "with_drmp3audioimporter": True, - "with_drwavaudioimporter": True, - "with_faad2audioimporter": True, + "with_devilimageimporter": False, + "with_drflacaudioimporter": False, + "with_drmp3audioimporter": False, + "with_drwavaudioimporter": False, + "with_faad2audioimporter": False, "with_freetypefont": True, "with_harfbuzzfont": True, "with_icoimporter": True, "with_jpegimageconverter": True, "with_jpegimporter": True, - "with_meshoptimizersceneconverter": True, - "with_miniexrimageconverter": True, - "with_opengeximporter": True, - "with_pngimageconverter": True, - "with_pngimporter": True, - "with_primitiveimporter": True, - "with_stanfordimporter": True, - "with_stanfordsceneconverter": True, - "with_stbimageconverter": True, - "with_stbimageimporter": True, - "with_stbtruetypefont": True, - "with_stbvorbisaudioimporter": True, - "with_stlimporter": True, - "with_tinygltfimporter": True, + "with_meshoptimizersceneconverter": False, + "with_miniexrimageconverter": False, + "with_opengeximporter": False, + "with_pngimageconverter": False, + "with_pngimporter": False, + "with_primitiveimporter": False, + "with_stanfordimporter": False, + "with_stanfordsceneconverter": False, + "with_stbimageconverter": False, + "with_stbimageimporter": False, + "with_stbtruetypefont": False, + "with_stbvorbisaudioimporter": False, + "with_stlimporter": False, + "with_tinygltfimporter": False, } generators = "cmake", "cmake_find_package" exports_sources = ["CMakeLists.txt", "patches/*"] @@ -105,6 +105,14 @@ def source(self): "Assimp::Assimp", "assimp::assimp") + harfbuzz_cmake_file = os.path.join(self._source_subfolder, "src", "MagnumPlugins", "HarfBuzzFont", "CMakeLists.txt") + tools.replace_in_file(harfbuzz_cmake_file, + "find_package(HarfBuzz REQUIRED)", + "find_package(harfbuzz REQUIRED)") + tools.replace_in_file(harfbuzz_cmake_file, + "HarfBuzz::HarfBuzz", + "harfbuzz::harfbuzz") + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -117,6 +125,10 @@ def requirements(self): self.requires("magnum/{}".format(self.version)) if self.options.with_assimpimporter: self.requires("assimp/5.0.1") + if self.options.with_harfbuzzfont: + self.requires("harfbuzz/2.8.2") + if self.options.with_jpegimporter or self.options.with_jpegimageconverter: + self.requires("libjpeg/9d") #def build_requirements(self): # self.build_requires("corrade/{}".format(self.version)) @@ -195,12 +207,50 @@ def package_info(self): if self.options.with_assimpimporter: self.cpp_info.components["assimpimporter"].names["cmake_find_package"] = "AssimpImporter" self.cpp_info.components["assimpimporter"].names["cmake_find_package_multi"] = "AssimpImporter" - self.cpp_info.components["assimpimporter"].libs = ["AssimpImporter"] + if not self.options.shared_plugins: + self.cpp_info.components["assimpimporter"].libs = ["AssimpImporter"] self.cpp_info.components["assimpimporter"].requires = ["magnum::trade", "assimp::assimp"] + if self.options.with_ddsimporter: + self.cpp_info.components["ddsimporter"].names["cmake_find_package"] = "DdsImporter" + self.cpp_info.components["ddsimporter"].names["cmake_find_package_multi"] = "DdsImporter" + if not self.options.shared_plugins: + self.cpp_info.components["ddsimporter"].libs = ["DdsImporter"] + self.cpp_info.components["ddsimporter"].requires = ["magnum::trade"] + + if self.options.with_freetypefont: + self.cpp_info.components["freetypefont"].names["cmake_find_package"] = "FreeTypeFont" + self.cpp_info.components["freetypefont"].names["cmake_find_package_multi"] = "FreeTypeFont" + if not self.options.shared_plugins: + self.cpp_info.components["freetypefont"].libs = ["FreeTypeFont"] + self.cpp_info.components["freetypefont"].requires = ["magnum::text"] + + if self.options.with_harfbuzzfont: + self.cpp_info.components["harfbuzzfont"].names["cmake_find_package"] = "HarfBuzzFont" + self.cpp_info.components["harfbuzzfont"].names["cmake_find_package_multi"] = "HarfBuzzFont" + if not self.options.shared_plugins: + self.cpp_info.components["harfbuzzfont"].libs = ["HarfBuzzFont"] + self.cpp_info.components["harfbuzzfont"].requires = ["magnum::text", "harfbuzz::harfbuzz"] + + if self.options.with_jpegimageconverter: + self.cpp_info.components["jpegimageconverter"].names["cmake_find_package"] = "JpegImageConverter" + self.cpp_info.components["jpegimageconverter"].names["cmake_find_package_multi"] = "JpegImageConverter" + if not self.options.shared_plugins: + self.cpp_info.components["jpegimageconverter"].libs = ["JpegImageConverter"] + self.cpp_info.components["jpegimageconverter"].requires = ["magnum::trade", "libjpeg::libjpeg"] + + if self.options.with_jpegimporter: + self.cpp_info.components["jpegimporter"].names["cmake_find_package"] = "JpegImporter" + self.cpp_info.components["jpegimporter"].names["cmake_find_package_multi"] = "JpegImporter" + if not self.options.shared_plugins: + self.cpp_info.components["jpegimporter"].libs = ["JpegImporter"] + self.cpp_info.components["jpegimporter"].requires = ["magnum::trade", "libjpeg::libjpeg"] + + # not yet if self.options.with_stbimageimporter: self.cpp_info.components["stbimageimporter"].names["cmake_find_package"] = "StbImageImporter" self.cpp_info.components["stbimageimporter"].names["cmake_find_package_multi"] = "StbImageImporter" - self.cpp_info.components["stbimageimporter"].libs = ["StbImageImporter"] + if not self.options.shared_plugins: + self.cpp_info.components["stbimageimporter"].libs = ["StbImageImporter"] self.cpp_info.components["stbimageimporter"].requires = ["magnum::trade"] From a9e8c6fe59ab60aca505e7500a53bda5970f4b9c Mon Sep 17 00:00:00 2001 From: "Javier G. Sogo" Date: Sat, 17 Jul 2021 14:20:51 +0200 Subject: [PATCH 40/88] more plugins --- recipes/magnum-plugins/all/conanfile.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/recipes/magnum-plugins/all/conanfile.py b/recipes/magnum-plugins/all/conanfile.py index 85aa2555daac7..a91220c843fa2 100644 --- a/recipes/magnum-plugins/all/conanfile.py +++ b/recipes/magnum-plugins/all/conanfile.py @@ -68,8 +68,8 @@ class MagnumConan(ConanFile): "with_icoimporter": True, "with_jpegimageconverter": True, "with_jpegimporter": True, - "with_meshoptimizersceneconverter": False, - "with_miniexrimageconverter": False, + "with_meshoptimizersceneconverter": True, + "with_miniexrimageconverter": True, "with_opengeximporter": False, "with_pngimageconverter": False, "with_pngimporter": False, @@ -83,7 +83,7 @@ class MagnumConan(ConanFile): "with_stlimporter": False, "with_tinygltfimporter": False, } - generators = "cmake", "cmake_find_package" + generators = "cmake", "cmake_find_package", "cmake_find_package_multi" exports_sources = ["CMakeLists.txt", "patches/*"] _cmake = None @@ -129,6 +129,8 @@ def requirements(self): self.requires("harfbuzz/2.8.2") if self.options.with_jpegimporter or self.options.with_jpegimageconverter: self.requires("libjpeg/9d") + if self.options.with_meshoptimizersceneconverter: + self.requires("meshoptimizer/0.15") #def build_requirements(self): # self.build_requires("corrade/{}".format(self.version)) @@ -246,6 +248,20 @@ def package_info(self): self.cpp_info.components["jpegimporter"].libs = ["JpegImporter"] self.cpp_info.components["jpegimporter"].requires = ["magnum::trade", "libjpeg::libjpeg"] + if self.options.with_meshoptimizersceneconverter: + self.cpp_info.components["meshoptimizersceneconverter"].names["cmake_find_package"] = "MeshOptimizerSceneConverter" + self.cpp_info.components["meshoptimizersceneconverter"].names["cmake_find_package_multi"] = "MeshOptimizerSceneConverter" + if not self.options.shared_plugins: + self.cpp_info.components["meshoptimizersceneconverter"].libs = ["MeshOptimizerSceneConverter"] + self.cpp_info.components["meshoptimizersceneconverter"].requires = ["magnum::trade", "magnum::meshtools", "meshoptimizer::meshoptimizer"] + + if self.options.with_miniexrimageconverter: + self.cpp_info.components["miniexrimageconverter"].names["cmake_find_package"] = "MiniExrImageConverter" + self.cpp_info.components["miniexrimageconverter"].names["cmake_find_package_multi"] = "MiniExrImageConverter" + if not self.options.shared_plugins: + self.cpp_info.components["miniexrimageconverter"].libs = ["MiniExrImageConverter"] + self.cpp_info.components["miniexrimageconverter"].requires = ["magnum::trade"] + # not yet if self.options.with_stbimageimporter: self.cpp_info.components["stbimageimporter"].names["cmake_find_package"] = "StbImageImporter" From 8c6ae111f9449d403ff3e9ebeb936d78d0d645e4 Mon Sep 17 00:00:00 2001 From: "Javier G. Sogo" Date: Sat, 17 Jul 2021 14:45:51 +0200 Subject: [PATCH 41/88] more plugins --- recipes/magnum-plugins/all/conanfile.py | 100 +++++++++++++++++++++--- 1 file changed, 88 insertions(+), 12 deletions(-) diff --git a/recipes/magnum-plugins/all/conanfile.py b/recipes/magnum-plugins/all/conanfile.py index a91220c843fa2..ab6982d1e7a4f 100644 --- a/recipes/magnum-plugins/all/conanfile.py +++ b/recipes/magnum-plugins/all/conanfile.py @@ -70,18 +70,18 @@ class MagnumConan(ConanFile): "with_jpegimporter": True, "with_meshoptimizersceneconverter": True, "with_miniexrimageconverter": True, - "with_opengeximporter": False, - "with_pngimageconverter": False, - "with_pngimporter": False, - "with_primitiveimporter": False, - "with_stanfordimporter": False, - "with_stanfordsceneconverter": False, - "with_stbimageconverter": False, - "with_stbimageimporter": False, - "with_stbtruetypefont": False, + "with_opengeximporter": True, + "with_pngimageconverter": True, + "with_pngimporter": True, + "with_primitiveimporter": True, + "with_stanfordimporter": True, + "with_stanfordsceneconverter": True, + "with_stbimageconverter": True, + "with_stbimageimporter": True, + "with_stbtruetypefont": True, "with_stbvorbisaudioimporter": False, - "with_stlimporter": False, - "with_tinygltfimporter": False, + "with_stlimporter": True, + "with_tinygltfimporter": True, } generators = "cmake", "cmake_find_package", "cmake_find_package_multi" exports_sources = ["CMakeLists.txt", "patches/*"] @@ -206,6 +206,12 @@ def package_info(self): self.cpp_info.names["cmake_find_package"] = "MagnumPlugins" self.cpp_info.names["cmake_find_package_multi"] = "MagnumPlugins" + self.cpp_info.components["magnumopenddl"].names["cmake_find_package"] = "MagnumOpenDdl" + self.cpp_info.components["magnumopenddl"].names["cmake_find_package_multi"] = "MagnumOpenDdl" + self.cpp_info.components["magnumopenddl"].libs = ["MagnumOpenDdl"] + self.cpp_info.components["magnumopenddl"].requires = ["magnum::magnum"] + + # Plugins if self.options.with_assimpimporter: self.cpp_info.components["assimpimporter"].names["cmake_find_package"] = "AssimpImporter" self.cpp_info.components["assimpimporter"].names["cmake_find_package_multi"] = "AssimpImporter" @@ -262,7 +268,57 @@ def package_info(self): self.cpp_info.components["miniexrimageconverter"].libs = ["MiniExrImageConverter"] self.cpp_info.components["miniexrimageconverter"].requires = ["magnum::trade"] - # not yet + if self.options.with_opengeximporter: + self.cpp_info.components["opengeximporter"].names["cmake_find_package"] = "OpenGexImporter" + self.cpp_info.components["opengeximporter"].names["cmake_find_package_multi"] = "OpenGexImporter" + if not self.options.shared_plugins: + self.cpp_info.components["opengeximporter"].libs = ["OpenGexImporter"] + self.cpp_info.components["opengeximporter"].requires = ["magnum::trade", "magnumopenddl"] + if not self.options["magnum"].shared_plugins: + self.cpp_info.components["opengeximporter"].requires = ["magnum::anyimageimporter"] + + if self.options.with_pngimporter: + self.cpp_info.components["pngimporter"].names["cmake_find_package"] = "PngImporter" + self.cpp_info.components["pngimporter"].names["cmake_find_package_multi"] = "PngImporter" + if not self.options.shared_plugins: + self.cpp_info.components["pngimporter"].libs = ["PngImporter"] + self.cpp_info.components["pngimporter"].requires = ["magnum::trade"] + + if self.options.with_pngimageconverter: + self.cpp_info.components["pngimageconverter"].names["cmake_find_package"] = "PngImageConverter" + self.cpp_info.components["pngimageconverter"].names["cmake_find_package_multi"] = "PngImageConverter" + if not self.options.shared_plugins: + self.cpp_info.components["pngimageconverter"].libs = ["PngImageConverter"] + self.cpp_info.components["pngimageconverter"].requires = ["magnum::trade"] + + if self.options.with_primitiveimporter: + self.cpp_info.components["primitiveimporter"].names["cmake_find_package"] = "PrimitiveImporter" + self.cpp_info.components["primitiveimporter"].names["cmake_find_package_multi"] = "PrimitiveImporter" + if not self.options.shared_plugins: + self.cpp_info.components["primitiveimporter"].libs = ["PrimitiveImporter"] + self.cpp_info.components["primitiveimporter"].requires = ["magnum::primitives", "magnum::trade"] + + if self.options.with_stanfordimporter: + self.cpp_info.components["stanfordimporter"].names["cmake_find_package"] = "StandfordImporter" + self.cpp_info.components["stanfordimporter"].names["cmake_find_package_multi"] = "StandfordImporter" + if not self.options.shared_plugins: + self.cpp_info.components["stanfordimporter"].libs = ["StandfordImporter"] + self.cpp_info.components["stanfordimporter"].requires = ["magnum::meshtools", "magnum::trade"] + + if self.options.with_stanfordsceneconverter: + self.cpp_info.components["stanfordsceneconverter"].names["cmake_find_package"] = "StandfordSceneConverter" + self.cpp_info.components["stanfordsceneconverter"].names["cmake_find_package_multi"] = "StandfordSceneConverter" + if not self.options.shared_plugins: + self.cpp_info.components["stanfordsceneconverter"].libs = ["StandfordSceneConverter"] + self.cpp_info.components["stanfordsceneconverter"].requires = ["magnum::meshtools", "magnum::trade"] + + if self.options.with_stbimageconverter: + self.cpp_info.components["stbimageconverter"].names["cmake_find_package"] = "StbImageConverter" + self.cpp_info.components["stbimageconverter"].names["cmake_find_package_multi"] = "StbImageConverter" + if not self.options.shared_plugins: + self.cpp_info.components["stbimageconverter"].libs = ["StbImageConverter"] + self.cpp_info.components["stbimageconverter"].requires = ["magnum::trade"] + if self.options.with_stbimageimporter: self.cpp_info.components["stbimageimporter"].names["cmake_find_package"] = "StbImageImporter" self.cpp_info.components["stbimageimporter"].names["cmake_find_package_multi"] = "StbImageImporter" @@ -270,3 +326,23 @@ def package_info(self): self.cpp_info.components["stbimageimporter"].libs = ["StbImageImporter"] self.cpp_info.components["stbimageimporter"].requires = ["magnum::trade"] + if self.options.with_stbtruetypefont: + self.cpp_info.components["stbtruetypefont"].names["cmake_find_package"] = "StbTrueTypeFont" + self.cpp_info.components["stbtruetypefont"].names["cmake_find_package_multi"] = "StbTrueTypeFont" + if not self.options.shared_plugins: + self.cpp_info.components["stbtruetypefont"].libs = ["StbTrueTypeFont"] + self.cpp_info.components["stbtruetypefont"].requires = ["magnum::text"] + + if self.options.with_stlimporter: + self.cpp_info.components["stlimporter"].names["cmake_find_package"] = "StlImporter" + self.cpp_info.components["stlimporter"].names["cmake_find_package_multi"] = "StlImporter" + if not self.options.shared_plugins: + self.cpp_info.components["stlimporter"].libs = ["StlImporter"] + self.cpp_info.components["stlimporter"].requires = ["magnum::meshtools", "magnum::trade"] + + if self.options.with_tinygltfimporter: + self.cpp_info.components["tinygltfimporter"].names["cmake_find_package"] = "TinyGltfImporter" + self.cpp_info.components["tinygltfimporter"].names["cmake_find_package_multi"] = "TinyGltfImporter" + if not self.options.shared_plugins: + self.cpp_info.components["tinygltfimporter"].libs = ["TinyGltfImporter"] + self.cpp_info.components["tinygltfimporter"].requires = ["magnum::trade", "magnum::anyimageimporter"] From 11061d81b4585e4117574f26bf235b191fc35405 Mon Sep 17 00:00:00 2001 From: "Javier G. Sogo" Date: Sat, 17 Jul 2021 14:53:00 +0200 Subject: [PATCH 42/88] more plugins --- recipes/magnum-plugins/all/conanfile.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/recipes/magnum-plugins/all/conanfile.py b/recipes/magnum-plugins/all/conanfile.py index ab6982d1e7a4f..d9c65453348cc 100644 --- a/recipes/magnum-plugins/all/conanfile.py +++ b/recipes/magnum-plugins/all/conanfile.py @@ -217,6 +217,7 @@ def package_info(self): self.cpp_info.components["assimpimporter"].names["cmake_find_package_multi"] = "AssimpImporter" if not self.options.shared_plugins: self.cpp_info.components["assimpimporter"].libs = ["AssimpImporter"] + self.cpp_info.components["assimpimporter"].libdirs = [os.path.join(self.package_folder, "lib", "magnum", "importers")] self.cpp_info.components["assimpimporter"].requires = ["magnum::trade", "assimp::assimp"] if self.options.with_ddsimporter: @@ -224,6 +225,7 @@ def package_info(self): self.cpp_info.components["ddsimporter"].names["cmake_find_package_multi"] = "DdsImporter" if not self.options.shared_plugins: self.cpp_info.components["ddsimporter"].libs = ["DdsImporter"] + self.cpp_info.components["ddsimporter"].libdirs = [os.path.join(self.package_folder, "lib", "magnum", "importers")] self.cpp_info.components["ddsimporter"].requires = ["magnum::trade"] if self.options.with_freetypefont: @@ -231,6 +233,7 @@ def package_info(self): self.cpp_info.components["freetypefont"].names["cmake_find_package_multi"] = "FreeTypeFont" if not self.options.shared_plugins: self.cpp_info.components["freetypefont"].libs = ["FreeTypeFont"] + self.cpp_info.components["freetypefont"].libdirs = [os.path.join(self.package_folder, "lib", "magnum", "fonts")] self.cpp_info.components["freetypefont"].requires = ["magnum::text"] if self.options.with_harfbuzzfont: @@ -238,6 +241,7 @@ def package_info(self): self.cpp_info.components["harfbuzzfont"].names["cmake_find_package_multi"] = "HarfBuzzFont" if not self.options.shared_plugins: self.cpp_info.components["harfbuzzfont"].libs = ["HarfBuzzFont"] + self.cpp_info.components["harfbuzzfont"].libdirs = [os.path.join(self.package_folder, "lib", "magnum", "fonts")] self.cpp_info.components["harfbuzzfont"].requires = ["magnum::text", "harfbuzz::harfbuzz"] if self.options.with_jpegimageconverter: @@ -245,6 +249,7 @@ def package_info(self): self.cpp_info.components["jpegimageconverter"].names["cmake_find_package_multi"] = "JpegImageConverter" if not self.options.shared_plugins: self.cpp_info.components["jpegimageconverter"].libs = ["JpegImageConverter"] + self.cpp_info.components["jpegimageconverter"].libdirs = [os.path.join(self.package_folder, "lib", "magnum", "imageconverters")] self.cpp_info.components["jpegimageconverter"].requires = ["magnum::trade", "libjpeg::libjpeg"] if self.options.with_jpegimporter: @@ -252,6 +257,7 @@ def package_info(self): self.cpp_info.components["jpegimporter"].names["cmake_find_package_multi"] = "JpegImporter" if not self.options.shared_plugins: self.cpp_info.components["jpegimporter"].libs = ["JpegImporter"] + self.cpp_info.components["jpegimporter"].libdirs = [os.path.join(self.package_folder, "lib", "magnum", "importers")] self.cpp_info.components["jpegimporter"].requires = ["magnum::trade", "libjpeg::libjpeg"] if self.options.with_meshoptimizersceneconverter: @@ -259,6 +265,7 @@ def package_info(self): self.cpp_info.components["meshoptimizersceneconverter"].names["cmake_find_package_multi"] = "MeshOptimizerSceneConverter" if not self.options.shared_plugins: self.cpp_info.components["meshoptimizersceneconverter"].libs = ["MeshOptimizerSceneConverter"] + self.cpp_info.components["meshoptimizersceneconverter"].libdirs = [os.path.join(self.package_folder, "lib", "magnum", "sceneconverters")] self.cpp_info.components["meshoptimizersceneconverter"].requires = ["magnum::trade", "magnum::meshtools", "meshoptimizer::meshoptimizer"] if self.options.with_miniexrimageconverter: @@ -266,6 +273,7 @@ def package_info(self): self.cpp_info.components["miniexrimageconverter"].names["cmake_find_package_multi"] = "MiniExrImageConverter" if not self.options.shared_plugins: self.cpp_info.components["miniexrimageconverter"].libs = ["MiniExrImageConverter"] + self.cpp_info.components["miniexrimageconverter"].libdirs = [os.path.join(self.package_folder, "lib", "magnum", "imageconverters")] self.cpp_info.components["miniexrimageconverter"].requires = ["magnum::trade"] if self.options.with_opengeximporter: @@ -273,6 +281,7 @@ def package_info(self): self.cpp_info.components["opengeximporter"].names["cmake_find_package_multi"] = "OpenGexImporter" if not self.options.shared_plugins: self.cpp_info.components["opengeximporter"].libs = ["OpenGexImporter"] + self.cpp_info.components["opengeximporter"].libdirs = [os.path.join(self.package_folder, "lib", "magnum", "importers")] self.cpp_info.components["opengeximporter"].requires = ["magnum::trade", "magnumopenddl"] if not self.options["magnum"].shared_plugins: self.cpp_info.components["opengeximporter"].requires = ["magnum::anyimageimporter"] @@ -282,6 +291,7 @@ def package_info(self): self.cpp_info.components["pngimporter"].names["cmake_find_package_multi"] = "PngImporter" if not self.options.shared_plugins: self.cpp_info.components["pngimporter"].libs = ["PngImporter"] + self.cpp_info.components["pngimporter"].libdirs = [os.path.join(self.package_folder, "lib", "magnum", "importers")] self.cpp_info.components["pngimporter"].requires = ["magnum::trade"] if self.options.with_pngimageconverter: @@ -289,6 +299,7 @@ def package_info(self): self.cpp_info.components["pngimageconverter"].names["cmake_find_package_multi"] = "PngImageConverter" if not self.options.shared_plugins: self.cpp_info.components["pngimageconverter"].libs = ["PngImageConverter"] + self.cpp_info.components["pngimageconverter"].libdirs = [os.path.join(self.package_folder, "lib", "magnum", "imageconverters")] self.cpp_info.components["pngimageconverter"].requires = ["magnum::trade"] if self.options.with_primitiveimporter: @@ -296,6 +307,7 @@ def package_info(self): self.cpp_info.components["primitiveimporter"].names["cmake_find_package_multi"] = "PrimitiveImporter" if not self.options.shared_plugins: self.cpp_info.components["primitiveimporter"].libs = ["PrimitiveImporter"] + self.cpp_info.components["primitiveimporter"].libdirs = [os.path.join(self.package_folder, "lib", "magnum", "importers")] self.cpp_info.components["primitiveimporter"].requires = ["magnum::primitives", "magnum::trade"] if self.options.with_stanfordimporter: @@ -303,6 +315,7 @@ def package_info(self): self.cpp_info.components["stanfordimporter"].names["cmake_find_package_multi"] = "StandfordImporter" if not self.options.shared_plugins: self.cpp_info.components["stanfordimporter"].libs = ["StandfordImporter"] + self.cpp_info.components["stanfordimporter"].libdirs = [os.path.join(self.package_folder, "lib", "magnum", "importers")] self.cpp_info.components["stanfordimporter"].requires = ["magnum::meshtools", "magnum::trade"] if self.options.with_stanfordsceneconverter: @@ -310,6 +323,7 @@ def package_info(self): self.cpp_info.components["stanfordsceneconverter"].names["cmake_find_package_multi"] = "StandfordSceneConverter" if not self.options.shared_plugins: self.cpp_info.components["stanfordsceneconverter"].libs = ["StandfordSceneConverter"] + self.cpp_info.components["stanfordsceneconverter"].libdirs = [os.path.join(self.package_folder, "lib", "magnum", "sceneconverters")] self.cpp_info.components["stanfordsceneconverter"].requires = ["magnum::meshtools", "magnum::trade"] if self.options.with_stbimageconverter: @@ -317,6 +331,7 @@ def package_info(self): self.cpp_info.components["stbimageconverter"].names["cmake_find_package_multi"] = "StbImageConverter" if not self.options.shared_plugins: self.cpp_info.components["stbimageconverter"].libs = ["StbImageConverter"] + self.cpp_info.components["stbimageconverter"].libdirs = [os.path.join(self.package_folder, "lib", "magnum", "imageconverters")] self.cpp_info.components["stbimageconverter"].requires = ["magnum::trade"] if self.options.with_stbimageimporter: @@ -324,6 +339,7 @@ def package_info(self): self.cpp_info.components["stbimageimporter"].names["cmake_find_package_multi"] = "StbImageImporter" if not self.options.shared_plugins: self.cpp_info.components["stbimageimporter"].libs = ["StbImageImporter"] + self.cpp_info.components["stbimageimporter"].libdirs = [os.path.join(self.package_folder, "lib", "magnum", "importers")] self.cpp_info.components["stbimageimporter"].requires = ["magnum::trade"] if self.options.with_stbtruetypefont: @@ -331,6 +347,7 @@ def package_info(self): self.cpp_info.components["stbtruetypefont"].names["cmake_find_package_multi"] = "StbTrueTypeFont" if not self.options.shared_plugins: self.cpp_info.components["stbtruetypefont"].libs = ["StbTrueTypeFont"] + self.cpp_info.components["stbtruetypefont"].libdirs = [os.path.join(self.package_folder, "lib", "magnum", "fonts")] self.cpp_info.components["stbtruetypefont"].requires = ["magnum::text"] if self.options.with_stlimporter: @@ -338,6 +355,7 @@ def package_info(self): self.cpp_info.components["stlimporter"].names["cmake_find_package_multi"] = "StlImporter" if not self.options.shared_plugins: self.cpp_info.components["stlimporter"].libs = ["StlImporter"] + self.cpp_info.components["stlimporter"].libdirs = [os.path.join(self.package_folder, "lib", "magnum", "importers")] self.cpp_info.components["stlimporter"].requires = ["magnum::meshtools", "magnum::trade"] if self.options.with_tinygltfimporter: @@ -345,4 +363,5 @@ def package_info(self): self.cpp_info.components["tinygltfimporter"].names["cmake_find_package_multi"] = "TinyGltfImporter" if not self.options.shared_plugins: self.cpp_info.components["tinygltfimporter"].libs = ["TinyGltfImporter"] + self.cpp_info.components["tinygltfimporter"].libdirs = [os.path.join(self.package_folder, "lib", "magnum", "importers")] self.cpp_info.components["tinygltfimporter"].requires = ["magnum::trade", "magnum::anyimageimporter"] From 4b4341247b401b98364560da7c1388ef9fe34d78 Mon Sep 17 00:00:00 2001 From: jgsogo Date: Mon, 19 Jul 2021 18:27:20 +0200 Subject: [PATCH 43/88] add magum-integration --- recipes/magnum-integration/all/CMakeLists.txt | 10 ++ recipes/magnum-integration/all/conandata.yml | 4 + recipes/magnum-integration/all/conanfile.py | 158 ++++++++++++++++++ recipes/magnum-integration/config.yml | 3 + 4 files changed, 175 insertions(+) create mode 100644 recipes/magnum-integration/all/CMakeLists.txt create mode 100644 recipes/magnum-integration/all/conandata.yml create mode 100644 recipes/magnum-integration/all/conanfile.py create mode 100644 recipes/magnum-integration/config.yml diff --git a/recipes/magnum-integration/all/CMakeLists.txt b/recipes/magnum-integration/all/CMakeLists.txt new file mode 100644 index 0000000000000..a278d77fbf38a --- /dev/null +++ b/recipes/magnum-integration/all/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(cmake_wrapper) + +include(conanbuildinfo.cmake) +conan_basic_setup() + +set(MAGNUM_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/Magnum) +set(MAGNUM_EXTERNAL_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/MagnumExternal) + +add_subdirectory("source_subfolder") diff --git a/recipes/magnum-integration/all/conandata.yml b/recipes/magnum-integration/all/conandata.yml new file mode 100644 index 0000000000000..4634cb503f8ce --- /dev/null +++ b/recipes/magnum-integration/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "2020.06": + url: "https://github.com/mosra/magnum-integration/archive/refs/tags/v2020.06.tar.gz" + sha256: "4eb461e0a38d7be69a52b8faf7664493da4e4cabc2c4fa86bd672d2e8f0a9311" diff --git a/recipes/magnum-integration/all/conanfile.py b/recipes/magnum-integration/all/conanfile.py new file mode 100644 index 0000000000000..998168e6923b1 --- /dev/null +++ b/recipes/magnum-integration/all/conanfile.py @@ -0,0 +1,158 @@ +from conans import ConanFile, CMake, tools +from conans.errors import ConanInvalidConfiguration +import os + +required_conan_version = ">=1.33.0" + + +class MagnumIntegrationConan(ConanFile): + name = "magnum-integration" + description = "Integration libraries for the Magnum C++11/C++14 graphics engine" + license = "MIT" + topics = ("conan", "magnum", "graphics", "rendering", "3d", "2d", "opengl") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://magnum.graphics" + + settings = "os", "compiler", "build_type", "arch" + + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_bullet": [True, False], + "with_dart": [True, False], + "with_eigen": [True, False], + "with_glm": [True, False], + "with_imgui": [True, False], + "with_ovr": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_bullet": True, + "with_dart": False, + "with_eigen": True, + "with_glm": True, + "with_imgui": True, + "with_ovr": False, + } + generators = "cmake", "cmake_find_package" + exports_sources = ["CMakeLists.txt", "patches/*"] + + _cmake = None + + @property + def _source_subfolder(self): + return "source_subfolder" + + def source(self): + tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), + 'set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/modules/" ${CMAKE_MODULE_PATH})', + "") + tools.replace_in_file(os.path.join(self._source_subfolder, "src", "Magnum", "GlmIntegration", "CMakeLists.txt"), + "GLM::GLM", + "glm::glm") + tools.replace_in_file(os.path.join(self._source_subfolder, "src", "Magnum", "ImGuiIntegration", "CMakeLists.txt"), + "ImGui::ImGui", + "imgui::imgui") + tools.replace_in_file(os.path.join(self._source_subfolder, "src", "Magnum", "ImGuiIntegration", "CMakeLists.txt"), + "ImGui::Sources", + "") + + + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + del self.options.fPIC + + def requirements(self): + self.requires("magnum/{}".format(self.version)) + if self.options.with_bullet: + self.requires("bullet3/3.17") + if self.options.with_dart: + raise ConanInvalidConfiguration("DART library is not available in ConanCenter (yet)") + if self.options.with_eigen: + self.requires("eigen/3.3.9") + if self.options.with_glm: + self.requires("glm/0.9.9.8") + if self.options.with_imgui: + self.requires("imgui/1.83") + if self.options.with_ovr: + raise ConanInvalidConfiguration("OVR library is not available in ConanCenter (yet)") + + def _configure_cmake(self): + if self._cmake: + return self._cmake + + self._cmake = CMake(self) + self._cmake.definitions["BUILD_STATIC"] = not self.options.shared + self._cmake.definitions["BUILD_STATIC_PIC"] = self.options.get_safe("fPIC", False) + self._cmake.definitions["BUILD_TESTS"] = False + self._cmake.definitions["BUILD_GL_TESTS"] = False + + self._cmake.definitions["WITH_BULLET"] = self.options.with_bullet + self._cmake.definitions["WITH_DART"] = self.options.with_dart + self._cmake.definitions["WITH_EIGEN"] = self.options.with_eigen + self._cmake.definitions["WITH_GLM"] = self.options.with_glm + self._cmake.definitions["WITH_IMGUI"] = self.options.with_imgui + self._cmake.definitions["WITH_OVR"] = self.options.with_ovr + + self._cmake.configure() + return self._cmake + + def _patch_sources(self): + for patch in self.conan_data.get("patches", {}).get(self.version, []): + tools.patch(**patch) + + def build(self): + self._patch_sources() + + cm = self._configure_cmake() + cm.build() + + def package(self): + cm = self._configure_cmake() + cm.install() + + #tools.rmdir(os.path.join(self.package_folder, "cmake")) + #tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + #tools.rmdir(os.path.join(self.package_folder, "share")) + + self.copy("COPYING", src=self._source_subfolder, dst="licenses") + + def package_info(self): + self.cpp_info.names["cmake_find_package"] = "MagnumIntegration" + self.cpp_info.names["cmake_find_package_multi"] = "MagnumIntegration" + + if self.options.with_bullet: + self.cpp_info.components["bullet"].names["cmake_find_package"] = "Bullet" + self.cpp_info.components["bullet"].names["cmake_find_package_multi"] = "Bullet" + self.cpp_info.components["bullet"].libs = ["MagnumBulletIntegration"] + self.cpp_info.components["bullet"].requires = ["magnum::magnum_main", "magnum::gl", "magnum::scene_graph", "magnum::shaders", "bullet3::bullet3"] + + if self.options.with_dart: + pass + + if self.options.with_eigen: + self.cpp_info.components["eigen"].names["cmake_find_package"] = "Eigen" + self.cpp_info.components["eigen"].names["cmake_find_package_multi"] = "Eigen" + self.cpp_info.components["eigen"].requires = ["magnum::magnum_main", "eigen::eigen"] + + if self.options.with_glm: + self.cpp_info.components["glm"].names["cmake_find_package"] = "Glm" + self.cpp_info.components["glm"].names["cmake_find_package_multi"] = "Glm" + self.cpp_info.components["glm"].libs = ["MagnumGlmIntegration"] + self.cpp_info.components["glm"].requires = ["magnum::magnum_main", "glm::glm"] + + if self.options.with_imgui: + self.cpp_info.components["imgui"].names["cmake_find_package"] = "ImGui" + self.cpp_info.components["imgui"].names["cmake_find_package_multi"] = "ImGui" + self.cpp_info.components["imgui"].libs = ["MagnumImGuiIntegration"] + self.cpp_info.components["imgui"].requires = ["magnum::magnum_main", "magnum::gl", "magnum::shaders", "imgui::imgui"] + + if self.options.with_ovr: + pass diff --git a/recipes/magnum-integration/config.yml b/recipes/magnum-integration/config.yml new file mode 100644 index 0000000000000..93230781a72ea --- /dev/null +++ b/recipes/magnum-integration/config.yml @@ -0,0 +1,3 @@ +versions: + "2020.06": + folder: all From 1571b8b73ff78cad35f3b5c6ae7e2cd76ef7252b Mon Sep 17 00:00:00 2001 From: jgsogo Date: Mon, 19 Jul 2021 18:41:39 +0200 Subject: [PATCH 44/88] typo on components --- recipes/magnum-integration/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/magnum-integration/all/conanfile.py b/recipes/magnum-integration/all/conanfile.py index 998168e6923b1..7c57f3a44fad1 100644 --- a/recipes/magnum-integration/all/conanfile.py +++ b/recipes/magnum-integration/all/conanfile.py @@ -132,7 +132,7 @@ def package_info(self): self.cpp_info.components["bullet"].names["cmake_find_package"] = "Bullet" self.cpp_info.components["bullet"].names["cmake_find_package_multi"] = "Bullet" self.cpp_info.components["bullet"].libs = ["MagnumBulletIntegration"] - self.cpp_info.components["bullet"].requires = ["magnum::magnum_main", "magnum::gl", "magnum::scene_graph", "magnum::shaders", "bullet3::bullet3"] + self.cpp_info.components["bullet"].requires = ["magnum::magnum_main", "magnum::gl", "magnum::scenegraph", "magnum::shaders", "bullet3::bullet3"] if self.options.with_dart: pass From 46f7984cffd76fd0eaab7c17d1c340943b05a981 Mon Sep 17 00:00:00 2001 From: jgsogo Date: Mon, 19 Jul 2021 19:04:43 +0200 Subject: [PATCH 45/88] add glcontext comp --- recipes/magnum/all/conanfile.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/recipes/magnum/all/conanfile.py b/recipes/magnum/all/conanfile.py index 1cce29d3413c7..911866a2c354e 100644 --- a/recipes/magnum/all/conanfile.py +++ b/recipes/magnum/all/conanfile.py @@ -32,6 +32,8 @@ class MagnumConan(ConanFile): "with_trade": [True, False], "with_vk": [True, False], + "with_cglcontext": [True, False], + # Options related to plugins "shared_plugins": [True, False], # WITH_ANYAUDIOIMPORTER @@ -63,6 +65,8 @@ class MagnumConan(ConanFile): "with_trade": True, "with_vk": False, + "with_cglcontext": True, + "shared_plugins": True, "with_anyimageimporter": True, "with_anyimageconverter": True, @@ -92,6 +96,8 @@ def source(self): def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if self.settings.os != "Macos": + del self.options.with_cglcontext def configure(self): if self.options.shared: @@ -115,6 +121,9 @@ def validate(self): if self.options.with_magnumfontconverter and not self.options.with_tgaimageconverter: raise ConanInvalidConfiguration("magnumfontconverter requires tgaimageconverter") + if self.options.get_safe("with_cglcontext", False) and not self.options.with_gl: + raise ConanInvalidConfiguration("Option 'with_cglcontext' requires option 'with_gl'") + def _configure_cmake(self): if self._cmake: return self._cmake @@ -139,6 +148,8 @@ def _configure_cmake(self): self._cmake.definitions["WITH_TRADE"] = self.options.with_trade self._cmake.definitions["WITH_VK"] = self.options.with_vk + self._cmake.definitions["WITH_CGLCONTEXT"] = self.options.get_safe("with_cglcontext", False) + ##### Plugins related ##### self._cmake.definitions["BUILD_PLUGINS_STATIC"] = not self.options.shared_plugins self._cmake.definitions["WITH_ANYIMAGEIMPORTER"] = self.options.with_anyimageimporter @@ -274,8 +285,19 @@ def package_info(self): # VK # TODO: target here, disabled by default + if self.options.with_cglcontext: + self.cpp_info.components["cglcontext"].names["cmake_find_package"] = "CglContext" + self.cpp_info.components["cglcontext"].names["cmake_find_package_multi"] = "CglContext" + self.cpp_info.components["cglcontext"].libs = ["MagnumCglContext"] + self.cpp_info.components["cglcontext"].requires = ["magnum_main", "gl"] + + # FIXME: If only one *context is provided, then it also gets the GLContext alias + self.cpp_info.components["glcontext"].names["cmake_find_package"] = "GLContext" + self.cpp_info.components["glcontext"].names["cmake_find_package_multi"] = "GLContext" + self.cpp_info.components["glcontext"].requires = ["cglcontext"] + ######## PLUGINS ######## - # TODO: If shared, there are no libraries to link with + # If shared, there are no libraries to link with if self.options.with_anyimageimporter: self.cpp_info.components["anyimageimporter"].names["cmake_find_package"] = "AnyImageImporter" self.cpp_info.components["anyimageimporter"].names["cmake_find_package_multi"] = "AnyImageImporter" From df4b0117bdbbcf4cf89c411808a32f605a2adeab Mon Sep 17 00:00:00 2001 From: jgsogo Date: Tue, 20 Jul 2021 23:07:30 +0200 Subject: [PATCH 46/88] add magnum-extras --- recipes/magnum-extras/all/CMakeLists.txt | 10 +++ recipes/magnum-extras/all/conandata.yml | 4 + recipes/magnum-extras/all/conanfile.py | 109 +++++++++++++++++++++++ recipes/magnum-extras/config.yml | 3 + 4 files changed, 126 insertions(+) create mode 100644 recipes/magnum-extras/all/CMakeLists.txt create mode 100644 recipes/magnum-extras/all/conandata.yml create mode 100644 recipes/magnum-extras/all/conanfile.py create mode 100644 recipes/magnum-extras/config.yml diff --git a/recipes/magnum-extras/all/CMakeLists.txt b/recipes/magnum-extras/all/CMakeLists.txt new file mode 100644 index 0000000000000..046d5c62ad057 --- /dev/null +++ b/recipes/magnum-extras/all/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(cmake_wrapper) + +include(conanbuildinfo.cmake) +conan_basic_setup() + +set(MAGNUM_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/Magnum) +#set(MAGNUM_EXTERNAL_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/MagnumExternal) + +add_subdirectory("source_subfolder") diff --git a/recipes/magnum-extras/all/conandata.yml b/recipes/magnum-extras/all/conandata.yml new file mode 100644 index 0000000000000..59cf467992abc --- /dev/null +++ b/recipes/magnum-extras/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "2020.06": + url: "https://github.com/mosra/magnum-extras/archive/refs/tags/v2020.06.tar.gz" + sha256: "a8d7babc50ac070984d39f6cc15c3ce2af7b41fe980fe81b0405da6f5ba3c36d" diff --git a/recipes/magnum-extras/all/conanfile.py b/recipes/magnum-extras/all/conanfile.py new file mode 100644 index 0000000000000..8f4faa30329bb --- /dev/null +++ b/recipes/magnum-extras/all/conanfile.py @@ -0,0 +1,109 @@ +from conans import ConanFile, CMake, tools +from conans.errors import ConanInvalidConfiguration +import os + +required_conan_version = ">=1.33.0" + + +class MagnumExtrasConan(ConanFile): + name = "magnum-extras" + description = "Extras for the Magnum C++11/C++14 graphics engine" + license = "MIT" + topics = ("conan", "magnum", "graphics", "rendering", "3d", "2d", "opengl") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://magnum.graphics" + + settings = "os", "compiler", "build_type", "arch" + + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_player": [True, False], + "with_ui": [True, False], + "with_ui_gallery": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_player": True, + "with_ui": True, + "with_ui_gallery": True, + } + generators = "cmake", "cmake_find_package" + exports_sources = ["CMakeLists.txt", "patches/*"] + + _cmake = None + + @property + def _source_subfolder(self): + return "source_subfolder" + + def source(self): + tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), + 'set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/modules/" ${CMAKE_MODULE_PATH})', + "") + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + del self.options.fPIC + + def requirements(self): + self.requires("magnum/{}".format(self.version)) + self.requires("corrade/{}".format(self.version)) + + def _configure_cmake(self): + if self._cmake: + return self._cmake + + self._cmake = CMake(self) + self._cmake.definitions["BUILD_STATIC"] = not self.options.shared + self._cmake.definitions["BUILD_STATIC_PIC"] = self.options.get_safe("fPIC", False) + self._cmake.definitions["BUILD_TESTS"] = False + self._cmake.definitions["BUILD_GL_TESTS"] = False + + self._cmake.definitions["WITH_PLAYER"] = self.options.with_player + self._cmake.definitions["WITH_UI"] = self.options.with_ui + self._cmake.definitions["WITH_UI_GALLERY"] = self.options.with_ui_gallery + + self._cmake.configure() + return self._cmake + + def _patch_sources(self): + for patch in self.conan_data.get("patches", {}).get(self.version, []): + tools.patch(**patch) + + def build(self): + self._patch_sources() + + cm = self._configure_cmake() + cm.build() + + def package(self): + cm = self._configure_cmake() + cm.install() + + #tools.rmdir(os.path.join(self.package_folder, "cmake")) + #tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + #tools.rmdir(os.path.join(self.package_folder, "share")) + + self.copy("COPYING", src=self._source_subfolder, dst="licenses") + + def package_info(self): + self.cpp_info.names["cmake_find_package"] = "MagnumExtras" + self.cpp_info.names["cmake_find_package_multi"] = "MagnumExtras" + + if self.options.with_ui: + self.cpp_info.components["ui"].names["cmake_find_package"] = "Ui" + self.cpp_info.components["ui"].names["cmake_find_package_multi"] = "Ui" + self.cpp_info.components["ui"].libs = ["MagnumUi"] + self.cpp_info.components["ui"].requires = ["corrade::interconnect", "magnum::magnum_main", "magnum::gl", "magnum::test"] + + if self.options.with_player or self.options.with_ui_gallery: + bin_path = os.path.join(self.package_folder, "bin") + self.output.info('Appending PATH environment variable: %s' % bin_path) + self.env_info.path.append(bin_path) diff --git a/recipes/magnum-extras/config.yml b/recipes/magnum-extras/config.yml new file mode 100644 index 0000000000000..93230781a72ea --- /dev/null +++ b/recipes/magnum-extras/config.yml @@ -0,0 +1,3 @@ +versions: + "2020.06": + folder: all From d9f0dab1872088e85be732d4fd67538ff4a02b7e Mon Sep 17 00:00:00 2001 From: jgsogo Date: Tue, 20 Jul 2021 23:22:09 +0200 Subject: [PATCH 47/88] typo --- recipes/magnum-extras/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/magnum-extras/all/conanfile.py b/recipes/magnum-extras/all/conanfile.py index 8f4faa30329bb..742d16e5f78e0 100644 --- a/recipes/magnum-extras/all/conanfile.py +++ b/recipes/magnum-extras/all/conanfile.py @@ -101,7 +101,7 @@ def package_info(self): self.cpp_info.components["ui"].names["cmake_find_package"] = "Ui" self.cpp_info.components["ui"].names["cmake_find_package_multi"] = "Ui" self.cpp_info.components["ui"].libs = ["MagnumUi"] - self.cpp_info.components["ui"].requires = ["corrade::interconnect", "magnum::magnum_main", "magnum::gl", "magnum::test"] + self.cpp_info.components["ui"].requires = ["corrade::interconnect", "magnum::magnum_main", "magnum::gl", "magnum::text"] if self.options.with_player or self.options.with_ui_gallery: bin_path = os.path.join(self.package_folder, "bin") From 6d51c9df0b0c11e886ba39fd58030990a5b12757 Mon Sep 17 00:00:00 2001 From: jgsogo Date: Tue, 20 Jul 2021 23:51:49 +0200 Subject: [PATCH 48/88] vk component --- recipes/magnum/all/conanfile.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/recipes/magnum/all/conanfile.py b/recipes/magnum/all/conanfile.py index 911866a2c354e..898e37c460b99 100644 --- a/recipes/magnum/all/conanfile.py +++ b/recipes/magnum/all/conanfile.py @@ -63,7 +63,7 @@ class MagnumConan(ConanFile): "with_text": True, "with_texturetools": True, "with_trade": True, - "with_vk": False, + "with_vk": True, "with_cglcontext": True, @@ -109,6 +109,8 @@ def requirements(self): self.requires("opengl/system") if self.options.sdl2_application: self.requires("sdl/2.0.14") + if self.options.with_vk: + self.requires("vulkan-loader/1.2.182") def build_requirements(self): self.build_requires("corrade/{}".format(self.version)) @@ -283,7 +285,11 @@ def package_info(self): self.cpp_info.components["trade"].requires = ["magnum_main", "corrade::plugin_manager"] # VK - # TODO: target here, disabled by default + if self.options.with_vk: + self.cpp_info.components["vk"].names["cmake_find_package"] = "Vk" + self.cpp_info.components["vk"].names["cmake_find_package_multi"] = "Vk" + self.cpp_info.components["vk"].libs = ["MagnumVk"] + self.cpp_info.components["vk"].requires = ["magnum_main", "vulkan-loader::vulkan-loader"] if self.options.with_cglcontext: self.cpp_info.components["cglcontext"].names["cmake_find_package"] = "CglContext" From bfffb8d52d258a29e05180c57e34313f7f6945c0 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Fri, 13 Aug 2021 02:09:10 +0200 Subject: [PATCH 49/88] emsdk: bump to 2.0.26 + always run test package --- recipes/emsdk/all/conandata.yml | 6 +- recipes/emsdk/all/conanfile.py | 92 ++++++++++--------- recipes/emsdk/all/test_package/CMakeLists.txt | 12 ++- recipes/emsdk/all/test_package/conanfile.py | 32 ++++--- .../emsdk/all/test_package/test_package.cpp | 2 +- recipes/emsdk/config.yml | 2 +- 6 files changed, 80 insertions(+), 66 deletions(-) diff --git a/recipes/emsdk/all/conandata.yml b/recipes/emsdk/all/conandata.yml index cd0a6b105e6eb..e24b73179c01f 100644 --- a/recipes/emsdk/all/conandata.yml +++ b/recipes/emsdk/all/conandata.yml @@ -1,4 +1,4 @@ sources: - 2.0.10: - url: https://github.com/emscripten-core/emsdk/archive/refs/tags/2.0.10.tar.gz - sha256: 297b7dc39eba6757e4b280254129ebac05dab6a65d96d77eaab1d67ef5e7338a + 2.0.26: + url: "https://github.com/emscripten-core/emsdk/archive/refs/tags/2.0.26.tar.gz" + sha256: "79e7166aa8eaae6e52cef1363b2d8db795d03684846066bc51f9dcf905dd58ad" diff --git a/recipes/emsdk/all/conanfile.py b/recipes/emsdk/all/conanfile.py index 33496f02602a1..55ae74a51ef69 100644 --- a/recipes/emsdk/all/conanfile.py +++ b/recipes/emsdk/all/conanfile.py @@ -1,4 +1,5 @@ from conans import ConanFile, tools +from conans.errors import ConanInvalidConfiguration import os required_conan_version = ">=1.33.0" @@ -15,10 +16,15 @@ class EmSDKConan(ConanFile): short_paths = True - @ property + @property def _source_subfolder(self): return "source_subfolder" + def validate(self): + if hasattr(self, "settings_target") and self.settings_target: + if self.settings_target.os != "Emscripten": + raise ConanInvalidConfiguration("When using {}, target os must be Emscripten".format(self.name)) + def package_id(self): del self.info.settings.os @@ -26,43 +32,34 @@ def source(self): tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) - @ staticmethod - def _create_dummy_file(directory): - tools.save(os.path.join(directory, "dummy"), "\n") - - @ staticmethod - def _touch(filename): - if not os.path.isfile(filename): - tools.save(filename, "\n") - - @ staticmethod + @staticmethod def _chmod_plus_x(filename): - if os.name == 'posix': + if os.name == "posix": os.chmod(filename, os.stat(filename).st_mode | 0o111) def build(self): with tools.chdir(self._source_subfolder): - emsdk = 'emsdk.bat' if os.name == 'nt' else './emsdk' + emsdk = "emsdk.bat" if tools.os_info.is_windows else "./emsdk" if os.path.isfile("python_selector"): self._chmod_plus_x("python_selector") - self._chmod_plus_x('emsdk') - self.run('%s update' % emsdk) + self._chmod_plus_x("emsdk") + self.run("%s update" % emsdk) if os.path.isfile("python_selector"): self._chmod_plus_x("python_selector") - self._chmod_plus_x('emsdk') + self._chmod_plus_x("emsdk") - self.run('%s install %s' % (emsdk, self.version)) - self.run('%s activate %s --embedded' % (emsdk, self.version)) + self.run("%s install %s" % (emsdk, self.version)) + self.run("%s activate %s --embedded" % (emsdk, self.version)) def package(self): self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - self.copy(pattern='*', dst='bin', - src=self._source_subfolder, excludes=('*.pc', '*Find*.cmake')) - emsdk = self.package_folder - emscripten = os.path.join(emsdk, 'bin', 'upstream', 'emscripten') + self.copy(pattern="*", dst="bin", + src=self._source_subfolder) + emscripten = os.path.join(self.package_folder, "bin", "upstream", "emscripten") toolchain = os.path.join( - emscripten, 'cmake', 'Modules', 'Platform', 'Emscripten.cmake') + emscripten, "cmake", "Modules", "Platform", "Emscripten.cmake") + # FIXME: conan should add the root of conan package requirements to CMAKE_PREFIX_PATH (LIBRARY/INCLUDE -> ONLY; PROGRAM -> NEVER) # allow to find conan libraries tools.replace_in_file(toolchain, "set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)", @@ -75,50 +72,57 @@ def package(self): "set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH)") def _define_tool_var(self, name, value): - suffix = '.bat' if self.settings.os == "Windows" else '' - path = os.path.join(self.package_folder, 'bin', 'upstream', - 'emscripten', '%s%s' % (value, suffix)) + suffix = ".bat" if self.settings.os == "Windows" else "" + path = os.path.join(self.package_folder, "bin", "upstream", + "emscripten", "%s%s" % (value, suffix)) self._chmod_plus_x(path) - self.output.info('Creating %s environment variable: %s' % (name, path)) + self.output.info("Creating %s environment variable: %s" % (name, path)) return path def package_info(self): emsdk = self.package_folder - em_config = os.path.join(emsdk, 'bin', '.emscripten') - emscripten = os.path.join(emsdk, 'bin', 'upstream', 'emscripten') - em_cache = os.path.join(emsdk, 'bin', '.emscripten_cache') + em_config = os.path.join(emsdk, "bin", ".emscripten") + emscripten = os.path.join(emsdk, "bin", "upstream", "emscripten") + em_cache = os.path.join(emsdk, "bin", ".emscripten_cache") toolchain = os.path.join( - emscripten, 'cmake', 'Modules', 'Platform', 'Emscripten.cmake') + emscripten, "cmake", "Modules", "Platform", "Emscripten.cmake") - self.output.info('Appending PATH environment variable: %s' % emsdk) + self.output.info("Appending PATH environment variable: %s" % emsdk) self.env_info.PATH.append(emsdk) self.output.info( - 'Appending PATH environment variable: %s' % emscripten) + "Appending PATH environment variable: %s" % emscripten) self.env_info.PATH.append(emscripten) - self.output.info('Creating EMSDK environment variable: %s' % emsdk) + self.output.info("Creating EMSDK environment variable: %s" % emsdk) self.env_info.EMSDK = emsdk self.output.info( - 'Creating EMSCRIPTEN environment variable: %s' % emscripten) + "Creating EMSCRIPTEN environment variable: %s" % emscripten) self.env_info.EMSCRIPTEN = emscripten self.output.info( - 'Creating EM_CONFIG environment variable: %s' % em_config) + "Creating EM_CONFIG environment variable: %s" % em_config) self.env_info.EM_CONFIG = em_config self.output.info( - 'Creating EM_CACHE environment variable: %s' % em_cache) + "Creating EM_CACHE environment variable: %s" % em_cache) self.env_info.EM_CACHE = em_cache self.output.info( - 'Creating CONAN_CMAKE_TOOLCHAIN_FILE environment variable: %s' % toolchain) + "Creating CONAN_CMAKE_TOOLCHAIN_FILE environment variable: %s" % toolchain) self.env_info.CONAN_CMAKE_TOOLCHAIN_FILE = toolchain - self.env_info.CC = self._define_tool_var('CC', 'emcc') - self.env_info.CXX = self._define_tool_var('CXX', 'em++') - self.env_info.RANLIB = self._define_tool_var('RANLIB', 'emranlib') - self.env_info.AR = self._define_tool_var('AR', 'emar') - self.cpp_info.builddirs = ['bin/releases/src/', 'bin/upstream/emscripten/cmake/Modules/', 'bin/upstream/emscripten/cmake/Modules/Platform/', 'bin/upstream/emscripten/system/lib/libunwind/cmake/Modules/', - 'bin/upstream/emscripten/system/lib/libunwind/cmake/', 'bin/upstream/emscripten/tests/cmake/target_library/', 'bin/upstream/lib/cmake/llvm/'] + self.env_info.CC = self._define_tool_var("CC", "emcc") + self.env_info.CXX = self._define_tool_var("CXX", "em++") + self.env_info.RANLIB = self._define_tool_var("RANLIB", "emranlib") + self.env_info.AR = self._define_tool_var("AR", "emar") + self.cpp_info.builddirs = [ + "bin/releases/src", + "bin/upstream/emscripten/cmake/Modules", + "bin/upstream/emscripten/cmake/Modules/Platform", + "bin/upstream/emscripten/system/lib/libunwind/cmake/Modules", + "bin/upstream/emscripten/system/lib/libunwind/cmake", + "bin/upstream/emscripten/tests/cmake/target_library", + "bin/upstream/lib/cmake/llvm", + ] diff --git a/recipes/emsdk/all/test_package/CMakeLists.txt b/recipes/emsdk/all/test_package/CMakeLists.txt index f4915287d39a2..ed8c3d87f829d 100644 --- a/recipes/emsdk/all/test_package/CMakeLists.txt +++ b/recipes/emsdk/all/test_package/CMakeLists.txt @@ -1,10 +1,14 @@ cmake_minimum_required(VERSION 3.18.2) project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - +option(USE_CONANBUILDINFO "Use conanbuildinfo.cmake") + +if(USE_CONANBUILDINFO) + include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) + conan_basic_setup() +else() + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY bin) +endif() add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) diff --git a/recipes/emsdk/all/test_package/conanfile.py b/recipes/emsdk/all/test_package/conanfile.py index 61730675f7523..a16bbd4c61bbd 100644 --- a/recipes/emsdk/all/test_package/conanfile.py +++ b/recipes/emsdk/all/test_package/conanfile.py @@ -1,24 +1,30 @@ -from conans import ConanFile, CMake, tools, RunEnvironment +from conans import ConanFile, CMake, tools import os required_conan_version = ">=1.36.0" class TestPackageConan(ConanFile): - settings = "os", "build_type", "arch", "compiler" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" test_type = "build_requires" + generators = "cmake" + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + def build_requirements(self): + if self._settings_build.os == "Windows": + self.build_requires("make/4.3") def build(self): - if self.settings.os == "Emscripten": - cmake = CMake(self, generator='MinGW Makefiles' if os.name == - 'nt' else 'Unix Makefiles', parallel=False) - cmake.definitions["CONAN_DISABLE_CHECK_COMPILER"] = True - cmake.configure() - cmake.build() + cmake = CMake(self, generator="Unix Makefiles") + cmake.definitions["USE_CONANBUILDINFO"] = self.settings.os == "Emscripten" + cmake.configure() + cmake.build() def test(self): - if self.settings.os == "Emscripten": - test_file = os.path.join( - self.build_folder, "bin", "test_package.js") - self.run('node %s' % test_file, run_environment=True) + test_file = os.path.join("bin", "test_package.js") + assert os.path.isfile(test_file) + if tools.which("node"): + self.run("node %s" % test_file, run_environment=True) diff --git a/recipes/emsdk/all/test_package/test_package.cpp b/recipes/emsdk/all/test_package/test_package.cpp index b3ea0727337e4..dc0f143f2972b 100644 --- a/recipes/emsdk/all/test_package/test_package.cpp +++ b/recipes/emsdk/all/test_package/test_package.cpp @@ -3,6 +3,6 @@ int main() { - std::cout << "Bincrafters\n"; + std::cout << "conan-center-index\n"; return EXIT_SUCCESS; } diff --git a/recipes/emsdk/config.yml b/recipes/emsdk/config.yml index 4cc5ca08ec8be..6594c45d81c7c 100644 --- a/recipes/emsdk/config.yml +++ b/recipes/emsdk/config.yml @@ -1,3 +1,3 @@ versions: - "2.0.10": + "2.0.26": folder: all From 19e700d0804b11a9d943780e915823a7664ceb9e Mon Sep 17 00:00:00 2001 From: werto87 Date: Fri, 13 Aug 2021 09:46:50 +0200 Subject: [PATCH 50/88] remove package id --- recipes/emsdk/all/conanfile.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/recipes/emsdk/all/conanfile.py b/recipes/emsdk/all/conanfile.py index 33496f02602a1..8ea052c20ef01 100644 --- a/recipes/emsdk/all/conanfile.py +++ b/recipes/emsdk/all/conanfile.py @@ -19,9 +19,6 @@ class EmSDKConan(ConanFile): def _source_subfolder(self): return "source_subfolder" - def package_id(self): - del self.info.settings.os - def source(self): tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) From 83ace2ec421cec81538939a9c1a14d44d1a30c53 Mon Sep 17 00:00:00 2001 From: werto87 Date: Sat, 14 Aug 2021 21:02:54 +0200 Subject: [PATCH 51/88] do not copy forbiden files --- recipes/emsdk/all/conanfile.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/recipes/emsdk/all/conanfile.py b/recipes/emsdk/all/conanfile.py index 8ea052c20ef01..578389fbe4e85 100644 --- a/recipes/emsdk/all/conanfile.py +++ b/recipes/emsdk/all/conanfile.py @@ -55,7 +55,9 @@ def package(self): self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) self.copy(pattern='*', dst='bin', - src=self._source_subfolder, excludes=('*.pc', '*Find*.cmake')) + src=self._source_subfolder, excludes=('*.pc', '*Find*.cmake', '*Box2DConfig.cmake', '*CTestConfig.cmake', + '*concrt140.dll', '*msvcr100.dll', '*concrt140d.dll', '*msvcp140.dll', '*msvcp140d.dll', '*vcruntime140.dll', + '*vcruntime140_1.dll', '*vcruntime140_1d.dll', '*vcruntime140d.dl')) emsdk = self.package_folder emscripten = os.path.join(emsdk, 'bin', 'upstream', 'emscripten') toolchain = os.path.join( From da299742d38508831da77e0efbd549b661b2e922 Mon Sep 17 00:00:00 2001 From: werto87 Date: Sat, 14 Aug 2021 21:28:12 +0200 Subject: [PATCH 52/88] only coppy allowed files --- recipes/emsdk/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/emsdk/all/conanfile.py b/recipes/emsdk/all/conanfile.py index 578389fbe4e85..a6e8711010761 100644 --- a/recipes/emsdk/all/conanfile.py +++ b/recipes/emsdk/all/conanfile.py @@ -57,7 +57,7 @@ def package(self): self.copy(pattern='*', dst='bin', src=self._source_subfolder, excludes=('*.pc', '*Find*.cmake', '*Box2DConfig.cmake', '*CTestConfig.cmake', '*concrt140.dll', '*msvcr100.dll', '*concrt140d.dll', '*msvcp140.dll', '*msvcp140d.dll', '*vcruntime140.dll', - '*vcruntime140_1.dll', '*vcruntime140_1d.dll', '*vcruntime140d.dl')) + '*vcruntime140_1.dll', '*vcruntime140_1d.dll', '*vcruntime140d.dl', '*vcruntime140d.dll')) emsdk = self.package_folder emscripten = os.path.join(emsdk, 'bin', 'upstream', 'emscripten') toolchain = os.path.join( From 0c87f09107da549444740aecbe56af1d12ed5859 Mon Sep 17 00:00:00 2001 From: werto87 Date: Sat, 14 Aug 2021 21:52:17 +0200 Subject: [PATCH 53/88] added arch as setting --- recipes/emsdk/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/emsdk/all/conanfile.py b/recipes/emsdk/all/conanfile.py index a6e8711010761..f6066d77531a8 100644 --- a/recipes/emsdk/all/conanfile.py +++ b/recipes/emsdk/all/conanfile.py @@ -11,7 +11,7 @@ class EmSDKConan(ConanFile): homepage = "https://github.com/kripken/emscripten" topics = ("conan", "emsdk", "emscripten", "sdk") license = "MIT" - settings = "os" + settings = "os", "arch" short_paths = True From d8b727221c24d1e8b97f1f3018408b2560c4fed8 Mon Sep 17 00:00:00 2001 From: werto87 Date: Sat, 14 Aug 2021 22:47:46 +0200 Subject: [PATCH 54/88] only allow arch wasm --- recipes/emsdk/all/conanfile.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/recipes/emsdk/all/conanfile.py b/recipes/emsdk/all/conanfile.py index f6066d77531a8..b2d63e139398c 100644 --- a/recipes/emsdk/all/conanfile.py +++ b/recipes/emsdk/all/conanfile.py @@ -1,5 +1,6 @@ from conans import ConanFile, tools import os +from conans.errors import ConanInvalidConfiguration required_conan_version = ">=1.33.0" @@ -15,6 +16,11 @@ class EmSDKConan(ConanFile): short_paths = True + def validate(self): + if self.settings.arch != "wasm": + raise ConanInvalidConfiguration( + "host arch should be wasm") + @ property def _source_subfolder(self): return "source_subfolder" From ef7fbefb51fda3d85d93abc1a02106483a1820b2 Mon Sep 17 00:00:00 2001 From: werto87 Date: Sun, 15 Aug 2021 00:00:50 +0200 Subject: [PATCH 55/88] build target arch should be wasm or asm.js --- recipes/emsdk/all/conanfile.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/recipes/emsdk/all/conanfile.py b/recipes/emsdk/all/conanfile.py index b2d63e139398c..3a0263f5fc30a 100644 --- a/recipes/emsdk/all/conanfile.py +++ b/recipes/emsdk/all/conanfile.py @@ -17,9 +17,10 @@ class EmSDKConan(ConanFile): short_paths = True def validate(self): - if self.settings.arch != "wasm": - raise ConanInvalidConfiguration( - "host arch should be wasm") + if hasattr(self, "settings_target"): + if ['wasm', 'asm.js'].count(self.settings.arch) == 0: + raise ConanInvalidConfiguration( + "Emscripten targets only arch=wasm or arch=asm.js, not {}.".format(self.settings_target.arch)) @ property def _source_subfolder(self): From d04ab6563a0a7a1db1f527804f1170469d211630 Mon Sep 17 00:00:00 2001 From: werto87 Date: Sun, 15 Aug 2021 00:09:08 +0200 Subject: [PATCH 56/88] mark m1 as invalid config --- recipes/emsdk/all/conanfile.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/recipes/emsdk/all/conanfile.py b/recipes/emsdk/all/conanfile.py index 3a0263f5fc30a..53765b2e09726 100644 --- a/recipes/emsdk/all/conanfile.py +++ b/recipes/emsdk/all/conanfile.py @@ -21,6 +21,10 @@ def validate(self): if ['wasm', 'asm.js'].count(self.settings.arch) == 0: raise ConanInvalidConfiguration( "Emscripten targets only arch=wasm or arch=asm.js, not {}.".format(self.settings_target.arch)) + if hasattr(self, "settings_build"): + if self.settings.arch == "armv8" and self.settings.settings_build.arch == "x86_64": + raise ConanInvalidConfiguration( + "Apple M1 currently not supported") @ property def _source_subfolder(self): From e97c334b95a4e07626df948834e4fa548a9e7eb3 Mon Sep 17 00:00:00 2001 From: werto87 Date: Sun, 15 Aug 2021 00:23:03 +0200 Subject: [PATCH 57/88] trying to disable m1 --- recipes/emsdk/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/emsdk/all/conanfile.py b/recipes/emsdk/all/conanfile.py index 53765b2e09726..1dec068b8b5a2 100644 --- a/recipes/emsdk/all/conanfile.py +++ b/recipes/emsdk/all/conanfile.py @@ -17,7 +17,7 @@ class EmSDKConan(ConanFile): short_paths = True def validate(self): - if hasattr(self, "settings_target"): + if hasattr(self, "settings_target.arch"): if ['wasm', 'asm.js'].count(self.settings.arch) == 0: raise ConanInvalidConfiguration( "Emscripten targets only arch=wasm or arch=asm.js, not {}.".format(self.settings_target.arch)) From 1dfd5a48164513ab2446bf8c889d9e78bc245aa9 Mon Sep 17 00:00:00 2001 From: werto87 Date: Sun, 15 Aug 2021 00:37:21 +0200 Subject: [PATCH 58/88] trying to fix m1 --- recipes/emsdk/all/conanfile.py | 10 +++++----- recipes/emsdk/all/test_package/conanfile.py | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/recipes/emsdk/all/conanfile.py b/recipes/emsdk/all/conanfile.py index 1dec068b8b5a2..b772c7c238427 100644 --- a/recipes/emsdk/all/conanfile.py +++ b/recipes/emsdk/all/conanfile.py @@ -17,14 +17,14 @@ class EmSDKConan(ConanFile): short_paths = True def validate(self): - if hasattr(self, "settings_target.arch"): + if hasattr(self, "settings_target"): if ['wasm', 'asm.js'].count(self.settings.arch) == 0: raise ConanInvalidConfiguration( "Emscripten targets only arch=wasm or arch=asm.js, not {}.".format(self.settings_target.arch)) - if hasattr(self, "settings_build"): - if self.settings.arch == "armv8" and self.settings.settings_build.arch == "x86_64": - raise ConanInvalidConfiguration( - "Apple M1 currently not supported") + # if hasattr(self, "settings_build"): + # if self.settings.arch == "armv8" and self.settings_build.arch == "x86_64": + # raise ConanInvalidConfiguration( + # "Apple M1 currently not supported") @ property def _source_subfolder(self): diff --git a/recipes/emsdk/all/test_package/conanfile.py b/recipes/emsdk/all/test_package/conanfile.py index 61730675f7523..dd3f86381cf97 100644 --- a/recipes/emsdk/all/test_package/conanfile.py +++ b/recipes/emsdk/all/test_package/conanfile.py @@ -7,7 +7,6 @@ class TestPackageConan(ConanFile): settings = "os", "build_type", "arch", "compiler" generators = "cmake" - test_type = "build_requires" def build(self): if self.settings.os == "Emscripten": From a6193341a8ed5cb55049d03436547411cd759d49 Mon Sep 17 00:00:00 2001 From: werto87 Date: Sun, 15 Aug 2021 00:46:32 +0200 Subject: [PATCH 59/88] m1 --- recipes/emsdk/all/conanfile.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/recipes/emsdk/all/conanfile.py b/recipes/emsdk/all/conanfile.py index b772c7c238427..e5c9c32e97050 100644 --- a/recipes/emsdk/all/conanfile.py +++ b/recipes/emsdk/all/conanfile.py @@ -16,16 +16,6 @@ class EmSDKConan(ConanFile): short_paths = True - def validate(self): - if hasattr(self, "settings_target"): - if ['wasm', 'asm.js'].count(self.settings.arch) == 0: - raise ConanInvalidConfiguration( - "Emscripten targets only arch=wasm or arch=asm.js, not {}.".format(self.settings_target.arch)) - # if hasattr(self, "settings_build"): - # if self.settings.arch == "armv8" and self.settings_build.arch == "x86_64": - # raise ConanInvalidConfiguration( - # "Apple M1 currently not supported") - @ property def _source_subfolder(self): return "source_subfolder" From 6a8d64f6e4a1bafb63accf356ba19c4d00a722d2 Mon Sep 17 00:00:00 2001 From: "Javier G. Sogo" Date: Fri, 20 Aug 2021 22:24:58 +0200 Subject: [PATCH 60/88] discard changes for corrade --- .../all/cmake/conan-corrade-vars.cmake | 61 -------- recipes/corrade/all/conanfile.py | 139 ++++++++---------- .../corrade/all/test_package/CMakeLists.txt | 6 +- recipes/corrade/all/test_package/conanfile.py | 8 +- 4 files changed, 71 insertions(+), 143 deletions(-) delete mode 100644 recipes/corrade/all/cmake/conan-corrade-vars.cmake diff --git a/recipes/corrade/all/cmake/conan-corrade-vars.cmake b/recipes/corrade/all/cmake/conan-corrade-vars.cmake deleted file mode 100644 index c098a20adb237..0000000000000 --- a/recipes/corrade/all/cmake/conan-corrade-vars.cmake +++ /dev/null @@ -1,61 +0,0 @@ - -# Here we are reproducing the variables and call performed by the FindCorrade.cmake provided by the library - -# Read flags from configuration -file(READ "${CMAKE_CURRENT_LIST_DIR}/../../include/Corrade/configure.h" _corradeConfigure) -string(REGEX REPLACE ";" "\\\\;" _corradeConfigure "${_corradeConfigure}") -string(REGEX REPLACE "\n" ";" _corradeConfigure "${_corradeConfigure}") -set(_corradeFlags - MSVC2015_COMPATIBILITY - MSVC2017_COMPATIBILITY - MSVC2019_COMPATIBILITY - BUILD_DEPRECATED - BUILD_STATIC - BUILD_STATIC_UNIQUE_GLOBALS - BUILD_MULTITHREADED - TARGET_UNIX - TARGET_APPLE - TARGET_IOS - TARGET_IOS_SIMULATOR - TARGET_WINDOWS - TARGET_WINDOWS_RT - TARGET_EMSCRIPTEN - TARGET_ANDROID - # TARGET_X86 etc and TARGET_LIBCXX are not exposed to CMake as the meaning - # is unclear on platforms with multi-arch binaries or when mixing different - # STL implementations. TARGET_GCC etc are figured out via UseCorrade.cmake, - # as the compiler can be different when compiling the lib & when using it. - PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT - TESTSUITE_TARGET_XCTEST - UTILITY_USE_ANSI_COLORS) -foreach(_corradeFlag ${_corradeFlags}) - list(FIND _corradeConfigure "#define CORRADE_${_corradeFlag}" _corrade_${_corradeFlag}) - if(NOT _corrade_${_corradeFlag} EQUAL -1) - set(CORRADE_${_corradeFlag} 1) - endif() -endforeach() - - -# Corrade::rc, a target with just an executable -if(NOT TARGET Corrade::rc) - if(CMAKE_CROSSCOMPILING) - find_program(CORRADE_RC_PROGRAM - NAMES corrade-rc - PATHS ENV - PATH NO_DEFAULT_PATH) - else() - find_program(CORRADE_RC_PROGRAM - NAMES corrade-rc - PATHS "${CMAKE_CURRENT_LIST_DIR}/../../bin/" - NO_DEFAULT_PATH) - endif() - - get_filename_component(CORRADE_RC_PROGRAM "${CORRADE_RC_PROGRAM}" ABSOLUTE) - - add_executable(Corrade::rc IMPORTED) - set_property(TARGET Corrade::rc PROPERTY IMPORTED_LOCATION ${CORRADE_RC_PROGRAM}) -endif() - -# Include and declare other build modules -include("${CMAKE_CURRENT_LIST_DIR}/UseCorrade.cmake") -set(CORRADE_LIB_SUFFIX_MODULE "${CMAKE_CURRENT_LIST_DIR}/CorradeLibSuffix.cmake") diff --git a/recipes/corrade/all/conanfile.py b/recipes/corrade/all/conanfile.py index 078bf4211c0e7..c1afaeaaa67eb 100644 --- a/recipes/corrade/all/conanfile.py +++ b/recipes/corrade/all/conanfile.py @@ -2,8 +2,6 @@ from conans.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.33.0" - class CorradeConan(ConanFile): name = "corrade" @@ -12,7 +10,7 @@ class CorradeConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://magnum.graphics/corrade" license = "MIT" - exports_sources = ["CMakeLists.txt", "cmake/*"] + exports_sources = ["CMakeLists.txt"] generators = "cmake" short_paths = True _cmake = None @@ -47,36 +45,29 @@ def config_options(self): del self.options.fPIC def configure(self): - if self.options.shared: - del self.options.fPIC - - def validate(self): if self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) < 14: raise ConanInvalidConfiguration("Corrade requires Visual Studio version 14 or greater") - - if not self.options.with_utility and (self.options.with_testsuite or self.options.with_interconnect or self.options.with_pluginmanager): - raise ConanInvalidConfiguration("Component 'utility' is required for 'test_suite', 'interconnect' and 'plugin_manager'") + if tools.cross_building(self): + self.output.warn("This Corrade recipe could not be prepared for cross building") + if self.options.shared: + del self.options.fPIC def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) - - def build_requirements(self): - if hasattr(self, 'settings_build') and tools.cross_building(self.settings, skip_x64_x86=True): - self.build_requires("corrade/{}".format(self.version)) + tools.get(**self.conan_data["sources"][self.version]) + extracted_dir = self.name + "-" + self.version + os.rename(extracted_dir, self._source_subfolder) def _configure_cmake(self): if not self._cmake: self._cmake = CMake(self) self._cmake.definitions["BUILD_STATIC"] = not self.options.shared - self._cmake.definitions["BUILD_STATIC_PIC"] = self.options.get_safe("fPIC", False) - - self._cmake.definitions["BUILD_DEPRECARED"] = self.options.build_deprecated - self._cmake.definitions["WITH_INTERCONNECT"] = self.options.with_interconnect - self._cmake.definitions["WITH_MAIN"] = self.options.with_main - self._cmake.definitions["WITH_PLUGINMANAGER"] = self.options.with_pluginmanager - self._cmake.definitions["WITH_TESTSUITE"] = self.options.with_testsuite - self._cmake.definitions["WITH_UTILITY"] = self.options.with_utility - self._cmake.definitions["WITH_RC"] = self.options.with_utility + self._cmake.definitions["BUILD_DEPRECARED"] = self.options["build_deprecated"] + self._cmake.definitions["WITH_INTERCONNECT"] = self.options["with_interconnect"] + self._cmake.definitions["WITH_MAIN"] = self.options["with_main"] + self._cmake.definitions["WITH_PLUGINMANAGER"] = self.options["with_pluginmanager"] + self._cmake.definitions["WITH_TESTSUITE"] = self.options["with_testsuite"] + self._cmake.definitions["WITH_UTILITY"] = self.options["with_utility"] + self._cmake.definitions["WITH_RC"] = "ON" # Corrade uses suffix on the resulting "lib"-folder when running cmake.install() # Set it explicitly to empty, else Corrade might set it implicitly (eg. to "64") @@ -91,6 +82,11 @@ def _configure_cmake(self): return self._cmake + + def build_requirements(self): + if hasattr(self, 'settings_build') and tools.cross_building(self.settings, skip_x64_x86=True): + self.build_requires("corrade/{}".format(self.version)) + def build(self): cmake = self._configure_cmake() cmake.build() @@ -101,63 +97,54 @@ def package(self): cmake.install() share_cmake = os.path.join(self.package_folder, "share", "cmake", "Corrade") - self.copy("UseCorrade.cmake", src=share_cmake, dst=os.path.join(self.package_folder, "lib", "cmake")) - self.copy("CorradeLibSuffix.cmake", src=share_cmake, dst=os.path.join(self.package_folder, "lib", "cmake")) - self.copy(pattern="*.cmake", dst=os.path.join("lib", "cmake"), src=os.path.join(self.source_folder, "cmake")) + self.copy("UseCorrade.cmake", src=share_cmake, dst=os.path.join(self.package_folder, "lib", "cmake", "Corrade")) + self.copy("CorradeLibSuffix.cmake", src=share_cmake, dst=os.path.join(self.package_folder, "lib", "cmake", "Corrade")) tools.rmdir(os.path.join(self.package_folder, "share")) + def _sort_libs(self, correct_order, libs, lib_suffix="", reverse_result=False): + # Add suffix for correct string matching + correct_order[:] = [s.__add__(lib_suffix) for s in correct_order] + + result = [] + for expectedLib in correct_order: + for lib in libs: + if expectedLib == lib: + result.append(lib) + + if reverse_result: + # Linking happens in reversed order + result.reverse() + return result + def package_info(self): self.cpp_info.names["cmake_find_package"] = "Corrade" self.cpp_info.names["cmake_find_package_multi"] = "Corrade" + self.cpp_info.builddirs.append(os.path.join("lib", "cmake")) + self.cpp_info.build_modules.append(os.path.join("lib", "cmake", "Corrade", "UseCorrade.cmake")) + self.cpp_info.build_modules.append(os.path.join("lib", "cmake", "Corrade", "CorradeLibSuffix.cmake")) + + # See dependency order here: https://doc.magnum.graphics/magnum/custom-buildsystems.html + allLibs = [ + #1 + "CorradeMain", + "CorradeUtility", + "CorradeContainers", + #2 + "CorradeInterconnect", + "CorradePluginManager", + "CorradeTestSuite", + ] + + # Sort all built libs according to above, and reverse result for correct link order suffix = "-d" if self.settings.build_type == "Debug" else "" + builtLibs = tools.collect_libs(self) + self.cpp_info.libs = self._sort_libs(allLibs, builtLibs, suffix, True) + if self.settings.os == "Linux": + self.cpp_info.system_libs = ["m", "dl"] + + self.cpp_info.builddirs = [os.path.join(self.package_folder, "lib", "cmake", "Corrade")] - # The FindCorrade.cmake file provided by the library populates some extra stuff - self.cpp_info.components["_corrade"].build_modules.append(os.path.join("lib", "cmake", "conan-corrade-vars.cmake")) - - if self.options.with_main: - self.cpp_info.components["main"].names["cmake_find_package"] = "Main" - self.cpp_info.components["main"].names["cmake_find_package_multi"] = "Main" - if self.settings.os == "Windows": - self.cpp_info.components["main"].libs = ["CorradeMain" + suffix] - self.cpp_info.components["main"].requires = ["_corrade"] - - if self.options.with_utility: - self.cpp_info.components["utility"].names["cmake_find_package"] = "Utility" - self.cpp_info.components["utility"].names["cmake_find_package_multi"] = "Utility" - self.cpp_info.components["utility"].libs = ["CorradeUtility" + suffix] - if self.settings.os == "Linux": - self.cpp_info.components["utility"].system_libs = ["m", "dl"] - self.cpp_info.components["utility"].requires = ["_corrade"] - - # This one is statically linked into utility - #self.cpp_info.components["containers"].names["cmake_find_package"] = "Containers" - #self.cpp_info.components["containers"].names["cmake_find_package_multi"] = "Containers" - #self.cpp_info.components["containers"].libs = ["CorradeContainers" + suffix] - - if self.options.with_interconnect: - self.cpp_info.components["interconnect"].names["cmake_find_package"] = "Interconnect" - self.cpp_info.components["interconnect"].names["cmake_find_package_multi"] = "Interconnect" - self.cpp_info.components["interconnect"].libs = ["CorradeInterconnect" + suffix] - self.cpp_info.components["interconnect"].requires = ["utility"] - - if self.options.with_pluginmanager: - self.cpp_info.components["plugin_manager"].names["cmake_find_package"] = "PluginManager" - self.cpp_info.components["plugin_manager"].names["cmake_find_package_multi"] = "PluginManager" - self.cpp_info.components["plugin_manager"].libs = ["CorradePluginManager" + suffix] - self.cpp_info.components["plugin_manager"].requires = ["utility"] - - if self.options.with_testsuite: - self.cpp_info.components["test_suite"].names["cmake_find_package"] = "TestSuite" - self.cpp_info.components["test_suite"].names["cmake_find_package_multi"] = "TestSuite" - self.cpp_info.components["test_suite"].libs = ["CorradeTestSuite" + suffix] - self.cpp_info.components["test_suite"].requires = ["utility"] - - if self.options.with_utility: - bindir = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bindir)) - self.env_info.PATH.append(bindir) - - # pkg_config: Add more explicit naming to generated files (avoid filesystem collision). - for key, cmp in self.cpp_info.components.items(): - self.cpp_info.components[key].names["pkg_config"] = "{}_{}".format(self.name, key) + bindir = os.path.join(self.package_folder, "bin") + self.output.info("Appending PATH environment variable: {}".format(bindir)) + self.env_info.PATH.append(bindir) diff --git a/recipes/corrade/all/test_package/CMakeLists.txt b/recipes/corrade/all/test_package/CMakeLists.txt index 951d74740bdd6..e6e36e8f483fb 100644 --- a/recipes/corrade/all/test_package/CMakeLists.txt +++ b/recipes/corrade/all/test_package/CMakeLists.txt @@ -2,12 +2,10 @@ cmake_minimum_required(VERSION 3.1) project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(Corrade REQUIRED) +conan_basic_setup() add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} Corrade::Utility) +target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) set_target_properties(${PROJECT_NAME} PROPERTIES diff --git a/recipes/corrade/all/test_package/conanfile.py b/recipes/corrade/all/test_package/conanfile.py index 3da371b660e0a..6efa898293411 100644 --- a/recipes/corrade/all/test_package/conanfile.py +++ b/recipes/corrade/all/test_package/conanfile.py @@ -4,14 +4,18 @@ class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + generators = "cmake" def build(self): cmake = CMake(self) + if self.settings.compiler == "Visual Studio": + cmake.definitions["CORRADE_MSVC2015_COMPATIBILITY"] = "ON" if self.settings.compiler.version == "14" else "OFF" + cmake.definitions["CORRADE_MSVC2017_COMPATIBILITY"] = "ON" if self.settings.compiler.version == "15" else "OFF" + cmake.definitions["CORRADE_MSVC2019_COMPATIBILITY"] = "ON" if self.settings.compiler.version == "16" else "OFF" cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): + if not tools.cross_building(self.settings): bin_path = os.path.join("bin", "test_package") self.run(bin_path, run_environment=True) From 5e3d4c6f028ad3128bcb54d529c87d9f2a36cb76 Mon Sep 17 00:00:00 2001 From: "Javier G. Sogo" Date: Fri, 20 Aug 2021 22:31:30 +0200 Subject: [PATCH 61/88] fix typos --- recipes/magnum/all/conanfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/magnum/all/conanfile.py b/recipes/magnum/all/conanfile.py index 898e37c460b99..46d41aae1899c 100644 --- a/recipes/magnum/all/conanfile.py +++ b/recipes/magnum/all/conanfile.py @@ -108,7 +108,7 @@ def requirements(self): if self.options.with_gl: self.requires("opengl/system") if self.options.sdl2_application: - self.requires("sdl/2.0.14") + self.requires("sdl/2.0.16") if self.options.with_vk: self.requires("vulkan-loader/1.2.182") @@ -118,7 +118,7 @@ def build_requirements(self): def validate(self): if self.options.shared and not self.options["corrade"].shared: # To fix issue with resource management, see here: https://github.com/mosra/magnum/issues/304#issuecomment-451768389 - raise ConanInvalidConfiguration("If using 'shared=True', corrado should be shared as well") + raise ConanInvalidConfiguration("If using 'shared=True', corrade should be shared as well") if self.options.with_magnumfontconverter and not self.options.with_tgaimageconverter: raise ConanInvalidConfiguration("magnumfontconverter requires tgaimageconverter") From ca85c5418dccf7a9a7995008ce34543224f741e5 Mon Sep 17 00:00:00 2001 From: "Javier G. Sogo" Date: Fri, 20 Aug 2021 22:47:23 +0200 Subject: [PATCH 62/88] fix typo --- recipes/magnum/all/conanfile.py | 2 +- recipes/magnum/all/test_package/test_package.cpp | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/recipes/magnum/all/conanfile.py b/recipes/magnum/all/conanfile.py index 46d41aae1899c..d638f79126c52 100644 --- a/recipes/magnum/all/conanfile.py +++ b/recipes/magnum/all/conanfile.py @@ -291,7 +291,7 @@ def package_info(self): self.cpp_info.components["vk"].libs = ["MagnumVk"] self.cpp_info.components["vk"].requires = ["magnum_main", "vulkan-loader::vulkan-loader"] - if self.options.with_cglcontext: + if self.options.get_safe("with_cglcontext", False): self.cpp_info.components["cglcontext"].names["cmake_find_package"] = "CglContext" self.cpp_info.components["cglcontext"].names["cmake_find_package_multi"] = "CglContext" self.cpp_info.components["cglcontext"].libs = ["MagnumCglContext"] diff --git a/recipes/magnum/all/test_package/test_package.cpp b/recipes/magnum/all/test_package/test_package.cpp index e2492e0f85be5..d71dd8e8a9fd9 100644 --- a/recipes/magnum/all/test_package/test_package.cpp +++ b/recipes/magnum/all/test_package/test_package.cpp @@ -12,8 +12,7 @@ int main() { Magnum::Math::StrictWeakOrdering o; if (o(v2a, v2b)) { - std::cout << "Magnum working"; + std::cout << "Magnum working\n"; } return 0; } - From 1fc430cfac226f5a668ced71204588740a26bb58 Mon Sep 17 00:00:00 2001 From: "Javier G. Sogo" Date: Fri, 20 Aug 2021 23:08:41 +0200 Subject: [PATCH 63/88] patch sources to match conan generated files --- recipes/magnum-integration/all/conanfile.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/recipes/magnum-integration/all/conanfile.py b/recipes/magnum-integration/all/conanfile.py index 7c57f3a44fad1..0e0ee87a70d34 100644 --- a/recipes/magnum-integration/all/conanfile.py +++ b/recipes/magnum-integration/all/conanfile.py @@ -44,22 +44,30 @@ class MagnumIntegrationConan(ConanFile): def _source_subfolder(self): return "source_subfolder" + def _patch_sources(self): + for patch in self.conan_data.get("patches", {}).get(self.version, []): + tools.patch(**patch) + def source(self): tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), 'set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/modules/" ${CMAKE_MODULE_PATH})', "") + tools.replace_in_file(os.path.join(self._source_subfolder, "src", "Magnum", "GlmIntegration", "CMakeLists.txt"), + "find_package(GLM REQUIRED)", + "find_package(glm REQUIRED)") tools.replace_in_file(os.path.join(self._source_subfolder, "src", "Magnum", "GlmIntegration", "CMakeLists.txt"), "GLM::GLM", "glm::glm") tools.replace_in_file(os.path.join(self._source_subfolder, "src", "Magnum", "ImGuiIntegration", "CMakeLists.txt"), "ImGui::ImGui", "imgui::imgui") + tools.replace_in_file(os.path.join(self._source_subfolder, "src", "Magnum", "ImGuiIntegration", "CMakeLists.txt"), + "find_package(ImGui REQUIRED Sources)", + "find_package(imgui REQUIRED)") tools.replace_in_file(os.path.join(self._source_subfolder, "src", "Magnum", "ImGuiIntegration", "CMakeLists.txt"), "ImGui::Sources", - "") - - + "") def config_options(self): if self.settings.os == "Windows": @@ -104,10 +112,6 @@ def _configure_cmake(self): self._cmake.configure() return self._cmake - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - def build(self): self._patch_sources() From 556aafc3c46b3ced26c8dd9e608e997478cf06f3 Mon Sep 17 00:00:00 2001 From: werto87 Date: Sun, 29 Aug 2021 11:35:57 +0200 Subject: [PATCH 64/88] install should be in package and not in build --- recipes/emsdk/all/conanfile.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/recipes/emsdk/all/conanfile.py b/recipes/emsdk/all/conanfile.py index e5c9c32e97050..ae61d9a1ff2b7 100644 --- a/recipes/emsdk/all/conanfile.py +++ b/recipes/emsdk/all/conanfile.py @@ -38,7 +38,7 @@ def _chmod_plus_x(filename): if os.name == 'posix': os.chmod(filename, os.stat(filename).st_mode | 0o111) - def build(self): + def package(self): with tools.chdir(self._source_subfolder): emsdk = 'emsdk.bat' if os.name == 'nt' else './emsdk' if os.path.isfile("python_selector"): @@ -51,8 +51,6 @@ def build(self): self.run('%s install %s' % (emsdk, self.version)) self.run('%s activate %s --embedded' % (emsdk, self.version)) - - def package(self): self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) self.copy(pattern='*', dst='bin', From 3ba594dca6d1e2353d447edae1ebb3a5380eaa68 Mon Sep 17 00:00:00 2001 From: jgsogo Date: Mon, 13 Sep 2021 09:07:14 +0200 Subject: [PATCH 65/88] recipe for magnum-extras --- recipes/magnum-extras/all/CMakeLists.txt | 10 +++ recipes/magnum-extras/all/conandata.yml | 4 + recipes/magnum-extras/all/conanfile.py | 109 +++++++++++++++++++++++ recipes/magnum-extras/config.yml | 3 + 4 files changed, 126 insertions(+) create mode 100644 recipes/magnum-extras/all/CMakeLists.txt create mode 100644 recipes/magnum-extras/all/conandata.yml create mode 100644 recipes/magnum-extras/all/conanfile.py create mode 100644 recipes/magnum-extras/config.yml diff --git a/recipes/magnum-extras/all/CMakeLists.txt b/recipes/magnum-extras/all/CMakeLists.txt new file mode 100644 index 0000000000000..046d5c62ad057 --- /dev/null +++ b/recipes/magnum-extras/all/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(cmake_wrapper) + +include(conanbuildinfo.cmake) +conan_basic_setup() + +set(MAGNUM_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/Magnum) +#set(MAGNUM_EXTERNAL_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/MagnumExternal) + +add_subdirectory("source_subfolder") diff --git a/recipes/magnum-extras/all/conandata.yml b/recipes/magnum-extras/all/conandata.yml new file mode 100644 index 0000000000000..59cf467992abc --- /dev/null +++ b/recipes/magnum-extras/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "2020.06": + url: "https://github.com/mosra/magnum-extras/archive/refs/tags/v2020.06.tar.gz" + sha256: "a8d7babc50ac070984d39f6cc15c3ce2af7b41fe980fe81b0405da6f5ba3c36d" diff --git a/recipes/magnum-extras/all/conanfile.py b/recipes/magnum-extras/all/conanfile.py new file mode 100644 index 0000000000000..742d16e5f78e0 --- /dev/null +++ b/recipes/magnum-extras/all/conanfile.py @@ -0,0 +1,109 @@ +from conans import ConanFile, CMake, tools +from conans.errors import ConanInvalidConfiguration +import os + +required_conan_version = ">=1.33.0" + + +class MagnumExtrasConan(ConanFile): + name = "magnum-extras" + description = "Extras for the Magnum C++11/C++14 graphics engine" + license = "MIT" + topics = ("conan", "magnum", "graphics", "rendering", "3d", "2d", "opengl") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://magnum.graphics" + + settings = "os", "compiler", "build_type", "arch" + + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_player": [True, False], + "with_ui": [True, False], + "with_ui_gallery": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_player": True, + "with_ui": True, + "with_ui_gallery": True, + } + generators = "cmake", "cmake_find_package" + exports_sources = ["CMakeLists.txt", "patches/*"] + + _cmake = None + + @property + def _source_subfolder(self): + return "source_subfolder" + + def source(self): + tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), + 'set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/modules/" ${CMAKE_MODULE_PATH})', + "") + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + del self.options.fPIC + + def requirements(self): + self.requires("magnum/{}".format(self.version)) + self.requires("corrade/{}".format(self.version)) + + def _configure_cmake(self): + if self._cmake: + return self._cmake + + self._cmake = CMake(self) + self._cmake.definitions["BUILD_STATIC"] = not self.options.shared + self._cmake.definitions["BUILD_STATIC_PIC"] = self.options.get_safe("fPIC", False) + self._cmake.definitions["BUILD_TESTS"] = False + self._cmake.definitions["BUILD_GL_TESTS"] = False + + self._cmake.definitions["WITH_PLAYER"] = self.options.with_player + self._cmake.definitions["WITH_UI"] = self.options.with_ui + self._cmake.definitions["WITH_UI_GALLERY"] = self.options.with_ui_gallery + + self._cmake.configure() + return self._cmake + + def _patch_sources(self): + for patch in self.conan_data.get("patches", {}).get(self.version, []): + tools.patch(**patch) + + def build(self): + self._patch_sources() + + cm = self._configure_cmake() + cm.build() + + def package(self): + cm = self._configure_cmake() + cm.install() + + #tools.rmdir(os.path.join(self.package_folder, "cmake")) + #tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + #tools.rmdir(os.path.join(self.package_folder, "share")) + + self.copy("COPYING", src=self._source_subfolder, dst="licenses") + + def package_info(self): + self.cpp_info.names["cmake_find_package"] = "MagnumExtras" + self.cpp_info.names["cmake_find_package_multi"] = "MagnumExtras" + + if self.options.with_ui: + self.cpp_info.components["ui"].names["cmake_find_package"] = "Ui" + self.cpp_info.components["ui"].names["cmake_find_package_multi"] = "Ui" + self.cpp_info.components["ui"].libs = ["MagnumUi"] + self.cpp_info.components["ui"].requires = ["corrade::interconnect", "magnum::magnum_main", "magnum::gl", "magnum::text"] + + if self.options.with_player or self.options.with_ui_gallery: + bin_path = os.path.join(self.package_folder, "bin") + self.output.info('Appending PATH environment variable: %s' % bin_path) + self.env_info.path.append(bin_path) diff --git a/recipes/magnum-extras/config.yml b/recipes/magnum-extras/config.yml new file mode 100644 index 0000000000000..93230781a72ea --- /dev/null +++ b/recipes/magnum-extras/config.yml @@ -0,0 +1,3 @@ +versions: + "2020.06": + folder: all From b3e5e8b055f44a69d7904aad95ff4a296769c1ef Mon Sep 17 00:00:00 2001 From: jgsogo Date: Sat, 25 Sep 2021 13:57:17 +0200 Subject: [PATCH 66/88] use NodeJS from conan package --- recipes/emsdk/all/conandata.yml | 6 +-- recipes/emsdk/all/conanfile.py | 72 +++++++++++++++++++-------------- 2 files changed, 44 insertions(+), 34 deletions(-) diff --git a/recipes/emsdk/all/conandata.yml b/recipes/emsdk/all/conandata.yml index e24b73179c01f..6250ba474005e 100644 --- a/recipes/emsdk/all/conandata.yml +++ b/recipes/emsdk/all/conandata.yml @@ -1,4 +1,4 @@ sources: - 2.0.26: - url: "https://github.com/emscripten-core/emsdk/archive/refs/tags/2.0.26.tar.gz" - sha256: "79e7166aa8eaae6e52cef1363b2d8db795d03684846066bc51f9dcf905dd58ad" + "2.0.30": + url: https://github.com/emscripten-core/emsdk/archive/refs/tags/2.0.30.tar.gz + sha256: 69050d76c8907a58f99b08831e8cb7a4fba857efec6037d5e59df4b73111ba36 diff --git a/recipes/emsdk/all/conanfile.py b/recipes/emsdk/all/conanfile.py index 66ffcf79b7a1d..3dfa5e0b5deea 100644 --- a/recipes/emsdk/all/conanfile.py +++ b/recipes/emsdk/all/conanfile.py @@ -1,17 +1,17 @@ from conans import ConanFile, tools from conans.errors import ConanInvalidConfiguration import os -from conans.errors import ConanInvalidConfiguration +import json required_conan_version = ">=1.33.0" class EmSDKConan(ConanFile): name = "emsdk" - description = "Emscripten is an Open Source LLVM to JavaScript compiler" + description = "Emscripten SDK. Emscripten is an Open Source LLVM to JavaScript compiler" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/kripken/emscripten" - topics = ("conan", "emsdk", "emscripten", "sdk") + topics = ("emsdk", "emscripten", "sdk") license = "MIT" settings = "os", "arch" @@ -21,6 +21,11 @@ class EmSDKConan(ConanFile): def _source_subfolder(self): return "source_subfolder" + def requirements(self): + self.requires("nodejs/16.3.0") + # self.requires("python") # FIXME: Not available as Conan package + # self.requires("wasm") # FIXME: Not available as Conan package + def validate(self): if hasattr(self, "settings_target") and self.settings_target: if self.settings_target.os != "Emscripten": @@ -38,28 +43,39 @@ def _chmod_plus_x(filename): if os.name == "posix": os.chmod(filename, os.stat(filename).st_mode | 0o111) - def package(self): + def _tools_for_version(self): + ret = {} + # Select release-upstream from version (wasm-binaries) + with open(os.path.join(self.build_folder, self._source_subfolder, "emscripten-releases-tags.json"), 'r') as f: + data = json.load(f) + ret['wasm'] = "releases-upstream-{}-64bit".format(data["releases"][self.version]) + # Select python and node versions + with open(os.path.join(self.build_folder, self._source_subfolder, "emsdk_manifest.json"), 'r') as f: + data = json.load(f) + tools = data["tools"] + python = next((it for it in tools if (it["id"] == "python" and not it.get("is_old", False))), None) + ret["python"] = "python-{}-64bit".format(python["version"]) + node = next((it for it in tools if (it["id"] == "node" and not it.get("is_old", False))), None) + ret["nodejs"] = "node-{}-64bit".format(node["version"]) + return ret + + def build(self): with tools.chdir(self._source_subfolder): emsdk = "emsdk.bat" if tools.os_info.is_windows else "./emsdk" - if os.path.isfile("python_selector"): - self._chmod_plus_x("python_selector") self._chmod_plus_x("emsdk") - self.run("%s update" % emsdk) - if os.path.isfile("python_selector"): - self._chmod_plus_x("python_selector") - self._chmod_plus_x("emsdk") - - self.run("%s install %s" % (emsdk, self.version)) - self.run("%s activate %s --embedded" % (emsdk, self.version)) + + # Install required tools + required_tools = self._tools_for_version() + for key, value in required_tools.items(): + if key != 'nodejs': + self.run("%s install %s" % (emsdk, value)) + self.run("%s activate %s" % (emsdk, value)) def package(self): - self.copy(pattern="LICENSE", dst="licenses", - src=self._source_subfolder) - self.copy(pattern="*", dst="bin", - src=self._source_subfolder) + self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) + self.copy(pattern="*", dst="bin", src=self._source_subfolder) emscripten = os.path.join(self.package_folder, "bin", "upstream", "emscripten") - toolchain = os.path.join( - emscripten, "cmake", "Modules", "Platform", "Emscripten.cmake") + toolchain = os.path.join(emscripten, "cmake", "Modules", "Platform", "Emscripten.cmake") # FIXME: conan should add the root of conan package requirements to CMAKE_PREFIX_PATH (LIBRARY/INCLUDE -> ONLY; PROGRAM -> NEVER) # allow to find conan libraries tools.replace_in_file(toolchain, @@ -85,33 +101,27 @@ def package_info(self): em_config = os.path.join(emsdk, "bin", ".emscripten") emscripten = os.path.join(emsdk, "bin", "upstream", "emscripten") em_cache = os.path.join(emsdk, "bin", ".emscripten_cache") - toolchain = os.path.join( - emscripten, "cmake", "Modules", "Platform", "Emscripten.cmake") + toolchain = os.path.join(emscripten, "cmake", "Modules", "Platform", "Emscripten.cmake") self.output.info("Appending PATH environment variable: %s" % emsdk) self.env_info.PATH.append(emsdk) - self.output.info( - "Appending PATH environment variable: %s" % emscripten) + self.output.info("Appending PATH environment variable: %s" % emscripten) self.env_info.PATH.append(emscripten) self.output.info("Creating EMSDK environment variable: %s" % emsdk) self.env_info.EMSDK = emsdk - self.output.info( - "Creating EMSCRIPTEN environment variable: %s" % emscripten) + self.output.info("Creating EMSCRIPTEN environment variable: %s" % emscripten) self.env_info.EMSCRIPTEN = emscripten - self.output.info( - "Creating EM_CONFIG environment variable: %s" % em_config) + self.output.info("Creating EM_CONFIG environment variable: %s" % em_config) self.env_info.EM_CONFIG = em_config - self.output.info( - "Creating EM_CACHE environment variable: %s" % em_cache) + self.output.info("Creating EM_CACHE environment variable: %s" % em_cache) self.env_info.EM_CACHE = em_cache - self.output.info( - "Creating CONAN_CMAKE_TOOLCHAIN_FILE environment variable: %s" % toolchain) + self.output.info("Creating CONAN_CMAKE_TOOLCHAIN_FILE environment variable: %s" % toolchain) self.env_info.CONAN_CMAKE_TOOLCHAIN_FILE = toolchain self.env_info.CC = self._define_tool_var("CC", "emcc") From 3bef50734da681ea2097beb478f3df5fc51e2d86 Mon Sep 17 00:00:00 2001 From: jgsogo Date: Sat, 25 Sep 2021 18:46:26 +0200 Subject: [PATCH 67/88] [magnum] Builds for emsdk --- recipes/magnum/all/conandata.yml | 7 ++ recipes/magnum/all/conanfile.py | 73 +++++++++++++++---- .../2020.06/0001-emscripten-toolchain.patch | 15 ++++ .../magnum/all/test_package/CMakeLists.txt | 8 ++ recipes/magnum/all/test_package/conanfile.py | 5 ++ 5 files changed, 94 insertions(+), 14 deletions(-) create mode 100644 recipes/magnum/all/patches/2020.06/0001-emscripten-toolchain.patch diff --git a/recipes/magnum/all/conandata.yml b/recipes/magnum/all/conandata.yml index 65803e3bd15c6..69a9046e1dddf 100644 --- a/recipes/magnum/all/conandata.yml +++ b/recipes/magnum/all/conandata.yml @@ -2,3 +2,10 @@ sources: "2020.06": url: "https://github.com/mosra/magnum/archive/refs/tags/v2020.06.tar.gz" sha256: "98dfe802e56614e4e6bf750d9b693de46a5ed0c6eb479b0268f1a20bf34268bf" +patches: + "2020.06": + - base_path: "source_subfolder" + patch_file: "patches/2020.06/0001-emscripten-toolchain.patch" + # patch_type: "portability" + # description: "Remove unnecessary dependency on UseEmscripten" + # source: "https://github.com/mosra/magnum/issues/490" \ No newline at end of file diff --git a/recipes/magnum/all/conanfile.py b/recipes/magnum/all/conanfile.py index f479f6ec9f38b..29036ff216744 100644 --- a/recipes/magnum/all/conanfile.py +++ b/recipes/magnum/all/conanfile.py @@ -143,7 +143,7 @@ class MagnumConan(ConanFile): "wav_audio_importer": True, } generators = "cmake", "cmake_find_package" - exports_sources = ["CMakeLists.txt", "cmake/*"] + exports_sources = ["CMakeLists.txt", "cmake/*", "patches/*"] _cmake = None @@ -190,6 +190,48 @@ def config_options(self): del self.options.windowless_windows_egl_application del self.options.target_headless # Requires EGL (when used gl_info) + if self.settings.os == "Emscripten": + self.options.shared_plugins = False + self.options.target_gl = "desktop_gl" # FIXME: Should be gles2? + + self.options.sdl2_application = False # FIXME: Fails to build (because of target_gl value? Needs emscripten-port?) + + self.options.gl_info = False + + del self.options.vk + del self.options.target_vk + + self.options.audio = False + self.options.any_audio_importer = False + self.options.wav_audio_importer = False + self.options.al_info = False + + self.options.glfw_application = False + + # X11 is not available + del self.options.glx_context + del self.options.glx_application + del self.options.windowless_glx_application + + # Some executables + del self.options.font_converter + del self.options.distance_field_converter + del self.options.scene_converter + del self.options.image_converter + + # Because of OpenGLFunctionLoader.cpp (because of target_gl option?) + self.options.wgl_context = False + self.options.windowless_wgl_application = False + self.options.cgl_context = False + self.options.windowless_cgl_application = False + + # FIXME: Disable EGL, Conan provides only Linux and FreeBSD (depends on build platform?) + self.options.egl_context = False + self.options.xegl_application = False + self.options.windowless_egl_application = False + self.options.windowless_windows_egl_application = False + self.options.target_headless = False + if self.settings.os != "Android": del self.options.android_application @@ -220,7 +262,7 @@ def requirements(self): self.requires("openal/1.21.1") if self.options.gl: self.requires("opengl/system") - if self.options.vk: + if self.options.get_safe("vk", False): self.requires("vulkan-loader/1.2.190") if self.options.get_safe("egl_context", False) or \ @@ -260,7 +302,7 @@ def validate(self): if self.options.target_gl in ["gles2", "gles3"] and self.settings.os == "Windows": raise ConanInvalidConfiguration("OpenGL ES is not supported in Windows") - if not self.options.vk and self.options.target_vk: + if not self.options.get_safe("vk", False) and self.options.get_safe("target_vk", False): raise ConanInvalidConfiguration("Option 'vk=True' is required") if self.options.get_safe("cgl_context", False) and not self.options.target_gl: @@ -269,8 +311,8 @@ def validate(self): if self.options.get_safe("windowless_cgl_application", False) and not self.options.target_gl: raise ConanInvalidConfiguration("Option 'windowless_cgl_application' requires some 'target_gl'") - if self.options.al_info and not self.options.audio: - raise ConanInvalidConfiguration("Option 'al_info' requires 'audio=True'") + if (self.options.al_info or self.options.wav_audio_importer) and not self.options.audio: + raise ConanInvalidConfiguration("Options 'al_info' and 'wav_audio_importer' require 'audio=True'") if self.options.magnum_font_converter and not self.options.tga_image_converter: raise ConanInvalidConfiguration("magnum_font_converter requires tga_image_converter") @@ -297,7 +339,7 @@ def _configure_cmake(self): self._cmake.definitions["TARGET_GLES2"] = self.options.target_gl == "gles2" self._cmake.definitions["TARGET_DESKTOP_GLES"] = self.options.target_gl == "desktop_gl" self._cmake.definitions["TARGET_HEADLESS"] = self.options.get_safe("target_headless", False) - self._cmake.definitions["TARGET_VK"] = self.options.target_vk + self._cmake.definitions["TARGET_VK"] = self.options.get_safe("target_vk", False) self._cmake.definitions["WITH_AUDIO"] = self.options.audio self._cmake.definitions["WITH_DEBUGTOOLS"] = self.options.debug_tools @@ -309,7 +351,7 @@ def _configure_cmake(self): self._cmake.definitions["WITH_TEXT"] = self.options.text self._cmake.definitions["WITH_TEXTURETOOLS"] = self.options.texture_tools self._cmake.definitions["WITH_TRADE"] = self.options.trade - self._cmake.definitions["WITH_VK"] = self.options.vk + self._cmake.definitions["WITH_VK"] = self.options.get_safe("vk", False) self._cmake.definitions["WITH_ANDROIDAPPLICATION"] = self.options.get_safe("android_application", False) self._cmake.definitions["WITH_EMSCRIPTENAPPLICATION"] = self.options.get_safe("emscripten_application", False) @@ -326,7 +368,7 @@ def _configure_cmake(self): self._cmake.definitions["WITH_CGLCONTEXT"] = self.options.get_safe("cgl_context", False) self._cmake.definitions["WITH_EGLCONTEXT"] = self.options.get_safe("egl_context", False) - self._cmake.definitions["WITH_GLXCONTEXT"] = self.options.glx_context + self._cmake.definitions["WITH_GLXCONTEXT"] = self.options.get_safe("glx_context", False) self._cmake.definitions["WITH_WGLCONTEXT"] = self.options.get_safe("wgl_context", False) ##### Plugins related ##### @@ -346,9 +388,9 @@ def _configure_cmake(self): self._cmake.definitions["WITH_GL_INFO"] = self.options.gl_info self._cmake.definitions["WITH_AL_INFO"] = self.options.al_info self._cmake.definitions["WITH_DISTANCEFIELDCONVERTER"] = self.options.get_safe("distance_field_converter", False) - self._cmake.definitions["WITH_FONTCONVERTER"] = self.options.font_converter - self._cmake.definitions["WITH_IMAGECONVERTER"] = self.options.image_converter - self._cmake.definitions["WITH_SCENECONVERTER"] = self.options.scene_converter + self._cmake.definitions["WITH_FONTCONVERTER"] = self.options.get_safe("font_converter", False) + self._cmake.definitions["WITH_IMAGECONVERTER"] = self.options.get_safe("image_converter", False) + self._cmake.definitions["WITH_SCENECONVERTER"] = self.options.get_safe("scene_converter", False) self._cmake.configure() return self._cmake @@ -531,7 +573,7 @@ def package_info(self): self.cpp_info.components["trade"].requires = ["magnum_main", "corrade::plugin_manager"] # VK - if self.options.vk: + if self.options.get_safe("vk", False): self.cpp_info.components["vk"].names["cmake_find_package"] = "Vk" self.cpp_info.components["vk"].names["cmake_find_package_multi"] = "Vk" self.cpp_info.components["vk"].libs = ["MagnumVk{}".format(lib_suffix)] @@ -543,7 +585,10 @@ def package_info(self): raise Exception("Recipe doesn't define this component") if self.options.get_safe("emscripten_application", False): - raise Exception("Recipe doesn't define this component") + self.cpp_info.components["emscripten_application"].names["cmake_find_package"] = "EmscriptenApplication" + self.cpp_info.components["emscripten_application"].names["cmake_find_package_multi"] = "EmscriptenApplication" + self.cpp_info.components["emscripten_application"].libs = ["MagnumEmscriptenApplication{}".format(lib_suffix)] + self.cpp_info.components["emscripten_application"].requires = ["gl"] if self.options.get_safe("windowless_ios_application", False): raise Exception("Recipe doesn't define this component") @@ -623,7 +668,7 @@ def package_info(self): self.cpp_info.components["egl_context"].libs = ["MagnumEglContext{}".format(lib_suffix)] self.cpp_info.components["egl_context"].requires = ["gl", "egl::egl"] - if self.options.glx_context: + if self.options.get_safe("glx_context", False): self.cpp_info.components["glx_context"].names["cmake_find_package"] = "GlxContext" self.cpp_info.components["glx_context"].names["cmake_find_package_multi"] = "GlxContext" self.cpp_info.components["glx_context"].libs = ["MagnumGlxContext{}".format(lib_suffix)] diff --git a/recipes/magnum/all/patches/2020.06/0001-emscripten-toolchain.patch b/recipes/magnum/all/patches/2020.06/0001-emscripten-toolchain.patch new file mode 100644 index 0000000000000..81540c7ef18c7 --- /dev/null +++ b/recipes/magnum/all/patches/2020.06/0001-emscripten-toolchain.patch @@ -0,0 +1,15 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 19e6c2d..feda9a4 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -276,10 +276,6 @@ if(TARGET_VK) + set(MAGNUM_TARGET_VK 1) + endif() + +-if(CORRADE_TARGET_EMSCRIPTEN) +- include(UseEmscripten) +-endif() +- + if(WITH_OPENGLTESTER) + if(MAGNUM_TARGET_HEADLESS OR CORRADE_TARGET_EMSCRIPTEN OR CORRADE_TARGET_ANDROID) + set(WITH_WINDOWLESSEGLAPPLICATION ON) diff --git a/recipes/magnum/all/test_package/CMakeLists.txt b/recipes/magnum/all/test_package/CMakeLists.txt index 61efc797ee893..39afc1743b58b 100644 --- a/recipes/magnum/all/test_package/CMakeLists.txt +++ b/recipes/magnum/all/test_package/CMakeLists.txt @@ -26,6 +26,14 @@ set_target_properties(${PROJECT_NAME} CXX_EXTENSIONS OFF ) +if(TARGET_EMSCRIPTEN) + message("Embed OBJ file") + set_target_properties(${PROJECT_NAME} + PROPERTIES + LINK_FLAGS "--embed-file ${OBJ_FILE}@${OBJ_FILE}" + ) +endif() + # Run some executables (we can only be sure they exist if native build) if (EXEC_GL_INFO AND NOT CMAKE_CROSSCOMPILING) diff --git a/recipes/magnum/all/test_package/conanfile.py b/recipes/magnum/all/test_package/conanfile.py index 09f5324643f93..0aebeb1e32e13 100644 --- a/recipes/magnum/all/test_package/conanfile.py +++ b/recipes/magnum/all/test_package/conanfile.py @@ -32,6 +32,7 @@ def build(self): cmake.definitions["IMPORTER_PLUGINS_FOLDER"] = os.path.join(self.deps_user_info["magnum"].plugins_basepath, "importers").replace("\\", "/") cmake.definitions["OBJ_FILE"] = os.path.join(self.source_folder, "triangleMesh.obj").replace("\\", "/") cmake.definitions["SHARED_PLUGINS"] = self.options["magnum"].shared_plugins + cmake.definitions["TARGET_EMSCRIPTEN"] = bool(self.settings.os == "Emscripten") cmake.configure() cmake.build() @@ -42,3 +43,7 @@ def test(self): bin_path = os.path.join("bin", "test_package") self.run(bin_path, run_environment=True) + + if self.settings.os == "Emscripten": + bin_path = os.path.join("bin", "test_package.js") + self.run("node {}".format(bin_path), run_environment=True) From ddf2fb194c80cba7538a7d67dd455bcc1580fbff Mon Sep 17 00:00:00 2001 From: jgsogo Date: Sat, 25 Sep 2021 21:10:48 +0200 Subject: [PATCH 68/88] fix hooks --- recipes/magnum/all/conandata.yml | 2 +- recipes/magnum/all/conanfile.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/magnum/all/conandata.yml b/recipes/magnum/all/conandata.yml index 69a9046e1dddf..3043353262bcf 100644 --- a/recipes/magnum/all/conandata.yml +++ b/recipes/magnum/all/conandata.yml @@ -8,4 +8,4 @@ patches: patch_file: "patches/2020.06/0001-emscripten-toolchain.patch" # patch_type: "portability" # description: "Remove unnecessary dependency on UseEmscripten" - # source: "https://github.com/mosra/magnum/issues/490" \ No newline at end of file + # source: "https://github.com/mosra/magnum/issues/490" diff --git a/recipes/magnum/all/conanfile.py b/recipes/magnum/all/conanfile.py index 29036ff216744..e63f66602b09f 100644 --- a/recipes/magnum/all/conanfile.py +++ b/recipes/magnum/all/conanfile.py @@ -208,7 +208,7 @@ def config_options(self): self.options.glfw_application = False - # X11 is not available + # X11 is not available del self.options.glx_context del self.options.glx_application del self.options.windowless_glx_application From 88e7e801e9c7c1155a01b66e5a8f63914e1cb4a8 Mon Sep 17 00:00:00 2001 From: jgsogo Date: Sat, 25 Sep 2021 21:41:23 +0200 Subject: [PATCH 69/88] sdl2 is provided by emscripten itself --- recipes/magnum/all/conanfile.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/recipes/magnum/all/conanfile.py b/recipes/magnum/all/conanfile.py index e63f66602b09f..233c0efdc6dad 100644 --- a/recipes/magnum/all/conanfile.py +++ b/recipes/magnum/all/conanfile.py @@ -3,6 +3,7 @@ import os import re import textwrap +import shutil required_conan_version = ">=1.33.0" @@ -192,9 +193,9 @@ def config_options(self): if self.settings.os == "Emscripten": self.options.shared_plugins = False - self.options.target_gl = "desktop_gl" # FIXME: Should be gles2? + self.options.target_gl = "gles2" - self.options.sdl2_application = False # FIXME: Fails to build (because of target_gl value? Needs emscripten-port?) + self.options.sdl2_application = True # FIXME: Fails to build. Use emscripten-port?) self.options.gl_info = False @@ -276,7 +277,7 @@ def requirements(self): if self.options.glfw_application: self.requires("glfw/3.3.4") - if self.options.sdl2_application: + if self.options.sdl2_application and self.settings.os != "Emscripten": self.requires("sdl/2.0.16") def build_requirements(self): @@ -433,6 +434,12 @@ def _patch_sources(self): "EGL::EGL", "egl::egl") + # Copy FindOpenGLES2/3.cmake to build folder + shutil.copy(os.path.join(self._source_subfolder, "modules", "FindOpenGLES2.cmake"), "FindOpenGLES2.cmake") + shutil.copy(os.path.join(self._source_subfolder, "modules", "FindOpenGLES3.cmake"), "FindOpenGLES3.cmake") + if self.settings.os == "Emscripten": + shutil.copy(os.path.join(self._source_subfolder, "modules", "FindSDL2.cmake"), "FindSDL2.cmake") + def build(self): self._patch_sources() @@ -611,7 +618,9 @@ def package_info(self): self.cpp_info.components["sdl2_application"].names["cmake_find_package"] = "Sdl2Application" self.cpp_info.components["sdl2_application"].names["cmake_find_package_multi"] = "Sdl2Application" self.cpp_info.components["sdl2_application"].libs = ["MagnumSdl2Application{}".format(lib_suffix)] - self.cpp_info.components["sdl2_application"].requires = ["magnum_main", "sdl::sdl"] + self.cpp_info.components["sdl2_application"].requires = ["magnum_main"] + if self.settings.os != "Emscripten": + self.cpp_info.components["sdl2_application"].requires += ["sdl::sdl"] if self.options.target_gl: self.cpp_info.components["sdl2_application"].requires += ["gl"] From d9ef7721722398e0b150b4c459e4ac6a2f74fccc Mon Sep 17 00:00:00 2001 From: jgsogo Date: Sat, 25 Sep 2021 22:55:04 +0200 Subject: [PATCH 70/88] prepare for emscripten --- recipes/magnum-extras/all/conanfile.py | 31 +++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/recipes/magnum-extras/all/conanfile.py b/recipes/magnum-extras/all/conanfile.py index 742d16e5f78e0..c027ba1845fbf 100644 --- a/recipes/magnum-extras/all/conanfile.py +++ b/recipes/magnum-extras/all/conanfile.py @@ -9,7 +9,7 @@ class MagnumExtrasConan(ConanFile): name = "magnum-extras" description = "Extras for the Magnum C++11/C++14 graphics engine" license = "MIT" - topics = ("conan", "magnum", "graphics", "rendering", "3d", "2d", "opengl") + topics = ("magnum", "graphics", "rendering", "3d", "2d", "opengl") url = "https://github.com/conan-io/conan-center-index" homepage = "https://magnum.graphics" @@ -21,6 +21,7 @@ class MagnumExtrasConan(ConanFile): "with_player": [True, False], "with_ui": [True, False], "with_ui_gallery": [True, False], + "application": ["android", "emscripten", "glfw", "glx", "sdl2", "xegl"], } default_options = { "shared": False, @@ -28,6 +29,7 @@ class MagnumExtrasConan(ConanFile): "with_player": True, "with_ui": True, "with_ui_gallery": True, + "application": "sdl2", } generators = "cmake", "cmake_find_package" exports_sources = ["CMakeLists.txt", "patches/*"] @@ -48,6 +50,11 @@ def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if self.settings.os == "Android": + self.options.application = "android" + if self.settings.os == "Emscripten": + self.options.application = "emscripten" + def configure(self): if self.options.shared: del self.options.fPIC @@ -55,6 +62,15 @@ def configure(self): def requirements(self): self.requires("magnum/{}".format(self.version)) self.requires("corrade/{}".format(self.version)) + if self.settings.os in ["iOS", "Emscripten", "Android"]: + self.requires("magnum-plugins/{}".format(self.version)) + + def validate(self): + opt_name = "{}_application".format(self.options.application) + if not getattr(self.options["magnum"], opt_name): + raise ConanInvalidConfiguration("Magnum needs option '{opt}=True'".format(opt=opt_name)) + if self.settings.os == "Emscripten" and self.options["magnum"].target_gl == "gles2": + raise ConanInvalidConfiguration("OpenGL ES 3 required, use option 'magnum:target_gl=gles3'") def _configure_cmake(self): if self._cmake: @@ -77,6 +93,14 @@ def _patch_sources(self): for patch in self.conan_data.get("patches", {}).get(self.version, []): tools.patch(**patch) + cmakelists = [os.path.join("src", "Magnum", "Ui", "CMakeLists.txt"), + os.path.join("src", "player","CMakeLists.txt")] + app_name = "{}Application".format("XEgl" if self.options.application == "xegl" else str(self.options.application).capitalize()) + for cmakelist in cmakelists: + tools.replace_in_file(os.path.join(self._source_subfolder, cmakelist), + "Magnum::Application", + "Magnum::{}".format(app_name)) + def build(self): self._patch_sources() @@ -87,10 +111,7 @@ def package(self): cm = self._configure_cmake() cm.install() - #tools.rmdir(os.path.join(self.package_folder, "cmake")) - #tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - #tools.rmdir(os.path.join(self.package_folder, "share")) - + tools.rmdir(os.path.join(self.package_folder, "share")) self.copy("COPYING", src=self._source_subfolder, dst="licenses") def package_info(self): From 6abf38f96bbb2c90171fb576e2f2f6b4d75773f3 Mon Sep 17 00:00:00 2001 From: jgsogo Date: Sat, 25 Sep 2021 23:43:18 +0200 Subject: [PATCH 71/88] building with emscripten --- recipes/magnum-extras/all/conandata.yml | 7 +++++ recipes/magnum-extras/all/conanfile.py | 31 ++++++++++++------- .../2020.06/0001-emscripten-toolchain.patch | 15 +++++++++ 3 files changed, 41 insertions(+), 12 deletions(-) create mode 100644 recipes/magnum-extras/all/patches/2020.06/0001-emscripten-toolchain.patch diff --git a/recipes/magnum-extras/all/conandata.yml b/recipes/magnum-extras/all/conandata.yml index 59cf467992abc..beb3ab34a0599 100644 --- a/recipes/magnum-extras/all/conandata.yml +++ b/recipes/magnum-extras/all/conandata.yml @@ -2,3 +2,10 @@ sources: "2020.06": url: "https://github.com/mosra/magnum-extras/archive/refs/tags/v2020.06.tar.gz" sha256: "a8d7babc50ac070984d39f6cc15c3ce2af7b41fe980fe81b0405da6f5ba3c36d" +patches: + "2020.06": + - base_path: "source_subfolder" + patch_file: "patches/2020.06/0001-emscripten-toolchain.patch" + # patch_type: "portability" + # description: "Remove unnecessary dependency on UseEmscripten" + # source: "https://github.com/mosra/magnum/issues/490" diff --git a/recipes/magnum-extras/all/conanfile.py b/recipes/magnum-extras/all/conanfile.py index c027ba1845fbf..0b2664315e57c 100644 --- a/recipes/magnum-extras/all/conanfile.py +++ b/recipes/magnum-extras/all/conanfile.py @@ -18,17 +18,17 @@ class MagnumExtrasConan(ConanFile): options = { "shared": [True, False], "fPIC": [True, False], - "with_player": [True, False], - "with_ui": [True, False], - "with_ui_gallery": [True, False], + "player": [True, False], + "ui": [True, False], + "ui_gallery": [True, False], "application": ["android", "emscripten", "glfw", "glx", "sdl2", "xegl"], } default_options = { "shared": False, "fPIC": True, - "with_player": True, - "with_ui": True, - "with_ui_gallery": True, + "player": True, + "ui": True, + "ui_gallery": True, "application": "sdl2", } generators = "cmake", "cmake_find_package" @@ -54,6 +54,10 @@ def config_options(self): self.options.application = "android" if self.settings.os == "Emscripten": self.options.application = "emscripten" + # FIXME: Requires 'magnum:basis_importer=True' + self.options.player = False + # #FIXME: Fails to compile + self.options.ui_gallery = False def configure(self): if self.options.shared: @@ -62,9 +66,12 @@ def configure(self): def requirements(self): self.requires("magnum/{}".format(self.version)) self.requires("corrade/{}".format(self.version)) - if self.settings.os in ["iOS", "Emscripten", "Android"]: + if self.settings.os in ["iOS", "Emscripten", "Android"] and self.options.ui_gallery: self.requires("magnum-plugins/{}".format(self.version)) + def build_requirements(self): + self.build_requires("corrade/{}".format(self.version)) + def validate(self): opt_name = "{}_application".format(self.options.application) if not getattr(self.options["magnum"], opt_name): @@ -82,9 +89,9 @@ def _configure_cmake(self): self._cmake.definitions["BUILD_TESTS"] = False self._cmake.definitions["BUILD_GL_TESTS"] = False - self._cmake.definitions["WITH_PLAYER"] = self.options.with_player - self._cmake.definitions["WITH_UI"] = self.options.with_ui - self._cmake.definitions["WITH_UI_GALLERY"] = self.options.with_ui_gallery + self._cmake.definitions["WITH_PLAYER"] = self.options.player + self._cmake.definitions["WITH_UI"] = self.options.ui + self._cmake.definitions["WITH_UI_GALLERY"] = self.options.ui_gallery self._cmake.configure() return self._cmake @@ -118,13 +125,13 @@ def package_info(self): self.cpp_info.names["cmake_find_package"] = "MagnumExtras" self.cpp_info.names["cmake_find_package_multi"] = "MagnumExtras" - if self.options.with_ui: + if self.options.ui: self.cpp_info.components["ui"].names["cmake_find_package"] = "Ui" self.cpp_info.components["ui"].names["cmake_find_package_multi"] = "Ui" self.cpp_info.components["ui"].libs = ["MagnumUi"] self.cpp_info.components["ui"].requires = ["corrade::interconnect", "magnum::magnum_main", "magnum::gl", "magnum::text"] - if self.options.with_player or self.options.with_ui_gallery: + if self.options.player or self.options.ui_gallery: bin_path = os.path.join(self.package_folder, "bin") self.output.info('Appending PATH environment variable: %s' % bin_path) self.env_info.path.append(bin_path) diff --git a/recipes/magnum-extras/all/patches/2020.06/0001-emscripten-toolchain.patch b/recipes/magnum-extras/all/patches/2020.06/0001-emscripten-toolchain.patch new file mode 100644 index 0000000000000..8fab49087628a --- /dev/null +++ b/recipes/magnum-extras/all/patches/2020.06/0001-emscripten-toolchain.patch @@ -0,0 +1,15 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e0e0eb7..65083df 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -58,10 +58,6 @@ if(CORRADE_TARGET_EMSCRIPTEN OR CORRADE_TARGET_ANDROID) + set(BUILD_STATIC ON) + endif() + +-if(CORRADE_TARGET_EMSCRIPTEN) +- include(UseEmscripten) +-endif() +- + if(BUILD_TESTS) + find_package(Corrade REQUIRED TestSuite) + if(CORRADE_TARGET_IOS) From 45714df3f2db29205ab58bd421bce4c2ed4c2e1f Mon Sep 17 00:00:00 2001 From: jgsogo Date: Sat, 25 Sep 2021 23:54:05 +0200 Subject: [PATCH 72/88] [magnum-integration] Add recipe --- recipes/magnum-integration/all/CMakeLists.txt | 10 ++ recipes/magnum-integration/all/conandata.yml | 4 + recipes/magnum-integration/all/conanfile.py | 156 ++++++++++++++++++ recipes/magnum-integration/config.yml | 3 + 4 files changed, 173 insertions(+) create mode 100644 recipes/magnum-integration/all/CMakeLists.txt create mode 100644 recipes/magnum-integration/all/conandata.yml create mode 100644 recipes/magnum-integration/all/conanfile.py create mode 100644 recipes/magnum-integration/config.yml diff --git a/recipes/magnum-integration/all/CMakeLists.txt b/recipes/magnum-integration/all/CMakeLists.txt new file mode 100644 index 0000000000000..a278d77fbf38a --- /dev/null +++ b/recipes/magnum-integration/all/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(cmake_wrapper) + +include(conanbuildinfo.cmake) +conan_basic_setup() + +set(MAGNUM_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/Magnum) +set(MAGNUM_EXTERNAL_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/MagnumExternal) + +add_subdirectory("source_subfolder") diff --git a/recipes/magnum-integration/all/conandata.yml b/recipes/magnum-integration/all/conandata.yml new file mode 100644 index 0000000000000..4634cb503f8ce --- /dev/null +++ b/recipes/magnum-integration/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "2020.06": + url: "https://github.com/mosra/magnum-integration/archive/refs/tags/v2020.06.tar.gz" + sha256: "4eb461e0a38d7be69a52b8faf7664493da4e4cabc2c4fa86bd672d2e8f0a9311" diff --git a/recipes/magnum-integration/all/conanfile.py b/recipes/magnum-integration/all/conanfile.py new file mode 100644 index 0000000000000..76a2f2352772b --- /dev/null +++ b/recipes/magnum-integration/all/conanfile.py @@ -0,0 +1,156 @@ +from conans import ConanFile, CMake, tools +from conans.errors import ConanInvalidConfiguration +import os + +required_conan_version = ">=1.33.0" + + +class MagnumIntegrationConan(ConanFile): + name = "magnum-integration" + description = "Integration libraries for the Magnum C++11/C++14 graphics engine" + license = "MIT" + topics = ("magnum", "graphics", "rendering", "3d", "2d", "opengl") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://magnum.graphics" + + settings = "os", "compiler", "build_type", "arch" + + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_bullet": [True, False], + "with_dart": [True, False], + "with_eigen": [True, False], + "with_glm": [True, False], + "with_imgui": [True, False], + "with_ovr": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_bullet": True, + "with_dart": False, + "with_eigen": True, + "with_glm": True, + "with_imgui": True, + "with_ovr": False, + } + generators = "cmake", "cmake_find_package" + exports_sources = ["CMakeLists.txt", "patches/*"] + + _cmake = None + + @property + def _source_subfolder(self): + return "source_subfolder" + + def source(self): + tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), + 'set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/modules/" ${CMAKE_MODULE_PATH})', + "") + tools.replace_in_file(os.path.join(self._source_subfolder, "src", "Magnum", "GlmIntegration", "CMakeLists.txt"), + "GLM::GLM", + "glm::glm") + tools.replace_in_file(os.path.join(self._source_subfolder, "src", "Magnum", "ImGuiIntegration", "CMakeLists.txt"), + "ImGui::ImGui", + "imgui::imgui") + tools.replace_in_file(os.path.join(self._source_subfolder, "src", "Magnum", "ImGuiIntegration", "CMakeLists.txt"), + "ImGui::Sources", + "") + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + del self.options.fPIC + + def requirements(self): + self.requires("magnum/{}".format(self.version)) + if self.options.with_bullet: + self.requires("bullet3/3.17") + if self.options.with_dart: + raise ConanInvalidConfiguration("DART library is not available in ConanCenter (yet)") + if self.options.with_eigen: + self.requires("eigen/3.4.0") + if self.options.with_glm: + self.requires("glm/0.9.9.8") + if self.options.with_imgui: + self.requires("imgui/1.84.2") + if self.options.with_ovr: + raise ConanInvalidConfiguration("OVR library is not available in ConanCenter (yet)") + + def _configure_cmake(self): + if self._cmake: + return self._cmake + + self._cmake = CMake(self) + self._cmake.definitions["BUILD_STATIC"] = not self.options.shared + self._cmake.definitions["BUILD_STATIC_PIC"] = self.options.get_safe("fPIC", False) + self._cmake.definitions["BUILD_TESTS"] = False + self._cmake.definitions["BUILD_GL_TESTS"] = False + + self._cmake.definitions["WITH_BULLET"] = self.options.with_bullet + self._cmake.definitions["WITH_DART"] = self.options.with_dart + self._cmake.definitions["WITH_EIGEN"] = self.options.with_eigen + self._cmake.definitions["WITH_GLM"] = self.options.with_glm + self._cmake.definitions["WITH_IMGUI"] = self.options.with_imgui + self._cmake.definitions["WITH_OVR"] = self.options.with_ovr + + self._cmake.configure() + return self._cmake + + def _patch_sources(self): + for patch in self.conan_data.get("patches", {}).get(self.version, []): + tools.patch(**patch) + + def build(self): + self._patch_sources() + + cm = self._configure_cmake() + cm.build() + + def package(self): + cm = self._configure_cmake() + cm.install() + + #tools.rmdir(os.path.join(self.package_folder, "cmake")) + #tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + #tools.rmdir(os.path.join(self.package_folder, "share")) + + self.copy("COPYING", src=self._source_subfolder, dst="licenses") + + def package_info(self): + self.cpp_info.names["cmake_find_package"] = "MagnumIntegration" + self.cpp_info.names["cmake_find_package_multi"] = "MagnumIntegration" + + if self.options.with_bullet: + self.cpp_info.components["bullet"].names["cmake_find_package"] = "Bullet" + self.cpp_info.components["bullet"].names["cmake_find_package_multi"] = "Bullet" + self.cpp_info.components["bullet"].libs = ["MagnumBulletIntegration"] + self.cpp_info.components["bullet"].requires = ["magnum::magnum_main", "magnum::gl", "magnum::scenegraph", "magnum::shaders", "bullet3::bullet3"] + + if self.options.with_dart: + pass + + if self.options.with_eigen: + self.cpp_info.components["eigen"].names["cmake_find_package"] = "Eigen" + self.cpp_info.components["eigen"].names["cmake_find_package_multi"] = "Eigen" + self.cpp_info.components["eigen"].requires = ["magnum::magnum_main", "eigen::eigen"] + + if self.options.with_glm: + self.cpp_info.components["glm"].names["cmake_find_package"] = "Glm" + self.cpp_info.components["glm"].names["cmake_find_package_multi"] = "Glm" + self.cpp_info.components["glm"].libs = ["MagnumGlmIntegration"] + self.cpp_info.components["glm"].requires = ["magnum::magnum_main", "glm::glm"] + + if self.options.with_imgui: + self.cpp_info.components["imgui"].names["cmake_find_package"] = "ImGui" + self.cpp_info.components["imgui"].names["cmake_find_package_multi"] = "ImGui" + self.cpp_info.components["imgui"].libs = ["MagnumImGuiIntegration"] + self.cpp_info.components["imgui"].requires = ["magnum::magnum_main", "magnum::gl", "magnum::shaders", "imgui::imgui"] + + if self.options.with_ovr: + pass diff --git a/recipes/magnum-integration/config.yml b/recipes/magnum-integration/config.yml new file mode 100644 index 0000000000000..93230781a72ea --- /dev/null +++ b/recipes/magnum-integration/config.yml @@ -0,0 +1,3 @@ +versions: + "2020.06": + folder: all From fe0191f1f84a74f3a24f2229dc67d1b42b3c0362 Mon Sep 17 00:00:00 2001 From: jgsogo Date: Sat, 25 Sep 2021 23:56:35 +0200 Subject: [PATCH 73/88] remove cmake files --- recipes/magnum-integration/all/conanfile.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/recipes/magnum-integration/all/conanfile.py b/recipes/magnum-integration/all/conanfile.py index 76a2f2352772b..4438e02b8086e 100644 --- a/recipes/magnum-integration/all/conanfile.py +++ b/recipes/magnum-integration/all/conanfile.py @@ -116,10 +116,7 @@ def package(self): cm = self._configure_cmake() cm.install() - #tools.rmdir(os.path.join(self.package_folder, "cmake")) - #tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - #tools.rmdir(os.path.join(self.package_folder, "share")) - + tools.rmdir(os.path.join(self.package_folder, "share")) self.copy("COPYING", src=self._source_subfolder, dst="licenses") def package_info(self): From f8c57a453e31bad916fe110e7f385db95b4bc673 Mon Sep 17 00:00:00 2001 From: jgsogo Date: Sun, 26 Sep 2021 00:13:10 +0200 Subject: [PATCH 74/88] test package --- recipes/magnum-integration/all/conanfile.py | 2 +- .../all/test_package/CMakeLists.txt | 33 +++++++++++++++++++ .../all/test_package/conanfile.py | 27 +++++++++++++++ .../all/test_package/test_package.cpp | 24 ++++++++++++++ 4 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 recipes/magnum-integration/all/test_package/CMakeLists.txt create mode 100644 recipes/magnum-integration/all/test_package/conanfile.py create mode 100644 recipes/magnum-integration/all/test_package/test_package.cpp diff --git a/recipes/magnum-integration/all/conanfile.py b/recipes/magnum-integration/all/conanfile.py index 4438e02b8086e..695ca7bd34eb0 100644 --- a/recipes/magnum-integration/all/conanfile.py +++ b/recipes/magnum-integration/all/conanfile.py @@ -127,7 +127,7 @@ def package_info(self): self.cpp_info.components["bullet"].names["cmake_find_package"] = "Bullet" self.cpp_info.components["bullet"].names["cmake_find_package_multi"] = "Bullet" self.cpp_info.components["bullet"].libs = ["MagnumBulletIntegration"] - self.cpp_info.components["bullet"].requires = ["magnum::magnum_main", "magnum::gl", "magnum::scenegraph", "magnum::shaders", "bullet3::bullet3"] + self.cpp_info.components["bullet"].requires = ["magnum::magnum_main", "magnum::gl", "magnum::shaders", "bullet3::bullet3"] if self.options.with_dart: pass diff --git a/recipes/magnum-integration/all/test_package/CMakeLists.txt b/recipes/magnum-integration/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..83c73fe2b0d1c --- /dev/null +++ b/recipes/magnum-integration/all/test_package/CMakeLists.txt @@ -0,0 +1,33 @@ +cmake_minimum_required(VERSION 3.11) +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(MagnumIntegration REQUIRED) + +add_executable(${PROJECT_NAME} test_package.cpp) +if(WITH_BULLET) + target_link_libraries(${PROJECT_NAME} PRIVATE MagnumIntegration::Bullet) + target_compile_definitions(${PROJECT_NAME} PRIVATE WITH_BULLET) +endif() +if(WITH_DART) + target_link_libraries(${PROJECT_NAME} PRIVATE MagnumIntegration::Dart) + target_compile_definitions(${PROJECT_NAME} PRIVATE WITH_DART) +endif() +if(WITH_EIGEN) + target_link_libraries(${PROJECT_NAME} PRIVATE MagnumIntegration::Eigen) + target_compile_definitions(${PROJECT_NAME} PRIVATE WITH_EIGEN) +endif() +if(WITH_GLM) + target_link_libraries(${PROJECT_NAME} PRIVATE MagnumIntegration::Glm) + target_compile_definitions(${PROJECT_NAME} PRIVATE WITH_GLM) +endif() +if(WITH_IMGUI) + target_link_libraries(${PROJECT_NAME} PRIVATE MagnumIntegration::ImGui) + target_compile_definitions(${PROJECT_NAME} PRIVATE WITH_IMGUI) +endif() +if(WITH_OVR) + target_link_libraries(${PROJECT_NAME} PRIVATE MagnumIntegration::Ovr) + target_compile_definitions(${PROJECT_NAME} PRIVATE WITH_OVR) +endif() diff --git a/recipes/magnum-integration/all/test_package/conanfile.py b/recipes/magnum-integration/all/test_package/conanfile.py new file mode 100644 index 0000000000000..1d2d6f7e65f70 --- /dev/null +++ b/recipes/magnum-integration/all/test_package/conanfile.py @@ -0,0 +1,27 @@ +import os +from conans import ConanFile, CMake, tools + +class TestPackage(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.definitions["WITH_BULLET"] = self.options["magnum-integration"].with_bullet + cmake.definitions["WITH_DART"] = self.options["magnum-integration"].with_dart + cmake.definitions["WITH_EIGEN"] = self.options["magnum-integration"].with_eigen + cmake.definitions["WITH_GLM"] = self.options["magnum-integration"].with_glm + cmake.definitions["WITH_IMGUI"] = self.options["magnum-integration"].with_imgui + cmake.definitions["WITH_OVR"] = self.options["magnum-integration"].with_ovr + cmake.configure() + cmake.build() + + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) + + if self.settings.os == "Emscripten": + bin_path = os.path.join("bin", "test_package.js") + self.run("node {}".format(bin_path), run_environment=True) diff --git a/recipes/magnum-integration/all/test_package/test_package.cpp b/recipes/magnum-integration/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..6486431e200d1 --- /dev/null +++ b/recipes/magnum-integration/all/test_package/test_package.cpp @@ -0,0 +1,24 @@ + +#include + +int main() { + #ifdef WITH_BULLET + std::cout << "With Bullet\n"; + #endif + #ifdef WITH_DART + std::cout << "With Dart\n"; + #endif + #ifdef WITH_EIGEN + std::cout << "With Eigen\n"; + #endif + #ifdef WITH_GLM + std::cout << "With Glm\n"; + #endif + #ifdef WITH_IMGUI + std::cout << "With ImGui\n"; + #endif + #ifdef WITH_OVR + std::cout << "With Ovr\n"; + #endif + return 0; +} From aad68b46e6e14d1bb37348e27f1cf1ad4d5fcceb Mon Sep 17 00:00:00 2001 From: jgsogo Date: Sun, 26 Sep 2021 11:20:03 +0200 Subject: [PATCH 75/88] add tests --- .../all/test_package/CMakeLists.txt | 3 + .../all/test_package/test_package.cpp | 67 ++++++++++++++++--- 2 files changed, 60 insertions(+), 10 deletions(-) diff --git a/recipes/magnum-integration/all/test_package/CMakeLists.txt b/recipes/magnum-integration/all/test_package/CMakeLists.txt index 83c73fe2b0d1c..2f483ffbe1392 100644 --- a/recipes/magnum-integration/all/test_package/CMakeLists.txt +++ b/recipes/magnum-integration/all/test_package/CMakeLists.txt @@ -5,6 +5,7 @@ include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) find_package(MagnumIntegration REQUIRED) +set(CMAKE_CXX_STANDARD 11) add_executable(${PROJECT_NAME} test_package.cpp) if(WITH_BULLET) @@ -12,6 +13,7 @@ if(WITH_BULLET) target_compile_definitions(${PROJECT_NAME} PRIVATE WITH_BULLET) endif() if(WITH_DART) + message(FATAL_ERROR "Please, add test with DART") target_link_libraries(${PROJECT_NAME} PRIVATE MagnumIntegration::Dart) target_compile_definitions(${PROJECT_NAME} PRIVATE WITH_DART) endif() @@ -28,6 +30,7 @@ if(WITH_IMGUI) target_compile_definitions(${PROJECT_NAME} PRIVATE WITH_IMGUI) endif() if(WITH_OVR) + message(FATAL_ERROR "Please, add test with OVR") target_link_libraries(${PROJECT_NAME} PRIVATE MagnumIntegration::Ovr) target_compile_definitions(${PROJECT_NAME} PRIVATE WITH_OVR) endif() diff --git a/recipes/magnum-integration/all/test_package/test_package.cpp b/recipes/magnum-integration/all/test_package/test_package.cpp index 6486431e200d1..f5d0c00b60a52 100644 --- a/recipes/magnum-integration/all/test_package/test_package.cpp +++ b/recipes/magnum-integration/all/test_package/test_package.cpp @@ -1,24 +1,71 @@ #include +#ifdef WITH_BULLET + #include "Magnum/BulletIntegration/Integration.h" + + void with_bullet() { + std::cout << "With Bullet\n"; + Magnum::Math::Vector3 a{btScalar(1.0), btScalar(2.0), btScalar(3.0)}; + btVector3 b{btScalar(1.0), btScalar(2.0), btScalar(3.0)}; + assert(Magnum::Math::Vector3{b} == a); + } +#endif + +#ifdef WITH_EIGEN + #include + #include "Magnum/EigenIntegration/Integration.h" + + void with_eigen() { + std::cout << "With Eigen\n"; + Magnum::Math::Quaternion q{}; + Eigen::Quaternion eq{q.scalar(), q.vector().x(), q.vector().y(), q.vector().z()}; + } +#endif + +#ifdef WITH_GLM + #include "Magnum/Magnum.h" + #include "Magnum/Math/Matrix3.h" + #include "Magnum/Math/Matrix4.h" + #include "Magnum/GlmIntegration/Integration.h" + + void with_glm() { + std::cout << "With GLM\n"; + Magnum::Math::BoolVector<2> a{0x6}; + glm::bvec2 b{false, true}; + assert(glm::bvec2(a) == b); + } +#endif + +#ifdef WITH_IMGUI + #include + #include + #include "Magnum/ImGuiIntegration/Integration.h" + + void with_imgui() { + std::cout << "With ImGui\n"; + ImVec2 imVec2{1.1f, 1.2f}; + Magnum::Vector2 vec2(1.1f, 1.2f); + assert(Magnum::Vector2{imVec2} == vec2); + } +#endif + int main() { #ifdef WITH_BULLET - std::cout << "With Bullet\n"; - #endif - #ifdef WITH_DART - std::cout << "With Dart\n"; + with_bullet(); #endif + #ifdef WITH_EIGEN - std::cout << "With Eigen\n"; + with_eigen(); #endif + #ifdef WITH_GLM - std::cout << "With Glm\n"; + with_glm(); #endif + #ifdef WITH_IMGUI - std::cout << "With ImGui\n"; - #endif - #ifdef WITH_OVR - std::cout << "With Ovr\n"; + with_imgui(); #endif + return 0; } From 1e90543afeee710328ddcd987e07fb5b96e5692b Mon Sep 17 00:00:00 2001 From: jgsogo Date: Sun, 26 Sep 2021 11:22:42 +0200 Subject: [PATCH 76/88] Add comments --- recipes/magnum-integration/all/conanfile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/magnum-integration/all/conanfile.py b/recipes/magnum-integration/all/conanfile.py index 695ca7bd34eb0..c0e4b24523965 100644 --- a/recipes/magnum-integration/all/conanfile.py +++ b/recipes/magnum-integration/all/conanfile.py @@ -72,6 +72,7 @@ def requirements(self): if self.options.with_bullet: self.requires("bullet3/3.17") if self.options.with_dart: + # FIXME: Add 'dart' requirement raise ConanInvalidConfiguration("DART library is not available in ConanCenter (yet)") if self.options.with_eigen: self.requires("eigen/3.4.0") @@ -80,6 +81,7 @@ def requirements(self): if self.options.with_imgui: self.requires("imgui/1.84.2") if self.options.with_ovr: + # FIXME: Add 'ovr' requirement raise ConanInvalidConfiguration("OVR library is not available in ConanCenter (yet)") def _configure_cmake(self): From d6546c7e24b043ee371174505753ff244159953e Mon Sep 17 00:00:00 2001 From: jgsogo Date: Sun, 26 Sep 2021 11:41:56 +0200 Subject: [PATCH 77/88] match casing --- recipes/magnum-integration/all/conanfile.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/recipes/magnum-integration/all/conanfile.py b/recipes/magnum-integration/all/conanfile.py index c0e4b24523965..28e8f0db97fae 100644 --- a/recipes/magnum-integration/all/conanfile.py +++ b/recipes/magnum-integration/all/conanfile.py @@ -49,9 +49,16 @@ def source(self): tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), 'set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/modules/" ${CMAKE_MODULE_PATH})', "") + # Casing + tools.replace_in_file(os.path.join(self._source_subfolder, "src", "Magnum", "GlmIntegration", "CMakeLists.txt"), + "find_package(GLM REQUIRED)", + "find_package(glm REQUIRED)") tools.replace_in_file(os.path.join(self._source_subfolder, "src", "Magnum", "GlmIntegration", "CMakeLists.txt"), "GLM::GLM", "glm::glm") + tools.replace_in_file(os.path.join(self._source_subfolder, "src", "Magnum", "ImGuiIntegration", "CMakeLists.txt"), + "find_package(ImGui REQUIRED Sources)", + "find_package(imgui REQUIRED Sources)") tools.replace_in_file(os.path.join(self._source_subfolder, "src", "Magnum", "ImGuiIntegration", "CMakeLists.txt"), "ImGui::ImGui", "imgui::imgui") From 6efa427ffcd0a83751f37809ac98d24ad4ca4fd2 Mon Sep 17 00:00:00 2001 From: jgsogo Date: Sun, 26 Sep 2021 12:12:58 +0200 Subject: [PATCH 78/88] debug libraries suffix -d --- recipes/magnum-integration/all/conanfile.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/recipes/magnum-integration/all/conanfile.py b/recipes/magnum-integration/all/conanfile.py index 28e8f0db97fae..5c722f2073a6d 100644 --- a/recipes/magnum-integration/all/conanfile.py +++ b/recipes/magnum-integration/all/conanfile.py @@ -132,10 +132,12 @@ def package_info(self): self.cpp_info.names["cmake_find_package"] = "MagnumIntegration" self.cpp_info.names["cmake_find_package_multi"] = "MagnumIntegration" + lib_suffix = "-d" if self.settings.build_type == "Debug" else "" + if self.options.with_bullet: self.cpp_info.components["bullet"].names["cmake_find_package"] = "Bullet" self.cpp_info.components["bullet"].names["cmake_find_package_multi"] = "Bullet" - self.cpp_info.components["bullet"].libs = ["MagnumBulletIntegration"] + self.cpp_info.components["bullet"].libs = ["MagnumBulletIntegration{}".format(lib_suffix)] self.cpp_info.components["bullet"].requires = ["magnum::magnum_main", "magnum::gl", "magnum::shaders", "bullet3::bullet3"] if self.options.with_dart: @@ -149,13 +151,13 @@ def package_info(self): if self.options.with_glm: self.cpp_info.components["glm"].names["cmake_find_package"] = "Glm" self.cpp_info.components["glm"].names["cmake_find_package_multi"] = "Glm" - self.cpp_info.components["glm"].libs = ["MagnumGlmIntegration"] + self.cpp_info.components["glm"].libs = ["MagnumGlmIntegration{}".format(lib_suffix)] self.cpp_info.components["glm"].requires = ["magnum::magnum_main", "glm::glm"] if self.options.with_imgui: self.cpp_info.components["imgui"].names["cmake_find_package"] = "ImGui" self.cpp_info.components["imgui"].names["cmake_find_package_multi"] = "ImGui" - self.cpp_info.components["imgui"].libs = ["MagnumImGuiIntegration"] + self.cpp_info.components["imgui"].libs = ["MagnumImGuiIntegration{}".format(lib_suffix)] self.cpp_info.components["imgui"].requires = ["magnum::magnum_main", "magnum::gl", "magnum::shaders", "imgui::imgui"] if self.options.with_ovr: From ee1feba669a5b1a435cf20e53e675ca4f9ca97d2 Mon Sep 17 00:00:00 2001 From: jgsogo Date: Sun, 26 Sep 2021 16:34:02 +0200 Subject: [PATCH 79/88] Add link flags that will be needed by consumers --- .../magnum/all/cmake/conan-magnum-vars.cmake | 19 +++++++++++++++++++ recipes/magnum/all/conandata.yml | 5 +++++ recipes/magnum/all/conanfile.py | 11 ++++++++--- .../2020.06/0002-emscripten-dyncall.patch | 16 ++++++++++++++++ .../magnum/all/test_package/CMakeLists.txt | 8 ++------ recipes/magnum/all/test_package/conanfile.py | 1 - 6 files changed, 50 insertions(+), 10 deletions(-) create mode 100644 recipes/magnum/all/patches/2020.06/0002-emscripten-dyncall.patch diff --git a/recipes/magnum/all/cmake/conan-magnum-vars.cmake b/recipes/magnum/all/cmake/conan-magnum-vars.cmake index 4364855e99fa4..678f5ee23a496 100644 --- a/recipes/magnum/all/cmake/conan-magnum-vars.cmake +++ b/recipes/magnum/all/cmake/conan-magnum-vars.cmake @@ -23,3 +23,22 @@ foreach(_magnumFlag ${_magnumFlags}) set(MAGNUM_${_magnumFlag} 1) endif() endforeach() + +# When using Emscripten, the 'magnum' library provides some additional variables and functions +if(CORRADE_TARGET_EMSCRIPTEN) + find_file(MAGNUM_EMSCRIPTENAPPLICATION_JS EmscriptenApplication.js + PATH_SUFFIXES "${CMAKE_CURRENT_LIST_DIR}/../../share/magnum") + find_file(MAGNUM_WINDOWLESSEMSCRIPTENAPPLICATION_JS WindowlessEmscriptenApplication.js + PATH_SUFFIXES "${CMAKE_CURRENT_LIST_DIR}/../../share/magnum") + find_file(MAGNUM_WEBAPPLICATION_CSS WebApplication.css + PATH_SUFFIXES "${CMAKE_CURRENT_LIST_DIR}/../../share/magnum") + + function(emscripten_embed_file target file destination) + get_filename_component(absolute_file ${file} ABSOLUTE) + get_target_property(${target}_LINK_FLAGS ${target} LINK_FLAGS) + if(NOT ${target}_LINK_FLAGS) + set(${target}_LINK_FLAGS ) + endif() + set_target_properties(${target} PROPERTIES LINK_FLAGS "${${target}_LINK_FLAGS} --embed-file ${absolute_file}@${destination}") + endfunction() +endif() diff --git a/recipes/magnum/all/conandata.yml b/recipes/magnum/all/conandata.yml index 3043353262bcf..4ea2558eb85bc 100644 --- a/recipes/magnum/all/conandata.yml +++ b/recipes/magnum/all/conandata.yml @@ -9,3 +9,8 @@ patches: # patch_type: "portability" # description: "Remove unnecessary dependency on UseEmscripten" # source: "https://github.com/mosra/magnum/issues/490" + - base_path: "source_subfolder" + patch_file: "patches/2020.06/0002-emscripten-dyncall.patch" + # patch_type: "portability" + # description: "Work around missing dynCall() since Emscripten 2.0.10" + # source: "https://github.com/mosra/magnum/commit/e65d6cff23b51b378bcdac32c8b2e7f09dd63caa" diff --git a/recipes/magnum/all/conanfile.py b/recipes/magnum/all/conanfile.py index 233c0efdc6dad..9ba69202c8f7b 100644 --- a/recipes/magnum/all/conanfile.py +++ b/recipes/magnum/all/conanfile.py @@ -193,7 +193,7 @@ def config_options(self): if self.settings.os == "Emscripten": self.options.shared_plugins = False - self.options.target_gl = "gles2" + self.options.target_gl = "gles3" self.options.sdl2_application = True # FIXME: Fails to build. Use emscripten-port?) @@ -482,7 +482,7 @@ def package(self): endif() """.format(target=target, library=library))) - tools.rmdir(os.path.join(self.package_folder, "share")) + tools.rmdir(os.path.join(self.package_folder, "share", "cmake")) self.copy("*.cmake", src=os.path.join(self.source_folder, "cmake"), dst=os.path.join("lib", "cmake")) self.copy("COPYING", src=self._source_subfolder, dst="licenses") @@ -595,7 +595,12 @@ def package_info(self): self.cpp_info.components["emscripten_application"].names["cmake_find_package"] = "EmscriptenApplication" self.cpp_info.components["emscripten_application"].names["cmake_find_package_multi"] = "EmscriptenApplication" self.cpp_info.components["emscripten_application"].libs = ["MagnumEmscriptenApplication{}".format(lib_suffix)] - self.cpp_info.components["emscripten_application"].requires = ["gl"] + self.cpp_info.components["emscripten_application"].requires = ["magnum_main", "gl"] + if self.options.target_gl == "gles2": + self.cpp_info.components["emscripten_application"].exelinkflags = ["-s FULL_ES2=1"] + elif self.options.target_gl == "gles3": + self.cpp_info.components["emscripten_application"].exelinkflags = ["-s FULL_ES3=1"] + if self.options.get_safe("windowless_ios_application", False): raise Exception("Recipe doesn't define this component") diff --git a/recipes/magnum/all/patches/2020.06/0002-emscripten-dyncall.patch b/recipes/magnum/all/patches/2020.06/0002-emscripten-dyncall.patch new file mode 100644 index 0000000000000..40716f7358d6e --- /dev/null +++ b/recipes/magnum/all/patches/2020.06/0002-emscripten-dyncall.patch @@ -0,0 +1,16 @@ +diff --git a/src/Magnum/Platform/EmscriptenApplication.cpp b/src/Magnum/Platform/EmscriptenApplication.cpp +index 010c4cb..ac28a19 100644 +--- a/src/Magnum/Platform/EmscriptenApplication.cpp ++++ b/src/Magnum/Platform/EmscriptenApplication.cpp +@@ -721,9 +721,8 @@ void EmscriptenApplication::redraw() { + var drawEvent = function() { + var id = window.requestAnimationFrame(drawEvent); + +- /* Call our callback via function pointer returning int with two +- int params */ +- if(!dynCall('ii', $0, [$1])) { ++ // https://github.com/mosra/magnum/commit/e65d6cff23b51b378bcdac32c8b2e7f09dd63caa ++ if(!wasmTable.get($0).apply(null, [$1])) { + window.cancelAnimationFrame(id); + } + }; diff --git a/recipes/magnum/all/test_package/CMakeLists.txt b/recipes/magnum/all/test_package/CMakeLists.txt index 39afc1743b58b..75058ba14203f 100644 --- a/recipes/magnum/all/test_package/CMakeLists.txt +++ b/recipes/magnum/all/test_package/CMakeLists.txt @@ -26,12 +26,8 @@ set_target_properties(${PROJECT_NAME} CXX_EXTENSIONS OFF ) -if(TARGET_EMSCRIPTEN) - message("Embed OBJ file") - set_target_properties(${PROJECT_NAME} - PROPERTIES - LINK_FLAGS "--embed-file ${OBJ_FILE}@${OBJ_FILE}" - ) +if(CORRADE_TARGET_EMSCRIPTEN) + emscripten_embed_file(${PROJECT_NAME} ${OBJ_FILE} ${OBJ_FILE}) endif() diff --git a/recipes/magnum/all/test_package/conanfile.py b/recipes/magnum/all/test_package/conanfile.py index 0aebeb1e32e13..3e9c44ed3a644 100644 --- a/recipes/magnum/all/test_package/conanfile.py +++ b/recipes/magnum/all/test_package/conanfile.py @@ -32,7 +32,6 @@ def build(self): cmake.definitions["IMPORTER_PLUGINS_FOLDER"] = os.path.join(self.deps_user_info["magnum"].plugins_basepath, "importers").replace("\\", "/") cmake.definitions["OBJ_FILE"] = os.path.join(self.source_folder, "triangleMesh.obj").replace("\\", "/") cmake.definitions["SHARED_PLUGINS"] = self.options["magnum"].shared_plugins - cmake.definitions["TARGET_EMSCRIPTEN"] = bool(self.settings.os == "Emscripten") cmake.configure() cmake.build() From 8da31ccc2118122ecc0d312b791f4c816688e9ad Mon Sep 17 00:00:00 2001 From: jgsogo Date: Sun, 26 Sep 2021 16:36:47 +0200 Subject: [PATCH 80/88] remove comment --- recipes/magnum/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/magnum/all/conanfile.py b/recipes/magnum/all/conanfile.py index 9ba69202c8f7b..808d0828cd218 100644 --- a/recipes/magnum/all/conanfile.py +++ b/recipes/magnum/all/conanfile.py @@ -195,7 +195,7 @@ def config_options(self): self.options.shared_plugins = False self.options.target_gl = "gles3" - self.options.sdl2_application = True # FIXME: Fails to build. Use emscripten-port?) + self.options.sdl2_application = True self.options.gl_info = False From 2ce766d571a9daa41a54b651fa9c4cc52cd2b692 Mon Sep 17 00:00:00 2001 From: jgsogo Date: Sun, 26 Sep 2021 16:59:59 +0200 Subject: [PATCH 81/88] find the files --- recipes/magnum/all/cmake/conan-magnum-vars.cmake | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/recipes/magnum/all/cmake/conan-magnum-vars.cmake b/recipes/magnum/all/cmake/conan-magnum-vars.cmake index 678f5ee23a496..76afdec322aba 100644 --- a/recipes/magnum/all/cmake/conan-magnum-vars.cmake +++ b/recipes/magnum/all/cmake/conan-magnum-vars.cmake @@ -27,11 +27,14 @@ endforeach() # When using Emscripten, the 'magnum' library provides some additional variables and functions if(CORRADE_TARGET_EMSCRIPTEN) find_file(MAGNUM_EMSCRIPTENAPPLICATION_JS EmscriptenApplication.js - PATH_SUFFIXES "${CMAKE_CURRENT_LIST_DIR}/../../share/magnum") + PATHS "${CMAKE_CURRENT_LIST_DIR}/../../share/magnum" + NO_DEFAULT_PATH) find_file(MAGNUM_WINDOWLESSEMSCRIPTENAPPLICATION_JS WindowlessEmscriptenApplication.js - PATH_SUFFIXES "${CMAKE_CURRENT_LIST_DIR}/../../share/magnum") + PATHS "${CMAKE_CURRENT_LIST_DIR}/../../share/magnum" + NO_DEFAULT_PATH) find_file(MAGNUM_WEBAPPLICATION_CSS WebApplication.css - PATH_SUFFIXES "${CMAKE_CURRENT_LIST_DIR}/../../share/magnum") + PATHS "${CMAKE_CURRENT_LIST_DIR}/../../share/magnum" + NO_DEFAULT_PATH) function(emscripten_embed_file target file destination) get_filename_component(absolute_file ${file} ABSOLUTE) From 06d950c5f712e1709b66ef0a02400655b47cdf38 Mon Sep 17 00:00:00 2001 From: werto87 Date: Sun, 26 Sep 2021 17:22:28 +0200 Subject: [PATCH 82/88] Update recipes/emsdk/config.yml Co-authored-by: Chris Mc --- recipes/emsdk/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/emsdk/config.yml b/recipes/emsdk/config.yml index 6594c45d81c7c..190a210d166e8 100644 --- a/recipes/emsdk/config.yml +++ b/recipes/emsdk/config.yml @@ -1,3 +1,3 @@ versions: - "2.0.26": + "2.0.30": folder: all From 63a0dce58dee45b3a22b64c07eef303dba4a9684 Mon Sep 17 00:00:00 2001 From: jgsogo Date: Sun, 26 Sep 2021 19:34:35 +0200 Subject: [PATCH 83/88] sdl2 app also works with emscripten --- recipes/magnum/all/conanfile.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/recipes/magnum/all/conanfile.py b/recipes/magnum/all/conanfile.py index 808d0828cd218..a45f9b5c39e63 100644 --- a/recipes/magnum/all/conanfile.py +++ b/recipes/magnum/all/conanfile.py @@ -624,10 +624,15 @@ def package_info(self): self.cpp_info.components["sdl2_application"].names["cmake_find_package_multi"] = "Sdl2Application" self.cpp_info.components["sdl2_application"].libs = ["MagnumSdl2Application{}".format(lib_suffix)] self.cpp_info.components["sdl2_application"].requires = ["magnum_main"] - if self.settings.os != "Emscripten": - self.cpp_info.components["sdl2_application"].requires += ["sdl::sdl"] if self.options.target_gl: self.cpp_info.components["sdl2_application"].requires += ["gl"] + if self.settings.os != "Emscripten": + self.cpp_info.components["sdl2_application"].requires += ["sdl::sdl"] + else: + if self.options.target_gl == "gles2": + self.cpp_info.components["sdl2_application"].exelinkflags = ["-s FULL_ES2=1"] + elif self.options.target_gl == "gles3": + self.cpp_info.components["sdl2_application"].exelinkflags = ["-s FULL_ES3=1"] if self.options.get_safe("xegl_application", False): self.cpp_info.components["xegl_application"].names["cmake_find_package"] = "XEglApplication" From 6edb6dd11287f9b8752282f2cc1dee7789ab3eb7 Mon Sep 17 00:00:00 2001 From: jgsogo Date: Mon, 27 Sep 2021 09:18:07 +0200 Subject: [PATCH 84/88] include for asserts --- recipes/magnum-integration/all/test_package/test_package.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/magnum-integration/all/test_package/test_package.cpp b/recipes/magnum-integration/all/test_package/test_package.cpp index f5d0c00b60a52..afd2f2d68e6f6 100644 --- a/recipes/magnum-integration/all/test_package/test_package.cpp +++ b/recipes/magnum-integration/all/test_package/test_package.cpp @@ -1,5 +1,6 @@ #include +#include #ifdef WITH_BULLET #include "Magnum/BulletIntegration/Integration.h" From 158bc4690a8faef1a53cac482d34370684e7b452 Mon Sep 17 00:00:00 2001 From: werto87 Date: Mon, 27 Sep 2021 09:26:29 +0200 Subject: [PATCH 85/88] Update recipes/emsdk/all/conanfile.py Co-authored-by: Javier G. Sogo --- recipes/emsdk/all/conanfile.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/recipes/emsdk/all/conanfile.py b/recipes/emsdk/all/conanfile.py index 3dfa5e0b5deea..2afc4e5ce7c08 100644 --- a/recipes/emsdk/all/conanfile.py +++ b/recipes/emsdk/all/conanfile.py @@ -53,8 +53,9 @@ def _tools_for_version(self): with open(os.path.join(self.build_folder, self._source_subfolder, "emsdk_manifest.json"), 'r') as f: data = json.load(f) tools = data["tools"] - python = next((it for it in tools if (it["id"] == "python" and not it.get("is_old", False))), None) - ret["python"] = "python-{}-64bit".format(python["version"]) + if self.settings.os != "Linux": + python = next((it for it in tools if (it["id"] == "python" and not it.get("is_old", False))), None) + ret["python"] = "python-{}-64bit".format(python["version"]) node = next((it for it in tools if (it["id"] == "node" and not it.get("is_old", False))), None) ret["nodejs"] = "node-{}-64bit".format(node["version"]) return ret From 136c29786c4f346c8ab39c09e9f74b40ae45b94d Mon Sep 17 00:00:00 2001 From: jgsogo Date: Mon, 27 Sep 2021 10:45:02 +0200 Subject: [PATCH 86/88] add short_paths --- recipes/magnum-integration/all/conanfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/magnum-integration/all/conanfile.py b/recipes/magnum-integration/all/conanfile.py index 5c722f2073a6d..5ab619d78ab17 100644 --- a/recipes/magnum-integration/all/conanfile.py +++ b/recipes/magnum-integration/all/conanfile.py @@ -38,6 +38,7 @@ class MagnumIntegrationConan(ConanFile): generators = "cmake", "cmake_find_package" exports_sources = ["CMakeLists.txt", "patches/*"] + short_paths = True _cmake = None @property From befb0f86992f8d7a759f415a9e15b44873922b6d Mon Sep 17 00:00:00 2001 From: jgsogo Date: Tue, 28 Sep 2021 09:32:44 +0200 Subject: [PATCH 87/88] review by @uilianries --- recipes/magnum-integration/all/conanfile.py | 43 +++++++++++---------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/recipes/magnum-integration/all/conanfile.py b/recipes/magnum-integration/all/conanfile.py index 5ab619d78ab17..de9206a19daf7 100644 --- a/recipes/magnum-integration/all/conanfile.py +++ b/recipes/magnum-integration/all/conanfile.py @@ -47,25 +47,6 @@ def _source_subfolder(self): def source(self): tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - 'set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/modules/" ${CMAKE_MODULE_PATH})', - "") - # Casing - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "Magnum", "GlmIntegration", "CMakeLists.txt"), - "find_package(GLM REQUIRED)", - "find_package(glm REQUIRED)") - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "Magnum", "GlmIntegration", "CMakeLists.txt"), - "GLM::GLM", - "glm::glm") - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "Magnum", "ImGuiIntegration", "CMakeLists.txt"), - "find_package(ImGui REQUIRED Sources)", - "find_package(imgui REQUIRED Sources)") - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "Magnum", "ImGuiIntegration", "CMakeLists.txt"), - "ImGui::ImGui", - "imgui::imgui") - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "Magnum", "ImGuiIntegration", "CMakeLists.txt"), - "ImGui::Sources", - "") def config_options(self): if self.settings.os == "Windows": @@ -116,6 +97,26 @@ def _patch_sources(self): for patch in self.conan_data.get("patches", {}).get(self.version, []): tools.patch(**patch) + tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), + 'set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/modules/" ${CMAKE_MODULE_PATH})', + "") + # Casing + tools.replace_in_file(os.path.join(self._source_subfolder, "src", "Magnum", "GlmIntegration", "CMakeLists.txt"), + "find_package(GLM REQUIRED)", + "find_package(glm REQUIRED)") + tools.replace_in_file(os.path.join(self._source_subfolder, "src", "Magnum", "GlmIntegration", "CMakeLists.txt"), + "GLM::GLM", + "glm::glm") + tools.replace_in_file(os.path.join(self._source_subfolder, "src", "Magnum", "ImGuiIntegration", "CMakeLists.txt"), + "find_package(ImGui REQUIRED Sources)", + "find_package(imgui REQUIRED Sources)") + tools.replace_in_file(os.path.join(self._source_subfolder, "src", "Magnum", "ImGuiIntegration", "CMakeLists.txt"), + "ImGui::ImGui", + "imgui::imgui") + tools.replace_in_file(os.path.join(self._source_subfolder, "src", "Magnum", "ImGuiIntegration", "CMakeLists.txt"), + "ImGui::Sources", + "") + def build(self): self._patch_sources() @@ -142,7 +143,7 @@ def package_info(self): self.cpp_info.components["bullet"].requires = ["magnum::magnum_main", "magnum::gl", "magnum::shaders", "bullet3::bullet3"] if self.options.with_dart: - pass + raise Exception("Recipe doesn't define this component 'dart'. Please contribute it") if self.options.with_eigen: self.cpp_info.components["eigen"].names["cmake_find_package"] = "Eigen" @@ -162,4 +163,4 @@ def package_info(self): self.cpp_info.components["imgui"].requires = ["magnum::magnum_main", "magnum::gl", "magnum::shaders", "imgui::imgui"] if self.options.with_ovr: - pass + raise Exception("Recipe doesn't define this component 'ovr'. Please contribute it") From 4eb2b7591f0f40dc1ebbae2cc1c42a1e7c88e785 Mon Sep 17 00:00:00 2001 From: jgsogo Date: Tue, 28 Sep 2021 14:14:11 +0200 Subject: [PATCH 88/88] use ConanException --- recipes/magnum-integration/all/conanfile.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/recipes/magnum-integration/all/conanfile.py b/recipes/magnum-integration/all/conanfile.py index de9206a19daf7..7ad741a1df267 100644 --- a/recipes/magnum-integration/all/conanfile.py +++ b/recipes/magnum-integration/all/conanfile.py @@ -1,5 +1,5 @@ from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conans.errors import ConanInvalidConfiguration, ConanException import os required_conan_version = ">=1.33.0" @@ -143,7 +143,7 @@ def package_info(self): self.cpp_info.components["bullet"].requires = ["magnum::magnum_main", "magnum::gl", "magnum::shaders", "bullet3::bullet3"] if self.options.with_dart: - raise Exception("Recipe doesn't define this component 'dart'. Please contribute it") + raise ConanException("Recipe doesn't define this component 'dart'. Please contribute it") if self.options.with_eigen: self.cpp_info.components["eigen"].names["cmake_find_package"] = "Eigen" @@ -163,4 +163,4 @@ def package_info(self): self.cpp_info.components["imgui"].requires = ["magnum::magnum_main", "magnum::gl", "magnum::shaders", "imgui::imgui"] if self.options.with_ovr: - raise Exception("Recipe doesn't define this component 'ovr'. Please contribute it") + raise ConanException("Recipe doesn't define this component 'ovr'. Please contribute it")