Closed al-sabr closed 5 years ago
It's using Corrade::PluginManager, which is basically a part of the engine as well (but one level below, without any ties to graphics stuff, math or GPUs). You can build & use the Corrade library completely independently of Magnum itself.
How complicated will it be to integrate it for the OSGi framework? I would like to go on that level because of the fact that we can load and unload bundles on the fly and not have any effect on the main core app.
This will be really awesome.
Is OSGi Java? I have no idea, never used it myself, sorry ;) You'll probably need some JNI I assume. Check out the example linked above, it's just a small amount of code and should give you an idea how easy/hard will it be.
Well it was built for Java especially but since It was ported for all platform almost. This is IMHO the best architecture framework I've found until today and that's why it is ported everywhere.
few examples:
Python : https://pypi.org/project/iPOPO/ .NET : https://archive.codeplex.com/?p=osgi Java : https://www.osgi.org/developer/architecture/ C++ : http://docs.cppmicroservices.org/en/stable/index.html AS3 : I have my own implementation that I did.
This version I'm talking about it is for C++11
Hi @gdeverlant !
I have some experience with both frameworks (OSGI through Eclipse plugins, though. Might mix up some stuff of the two!).
If you have some experience with JNI, this should work pretty easily. While OSGI defines a lot of meta-information like dependencies, version, exported packages and loads of Java-specific stuff, Magnum's plugin management system (Corrade::PluginManager, as @mosra pointed out) is meant to dynamically load and unload code in C++.
Interfaces to the plugins are always defined in core and implemented in the dynamically loaded plugins. Hence, you cannot "add classes" as you would in Java without having an interface to it already loaded in your application. JNI will be required here, to call the interfaces functions from Java and call out to the PluginManager. Magnum handles the DLL loading for you, but you will need to provide the DLL, i.e. through a fragment/plugin that only contains the DLL. Magnum finds plugins automatically if located in the correct folder. On load, you would make magnum load the plugin or just ensure the DLL is on the correct path for magnum to load it automatically. Often plugins are loaded on-demand, i.e. "I want to load an image, load PngImporter, load the image, undload PngImporter". You merely need to ensure the bundle isn't unloaded during this type of use, I recommend locking unloading before calling such a function, and then unlocking after again.
This way you can wrap every plugin as an independent fragment/bundle and provide it through your update site. Versioning of the bundles can be done pretty much independent of Magnum, as it only knows interface versions and implementation versions match that of the entire Magnum family (e.g. v2019.01).
If you have any questions, let me know!
Cheers, Jonathan.
Hi @Squareys!
thank you for your detailed reply I appreciate the level of it. I don't know if you had a look to http://docs.cppmicroservices.org/en/stable/index.html but it lays down the basic of an OSGi framework but it has nothing to do with Java and I'm not planning to use Java neither this is pure C++ implementation. I never heard about Corrade::PluginManager but if you tell me that it has some of the functionalities such as ServiceRegistry, Dynamic Bundle loading/unloading, Dependency Injection, ServiceTracker, etc.... then I would go with Corrade. Otherwise is there a separation of concern from the plugin mechanism to be able to either use corrade or cppmicroservice as the plugin manager?
How complicated would it be to just swap Corrade with CppMicroservices?
Hey @gdeverlant !
Corrade::PluginManager has none of that. Dynamic loading and unloading, yes, and it automatically loads dependencies, but none of the other. You wouldn't want to swap them, but wrapping it with cppmicroservices should be very doable.
Okay, I'm a bit lost in understanding what you want to achieve here and why.
If you want to use Magnum and its plugins, you'll need to use Corrade::PluginManager
, because that's what the plugins are built with. (Similarly as any software using the Qt Plugin Framework would require Qt underneath.) It can list all plugins it knows about (which would probably be equivalent to the ServiceRegistry
you're talking about), it can do dynamic (un)loading of course (that's what plugins are), there are plugin aliases (aka "load some PNG importer for me") which would probably satisfy your "Dependency Injection" requirement, but I have no idea what ServiceTracker
is -- if it's about tracking dependencies correctly, then yes that's also a check.
You can also build the plugins as static libraries and then wrap them in whatever different dynamic module loading framework you want, but I'm not sure why you would want to do that, since you'd then need to recreate all the interfaces, handle the dependencies and everything else on your own.
@mosra I was trying to understand if it is possible to replace the Corrade plugin system with the CppMicroservices one. OSGi would take care of all the load and unloading automatically I would not need to implement anything since it does it in Windows as DLL, on MacOs as DynLib and on Linux as .so module.
CppMicroservice offers a solid dynamic runtime where bundles can load and unload on the fly without interrupting the main core application. The framework takes care of the dependencies and notify all the other bundles in realtime if a service is available or not. The ServiceTracker allows you to extend the framework with additional functionalities without ever touching the core. CppMicroservice is the most advanced framework for large scale modular application development that's why I want it to be the base of my App.
The foundation will be CppMicroservice + Magnum Engine with ImGui
As it is maybe Corrage at its core might be CppMicroservice and I just want to be sure that it is not the case.
I see, thanks for the clarification.
If you want CppMicroservice to handle all the dynamic loading/unloading without Corrade talking into that, then I think building the plugins as static (and then wrapping them as you see fit, either one by one, or in larger modules) is the way to go.
Well if all the plugins in Magnum are actually DLL then they can stay like that and I would just adapt them to by creating for each of them their respective BundleActivator because that's the main entry point for a bundle in CppMicroservices. Once they are taken care by CppMs they will register themselves inside of the ServiceRegistry and any other bundle that want to use a Plugin can just make bundleContext.getServiceReference(IPngEncoderDecoder) as an example.
Where do I need to start to have a look at if I want to swap Corrade with CPPMs ?
if I want to swap Corrade with CPPMs ?
That's what I'm saying -- you can't swap it, you can merely wrap it 'where the PluginManager would still take care of dynamic library loading) or compile them as static, thus sidestepping the DLLs altogether. However some of the plugins depend on other plugins (or are loading and instantiating other plugins through the plugin manager), so there will be probably some limitations you'll run into sooner or later when trying to completely sidestep the Pluginmanager.
Where do you need to start -- compile the plugins as static and then continue from there.
To be more precisely where in the Code source I need to go to understand the plugin system architecture. Compiling is not a problem I want to know the internals.
Sorry for not formulating my question properly.
The whole source is contained in these few files: https://github.com/mosra/corrade/tree/master/src/Corrade/PluginManager
... but I think you'll be better off reading some of the high-level docs first, like here, here or here.
Thanx for the link. As I have read the docu I saw this part:
Usage checks, the manager doesn't allow plugin unload if there are any active plugin instances
That's what I was afraid of because OSGi allows that part which is missing in Corrade.
Right now it seems that Corrade is limited in its features although I find that it is really well built. The code is super clean and easy to understand. The docu states that this is the right way of implementing a new plugin:
class AbstractAnimal: public PluginManager::AbstractPlugin {
public:
static std::string pluginInterface() {
return "cz.mosra.corrade.Examples.AbstractAnimal/1.0";
}
static std::vector<std::string> pluginSearchPaths() {
return {""};
}
explicit AbstractAnimal(PluginManager::AbstractManager& manager, const std::string& plugin):
AbstractPlugin{manager, plugin} {}
virtual std::string name() const = 0;
virtual int legCount() const = 0;
virtual bool hasTail() const = 0;
};
Plugin definition
class Canary: public AbstractAnimal {
public:
explicit Canary(PluginManager::AbstractManager& manager, const std::string& plugin):
AbstractAnimal{manager, plugin} {}
std::string name() const override { return "Achoo"; }
int legCount() const override { return 2; }
bool hasTail() const override { return true; }
};
With the CPPMS(OSGi) this will all go away and be replaced by something else as stated in : http://docs.cppmicroservices.org/en/stable/doc/src/getting_started.html
#include <ServiceTime.h>
#include <cppmicroservices/BundleActivator.h>
using namespace cppmicroservices;
class ServiceTimeSystemClock : public ServiceTime
{
std::chrono::milliseconds elapsed() const
{
auto now = std::chrono::system_clock::now();
// Relies on the de-facto standard of relying on
// POSIX time in all known implementations so far.
return std::chrono::duration_cast<std::chrono::milliseconds>(
now.time_since_epoch());
}
};
class ServiceTimeActivator : public BundleActivator
{
void Start(BundleContext ctx)
{
auto service = std::make_shared<ServiceTimeSystemClock>();
ctx.RegisterService<ServiceTime>(service);
}
void Stop(BundleContext)
{
// Nothing to do
}
};
CPPMICROSERVICES_EXPORT_BUNDLE_ACTIVATOR(ServiceTimeActivator)
Once that is working all other bundles could consume that register service once it becomes available like following:
#include <cppmicroservices/BundleActivator.h>
#include <cppmicroservices/BundleContext.h>
#include <cppmicroservices/GetBundleContext.h>
#include <ServiceTime.h>
#include <iostream>
using namespace cppmicroservices;
class ServiceTimeConsumerActivator : public BundleActivator
{
typedef ServiceReference<ServiceTime> ServiceTimeRef;
void Start(BundleContext ctx)
{
auto ref = ctx.GetServiceReference<ServiceTime>();
PrintTime(ref);
}
void Stop(BundleContext)
{
// Nothing to do
}
void PrintTime(const ServiceTimeRef& ref) const
{
if (!ref)
{
std::cout << "ServiceTime reference invalid" << std::endl;
return;
}
// We can also get the bundle context like this
auto ctx = GetBundleContext();
// Get the ServiceTime service
auto svc_time = ctx.GetService(ref);
if (!svc_time)
{
std::cout << "ServiceTime not available" << std::endl;
}
else
{
std::cout << "Elapsed: " << svc_time->elapsed().count() << "ms" << std::endl;
}
}
};
CPPMICROSERVICES_EXPORT_BUNDLE_ACTIVATOR(ServiceTimeConsumerActivator)
Because the C++ Micro Services is a dynamic environment, a particular service might not be available yet. Therefore, we first need to check the validity of some returned objects.
The above code would be sufficient only in the simplest use cases. To avoid bundle start ordering problems (e.g. one bundle assuming the existence of a service published by another bundle), a ServiceTracker should be used instead. Such a tracker allows bundles to react on service events and in turn be more robust.
I started with this https://doc.magnum.graphics/magnum/getting-started.html#getting-started-bootstrap
I tried the Bootstrap tutorial until I'm ready to use CMake GUI to output VC++ project and I end up to an error. I went until the Windows cmake section but instead of using the command line I used the GUI:
mkdir build && cd build
cmake .. ^
-DWITH_SDL2APPLICATION=ON ^
-DCMAKE_PREFIX_PATH="C:/Users/you/where/you/extracted/SDL2-2.0.5" ^
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY="bin"
Where are CORRADE_CONFIGURE_FILE and CORRADE_INCLUDE_DIR?
Usage checks, the manager doesn't allow plugin unload if there are any active plugin instances
That's what I was afraid of because OSGi allows that part which is missing in Corrade.
That is possible (but not recommended, so it's not mentioned in the overview). See AbstractPlugin::canBeDeleted(). It basically inverts the ownership -- the manager returns an unique pointer containing the plugin instance and with this it may mean that the unique pointer might become dangling once the DLL gets unloaded.
Where are CORRADE_CONFIGURE_FILE and CORRADE_INCLUDE_DIR?
Did you add_subdirectory()
the corrade and magnum subdirectories as the tutorial suggests? Besides CMake subprojects you can also install the dependencies to some filesystem location and point CMAKE_PREFIX_PATH
to it, or use any of the provided packages. If you're on WIndows and use MSVC, the best and easiest is using the Vcpkg package as the project is then a "single-click" install away.
Ok for the CORRADE_CONFIGURE_FILE I just compiled with ALL_BUILD->MinSizeRef inside of Visual C++ 2017 and then I did the INSTALL for Win32 (sorry I didn't go through vcpkg)
I get this which is correct :
1>------ Build started: Project: CorradeUtilityObjects, Configuration: MinSizeRel Win32 ------
2>------ Build started: Project: CorradePluginManagerObjects, Configuration: MinSizeRel Win32 ------
3>------ Build started: Project: corrade-rc, Configuration: MinSizeRel Win32 ------
2>CorradePluginManagerObjects.vcxproj -> G:\programming\c++\multiverses\corrade\build\src\Corrade\PluginManager\CorradePluginManagerObjects.dir\MinSizeRel\CorradePluginManagerObjects.lib
1>CorradeUtilityObjects.vcxproj -> G:\programming\c++\multiverses\corrade\build\src\Corrade\Utility\CorradeUtilityObjects.dir\MinSizeRel\CorradeUtilityObjects.lib
3>corrade-rc.vcxproj -> G:\programming\c++\multiverses\corrade\build\src\Corrade\Utility\MinSizeRel\corrade-rc.exe
4>------ Build started: Project: CorradeUtility, Configuration: MinSizeRel Win32 ------
4>CorradeUtility.vcxproj -> G:\programming\c++\multiverses\corrade\build\src\Corrade\Utility\MinSizeRel\CorradeUtility.dll
5>------ Build started: Project: CorradeInterconnect, Configuration: MinSizeRel Win32 ------
6>------ Build started: Project: CorradePluginManager, Configuration: MinSizeRel Win32 ------
7>------ Build started: Project: CorradeTestSuite, Configuration: MinSizeRel Win32 ------
7>CorradeTestSuite.vcxproj -> G:\programming\c++\multiverses\corrade\build\src\Corrade\TestSuite\MinSizeRel\CorradeTestSuite.dll
5>CorradeInterconnect.vcxproj -> G:\programming\c++\multiverses\corrade\build\src\Corrade\Interconnect\MinSizeRel\CorradeInterconnect.dll
6>CorradePluginManager.vcxproj -> G:\programming\c++\multiverses\corrade\build\src\Corrade\PluginManager\MinSizeRel\CorradePluginManager.dll
8>------ Build started: Project: INSTALL, Configuration: MinSizeRel Win32 ------
8>-- Install configuration: "MinSizeRel"
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./share/cmake/Corrade/CorradeConfig.cmake
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./share/cmake/Corrade/CorradeLibSuffix.cmake
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./share/cmake/Corrade/FindCorrade.cmake
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./share/cmake/Corrade/UseCorrade.cmake
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Corrade.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/configure.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Containers/Array.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Containers/ArrayView.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Containers/ArrayViewStl.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Containers/ArrayViewStlSpan.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Containers/Containers.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Containers/EnumSet.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Containers/EnumSet.hpp
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Containers/LinkedList.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Containers/Optional.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Containers/OptionalStl.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Containers/Pointer.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Containers/PointerStl.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Containers/Reference.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Containers/ScopeGuard.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Containers/StaticArray.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Containers/StridedArrayView.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Containers/Tags.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Containers/ScopedExit.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/lib/CorradeInterconnect.lib
8>-- Up-to-date: C:/Program Files (x86)/Corrade/bin/CorradeInterconnect.dll
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Interconnect/Connection.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Interconnect/Emitter.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Interconnect/Interconnect.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Interconnect/Receiver.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Interconnect/StateMachine.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Interconnect/visibility.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/lib/CorradePluginManager.lib
8>-- Up-to-date: C:/Program Files (x86)/Corrade/bin/CorradePluginManager.dll
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/PluginManager/AbstractPlugin.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/PluginManager/AbstractManager.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/PluginManager/AbstractManagingPlugin.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/PluginManager/Manager.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/PluginManager/PluginManager.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/PluginManager/PluginMetadata.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/PluginManager/visibility.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/lib/CorradeTestSuite.lib
8>-- Up-to-date: C:/Program Files (x86)/Corrade/bin/CorradeTestSuite.dll
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/TestSuite/Comparator.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/TestSuite/Tester.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/TestSuite/TestSuite.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/TestSuite/visibility.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/TestSuite/Compare/Container.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/TestSuite/Compare/File.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/TestSuite/Compare/FileToString.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/TestSuite/Compare/FloatingPoint.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/TestSuite/Compare/Numeric.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/TestSuite/Compare/StringToFile.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/lib/CorradeUtility.lib
8>-- Up-to-date: C:/Program Files (x86)/Corrade/bin/CorradeUtility.dll
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Utility/Arguments.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Utility/AbstractHash.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Utility/Assert.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Utility/Configuration.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Utility/ConfigurationGroup.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Utility/ConfigurationValue.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Utility/Debug.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Utility/Directory.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Utility/Endianness.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Utility/Format.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Utility/Macros.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Utility/MurmurHash2.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Utility/Resource.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Utility/Sha1.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Utility/String.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Utility/System.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Utility/TypeTraits.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Utility/Unicode.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Utility/utilities.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Utility/Utility.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Utility/VisibilityMacros.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Utility/visibility.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Utility/FileWatcher.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Utility/Tweakable.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/./include/Corrade/Utility/TweakableParser.h
8>-- Up-to-date: C:/Program Files (x86)/Corrade/bin/corrade-rc.exe
========== Build: 8 succeeded, 0 failed, 2 up-to-date, 0 skipped ==========
When I add a new solution Plaftform for x64 and try the same I get this error:
============================================================== Here is the list of what is in the files...
Root CMakeList.txt contains:
cmake_minimum_required(VERSION 3.1)
project(Multiverses)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/modules/")
add_subdirectory(src)
add_subdirectory(corrade)
add_subdirectory(magnum)
add_subdirectory(src)
src/CMakeList.txt contains:
find_package(Magnum REQUIRED GL Sdl2Application)
set_directory_properties(PROPERTIES CORRADE_USE_PEDANTIC_FLAGS ON)
add_executable(Multiverses Multiverses.cpp)
target_link_libraries(Multiverses PRIVATE
Magnum::Application
Magnum::GL
Magnum::Magnum)
This is the INSTALL target for x86
Did you
add_subdirectory()
the corrade and magnum subdirectories as the tutorial suggests? Besides CMake subprojects you can also install the dependencies to some filesystem location and pointCMAKE_PREFIX_PATH
to it, or use any of the provided packages. If you're on WIndows and use MSVC, the best and easiest is using the Vcpkg package as the project is then a "single-click" install away.
If you look at the screenshot you can see the 2 subfolders:
That is possible (but not recommended, so it's not mentioned in the overview). See AbstractPlugin::canBeDeleted(). It basically inverts the ownership -- the manager returns an unique pointer containing the plugin instance and with this it may mean that the unique pointer might become dangling once the DLL gets unloaded.
That's why I want to use CppMS(OSGi) because the framework handle all cases perfectly and you don't have to worry about anything. I assume that your implementation is a basic PluginManager which doesn't deal with extreme use cases where the plugins come and go. Correct me if I'm wrong with my assumption. Thanx by the way!
I was wondering if the modules folder which is not found is at the root folder of my bootstrap project?
I've changed so that the modules folder points to G:\programming\c++\multiverses\modules and the next part is about MAGNUM_INCLUDE_DIR:
the best and easiest is using the Vcpkg package as the project is then a "single-click" install away.
Yeah this is what I'm doing right now and truly it is much more easier. Let see what is the next step after vcpkg is done.
When I add a new solution Plaftform for x64 and try the same I get this error:
If you configured the project for 32bit with CMake, you get an error when trying to build for 64 bits, yes. CMake only generates one project per target platform. If you need to target a 64bit platform, generate a 64bit project.
All other problems are probably because of this in your root CMakeLists:
add_subdirectory(src) # <------- this shouldn't be here
add_subdirectory(corrade)
add_subdirectory(magnum)
add_subdirectory(src)
You need to add the dependency subdirectories before the src
dir (and also don't add it twice). If you don't do that, then the src/CMakeLists.txt
is not able to locate the dependencies, because these are not yet known at that point.
Using Vcpkg will be simpler for you and you also won't need to touch CMake at all.
Ok finally I was able to generate a VC++ 2017 project with compatibility checked.
Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.17134.
Found Corrade: G:/programming/c++/multiverses/corrade/src found components: Containers rc Utility TestSuite
Found Corrade: G:/programming/c++/multiverses/corrade/src found components: Containers rc Utility PluginManager
Found Corrade: G:/programming/c++/multiverses/corrade/src found components: Containers rc Utility
Configuring done
But there is a problem the bootstrap project is not able to compile with 205 errors:
At https://doc.magnum.graphics/magnum/getting-started.html#getting-started-build it says:
Note If you installed Corrade and Magnum separately (instead of putting them in the project as subprojects), the -DWITH_SDL2APPLICATION=ON is not needed as that was already done when compiling & installing Magnum before.
I'm now confused because from one side I started the tutorial showing something and from the other side you tell me to use vcpkg which I later switched to.
I don't get it. It seems that I need to remove those 2 folders and 2 entries in the CMakeList.txt
add_subdirectory(corrade)
add_subdirectory(magnum)
Here is the new try without the two subfolders : screencam :
I added the missing 2 _CORRAD_CONFIGURE_FILE and _MAGNUM_CONFIGURE_FILE
G:/programming/c++/vcpkg/packages/corrade_x86-windows/share/cmake/Corrade/CorradeConfig.cmake G:/programming/c++/vcpkg/packages/magnum_x86-windows/share/cmake/Magnum/MagnumConfig.cmake
Still getting errors:
Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.17134.
CMake Error at modules/FindCorrade.cmake:497 (include):
include could not find load file:
G:/programming/c++/vcpkg/packages/corrade_x86-windows/bin/UseCorrade.cmake
Call Stack (most recent call first):
modules/FindMagnum.cmake:220 (find_package)
src/CMakeLists.txt:1 (find_package)
CMake Error at modules/FindMagnum.cmake:1095 (include):
include could not find load file:
G:/programming/c++/vcpkg/packages/corrade_x86-windows/bin/CorradeLibSuffix.cmake
Call Stack (most recent call first):
src/CMakeLists.txt:1 (find_package)
Configuring incomplete, errors occurred!
I used all features of Magnum with vcpkg
vcpkg install magnum[*]
vcpkg install --recurse magnum[*]
The following packages will be rebuilt:
magnum[al-info,anyaudioimporter,anyimageconverter,anyimageimporter,anysceneimporter,audio,core,debugtools,distancefieldconverter,fontconverter,gl,gl-info,glfwapplication,imageconverter,magnumfont,magnumfontconverter,meshtools,objimporter,opengltester,primitives,scenegraph,sdl2application,shaders,text,texturetools,tgaimageconverter,tgaimporter,trade,wavaudioimporter,wglcontext,windowlesswglapplication]:x86-windows
The following packages will be built and installed:
* glfw3[core]:x86-windows
Additional packages (*) will be modified to complete this operation.
Starting package 1/3: magnum:x86-windows
Removing package magnum:x86-windows...
Removing package magnum:x86-windows... done
Purging package magnum:x86-windows...
Purging package magnum:x86-windows... done
Elapsed time for package magnum:x86-windows: 707.9 ms
Starting package 2/3: glfw3:x86-windows
Building package glfw3[core]:x86-windows...
-- Downloading https://github.com/glfw/glfw/archive/3.2.1.tar.gz...
-- Extracting source G:/programming/c++/vcpkg/downloads/glfw-glfw-3.2.1.tar.gz
-- Applying patch move-cmake-min-req.patch
-- Using source at G:/programming/c++/vcpkg/buildtrees/glfw3/src/3.2.1-28ab61727b
-- Configuring x86-windows
-- Building x86-windows-dbg
-- Building x86-windows-rel
-- Performing post-build validation
-- Performing post-build validation done
Building package glfw3[core]:x86-windows... done
Installing package glfw3[core]:x86-windows...
Installing package glfw3[core]:x86-windows... done
Elapsed time for package glfw3:x86-windows: 28.04 s
Starting package 3/3: magnum:x86-windows
Building package magnum[al-info,anyaudioimporter,anyimageconverter,anyimageimporter,anysceneimporter,audio,core,debugtools,distancefieldconverter,fontconverter,gl,gl-info,glfwapplication,imageconverter,magnumfont,magnumfontconverter,meshtools,objimporter,opengltester,primitives,scenegraph,sdl2application,shaders,text,texturetools,tgaimageconverter,tgaimporter,trade,wavaudioimporter,wglcontext,windowlesswglapplication]:x86-windows...
-- Using cached G:/programming/c++/vcpkg/downloads/mosra-magnum-v2019.01.tar.gz
-- Using source at G:/programming/c++/vcpkg/buildtrees/magnum/src/v2019.01-029cd7c2e8
-- Applying patch G:/programming/c++/vcpkg/ports/magnum/001-sdl-includes.patch
-- Applying patch failed. This is expected if this patch was previously applied.
-- Applying patch G:/programming/c++/vcpkg/ports/magnum/002-tools-path.patch
-- Applying patch failed. This is expected if this patch was previously applied.
-- Applying patch G:/programming/c++/vcpkg/ports/magnum/003-glfw-find-module.patch
-- Applying patch failed. This is expected if this patch was previously applied.
-- Configuring x86-windows
-- Building x86-windows-dbg
-- Building x86-windows-rel
-- Performing post-build validation
-- Performing post-build validation done
Building package magnum[al-info,anyaudioimporter,anyimageconverter,anyimageimporter,anysceneimporter,audio,core,debugtools,distancefieldconverter,fontconverter,gl,gl-info,glfwapplication,imageconverter,magnumfont,magnumfontconverter,meshtools,objimporter,opengltester,primitives,scenegraph,sdl2application,shaders,text,texturetools,tgaimageconverter,tgaimporter,trade,wavaudioimporter,wglcontext,windowlesswglapplication]:x86-windows... done
Installing package magnum[al-info,anyaudioimporter,anyimageconverter,anyimageimporter,anysceneimporter,audio,core,debugtools,distancefieldconverter,fontconverter,gl,gl-info,glfwapplication,imageconverter,magnumfont,magnumfontconverter,meshtools,objimporter,opengltester,primitives,scenegraph,sdl2application,shaders,text,texturetools,tgaimageconverter,tgaimporter,trade,wavaudioimporter,wglcontext,windowlesswglapplication]:x86-windows...
Installing package magnum[al-info,anyaudioimporter,anyimageconverter,anyimageimporter,anysceneimporter,audio,core,debugtools,distancefieldconverter,fontconverter,gl,gl-info,glfwapplication,imageconverter,magnumfont,magnumfontconverter,meshtools,objimporter,opengltester,primitives,scenegraph,sdl2application,shaders,text,texturetools,tgaimageconverter,tgaimporter,trade,wavaudioimporter,wglcontext,windowlesswglapplication]:x86-windows... done
Elapsed time for package magnum:x86-windows: 2.733 min
Total elapsed time: 3.212 min
The package magnum:x86-windows provides CMake targets:
find_package(Magnum CONFIG REQUIRED)
# Note: 5 target(s) were omitted.
target_link_libraries(main PRIVATE Magnum::Magnum Magnum::GLContext Magnum::GLContext Magnum::Application)
is not able to compile with 205 errors
Sorry about that, I see a packaging error with the 2019.01 release -- these lines look suspicious, in particular, and are the most probable cause for the above errors:
-- Applying patch G:/programming/c++/vcpkg/ports/magnum/001-sdl-includes.patch -- Applying patch failed. This is expected if this patch was previously applied. -- Applying patch G:/programming/c++/vcpkg/ports/magnum/002-tools-path.patch -- Applying patch failed. This is expected if this patch was previously applied. -- Applying patch G:/programming/c++/vcpkg/ports/magnum/003-glfw-find-module.patch -- Applying patch failed. This is expected if this patch was previously applied.
We'll be fixing this with @Squareys as soon as we get a chance.
I just want to mention that I in the beginning already did vcpkg install magnum. I redid the same later thinking I was maybe missing some necessary packages which were missing.
I used *vcpkg install --recurse magnum[]**
I will try to remove all the packages installed by vcpkg and try again with the log:
vcpkg install magnum[*]
The following packages will be built and installed:
* corrade[core,interconnect,pluginmanager,testsuite,utility]:x86-windows
* glfw3[core]:x86-windows
magnum[al-info,anyaudioimporter,anyimageconverter,anyimageimporter,anysceneimporter,audio,core,debugtools,distancefieldconverter,fontconverter,gl,gl-info,glfwapplication,imageconverter,magnumfont,magnumfontconverter,meshtools,objimporter,opengltester,primitives,scenegraph,sdl2application,shaders,text,texturetools,tgaimageconverter,tgaimporter,trade,wavaudioimporter,wglcontext,windowlesswglapplication]:x86-windows
* openal-soft[core]:x86-windows
* sdl2[core]:x86-windows
Additional packages (*) will be modified to complete this operation.
Starting package 1/5: corrade:x86-windows
Building package corrade[core,interconnect,pluginmanager,testsuite,utility]:x86-windows...
-- Using cached G:/programming/c++/vcpkg/downloads/mosra-corrade-v2019.01.tar.gz
-- Using source at G:/programming/c++/vcpkg/buildtrees/corrade/src/v2019.01-910c0f8340
-- Configuring x86-windows
-- Building x86-windows-dbg
-- Building x86-windows-rel
-- Performing post-build validation
-- Performing post-build validation done
Building package corrade[core,interconnect,pluginmanager,testsuite,utility]:x86-windows... done
Installing package corrade[core,interconnect,pluginmanager,testsuite,utility]:x86-windows...
Installing package corrade[core,interconnect,pluginmanager,testsuite,utility]:x86-windows... done
Elapsed time for package corrade:x86-windows: 55.23 s
Starting package 2/5: openal-soft:x86-windows
Building package openal-soft[core]:x86-windows...
-- Using cached G:/programming/c++/vcpkg/downloads/kcat-openal-soft-openal-soft-1.19.1.tar.gz
-- Using source at G:/programming/c++/vcpkg/buildtrees/openal-soft/src/oft-1.19.1-6c137ea078
-- Configuring x86-windows
-- Building x86-windows-dbg
-- Building x86-windows-rel
-- Performing post-build validation
-- Performing post-build validation done
Building package openal-soft[core]:x86-windows... done
Installing package openal-soft[core]:x86-windows...
Installing package openal-soft[core]:x86-windows... done
Elapsed time for package openal-soft:x86-windows: 2.347 min
Starting package 3/5: sdl2:x86-windows
Building package sdl2[core]:x86-windows...
-- Using cached G:/programming/c++/vcpkg/downloads/SDL-Mirror-SDL-release-2.0.9.tar.gz
-- Using source at G:/programming/c++/vcpkg/buildtrees/sdl2/src/ease-2.0.9-ad425106c1
-- Configuring x86-windows
-- Building x86-windows-dbg
-- Building x86-windows-rel
CMake Error at scripts/cmake/vcpkg_build_cmake.cmake:175 (message):
Command failed: C:/Program Files (x86)/CMake/bin/cmake.exe;--build;.;--config;Release;--target;install;--;-v;-j1
Working Directory: G:/programming/c++/vcpkg/buildtrees/sdl2/x86-windows-rel
See logs for more information:
G:\programming\c++\vcpkg\buildtrees\sdl2\install-x86-windows-rel-out.log
Call Stack (most recent call first):
scripts/cmake/vcpkg_install_cmake.cmake:24 (vcpkg_build_cmake)
ports/sdl2/portfile.cmake:35 (vcpkg_install_cmake)
scripts/ports.cmake:71 (include)
Error: Building package sdl2:x86-windows failed with: BUILD_FAILED
Please ensure you're using the latest portfiles with `.\vcpkg update`, then
submit an issue at https://github.com/Microsoft/vcpkg/issues including:
Package: sdl2:x86-windows
Vcpkg version: 2018.11.23-nohash
Additionally, attach any relevant sections from the log files above.
Does the log confirm your suspicions ????
Few minutes ago, https://github.com/Microsoft/vcpkg/pull/5730 with fixed patches was merged, so if you .\vcpkg update
and install magnum again, everything should work properly -- the patches were meant to fix up SDL include paths and because they didn't, you were getting the 205 errors above.
Note that all you need after is opening Visual Studio and #include
ing the headers you want, the vcpkg automagic will do all the library linking business for you -- no need to touch CMake at all. (Or, you can continue using CMake, but from the conversation above I'm assuming your life will be easier when not using it.)
Does the log confirm your suspicions ?
No, the log is completely unrelated to that. It failed building SDL, which is an error completely unrelated to Magnum itself. Maybe it goes through if you simply retry it.
This is how i built vcpkg as stated on their github:
> git clone https://github.com/Microsoft/vcpkg.git
> cd vcpkg
PS> .\bootstrap-vcpkg.bat
How could it be that Visual Studio is recognizing vcpkg which is not linked together?
Is this the right answer?
cmake .. -DCMAKE_TOOLCHAIN_FILE=G:\programming\c++\vcpkg\scripts\buildsystems/v
cpkg.cmake
Final result for the reinstallation of Magnum :
PS G:\programming\c++\vcpkg> .\vcpkg.exe install magnum[*]
The following packages will be built and installed:
* corrade[core,interconnect,pluginmanager,testsuite,utility]:x86-windows
* glfw3[core]:x86-windows
magnum[al-info,anyaudioimporter,anyimageconverter,anyimageimporter,anysceneimporter,audio,core,debugtools,distancefieldconverter,fontconverter,gl,gl-info,glfwapplication,imageconverter,magnumfont,magnumfontconverter,meshtools,objimporter,opengltester,primitives,scenegraph,sdl2application,shaders,text,texturetools,tgaimageconverter,tgaimporter,trade,wavaudioimporter,wglcontext,windowlesswglapplication]:x86-windows
* openal-soft[core]:x86-windows
* sdl2[core]:x86-windows
Additional packages (*) will be modified to complete this operation.
Starting package 1/5: corrade:x86-windows
Building package corrade[core,interconnect,pluginmanager,testsuite,utility]:x86-windows...
-- Using cached G:/programming/c++/vcpkg/downloads/mosra-corrade-v2019.01.tar.gz
-- Using source at G:/programming/c++/vcpkg/buildtrees/corrade/src/v2019.01-910c0f8340
-- Configuring x86-windows
-- Building x86-windows-dbg
-- Building x86-windows-rel
-- Performing post-build validation
-- Performing post-build validation done
Building package corrade[core,interconnect,pluginmanager,testsuite,utility]:x86-windows... done
Installing package corrade[core,interconnect,pluginmanager,testsuite,utility]:x86-windows...
Installing package corrade[core,interconnect,pluginmanager,testsuite,utility]:x86-windows... done
Elapsed time for package corrade:x86-windows: 47.42 s
Starting package 2/5: openal-soft:x86-windows
Building package openal-soft[core]:x86-windows...
-- Using cached G:/programming/c++/vcpkg/downloads/kcat-openal-soft-openal-soft-1.19.1.tar.gz
-- Using source at G:/programming/c++/vcpkg/buildtrees/openal-soft/src/oft-1.19.1-6c137ea078
-- Configuring x86-windows
-- Building x86-windows-dbg
-- Building x86-windows-rel
-- Performing post-build validation
-- Performing post-build validation done
Building package openal-soft[core]:x86-windows... done
Installing package openal-soft[core]:x86-windows...
Installing package openal-soft[core]:x86-windows... done
Elapsed time for package openal-soft:x86-windows: 2.35 min
Starting package 3/5: sdl2:x86-windows
Building package sdl2[core]:x86-windows...
-- Using cached G:/programming/c++/vcpkg/downloads/SDL-Mirror-SDL-release-2.0.9.tar.gz
-- Using source at G:/programming/c++/vcpkg/buildtrees/sdl2/src/ease-2.0.9-ad425106c1
-- Configuring x86-windows
-- Building x86-windows-dbg
-- Building x86-windows-rel
-- Performing post-build validation
-- Performing post-build validation done
Building package sdl2[core]:x86-windows... done
Installing package sdl2[core]:x86-windows...
Installing package sdl2[core]:x86-windows... done
Elapsed time for package sdl2:x86-windows: 13.72 min
Starting package 4/5: glfw3:x86-windows
Building package glfw3[core]:x86-windows...
-- Using cached G:/programming/c++/vcpkg/downloads/glfw-glfw-3.2.1.tar.gz
-- Using source at G:/programming/c++/vcpkg/buildtrees/glfw3/src/3.2.1-28ab61727b
-- Configuring x86-windows
-- Building x86-windows-dbg
-- Building x86-windows-rel
-- Performing post-build validation
-- Performing post-build validation done
Building package glfw3[core]:x86-windows... done
Installing package glfw3[core]:x86-windows...
Installing package glfw3[core]:x86-windows... done
Elapsed time for package glfw3:x86-windows: 24.24 s
Starting package 5/5: magnum:x86-windows
Building package magnum[al-info,anyaudioimporter,anyimageconverter,anyimageimporter,anysceneimporter,audio,core,debugtools,distancefieldconverter,fontconverter,gl,gl-info,glfwapplication,imageconverter,magnumfont,magnumfontconverter,meshtools,objimporter,opengltester,primitives,scenegraph,sdl2application,shaders,text,texturetools,tgaimageconverter,tgaimporter,trade,wavaudioimporter,wglcontext,windowlesswglapplication]:x86-windows...
-- Using cached G:/programming/c++/vcpkg/downloads/mosra-magnum-v2019.01.tar.gz
-- Using source at G:/programming/c++/vcpkg/buildtrees/magnum/src/v2019.01-029cd7c2e8
-- Applying patch G:/programming/c++/vcpkg/ports/magnum/001-sdl-includes.patch
-- Applying patch G:/programming/c++/vcpkg/ports/magnum/002-tools-path.patch
-- Applying patch failed. This is expected if this patch was previously applied.
-- Applying patch G:/programming/c++/vcpkg/ports/magnum/003-glfw-find-module.patch
-- Configuring x86-windows
-- Building x86-windows-dbg
-- Building x86-windows-rel
-- Performing post-build validation
-- Performing post-build validation done
Building package magnum[al-info,anyaudioimporter,anyimageconverter,anyimageimporter,anysceneimporter,audio,core,debugtools,distancefieldconverter,fontconverter,gl,gl-info,glfwapplication,imageconverter,magnumfont,magnumfontconverter,meshtools,objimporter,opengltester,primitives,scenegraph,sdl2application,shaders,text,texturetools,tgaimageconverter,tgaimporter,trade,wavaudioimporter,wglcontext,windowlesswglapplication]:x86-windows... done
Installing package magnum[al-info,anyaudioimporter,anyimageconverter,anyimageimporter,anysceneimporter,audio,core,debugtools,distancefieldconverter,fontconverter,gl,gl-info,glfwapplication,imageconverter,magnumfont,magnumfontconverter,meshtools,objimporter,opengltester,primitives,scenegraph,sdl2application,shaders,text,texturetools,tgaimageconverter,tgaimporter,trade,wavaudioimporter,wglcontext,windowlesswglapplication]:x86-windows...
Installing package magnum[al-info,anyaudioimporter,anyimageconverter,anyimageimporter,anysceneimporter,audio,core,debugtools,distancefieldconverter,fontconverter,gl,gl-info,glfwapplication,imageconverter,magnumfont,magnumfontconverter,meshtools,objimporter,opengltester,primitives,scenegraph,sdl2application,shaders,text,texturetools,tgaimageconverter,tgaimporter,trade,wavaudioimporter,wglcontext,windowlesswglapplication]:x86-windows... done
Elapsed time for package magnum:x86-windows: 3.541 min
Total elapsed time: 20.81 min
The package magnum:x86-windows provides CMake targets:
find_package(Magnum CONFIG REQUIRED)
# Note: 5 target(s) were omitted.
target_link_libraries(main PRIVATE Magnum::Magnum Magnum::GLContext Magnum::GLContext Magnum::Application)
👍
Ok I just tried this command with CMake in Powershell:
cmake .. -DCMAKE_TOOLCHAIN_FILE=G:\programming\c++\vcpkg\scripts\buildsystems/v
cpkg.cmake
-- Building for: Visual Studio 15 2017
-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.17134.
-- The C compiler identification is MSVC 19.16.27027.1
-- The CXX compiler identification is MSVC 19.16.27027.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Warning at corrade/CMakeLists.txt:182 (message):
MSVC 2017 detected, automatically enabling MSVC2017_COMPATIBILITY. Note
that some features may not be available with this compiler.
-- LIB_SUFFIX variable is not defined. It will be autodetected now.
-- You can set it manually with -DLIB_SUFFIX=<value> (64 for example)
-- LIB_SUFFIX autodetected as '', libraries will be installed into C:/Program Files (x86)/Multiverses/lib
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Using unsigned short
-- Check if the system is big endian - little endian
-- Found Corrade: G:/programming/c++/multiverses/corrade/src found components: Containers rc Utility
-- Found OpenGL: opengl32
-- Found Corrade: G:/programming/c++/multiverses/corrade/src found components: Containers rc Utility TestSuite
-- Found Corrade: G:/programming/c++/multiverses/corrade/src found components: Containers rc Utility PluginManager
-- Found Corrade: G:/programming/c++/multiverses/corrade/src found components: Containers rc Utility
-- Found SDL2: optimized;G:/programming/c++/vcpkg/installed/x86-windows/lib/SDL2.lib;debug;G:/programming/c++/vcpkg/installed/x86-windows/debug/lib/SDL2d.lib
-- Found Magnum: G:/programming/c++/multiverses/magnum/src found components: GL Sdl2Application
-- Configuring done
-- Generating done
-- Build files have been written to: G:/programming/c++/multiverses/build
I don't have any include problems like before but I still end-up with 256 errors:
Oh, um, well. This looks like you have two different versions of Magnum present and it's picking up headers from the vcpkg version 2019.01 but libraries from master -- the errors are most probably related to a change that was commited a week ago to master. Mixing them up like this will not work.
Assuming you're using the same CMake project as above, then probably the add_subdirectory()
with corrade/magnum master is to blame. Delete all that, use just what got installed with vcpkg.
Ok after removing the 2 subfolders and the 2 CMake add_subdirectory:
Rebuild again :
cmake .. -DCMAKE_TOOLCHAIN_FILE=G:\programming\c++\vcpkg\scripts\buildsystems/v
cpkg.cmake
-- Building for: Visual Studio 15 2017
-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.17134.
-- The C compiler identification is MSVC 19.16.27027.1
-- The CXX compiler identification is MSVC 19.16.27027.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Corrade: G:/programming/c++/vcpkg/installed/x86-windows/include found components: Containers rc Utility
-- Found OpenGL: opengl32
-- Found SDL2: optimized;G:/programming/c++/vcpkg/installed/x86-windows/lib/SDL2.lib;debug;G:/programming/c++/vcpkg/installed/x86-windows/debug/lib/SDL2d.lib
-- Found Magnum: G:/programming/c++/vcpkg/installed/x86-windows/include found components: GL Sdl2Application
-- LIB_SUFFIX variable is not defined. It will be autodetected now.
-- You can set it manually with -DLIB_SUFFIX=<value> (64 for example)
-- LIB_SUFFIX autodetected as '', libraries will be installed into C:/Program Files (x86)/Multiverses/lib
-- Configuring done
-- Generating done
-- Build files have been written to: G:/programming/c++/multiverses/build
Run the ALL_BUILD target :
1>------ Rebuild All started: Project: ZERO_CHECK, Configuration: Debug Win32 ------
1>Checking Build System
1>CMake does not need to re-run because G:/programming/c++/multiverses/build/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because G:/programming/c++/multiverses/build/src/CMakeFiles/generate.stamp is up-to-date.
2>------ Rebuild All started: Project: Multiverses, Configuration: Debug Win32 ------
2>Building Custom Rule G:/programming/c++/multiverses/src/CMakeLists.txt
2>CMake does not need to re-run because G:/programming/c++/multiverses/build/src/CMakeFiles/generate.stamp is up-to-date.
2>Multiverses.cpp
2>Multiverses.vcxproj -> G:\programming\c++\multiverses\build\src\Debug\Multiverses.exe
It seems that everything compile and I can run the basic application:
The only problem is when I press the Local Windows Debugger button I get this message:
This is the new project structure:
Congrats, you just ran into the very last issue of first-time CMake users on Visual Studio.
The ALL_BUILD
is the default target. Simply make the actual application target the default (which is the Multiverses
, I think). Right-click menu has that option. Then the build&run will work.
I must say I owe you a good one! Your patience and love for your project tells me how worthy it is for me to base my already working project port on Magnum. I thank you for your patience and guidance at last I've made it!
It is an amazing learning curve in 2 day without knowing anything about CMake and Magnum to be able to come up with the basic foundation. Your help was tremendous (like Trump would say https://www.youtube.com/watch?v=CDhhzSXxnw0).
And by the way I found the magic button you talked about:
Now I was wondering how to integrate CppMicroservices instead of Corrade's PluginManager.
You're welcome. With CppMicroservices I guess you're on your own now, have fun diving into the code :)
One more question when I do debugging with my current setup does the debugging go in the source code of Magnum and Corrade? Do I need to make another setup?
yes it does, vcpkg installs both debug and release libraries and if you are building the Debug configuration the debugger should be able to go into the vcpkg-owned sources (if not, you should be able to point it to where the sources are inside vcpkg) (disclaimer: i'm not a windows user)
This can be closed, right?
Yes it can be. Thank you @mosra.
Greetings again!
I was wondering if any specific framework is used for the plugin system? I was planning to build Magnum inside of an OSGi framework in my main core application so that I can on the fly load and plugin or unload a plugin without interrupting the main app which is undepdent.
The most powerful programming paradigm I've learned as an Architect. Dynamic micro-service oriented architecture.
For more information please check http://cppmicroservices.org/