Code Monkey home page Code Monkey logo

magnum-bootstrap's Introduction

This repository contains "bootstrap projects" for the Magnum C++11/C++14 graphics engine.

Join the chat at https://gitter.im/mosra/magnum Build Status Build Status Build Status UNLICENSE

Setting up a new project can be pretty gruesome and nobody likes repeating the same process every time. This repository provides "bootstrap" project structures for many use cases, helping you get up and running in no time.

USAGE

To use Magnum, you obviously need to have Magnum installed. The whole building and installation process (along with the following guide) is thoroughly explained in Magnum documentation, particularly in the Getting Started Guide.

Minimal dependencies

  • C++ compiler with good C++11 support. Compilers which are tested to have everything needed are GCC >= 4.8.1, Clang >= 3.3 and MSVC >= 2015. On Windows you can also use clang-cl and MinGW-w64.
  • CMake >= 3.4
  • Corrade, Magnum — The engine itself

Note that each bootstrap project has additional dependency requirements, listed below. See Magnum building documentation for more information.

Bootstrapping the project

Desired usage is to download selected branch from the list below as an archive (using the Download button in GitHub) or by using URL similar to one of the following (replace <branch> with desired branch name):

https://github.com/mosra/magnum-bootstrap/archive/<branch>.tar.gz
https://github.com/mosra/magnum-bootstrap/archive/<branch>.zip

After extracting the downloaded archive you can build and run the application with these four commands:

mkdir build && cd build
cmake ..
cmake --build .
./src/MyApplication # or ./src/Debug/MyApplication

For crosscompiling (in base-nacl and base-emscripten branches, see below) you will need to have the toolchains submodule. It is present in Git clone and can be updated with these commands:

git submodule init
git submodule update

However, because you should use downloaded archive anyway, you need to manually download snapshot of toolchains repository from https://github.com/mosra/toolchains and put the contents in toolchains/ subdirectory.

Contents of the repository

This master branch contains just an README file and the actual bootstrap projects are in various other branches, each covering some particular use case.

Base application

The base branch contains barebones windowed application using Platform::Sdl2Application with only the essential files. You need Magnum built with WITH_SDL2APPLICATION enabled.

Base application using GLFW

The base-glfw branch is similar to base one, except that it uses Platform::GlfwApplication instead of Platform::Sdl2Application. You need Magnum built with WITH_GLFWAPPLICATION enabled.

Base application using gtkmm

The base-gtkmm branch does not use any of the application wrappers provided in Platform namespace, but uses gtkmm window and context creation directly and manually initializes Magnum on top of that using EGL on embedded devices, WGL on Windows, CGL on macOS and GLX on Unix/Linux. You need Magnum built with WITH_EGLCONTEXT, WITH_WGLCONTEXT, WITH_CGLCONTEXT or WITH_GLXCONTEXT enabled, depending on the platform of your choice.

Base application using Qt

The base-qt branch does not use any of the application wrappers provided in Platform namespace, but uses Qt5 window and context creation directly and manually initializes Magnum on top of that using EGL on embedded devices, WGL on Windows, CGL on macOS and GLX on Unix/Linux. You need Magnum built with WITH_EGLCONTEXT, WITH_WGLCONTEXT, WITH_CGLCONTEXT or WITH_GLXCONTEXT enabled, depending on the platform of your choice.

Base application using wxWidgets

The base-wxwidgets branch does not use any of the application wrappers provided in Platform namespace, but uses wxWidgets window and context creation directly and manually initializes Magnum on top of that using EGL on embedded devices, WGL on Windows, CGL on macOS and GLX on Unix/Linux. You need Magnum built with WITH_EGLCONTEXT, WITH_WGLCONTEXT, WITH_CGLCONTEXT or WITH_GLXCONTEXT enabled, depending on the platform of your choice.

Windowless application

The windowless branch contains windowless application using Platform::WindowlessGlxApplication on X11-based Unix, Platform::WindowlessCglApplication on macOS, Platform::WindowlessWglApplication on Windows, Platform::WindowlessWindowsEglApplication on Windows GLES or ANGLE, Platform::WindowlessEglApplication on headless systems supporting EGL and Platform::WindowlessIosApplication on iOS. Useful for querying information about the renderer, offscreen rendering, image processing etc. You need Magnum built with WITH_WINDOWLESS*APPLICATION enabled, depending on the platform of your choice.

Scene graph

The scenegraph2D and scenegraph3D branches contain application prepared for using 2D/3D SceneGraph. You need Magnum built with WITH_SDL2APPLICATION and WITH_SCENEGRAPH enabled.

Base application with port to Emscripten

The base-emscripten branch contains application using Platform::Sdl2Application for desktop and and Platform::EmscriptenApplication for Emscripten build. For desktop build you need Magnum built with WITH_SDL2APPLICATION enabled and you can use the commands above to build it.

For Emscripten build you need to have Emscripten installed with Corrade and Magnum crosscompiled for Emscripten, don't forget to build Magnum with WITH_EMSCRIPTENAPPLICATION enabled. See Corrade's and Magnum's building documentation for more information.

In the toolchains/ submodule there are two toolchain files. The generic/Emscripten.cmake is for the classical (asm.js) build, the generic/Emscripten-wasm.cmake is for WebAssembly build. Don't forget to adapt EMSCRIPTEN_PREFIX variable in generic/Emscripten*.cmake to path where Emscripten is installed; you can also pass it explicitly on command-line using -DEMSCRIPTEN_PREFIX. Default is /usr/lib/emscripten.

Then create build directory and run cmake and build/install commands in it. Set CMAKE_PREFIX_PATH to where you have all the dependencies installed, set CMAKE_INSTALL_PREFIX to have the files installed in proper location (a webserver, e.g. /srv/http/emscripten).

mkdir build-emscripten && cd build-emscripten
cmake .. \
    -DCMAKE_TOOLCHAIN_FILE=path/to/toolchains/generic/Emscripten-wasm.cmake \
    -DCMAKE_PREFIX_PATH=/usr/lib/emscripten/system \
    -DCMAKE_INSTALL_PREFIX=/srv/http/emscripten
cmake --build .
cmake --build . --target install

You can then open MyApplication.html in your browser (through webserver, e.g. http://localhost/emscripten/MyApplication.html).

Windowless application with port to Emscripten

The windowless-emscripten branch contains a version of the windowless bootstrap project which in addition uses Platform::WindowlessEglApplication for Emscripten build. You need Magnum built with WITH_WINDOWLESS*APPLICATION enabled depending on your platform of choice and you can use the commands above to build the desktop version.

For Emscripten build you need to have Emscripten installed with Corrade and Magnum crosscompiled for Emscripten, don't forget to build Magnum with WITH_WINDOWLESSEGLAPPLICATION enabled. See Corrade's and Magnum's building documentation for more information.

In the toolchains/ submodule there are two toolchain files. The generic/Emscripten.cmake is for the classical (asm.js) build, the generic/Emscripten-wasm.cmake is for WebAssembly build. Don't forget to adapt EMSCRIPTEN_PREFIX variable in generic/Emscripten*.cmake to path where Emscripten is installed; you can also pass it explicitly on command-line using -DEMSCRIPTEN_PREFIX. Default is /usr/lib/emscripten.

Then create build directory and run cmake and build/install commands in it. Set CMAKE_PREFIX_PATH to where you have all the dependencies installed, set CMAKE_INSTALL_PREFIX to have the files installed in proper location (a webserver, e.g. /srv/http/emscripten).

mkdir build-emscripten && cd build-emscripten
cmake .. \
    -DCMAKE_TOOLCHAIN_FILE=path/to/toolchains/generic/Emscripten-wasm.cmake \
    -DCMAKE_PREFIX_PATH=/usr/lib/emscripten/system \
    -DCMAKE_INSTALL_PREFIX=/srv/http/emscripten
cmake --build .
cmake --build . --target install

You can then open MyApplication.html in your browser (through webserver, e.g. http://localhost/emscripten/MyApplication.html).

Base application with port to Android

The base-android branch contains application using Platform::Sdl2Application for desktop build and Platform::AndroidApplication for Android build. For desktop build you need Magnum built with WITH_SDL2APPLICATION enabled and you can use the commands above to build it.

For Android build you need to have Android NDK installed with Corrade and Magnum crosscompiled for Android, Magnum built with WITH_ANDROIDAPPLICATION enabled. See Corrade's and Magnum's building documentation for more information.

In order to build the application and install it on your device, use Gradle:

gradle build
gradle installDebug

Base application with port to iOS

The base-ios branch contains application using Platform::Sdl2Application for both desktop and iOS build. You need Magnum built with WITH_SDL2APPLICATION enabled and you can use the commands above to build the desktop version.

For iOS you need macOS and XCode installed with Corrade and Magnum crosscompiled for iOS, don't forget to build Magnum with WITH_SDL2APPLICATION enabled. See Corrade's and Magnum's building documentation for more information.

Then create build directory and run cmake to generate the Xcode project. Set CMAKE_OSX_ROOT to SDK you want to target and enable all desired architectures in CMAKE_OSX_ARCHITECTURES. Set CMAKE_PREFIX_PATH to the directory where you have all the dependencies.

mkdir build-ios && cd build-ios
cmake .. \
    -DCMAKE_TOOLCHAIN_FILE=path/to/toolchains/generic/iOS.cmake \
    -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk \
    -DCMAKE_OSX_ARCHITECTURES="arm64;armv7;armv7s" \
    -DCMAKE_PREFIX_PATH=~/ios-libs \
    -G Xcode

You can then open the generated project file in Xcode and build/deploy it from there.

Base application with port to Windows RT (Store/Phone)

The base-winrt branch contains application using Platform::Sdl2Application for both desktop and Windows RT build. You need Magnum built with WITH_SDL2APPLICATION enabled and you can use the commands above to build the desktop version.

For Windows RT build you need to have at least Windows 8.1, Visual Studio 2013 and Windows 8.1 Store/Phone SDK installed with Corrade and Magnum crosscompiled for Windows RT, don't forget to build Magnum with WITH_SDL2APPLICATION enabled. See Corrade's and Magnum's building documentation for more information.

You need to provide your own *.pfx certificate file and pass it to CMake in a SIGNING_CERTIFICATE variable. The bootstrap application assumes that SDL2 and ANGLE is built as DLL and both Corrade and Magnum are built statically. Assuming the native Corrade installation is in C:/Sys and all WinRT dependencies are in C:/Sys-winrt, the build can be done similarly to the following:

mkdir build-winrt && cd build-winrt
cmake .. ^
    -DCORRADE_RC_EXECUTABLE="C:/Sys/bin/corrade-rc.exe" ^
    -DCMAKE_PREFIX_PATH="C:/Sys-winrt" ^
    -DCMAKE_SYSTEM_NAME=WindowsStore ^
    -DCMAKE_SYSTEM_VERSION=8.1 ^
    -DSIGNING_CERTIFICATE=<path-to-your-pfx-file> ^
    -G "Visual Studio 14 2015"
cmake --build .

Change WindowsStore to WindowsPhone if you want to build for Windows Phone instead. The build-winrt/src/AppPackages directory will then contain the final package along with a PowerShell script for easy local installation.

CONTACT & SUPPORT

If you want to contribute to Magnum, if you spotted a bug, need a feature or have an awesome idea, you can get a copy of the sources from GitHub and start right away! There is the already mentioned guide about how to download and build Magnum and also a guide about coding style and best practices which you should follow to keep the library as consistent and maintainable as possible.

See also the Magnum Project Contact & Support page for further information.

LICENSE

While Magnum itself and its documentation are licensed under the MIT/Expat license, all boostrap projects are put into public domain (or UNLICENSE) to free you from any legal obstacles when reusing the code in your apps. See the COPYING file for details.

magnum-bootstrap's People

Contributors

jacksoncampolattaro avatar mosra avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

magnum-bootstrap's Issues

Help understanding bootstrap emscripten js error

Hello I've managed to build out emscripten bootstrap using cmake->ninja on windows but however, it fails to load in the browser. Any idea what's causing this?

What I did aside form modifying "src" module

  • specified language level c++17 in top level cmakelist
  • uncomment #undef MAGNUM_TARGET_GLES2 in magnum configure.h
  • specified GL version 300 for shaders
  • add USE_SDL=2 -s USE_WEBGL2=1 -s FULL_ES3=1 to em++ 's LINK_FLAGS in build.ninja because it complains about missing SDL symbol

image

image

Basically Same result on both js and wasm

Not installing `.wasm`

install(TARGETS MyApplication DESTINATION ${CMAKE_INSTALL_PREFIX})

Then building to wasm then the installation does not copy the MyApplication.wasm file to the install destination.

Can be fixed by adding line
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/MyApplication.wasm DESTINATION ${CMAKE_INSTALL_PREFIX} OPTIONAL)
But I'm not sure if this is the cleanest solution there is. The OPTIONAL is there not to break other builds.

Tomas

base-Qt reports wrong OpenGL Version

When I compile the magnum-bootstrap-base-qt code using the latest Qt 5.13 on MacOS, _context_create() reports

OpenGL version: 2.1 ATI-2.11.20

which is much older than what my GPU supports. Compiling a standard example with CMake and SDLApplication (e.g., the triangle example), results in

OpenGL version: 4.1 ATI-2.11.20

Any idea why Qt and/or Magnum picks an older OpenGL version?

Linking issue with scenegraph3D bootstrap project

Compilation of the bootstrap project scenegraph3D fails at link stage with this error:

Linking CXX executable MyApplication
CMakeFiles/MyApplication.dir/MyApplication.cpp.o: In function `Magnum::SceneGraph::BasicCamera3D<float>::setAspectRatioPolicy(Magnum::SceneGraph::AspectRatioPolicy)':
/home/lemaigna/src/augmentedreality/src/MyApplication.cpp:(.text._ZN6Magnum10SceneGraph13BasicCamera3DIfE20setAspectRatioPolicyENS0_17AspectRatioPolicyE[_ZN6Magnum10SceneGraph13BasicCamera3DIfE20setAspectRatioPolicyENS0_17AspectRatioPolicyE]+0x25): undefined reference to `Magnum::SceneGraph::AbstractCamera<3u, float>::setAspectRatioPolicy(Magnum::SceneGraph::AspectRatioPolicy)'

Tested with both GCC 4.7 and clang 3.1, both on Ubuntu 13.04 64bits.

Note that:

  • tested against GIT magnum
  • all magnum (including the one related to scene graph) pass
  • the CMakeLists used is the one provided (ie, it includes target_link_libraries(MyApplication ${MAGNUM_LIBRARIES} ${MAGNUM_SCENEGRAPH_LIBRARIES})
  • nm /usr/local/lib/libMagnumSceneGraph.so | grep setAspectRatioPolicy seems to indicate that the symbol exist:
0000000000013470 W _ZN6Magnum10SceneGraph13BasicCamera2DIfE20setAspectRatioPolicyENS0_17AspectRatioPolicyE
0000000000013ac0 W _ZN6Magnum10SceneGraph13BasicCamera3DIfE20setAspectRatioPolicyENS0_17AspectRatioPolicyE
0000000000011f30 t _ZN6Magnum10SceneGraph14AbstractCameraILj2EfE20setAspectRatioPolicyENS0_17AspectRatioPolicyE
00000000000127a0 t _ZN6Magnum10SceneGraph14AbstractCameraILj3EfE20setAspectRatioPolicyENS0_17AspectRatioPolicyE

Steps to reproduce:

$ git clone https://github.com/mosra/magnum-bootstrap.git -b scenegraph3D
$ cd magnum-bootstrap && mkdir build $$ cd build
$ cmake ..
$ make

The exact same linking error also occurs when compiling magnum-examples/src/viewer.

Android Gradle build

I want to build Magnum for Android and bootstrap projects and generate APK which I can install on my device.

It looks like I have built a minimal core magnum framework for Android including (corrade, magnum, magnum-integration with imguy). All using cmake setup here:
cmake-scripts
There are:
setup-corrade-build.sh
setup-magnum-build.sh
setup-magnum-integration-build.sh
I was following CI build scripts with some modifications to get it built.

Then I have magnum-bootstrap Gradle setup. I had to do some modifications to get it working, but there are errors. I am targetting Android 26, arm64-v8a.
I have built Magnum inside the "./library" folder in magnum-bootstrap project. Gradle config:
magnum-bootstrap-android

When I try to build gradle project I get the error during linking. Error log:
Gradle error log

../../../../libraries/lib/libMagnumAndroidApplication.a: error adding symbols: File in wrong format

May it be some problem with target architecture?
--target=aarch64-none-linux-android26

Is my setup wrong? Any ideas?
Thank you.

Cross platform bootstrap?

Is there any procedure to get Magnum working on as many platforms as possible, as quickly as possible? I noticed it's possible to get Magnum to build many platforms via Jenkins; is there an established way to get a project using Magnum to build similarly?

vcpkg doesn't play well with FindXYZ modules

vcpkg's modules are overridden by the CMake find modules in the modules directory, which causes a build to fail to find those packages.

Annoyingly, the workaround seems to be:

if(NOT VCPKG_TOOLCHAIN)
	set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/modules/")
endif()

Which isn't exactly great.

Linker Error (SDL2)

I've installed sdl2, corrade and magnum via from the arch community repository.
When I tried to build the bootstrap (base) project I received the following error:

[ 50%] Linking CXX executable MyApplication
/usr/bin/ld: /usr/lib64/libMagnumSdl2Application.a(Sdl2Application.cpp.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
make[3]: *** [src/CMakeFiles/MyApplication.dir/build.make:101: src/MyApplication] Error 1
make[2]: *** [CMakeFiles/Makefile2:86: src/CMakeFiles/MyApplication.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:98: src/CMakeFiles/MyApplication.dir/rule] Error 2
make: *** [Makefile:118: MyApplication] Error 2

I've also tried to add -fPIC to the linker flags but it didn't work.
Do you have an idea what the problem might be and how I can fix it?

ANDROID_SDK variable has wrong path on Windows.

@mosra
Hey Vladimir.

One issue I have found in the Android Bootstrap project.
It looks like ANDROID_SDK path search is not cross-platform:
get_filename_component(ANDROID_SDK ${CMAKE_ANDROID_NDK}/../android-sdk/ REALPATH CACHE)

Not sure what should be the right approach here.
I have modified your config on Windows to use the environment variable ANDROID_HOME.
For example my default NDK location on Windows is:
export ANDROID_NDK_HOME=/c/Users/<user>/AppData/Local/Android/Sdk/ndk/20.0.5594570

After my modification, I can generate and install .apk.

coming form here
https://github.com/mosra/toolchains/blob/99954afbab3b2a9e3ba518edccc8379733080db9/modules/UseAndroid.cmake

GL::Context: unsupported OpenGL version (0, 0) output while building base-wxwidgets

I am getting GL::Context: unsupported OpenGL version (0, 0) output when I run MyApplication that is created by building the base-wxwidgets branch of magnum-bootstrap. My distro is Arch Linux.
Btw I moved _wxGlCanvas->SetCurrent(_wxGlContext) method to MainFrame::OnPaint because otherwise I get a failed assert. Assert error is glx11.cpp assert xid failed in setcurrent window must be shown.

[src]$ ldd MyApplication 
	linux-vdso.so.1 (0x00007ffcd8b2c000)
	libMagnumGL.so.2 => /usr/lib/libMagnumGL.so.2 (0x00007fee7f091000)
	libMagnum.so.2 => /usr/lib/libMagnum.so.2 (0x00007fee7f041000)
	libwx_baseu-3.1.so.4 => /usr/lib/libwx_baseu-3.1.so.4 (0x00007fee7edb1000)
	libwx_gtk3u_core-3.1.so.4 => /usr/lib/libwx_gtk3u_core-3.1.so.4 (0x00007fee7e57a000)
	libwx_gtk3u_gl-3.1.so.4 => /usr/lib/libwx_gtk3u_gl-3.1.so.4 (0x00007fee7e55f000)
	libCorradeUtility.so.2 => /usr/lib/libCorradeUtility.so.2 (0x00007fee7e502000)
	libdl.so.2 => /usr/lib/libdl.so.2 (0x00007fee7e4fa000)
	libGLX.so.0 => /usr/lib/libGLX.so.0 (0x00007fee7e4c7000)
	libOpenGL.so.0 => /usr/lib/libOpenGL.so.0 (0x00007fee7e49b000)
	libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007fee7e2be000)
	libm.so.6 => /usr/lib/libm.so.6 (0x00007fee7e178000)
	libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007fee7e15e000)
	libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007fee7e13a000)
	libc.so.6 => /usr/lib/libc.so.6 (0x00007fee7df71000)
	/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007fee7f167000)
	libz.so.1 => /usr/lib/libz.so.1 (0x00007fee7df57000)
	libsecret-1.so.0 => /usr/lib/libsecret-1.so.0 (0x00007fee7def4000)
	libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0x00007fee7de9c000)
	libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0x00007fee7dd68000)
	liblzma.so.5 => /usr/lib/liblzma.so.5 (0x00007fee7dd3e000)
	libgtk-3.so.0 => /usr/lib/libgtk-3.so.0 (0x00007fee7d596000)
	libgdk-3.so.0 => /usr/lib/libgdk-3.so.0 (0x00007fee7d497000)
	libpangocairo-1.0.so.0 => /usr/lib/libpangocairo-1.0.so.0 (0x00007fee7d486000)
	libpango-1.0.so.0 => /usr/lib/libpango-1.0.so.0 (0x00007fee7d434000)
	libcairo.so.2 => /usr/lib/libcairo.so.2 (0x00007fee7d315000)
	libgdk_pixbuf-2.0.so.0 => /usr/lib/libgdk_pixbuf-2.0.so.0 (0x00007fee7d2ee000)
	libgio-2.0.so.0 => /usr/lib/libgio-2.0.so.0 (0x00007fee7d132000)
	libX11.so.6 => /usr/lib/libX11.so.6 (0x00007fee7cff1000)
	libXxf86vm.so.1 => /usr/lib/libXxf86vm.so.1 (0x00007fee7cfea000)
	libSM.so.6 => /usr/lib/libSM.so.6 (0x00007fee7cfe0000)
	libnotify.so.4 => /usr/lib/libnotify.so.4 (0x00007fee7cfd6000)
	libXtst.so.6 => /usr/lib/libXtst.so.6 (0x00007fee7cfcc000)
	libpangoft2-1.0.so.0 => /usr/lib/libpangoft2-1.0.so.0 (0x00007fee7cfb0000)
	libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x00007fee7cf65000)
	libpng16.so.16 => /usr/lib/libpng16.so.16 (0x00007fee7cf2e000)
	libjpeg.so.8 => /usr/lib/libjpeg.so.8 (0x00007fee7ceaa000)
	libtiff.so.5 => /usr/lib/libtiff.so.5 (0x00007fee7ce1a000)
	libGL.so.1 => /usr/lib/libGL.so.1 (0x00007fee7cd92000)
	libGLdispatch.so.0 => /usr/lib/libGLdispatch.so.0 (0x00007fee7ccdb000)
	libgcrypt.so.20 => /usr/lib/libgcrypt.so.20 (0x00007fee7cbba000)
	libffi.so.7 => /usr/lib/libffi.so.7 (0x00007fee7cbae000)
	libpcre.so.1 => /usr/lib/libpcre.so.1 (0x00007fee7cb3c000)
	libgmodule-2.0.so.0 => /usr/lib/libgmodule-2.0.so.0 (0x00007fee7cb35000)
	libharfbuzz.so.0 => /usr/lib/libharfbuzz.so.0 (0x00007fee7ca61000)
	libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00007fee7c98d000)
	libfribidi.so.0 => /usr/lib/libfribidi.so.0 (0x00007fee7c96e000)
	libcairo-gobject.so.2 => /usr/lib/libcairo-gobject.so.2 (0x00007fee7c962000)
	libatk-1.0.so.0 => /usr/lib/libatk-1.0.so.0 (0x00007fee7c939000)
	libepoxy.so.0 => /usr/lib/libepoxy.so.0 (0x00007fee7c806000)
	libXi.so.6 => /usr/lib/libXi.so.6 (0x00007fee7c7f3000)
	libatk-bridge-2.0.so.0 => /usr/lib/libatk-bridge-2.0.so.0 (0x00007fee7c7bd000)
	libcloudproviders.so.0 => /usr/lib/libcloudproviders.so.0 (0x00007fee7c7a5000)
	libXfixes.so.3 => /usr/lib/libXfixes.so.3 (0x00007fee7c79c000)
	librt.so.1 => /usr/lib/librt.so.1 (0x00007fee7c791000)
	libxkbcommon.so.0 => /usr/lib/libxkbcommon.so.0 (0x00007fee7c74a000)
	libwayland-client.so.0 => /usr/lib/libwayland-client.so.0 (0x00007fee7c739000)
	libwayland-cursor.so.0 => /usr/lib/libwayland-cursor.so.0 (0x00007fee7c730000)
	libwayland-egl.so.1 => /usr/lib/libwayland-egl.so.1 (0x00007fee7c72b000)
	libXext.so.6 => /usr/lib/libXext.so.6 (0x00007fee7c716000)
	libXcursor.so.1 => /usr/lib/libXcursor.so.1 (0x00007fee7c70a000)
	libXdamage.so.1 => /usr/lib/libXdamage.so.1 (0x00007fee7c703000)
	libXcomposite.so.1 => /usr/lib/libXcomposite.so.1 (0x00007fee7c6fe000)
	libXrandr.so.2 => /usr/lib/libXrandr.so.2 (0x00007fee7c6f1000)
	libXinerama.so.1 => /usr/lib/libXinerama.so.1 (0x00007fee7c6ec000)
	libthai.so.0 => /usr/lib/libthai.so.0 (0x00007fee7c6e1000)
	libXrender.so.1 => /usr/lib/libXrender.so.1 (0x00007fee7c6d2000)
	libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00007fee7c6a8000)
	libxcb-render.so.0 => /usr/lib/libxcb-render.so.0 (0x00007fee7c698000)
	libxcb-shm.so.0 => /usr/lib/libxcb-shm.so.0 (0x00007fee7c693000)
	libpixman-1.so.0 => /usr/lib/libpixman-1.so.0 (0x00007fee7c5eb000)
	libmount.so.1 => /usr/lib/libmount.so.1 (0x00007fee7c58e000)
	libresolv.so.2 => /usr/lib/libresolv.so.2 (0x00007fee7c572000)
	libICE.so.6 => /usr/lib/libICE.so.6 (0x00007fee7c555000)
	libuuid.so.1 => /usr/lib/libuuid.so.1 (0x00007fee7c54c000)
	libexpat.so.1 => /usr/lib/libexpat.so.1 (0x00007fee7c51d000)
	libzstd.so.1 => /usr/lib/libzstd.so.1 (0x00007fee7c44b000)
	libgpg-error.so.0 => /usr/lib/libgpg-error.so.0 (0x00007fee7c422000)
	libgraphite2.so.3 => /usr/lib/libgraphite2.so.3 (0x00007fee7c3fd000)
	libbz2.so.1.0 => /usr/lib/libbz2.so.1.0 (0x00007fee7c3ea000)
	libdbus-1.so.3 => /usr/lib/libdbus-1.so.3 (0x00007fee7c395000)
	libatspi.so.0 => /usr/lib/libatspi.so.0 (0x00007fee7c35e000)
	libdatrie.so.1 => /usr/lib/libdatrie.so.1 (0x00007fee7c352000)
	libXau.so.6 => /usr/lib/libXau.so.6 (0x00007fee7c34d000)
	libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00007fee7c345000)
	libblkid.so.1 => /usr/lib/libblkid.so.1 (0x00007fee7c2f4000)
	libsystemd.so.0 => /usr/lib/libsystemd.so.0 (0x00007fee7c23e000)
	liblz4.so.1 => /usr/lib/liblz4.so.1 (0x00007fee7c219000)

Segment fault using Getting Started Guide on Ubuntu 16.06

Attempting to get subproject compilation working leads directly to a segfault from cmake of all places.

cmake .. -DWITH_SDL2APPLICATION=ON
-- LIB_SUFFIX variable is not defined. It will be autodetected now.
-- You can set it manually with -DLIB_SUFFIX= (64 for example)
-- LIB_SUFFIX autodetected as '', libraries will be installed into /usr/local/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: /home/ren/Desktop/ArcAngel2D/experimenta/magnum-bootstrap/corrade/src found components: Containers Utility rc PluginManager
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libGL.so
-- Found SDL2: /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so
-- Found Corrade: /home/ren/Desktop/ArcAngel2D/experimenta/magnum-bootstrap/corrade/src found components: Containers rc Utility PluginManager
-- Found Magnum: /home/ren/Desktop/ArcAngel2D/experimenta/magnum-bootstrap/magnum/src found components: Sdl2Application
Segmentation fault (core dumped)

Without -SDL2_APPLICATION=ON, cmake spits out make files, but they fail to actually make (with errors related to what I assume is glfw).

cmake --version outputs "cmake version 3.5.1", so this isn't some out of date version of cmake.

I should note I have had no real issues compiling separately (though I'd prefer to use the subproject concept to simplify my project).

Building Issue - The fully qualified file name must be less than 260 characters

I just started using the magnum library on a Windows computer. I was following the Get Started tutorial and was able to finish it. I then went to the Triangle example. I followed the tutorial and started to build the project. The build then comes with this error.

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(382,5): error MSB3491: Could not write lines to file "x64\Debug\MagnumShaders_RESOURCES_GL-dependencies\MagnumSh.9D2F43E4.tlog\MagnumShaders_RESOURCES_GL-dependencies.lastbuildstate". Path: x64\Debug\MagnumShaders_RESOURCES_GL-dependencies\MagnumSh.9D2F43E4.tlog\MagnumShaders_RESOURCES_GL-dependencies.lastbuildstate exceeds the OS max path limit. The fully qualified file name must be less than 260 characters.

All the other parts of the build succeeded and I was even able to run the application. From what I understand about this error is that it is a well-known restriction within the Win32 API. Is there a way to get around this error?

FrameBuffer::clearColor not working

I've succesfully installed the base-qt bootstrap, however, I have a little problem using the function clearColor which in fact doesn't change the clear color from the default buffer.

with the given paintGL function:

void MyApplication::paintGL() {
    /* Reset state to avoid Qt affecting Magnum */
    GL::Context::current().resetState(GL::Context::State::ExitExternal);

    /* Using framebuffer provided by Qt as default framebuffer */
    auto qtDefaultFramebuffer = GL::Framebuffer::wrap(defaultFramebufferObject(), {{}, {width(), height()}});
    qtDefaultFramebuffer.clearColor(GL_COLOR_ATTACHMENT0, Math::Color4<Float>::red());
    qtDefaultFramebuffer.clear(GL::FramebufferClear::Color);
    /* TODO: Add your drawing code here */

    /* Clean up Magnum state and back to Qt */
    GL::Context::current().resetState(GL::Context::State::EnterExternal);
}

I added the clearColor call before clearing the buffer, but it doesn't work. So i tried using the native opengl function which actually worked as spected. I'm not sure if i'm doing something wrong or it's a bug.

void MyApplication::paintGL() {
    /* Reset state to avoid Qt affecting Magnum */
    GL::Context::current().resetState(GL::Context::State::ExitExternal);

    /* Using framebuffer provided by Qt as default framebuffer */
    auto qtDefaultFramebuffer = GL::Framebuffer::wrap(defaultFramebufferObject(), {{}, {width(), height()}});
    //qtDefaultFramebuffer.clearColor(GL_COLOR_ATTACHMENT0, Math::Color4<Float>::red());
    glClearColor(1.f, 0.f, 0.f, 1.f);
    qtDefaultFramebuffer.clear(GL::FramebufferClear::Color);
    /* TODO: Add your drawing code here */

    /* Clean up Magnum state and back to Qt */
    GL::Context::current().resetState(GL::Context::State::EnterExternal);
}

OS: Windows 10
IDE: Visual Studio 2017
Qt: 5.12
Both Magnum and Corrade where compiled from master branch.

magnum + wxWidgets sample projects, mouse drag can rotate the camera, but not as expected

Hi, I try to implement a magnum + wxWidgets sample C++ projects by using the msys2.

I just copy and modify the code:

https://github.com/mosra/magnum-examples/blob/master/src/mouseinteraction/MouseInteractionExample.cpp

Since it use the SDL as the main GUI, I just translated all the GUI related code to wxWidgets, the main GUI shows correctly, but I found an issue that the mouse drag can rotate the camera/scene, but not as expected as the webgl one shown in the Mouse In­ter­ac­tion Ex­am­ple, can any one help me.

I'm not quite understand how the matrix calculation works for the mouseinteraction example project.

My project is in https://github.com/asmwarrior/magnum-wx

Thanks.

Building woes

Currently when checking out / downloading the archive of one of the branches then we try to cmake <path-to-extracted-directory> -D... it fails pretty quick because it cannot find corrade:

Make Error at /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
  Could NOT find Corrade (missing: CORRADE_INCLUDE_DIR
  _CORRADE_CONFIGURE_FILE)

Looking in the CMakeLists.txt file it seems that it is assuming that CORRADE, MAGNUM, and occasional other things like SDL2 are installed either globally or have their base paths passed explicitly to the cmake command, all of which is painful (especially as there are no version restrictions, so what if, say, someone's SDL2 was too old or too new?).

Using any kind of cmake based downloading and build manager (I tend to prefer hunter.sh nowadays) would make this a simple process as it could acquire everything it needs at the correct versions of what is needed without filling up the system package scope and/or passing in huge path lines to various directories after manually(!) building a host of dependencies.

Compare this to, say if using hunter.sh, then first you'd just need to include the gate file (scaffolding, rarely updates, it grabs everything else it needs automatically), put it in a cmake or so directory of the project or where-ever you want to store such cmake utility files. Then you call in to it while declaring what version of the main package repository you want (you can define your own repositories as well, hosted anywhere, even the 'main' one is on github and is optional unless you want something from it), such as:

# Load the gate file:
include("cmake/HunterGate.cmake")
# Bring in the primary repository (this is cached globally by default, user-configurable)
HunterGate(
    URL "https://github.com/ruslo/hunter/archive/v0.19.218.tar.gz"
    SHA1 "edaeb585f5ba709311c828facf9ea9e83754fd4b"
)

Then you bring in whatever dependencies you want (like SDL2, you can specify a specific version to use as well, by default it just uses the latest that the package snapshot knows about):

hunter_add_package(SDL2)
# If corrade was in the repo, or a custom one added above:
hunter_add_package(Corrade)
# Ditto with magnum
hunter_add_package(Magnum)

At this point you just use them as normal, nothing special here:

find_package(SDL2 CONFIG REQUIRED)
find_package(Magnum CONFIG REQUIRED
    SceneGraph
    Sdl2Application)

set_directory_properties(PROPERTIES CORRADE_USE_PEDANTIC_FLAGS ON)

add_executable(MyApplication MyApplication.cpp)
target_link_libraries(MyApplication
    Magnum::Application
    Magnum::Magnum
    Magnum::SceneGraph)

Everything gets built and cached globally by default (again, it's configurable, defaults to ~/.hunter) based on the build parameters (so multiple projects that bring in, say, magnum will use the shared built version if they all want it with the same build parameters, else each set of distinct builds get their own hashed location so no worry of conflicts).

This works wonderfully with CI especially as you just have to cache the ~/.hunter directory and you can clone and build all you want very quickly (sans the first time when all the dependencies are built or when they are updated or build options are changed).

Even if not using hunter.sh, just using anything that does not require anything more than CMake and the C++ compiler/linker/etc... would significantly ease a lot of setup on using this.

A few extra nice bits, hunter.sh also has a repo full of toolchains for (cross-)compiling to about everything in existence in any form wanted, if those would ever be useful to add more platforms on.

Separate declarations from implementations

Currently, the bootstrap projects include the class declarations in the implementation.

Is there any good reason not to provide separate headers (which are needed as soon as the project grows up)?

I can submit a pull request for that, if needed.

Getting started tutorial issue - can't find SDL2

I just found this project and it looks great - I followed the tutorial at http://mosra.cz/blog/magnum-doc/getting-started.html and when I get to the "cmake .. -DWITH_SDL2APPLICATION=ON" step, I get the following output:

CMake Warning at corrade/CMakeLists.txt:158 (message):
MSVC 2015 detected, automatically enabling MSVC2015_COMPATIBILITY. Note
that some features may not be available with this compiler.
-- Could NOT find SDL2 (missing: SDL2_LIBRARY SDL2_INCLUDE_DIR)
CMake Error at magnum/src/Magnum/Platform/CMakeLists.txt:163 (message):
SDL2 library, required by Sdl2Application, was not found. Set
WITH_SDL2APPLICATION to OFF to skip building it.
-- Configuring incomplete, errors occurred!

The guide doesn't mention where to get SDL2 from or how to include it in the project - I downloaded SDL2, but it didn't come with a CMakeLists.txt file so I'm not sure how to include it? I understand that FindSDL2.cmake is meant to find SDL2, but I'm not sure where to put it so it can find it?

Unable to build on VS2019

I've been trying to build a minimal program (branch: base) using these instructions
https://github.com/mosra/magnum-bootstrap
https://doc.magnum.graphics/magnum/getting-started.html
but gotten stuck on errors posted below:

image

This one goes away after removing constexpr qualifier. (should this be ignored?)

image

I've tracked down the issue to MagnumGL project failing to build but still couldn't pinpoint the exact problem. What did I miss?

environment:
windows,
VS2019
clang (v142) (LLVM 8.0)
Debug, x64
cmake setting:
WITH_SDL2APPLICATION=ON
set(CMAKE_CXX_STANDARD 17)

Corrade, magnum were installed as submodule.
both checked out @ tag 2019.01

Build Output Directories

Currently the build output is scattered deep into the project tree which makes it difficult for new users and/or to setup a new project.

BootStrap\magnum\src\Magnum\Release
BootStrap\corrade\src\Corrade\Utility\Release
BootStrap\corrade\src\Corrade\PluginManager\Release

As you know, those directories contain the .lib and .dll files required for the bootstrap "MyApplication". As a new user finding these files proved a bit difficult. As projects grow in size, requiring more features, the complexity of setting up your project increases.

Could you consider making bootstrap generate project files to dump the build output into a unified folder?

BootStrap\build\bin
BootStrap\build\lib

This allows users to set their projects up to use these directories then when more features are required just build them and copy over the .dll; No need to add more paths to the project and dig through folders for the output.

Thank you for your time and dedication to this project!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.