Browse Source

CMake: put all binaries into a dedicated location in the build dir.

This makes it possible to:

 - finally use Magnum as a CMake subproject on Windows and have your
   executables not fail to run with a "DLL missing" error (and the
   setting is put to cache so superprojects just implicitly make use of
   that)
 - run tests on Windows without having to install first
 - use dynamic plugins from a CMake subproject on any platform without
   having to install first or load them by filename --- and the plugin
   directory is now easily discovered as relative to
   libraryLocation() of the library implementing given plugin interface
findsdl-include-root
Vladimír Vondruš 7 years ago
parent
commit
3a243a04b2
  1. 31
      CMakeLists.txt
  2. 12
      doc/building.dox
  3. 49
      doc/cmake.dox
  4. 4
      package/archlinux/PKGBUILD-coverage
  5. 4
      package/ci/appveyor-desktop-gles.bat
  6. 4
      package/ci/appveyor-desktop-mingw.bat
  7. 4
      package/ci/appveyor-desktop-vulkan.bat
  8. 4
      package/ci/appveyor-desktop.bat
  9. 3
      package/ci/appveyor-rt.bat
  10. 4
      package/ci/travis-android-arm.sh
  11. 8
      package/ci/travis-desktop-gles.sh
  12. 3
      package/ci/travis-desktop-vulkan.sh
  13. 4
      package/ci/travis-desktop.sh
  14. 3
      package/ci/travis-emscripten.sh
  15. 3
      package/ci/travis-ios-simulator.sh
  16. 16
      src/Magnum/Audio/AbstractImporter.cpp
  17. 9
      src/Magnum/Audio/CMakeLists.txt
  18. 9
      src/Magnum/CMakeLists.txt
  19. 9
      src/Magnum/DebugTools/CMakeLists.txt
  20. 9
      src/Magnum/GL/CMakeLists.txt
  21. 9
      src/Magnum/MeshTools/CMakeLists.txt
  22. 9
      src/Magnum/SceneGraph/CMakeLists.txt
  23. 9
      src/Magnum/Shaders/CMakeLists.txt
  24. 24
      src/Magnum/Text/AbstractFont.cpp
  25. 16
      src/Magnum/Text/AbstractFontConverter.cpp
  26. 9
      src/Magnum/Text/CMakeLists.txt
  27. 24
      src/Magnum/Trade/AbstractImageConverter.cpp
  28. 24
      src/Magnum/Trade/AbstractImporter.cpp
  29. 9
      src/Magnum/Trade/CMakeLists.txt
  30. 9
      src/Magnum/Vk/CMakeLists.txt
  31. 4
      src/MagnumPlugins/AnyAudioImporter/CMakeLists.txt
  32. 4
      src/MagnumPlugins/AnyImageConverter/CMakeLists.txt
  33. 4
      src/MagnumPlugins/AnyImageImporter/CMakeLists.txt
  34. 4
      src/MagnumPlugins/AnySceneImporter/CMakeLists.txt
  35. 4
      src/MagnumPlugins/MagnumFont/CMakeLists.txt
  36. 4
      src/MagnumPlugins/MagnumFontConverter/CMakeLists.txt
  37. 4
      src/MagnumPlugins/ObjImporter/CMakeLists.txt
  38. 4
      src/MagnumPlugins/TgaImageConverter/CMakeLists.txt
  39. 4
      src/MagnumPlugins/TgaImporter/CMakeLists.txt
  40. 4
      src/MagnumPlugins/WavAudioImporter/CMakeLists.txt

31
CMakeLists.txt

@ -408,6 +408,37 @@ set(MAGNUM_PLUGINS_AUDIOIMPORTER_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/audio
set(MAGNUM_LIBRARY_VERSION 2.2)
set(MAGNUM_LIBRARY_SOVERSION 2)
# A single output location. After a decade of saying NO THIS IS A NON-SOLUTION
# TO A NON-PROBLEM I reconsidered my views and enabled this, because:
#
# - On Windows (which don't have RPATH), this makes test execution finally
# possible without having to install all the stuff first (including the
# test-only libs, which is ugh).
# - With CMake subprojects, this makes it finally possible to use dynamic
# plugins directly from the build dir (again without installing anything) ---
# all plugins are put into the same place, so PluginManager has a single
# place to look into; and thanks to the dynamic libraries being there as
# well, this location can be automagically detected as relative to
# Directory::libraryLocation().
# - Thanks to the $<CONFIG> being part of the output path, you are always sure
# you never accidentally mix up debug/release libraries when switching
# CMAKE_BUILD_TYPE in an existing build dir.
#
# The runtime location is set to CMAKE_BINARY_DIR and not PROJECT_BINARY_DIR
# because have one runtime location per CMake subproject would not solve much
# either. If the user already provides CMAKE_RUNTIME_OUTPUT_DIRECTORY (even
# empty), it's respected and nothing is being done.
#
# Explicitly using a generator expression to ensure plugins are added to e.g.
# <CONFIG>/lib/magnum/importers/ instead of lib/magnum/importers/<CONFIG>. Also
# adding this to cache, making superprojects pick that up implicitly as well,
# without forcing them to explicitly mirror this setting.
if(NOT DEFINED CMAKE_RUNTIME_OUTPUT_DIRECTORY)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/$<CONFIG>/bin CACHE PATH "" FORCE)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/$<CONFIG>/lib CACHE PATH "" FORCE)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/$<CONFIG>/lib CACHE PATH "" FORCE)
endif()
add_subdirectory(modules)
add_subdirectory(src)

12
doc/building.dox

@ -53,6 +53,11 @@ information. Additional functionality is provided separately in
@ref building-extras "Magnum Extras" and
@ref building-examples "Magnum Examples".
@section building-cmake-subproject Using Magnum as a CMake subproject
Magnum can be bundled into your project with the @cb{.cmake} add_subdirectory() @ce
CMake command. See @ref cmake-subproject for more information.
@section building-packages Prepared packages
The easiest way to install Magnum is to use one of the ready-made packages for
@ -707,9 +712,8 @@ using
ctest --output-on-failure
@endcode
in the build directory. On Windows the tests require the library to be
installed with DLLs accessible through @cb{.bat} %PATH% @ce. See the above
@ref building-windows "Windows documentation" for more information.
in the build directory. It's not needed to install anything anywhere to run the
tests.
The @ref Audio library has tests which require OpenAL to be able to create a
context. That is the case on most platforms, so they are enabled by default.
@ -1044,7 +1048,7 @@ through `PATH`.
If you set `CMAKE_INSTALL_PREFIX` to `/usr` subdirectory of the particular
Android platform sysroot, the package will get found automatically when
compiling subprojects. Gradle and other Android buildsystems expect
compiling depending projects. Gradle and other Android buildsystems expect
platform-independent includes and other files to be stored in a central
location, you can set `MAGNUM_INCLUDE_INSTALL_PREFIX` to `/usr` subdirectory of
the global NDK sysroot. Another option is to explicitly set `CMAKE_PREFIX_PATH`

49
doc/cmake.dox

@ -36,6 +36,8 @@ Magnum uses CMake as a primary build system for both building and integration
into your projects. The following guide explains how to use it. If you wish to
use a different buildsystem, see @ref custom-buildsystems instead.
@section cmake-installed Using Magnum that was externally built and installed
The main logic is in the [FindMagnum.cmake](https://github.com/mosra/magnum/blob/master/modules/FindMagnum.cmake)
module distributed with the engine in the `modules/` directory, you are
encouraged to copy it along with [FindCorrade.cmake](https://github.com/mosra/corrade/blob/master/modules/FindCorrade.cmake)
@ -44,6 +46,8 @@ into your project and add path to the files to `CMAKE_MODULE_PATH`:
@code{.cmake}
# Path where FindCorrade.cmake & FindMagnum.cmake can be found, adapt as needed
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/modules/" ${CMAKE_MODULE_PATH})
find_package(Magnum REQUIRED ...) # see below
@endcode
Otherwise, if CMake won't be able to find this file in predefined locations, it
@ -59,6 +63,51 @@ If you installed the library or its dependencies to non-standard location
directory to help CMake find it. You can enter more different dirs if you
separate them with semicolons.
@section cmake-subproject Using Magnum as a CMake subproject
A self-contained alternative to the above is adding Corrade and Magnum
repositories into your project (as a Git submodule, bundling a downloaded
archive etc.) and use @cb{.cmake} add_subdirectory() @ce. With that approach
you don't need to care about `FindCorrade.cmake` / `FindMagnum.cmake`, however
the usual tradeoffs when bundling code apply --- slower full rebuilds, IDEs
having more to parse etc.
@code{.cmake}
add_subdirectory(corrade EXCLUDE_FROM_ALL) # so only things you use are built
add_subdirectory(magnum EXCLUDE_FROM_ALL)
find_package(Magnum REQUIRED ...) # see below
@endcode
Note that the @cb{.cmake} find_package() @ce call is needed in both the
installed and the subproject case for a properly configured environment.
To simplify your project setup, the subproject globally configures
@m_class{m-doc-external} [CMAKE_RUNTIME_OUTPUT_DIRECTORY](https://cmake.org/cmake/help/latest/variable/CMAKE_RUNTIME_OUTPUT_DIRECTORY.html)
and friends to `<CONFIG>/bin` / `<CONFIG>/lib` directories inside your build
directory. This makes the subproject workflow easier when dynamically-loaded
plugins are involved; and on Windows it makes it possible to run built
executables without having to do a @cb{.sh} $PATH @ce setup for dependency
DLLs. If your project already configures `CMAKE_{RUNTIME,LIBRARY,ARCHIVE}_OUTPUT_DIRECTORY`,
those will get used instead (and you can also set your own output directories
* *after* the @cb{.cmake} add_subdirectory() @ce call, which will make Magnum
keep the above). If you want to disable this behavior altogether and keep
all executables and libraries in their implicit locations, set those variables
to an empty string (as opposed to nothing at all, which is the same as if the
variable is not set) --- Magnum will detect and respect that:
@code{.cmake}
# I'm happy with having binaries scattered around the build dir
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "")
add_subdirectory(corrade EXCLUDE_FROM_ALL)
add_subdirectory(magnum EXCLUDE_FROM_ALL)
@endcode
@section cmake-find-module Finding the package and its component
Basic usage is:
@code{.cmake}

4
package/archlinux/PKGBUILD-coverage

@ -65,8 +65,8 @@ check() {
MAGNUM_DISABLE_EXTENSIONS="GL_ARB_get_texture_sub_image" CORRADE_TEST_SKIP_BENCHMARKS=ON CORRADE_TEST_COLOR=ON ctest --output-on-failure -j5 -R GLTest || true
MAGNUM_DISABLE_EXTENSIONS="GL_ARB_vertex_array_object" CORRADE_TEST_SKIP_BENCHMARKS=ON CORRADE_TEST_COLOR=ON ctest --output-on-failure -j5 -R GLTest || true
MAGNUM_DISABLE_EXTENSIONS="GL_KHR_debug" CORRADE_TEST_SKIP_BENCHMARKS=ON CORRADE_TEST_COLOR=ON ctest --output-on-failure -j5 -R GLTest || true
./src/Magnum/Platform/magnum-gl-info --limits > /dev/null
./src/Magnum/Audio/magnum-al-info > /dev/null
./Debug/bin/magnum-al-info > /dev/null
./Debug/bin/magnum-gl-info --limits > /dev/null
rm -rf coverage
mkdir coverage

4
package/ci/appveyor-desktop-gles.bat

@ -49,8 +49,10 @@ cmake .. ^
-DBUILD_GL_TESTS=ON ^
-G Ninja || exit /b
cmake --build . || exit /b
cmake --build . --target install || exit /b
rem Test
set CORRADE_TEST_COLOR=ON
ctest -V -E GLTest || exit /b
rem Test install, after running the tests as for them it shouldn't be needed
cmake --build . --target install || exit /b

4
package/ci/appveyor-desktop-mingw.bat

@ -48,12 +48,14 @@ cmake .. ^
-DBUILD_GL_TESTS=ON ^
-G Ninja || exit /b
cmake --build . || exit /b
cmake --build . --target install || exit /b
rem Test
set CORRADE_TEST_COLOR=ON
ctest -V -E GLTest || exit /b
rem Test install, after running the tests as for them it shouldn't be needed
cmake --build . --target install || exit /b
rem Coverage upload
set PATH=C:\msys64\usr\bin;%PATH%
bash %APPVEYOR_BUILD_FOLDER%\package\ci\appveyor-lcov.sh || exit /b

4
package/ci/appveyor-desktop-vulkan.bat

@ -60,8 +60,10 @@ cmake .. ^
-DBUILD_GL_TESTS=OFF ^
-G Ninja || exit /b
cmake --build . || exit /b
cmake --build . --target install || exit /b
rem Test
set CORRADE_TEST_COLOR=ON
ctest -V -E GLTest || exit /b
rem Test install, after running the tests as for them it shouldn't be needed
cmake --build . --target install || exit /b

4
package/ci/appveyor-desktop.bat

@ -50,8 +50,10 @@ cmake .. ^
-DBUILD_STATIC=%BUILD_STATIC% ^
-G Ninja || exit /b
cmake --build . || exit /b
cmake --build . --target install || exit /b
rem Test
set CORRADE_TEST_COLOR=ON
ctest -V -E GLTest || exit /b
rem Test install, after running the tests as for them it shouldn't be needed
cmake --build . --target install || exit /b

3
package/ci/appveyor-rt.bat

@ -83,3 +83,6 @@ cmake .. ^
-DBUILD_STATIC=ON ^
-G "%GENERATOR%" -A x64 || exit /b
cmake --build . --config Release -- /m /v:m || exit /b
rem Test install, after running the tests as for them it shouldn't be needed
cmake --build . --config Release --target install || exit /b

4
package/ci/travis-android-arm.sh

@ -51,6 +51,7 @@ cmake .. \
-DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang \
-DCMAKE_ANDROID_STL_TYPE=c++_static \
-DCORRADE_RC_EXECUTABLE=$HOME/deps-native/bin/corrade-rc \
-DCMAKE_INSTALL_PREFIX=$HOME/deps \
-DCMAKE_PREFIX_PATH=$HOME/deps \
-DCMAKE_FIND_ROOT_PATH=$HOME/deps \
-DCMAKE_BUILD_TYPE=Release \
@ -81,3 +82,6 @@ echo no | android create avd --force -n test -t android-22 --abi armeabi-v7a
emulator -avd test -no-audio -no-window &
android-wait-for-emulator
CORRADE_TEST_COLOR=ON ctest -V -E GLTest
# Test install, after running the tests as for them it shouldn't be needed
ninja install

8
package/ci/travis-desktop-gles.sh

@ -20,6 +20,7 @@ cmake .. \
-DCMAKE_CXX_FLAGS="$CMAKE_CXX_FLAGS" \
-DCMAKE_PREFIX_PATH="$HOME/deps" \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_PREFIX=$HOME/deps \
-DEGL_LIBRARY=$HOME/swiftshader/libEGL.so \
-DOPENGLES2_LIBRARY=$HOME/swiftshader/libGLESv2.so \
-DOPENGLES3_LIBRARY=$HOME/swiftshader/libGLESv2.so \
@ -55,5 +56,8 @@ cmake .. \
ninja -j4
CORRADE_TEST_COLOR=ON ctest -V
if [ "$TARGET_GLES2" == "ON" ]; then CORRADE_TEST_COLOR=ON MAGNUM_DISABLE_EXTENSIONS="OES_vertex_array_object" ctest -V -R GLTest; fi
src/Magnum/Audio/magnum-al-info > /dev/null
src/Magnum/Platform/magnum-gl-info --limits > /dev/null
Debug/bin/magnum-al-info > /dev/null
Debug/bin/magnum-gl-info --limits > /dev/null
# Test install, after running the tests as for them it shouldn't be needed
ninja install

3
package/ci/travis-desktop-vulkan.sh

@ -65,3 +65,6 @@ cmake .. \
# Otherwise the job gets killed (probably because using too much memory)
ninja -j4
ASAN_OPTIONS="color=always" LSAN_OPTIONS="color=always suppressions=$TRAVIS_BUILD_DIR/package/ci/leaksanitizer.conf" CORRADE_TEST_COLOR=ON ctest -V -E GLTest
# Test install, after running the tests as for them it shouldn't be needed
ninja install

4
package/ci/travis-desktop.sh

@ -54,8 +54,10 @@ cmake .. \
ninja -j4
ASAN_OPTIONS="color=always" LSAN_OPTIONS="color=always suppressions=$TRAVIS_BUILD_DIR/package/ci/leaksanitizer.conf" CORRADE_TEST_COLOR=ON ctest -V -E GLTest
# Verify also compilation of the documentation image generators
# Test install, after running the tests as for them it shouldn't be needed
ninja install
# Verify also compilation of the documentation image generators
cd ..
mkdir build-doc-generated && cd build-doc-generated
cmake ../doc/generated \

3
package/ci/travis-emscripten.sh

@ -75,3 +75,6 @@ ninja -j4
# Test
CORRADE_TEST_COLOR=ON ctest -V -E "(GL|AL)Test"
# Test install, after running the tests as for them it shouldn't be needed
ninja install

3
package/ci/travis-ios-simulator.sh

@ -69,3 +69,6 @@ set -o pipefail && cmake --build . --config Release | xcpretty
# Library not loaded: /System/Library/Frameworks/OpenGLES.framework/OpenGLES
# error
DYLD_FALLBACK_LIBRARY_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/OpenGLES.framework/ DYLD_FALLBACK_FRAMEWORK_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks CORRADE_TEST_COLOR=ON ctest -V -C Release -E GLTest
# Test install, after running the tests as for them it shouldn't be needed
set -o pipefail && cmake --build . --config Release --target install | xcpretty

16
src/Magnum/Audio/AbstractImporter.cpp

@ -45,23 +45,15 @@ std::string AbstractImporter::pluginInterface() {
std::vector<std::string> AbstractImporter::pluginSearchPaths() {
return {
#ifdef CORRADE_IS_DEBUG_BUILD
#if defined(CORRADE_TARGET_WINDOWS) && !defined(MAGNUM_BUILD_STATIC)
Utility::Directory::join(Utility::Directory::path(Utility::Directory::dllLocation(
#ifdef __MINGW32__
"lib"
#endif
"MagnumAudio-d")), "magnum-d/audioimporters"),
#ifndef MAGNUM_BUILD_STATIC
Utility::Directory::join(Utility::Directory::path(Utility::Directory::libraryLocation(&pluginInterface)), "magnum-d/audioimporters"),
#else
"magnum-d/audioimporters",
#endif
Utility::Directory::join(MAGNUM_PLUGINS_DEBUG_DIR, "audioimporters")
#else
#if defined(CORRADE_TARGET_WINDOWS) && !defined(MAGNUM_BUILD_STATIC)
Utility::Directory::join(Utility::Directory::path(Utility::Directory::dllLocation(
#ifdef __MINGW32__
"lib"
#endif
"MagnumAudio")), "magnum/audioimporters"),
#ifndef MAGNUM_BUILD_STATIC
Utility::Directory::join(Utility::Directory::path(Utility::Directory::libraryLocation(&pluginInterface)), "magnum/audioimporters"),
#else
"magnum/audioimporters",
#endif

9
src/Magnum/Audio/CMakeLists.txt

@ -162,14 +162,5 @@ if(BUILD_TESTS)
target_link_libraries(MagnumAudioTestLib MagnumSceneGraph)
endif()
# On Windows we need to install first and then run the tests to avoid "DLL
# not found" hell, thus we need to install this too
if(CORRADE_TARGET_WINDOWS AND NOT CMAKE_CROSSCOMPILING AND NOT BUILD_STATIC)
install(TARGETS MagnumAudioTestLib
RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR}
LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}
ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
endif()
add_subdirectory(Test)
endif()

9
src/Magnum/CMakeLists.txt

@ -212,15 +212,6 @@ if(BUILD_TESTS)
endif()
target_link_libraries(MagnumTestLib PUBLIC Corrade::Utility)
# On Windows we need to install first and then run the tests to avoid "DLL
# not found" hell, thus we need to install this too
if(CORRADE_TARGET_WINDOWS AND NOT CMAKE_CROSSCOMPILING AND NOT BUILD_STATIC)
install(TARGETS MagnumMathTestLib MagnumTestLib
RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR}
LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}
ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
endif()
add_subdirectory(Test)
endif()

9
src/Magnum/DebugTools/CMakeLists.txt

@ -167,15 +167,6 @@ if(BUILD_TESTS)
endif()
endif()
# On Windows we need to install first and then run the tests to avoid "DLL
# not found" hell, thus we need to install this too
if(CORRADE_TARGET_WINDOWS AND NOT CMAKE_CROSSCOMPILING AND NOT BUILD_STATIC)
install(TARGETS MagnumDebugToolsTestLib
RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR}
LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}
ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
endif()
add_subdirectory(Test)
endif()

9
src/Magnum/GL/CMakeLists.txt

@ -317,15 +317,6 @@ if(BUILD_TESTS)
target_link_libraries(MagnumGLTestLib PUBLIC OpenGLES3::OpenGLES3)
endif()
# On Windows we need to install first and then run the tests to avoid "DLL
# not found" hell, thus we need to install this too
if(CORRADE_TARGET_WINDOWS AND NOT CMAKE_CROSSCOMPILING AND NOT BUILD_STATIC)
install(TARGETS MagnumGLTestLib
RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR}
LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}
ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
endif()
if(BUILD_GL_TESTS)
add_library(MagnumOpenGLTesterTestLib STATIC
$<TARGET_OBJECTS:MagnumOpenGLTesterObjects>

9
src/Magnum/MeshTools/CMakeLists.txt

@ -121,15 +121,6 @@ if(BUILD_TESTS)
target_link_libraries(MagnumMeshToolsTestLib PUBLIC MagnumGL MagnumTrade)
endif()
# On Windows we need to install first and then run the tests to avoid "DLL
# not found" hell, thus we need to install this too
if(CORRADE_TARGET_WINDOWS AND NOT CMAKE_CROSSCOMPILING AND NOT BUILD_STATIC)
install(TARGETS MagnumMeshToolsTestLib
RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR}
LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}
ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
endif()
add_subdirectory(Test)
endif()

9
src/Magnum/SceneGraph/CMakeLists.txt

@ -112,15 +112,6 @@ if(BUILD_TESTS)
"CORRADE_GRACEFUL_ASSERT" "MagnumSceneGraph_EXPORTS")
target_link_libraries(MagnumSceneGraphTestLib MagnumMathTestLib)
# On Windows we need to install first and then run the tests to avoid "DLL
# not found" hell, thus we need to install this too
if(CORRADE_TARGET_WINDOWS AND NOT CMAKE_CROSSCOMPILING AND NOT BUILD_STATIC)
install(TARGETS MagnumSceneGraphTestLib
RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR}
LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}
ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
endif()
add_subdirectory(Test)
endif()

9
src/Magnum/Shaders/CMakeLists.txt

@ -113,15 +113,6 @@ if(BUILD_TESTS)
Magnum
MagnumGL)
# On Windows we need to install first and then run the tests to avoid "DLL
# not found" hell, thus we need to install this too
if(CORRADE_TARGET_WINDOWS AND NOT CMAKE_CROSSCOMPILING AND NOT BUILD_STATIC)
install(TARGETS MagnumShadersTestLib
RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR}
LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}
ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
endif()
add_subdirectory(Test)
endif()

24
src/Magnum/Text/AbstractFont.cpp

@ -50,24 +50,24 @@ std::string AbstractFont::pluginInterface() {
std::vector<std::string> AbstractFont::pluginSearchPaths() {
return {
#ifdef CORRADE_IS_DEBUG_BUILD
#if defined(CORRADE_TARGET_WINDOWS) && !defined(MAGNUM_BUILD_STATIC)
Utility::Directory::join(Utility::Directory::path(Utility::Directory::dllLocation(
#ifdef __MINGW32__
"lib"
#endif
"MagnumText-d")), "magnum-d/fonts"),
#ifndef MAGNUM_BUILD_STATIC
Utility::Directory::join(Utility::Directory::path(Utility::Directory::libraryLocation(&pluginInterface)), "magnum-d/fonts"),
#else
#ifndef MAGNUM_TARGET_WINDOWS
/* On Windows, the plugin DLLs are next to the executable, so the one
below works. Elsewhere the plugins are in the lib dir instead */
"../lib/magnum-d/fonts",
#endif
"magnum-d/fonts",
#endif
Utility::Directory::join(MAGNUM_PLUGINS_DEBUG_DIR, "fonts")
#else
#if defined(CORRADE_TARGET_WINDOWS) && !defined(MAGNUM_BUILD_STATIC)
Utility::Directory::join(Utility::Directory::path(Utility::Directory::dllLocation(
#ifdef __MINGW32__
"lib"
#endif
"MagnumText")), "magnum/fonts"),
#ifndef MAGNUM_BUILD_STATIC
Utility::Directory::join(Utility::Directory::path(Utility::Directory::libraryLocation(&pluginInterface)), "magnum/fonts"),
#else
#ifndef MAGNUM_TARGET_WINDOWS
"../lib/magnum/fonts",
#endif
"magnum/fonts",
#endif
Utility::Directory::join(MAGNUM_PLUGINS_DIR, "fonts")

16
src/Magnum/Text/AbstractFontConverter.cpp

@ -64,23 +64,15 @@ std::string AbstractFontConverter::pluginInterface() {
std::vector<std::string> AbstractFontConverter::pluginSearchPaths() {
return {
#ifdef CORRADE_IS_DEBUG_BUILD
#if defined(CORRADE_TARGET_WINDOWS) && !defined(MAGNUM_BUILD_STATIC)
Utility::Directory::join(Utility::Directory::path(Utility::Directory::dllLocation(
#ifdef __MINGW32__
"lib"
#endif
"MagnumText-d")), "magnum-d/fontconverters"),
#ifndef MAGNUM_BUILD_STATIC
Utility::Directory::join(Utility::Directory::path(Utility::Directory::libraryLocation(&pluginInterface)), "magnum-d/fontconverters"),
#else
"magnum-d/fontconverters",
#endif
Utility::Directory::join(MAGNUM_PLUGINS_DEBUG_DIR, "fontconverters")
#else
#if defined(CORRADE_TARGET_WINDOWS) && !defined(MAGNUM_BUILD_STATIC)
Utility::Directory::join(Utility::Directory::path(Utility::Directory::dllLocation(
#ifdef __MINGW32__
"lib"
#endif
"MagnumText")), "magnum/fontconverters"),
#ifndef MAGNUM_BUILD_STATIC
Utility::Directory::join(Utility::Directory::path(Utility::Directory::libraryLocation(&pluginInterface)), "magnum/fontconverters"),
#else
"magnum/fontconverters",
#endif

9
src/Magnum/Text/CMakeLists.txt

@ -163,15 +163,6 @@ if(BUILD_TESTS)
target_link_libraries(MagnumText PUBLIC MagnumGL)
endif()
# On Windows we need to install first and then run the tests to avoid "DLL
# not found" hell, thus we need to install this too
if(CORRADE_TARGET_WINDOWS AND NOT CMAKE_CROSSCOMPILING AND NOT BUILD_STATIC)
install(TARGETS MagnumTextTestLib
RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR}
LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}
ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
endif()
add_subdirectory(Test)
endif()

24
src/Magnum/Trade/AbstractImageConverter.cpp

@ -50,24 +50,24 @@ std::string AbstractImageConverter::pluginInterface() {
std::vector<std::string> AbstractImageConverter::pluginSearchPaths() {
return {
#ifdef CORRADE_IS_DEBUG_BUILD
#if defined(CORRADE_TARGET_WINDOWS) && !defined(MAGNUM_BUILD_STATIC)
Utility::Directory::join(Utility::Directory::path(Utility::Directory::dllLocation(
#ifdef __MINGW32__
"lib"
#endif
"MagnumTrade-d")), "magnum-d/imageconverters"),
#ifndef MAGNUM_BUILD_STATIC
Utility::Directory::join(Utility::Directory::path(Utility::Directory::libraryLocation(&pluginInterface)), "magnum-d/imageconverters"),
#else
#ifndef MAGNUM_TARGET_WINDOWS
/* On Windows, the plugin DLLs are next to the executable, so the one
below works. Elsewhere the plugins are in the lib dir instead */
"../lib/magnum-d/imageconverters",
#endif
"magnum-d/imageconverters",
#endif
Utility::Directory::join(MAGNUM_PLUGINS_DEBUG_DIR, "imageconverters")
#else
#if defined(CORRADE_TARGET_WINDOWS) && !defined(MAGNUM_BUILD_STATIC)
Utility::Directory::join(Utility::Directory::path(Utility::Directory::dllLocation(
#ifdef __MINGW32__
"lib"
#endif
"MagnumTrade")), "magnum/imageconverters"),
#ifndef MAGNUM_BUILD_STATIC
Utility::Directory::join(Utility::Directory::path(Utility::Directory::libraryLocation(&pluginInterface)), "magnum/imageconverters"),
#else
#ifndef MAGNUM_TARGET_WINDOWS
"../lib/magnum/imageconverters",
#endif
"magnum/imageconverters",
#endif
Utility::Directory::join(MAGNUM_PLUGINS_DIR, "imageconverters")

24
src/Magnum/Trade/AbstractImporter.cpp

@ -59,26 +59,26 @@ std::string AbstractImporter::pluginInterface() {
std::vector<std::string> AbstractImporter::pluginSearchPaths() {
return {
#ifdef CORRADE_IS_DEBUG_BUILD
#if defined(CORRADE_TARGET_WINDOWS) && !defined(MAGNUM_BUILD_STATIC)
Utility::Directory::join(Utility::Directory::path(Utility::Directory::dllLocation(
#ifdef __MINGW32__
"lib"
#endif
"MagnumTrade-d")), "magnum-d/importers"),
#ifndef MAGNUM_BUILD_STATIC
Utility::Directory::join(Utility::Directory::path(Utility::Directory::libraryLocation(&pluginInterface)), "magnum-d/importers"),
#else
#ifndef MAGNUM_TARGET_WINDOWS
/* On Windows, the plugin DLLs are next to the executable, so the one
below works. Elsewhere the plugins are in the lib dir instead */
"../lib/magnum-d/importers",
#endif
"magnum-d/importers",
#endif
Utility::Directory::join(MAGNUM_PLUGINS_DEBUG_DIR, "importers")
#ifdef CORRADE_TARGET_WINDOWS
#endif
#else
#if defined(CORRADE_TARGET_WINDOWS) && !defined(MAGNUM_BUILD_STATIC)
Utility::Directory::join(Utility::Directory::path(Utility::Directory::dllLocation(
#ifdef __MINGW32__
"lib"
#endif
"MagnumTrade")), "magnum/importers"),
#ifndef MAGNUM_BUILD_STATIC
Utility::Directory::join(Utility::Directory::path(Utility::Directory::libraryLocation(&pluginInterface)), "magnum/importers"),
#else
#ifndef MAGNUM_TARGET_WINDOWS
"../lib/magnum/importers",
#endif
"magnum/importers",
#endif
Utility::Directory::join(MAGNUM_PLUGINS_DIR, "importers")

9
src/Magnum/Trade/CMakeLists.txt

@ -138,15 +138,6 @@ if(BUILD_TESTS)
Magnum
Corrade::PluginManager)
# On Windows we need to install first and then run the tests to avoid "DLL
# not found" hell, thus we need to install this too
if(CORRADE_TARGET_WINDOWS AND NOT CMAKE_CROSSCOMPILING AND NOT BUILD_STATIC)
install(TARGETS MagnumTradeTestLib
RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR}
LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}
ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
endif()
add_subdirectory(Test)
endif()

9
src/Magnum/Vk/CMakeLists.txt

@ -104,15 +104,6 @@ if(BUILD_TESTS)
Magnum
Vulkan::Vulkan)
# On Windows we need to install first and then run the tests to avoid "DLL
# not found" hell, thus we need to install this too
if(CORRADE_TARGET_WINDOWS AND NOT CMAKE_CROSSCOMPILING AND NOT BUILD_STATIC)
install(TARGETS MagnumVkTestLib
RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR}
LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}
ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
endif()
add_subdirectory(Test)
endif()

4
src/MagnumPlugins/AnyAudioImporter/CMakeLists.txt

@ -43,6 +43,10 @@ if(BUILD_PLUGINS_STATIC AND BUILD_STATIC_PIC)
set_target_properties(AnyAudioImporter PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
target_link_libraries(AnyAudioImporter PUBLIC Magnum MagnumAudio)
set_target_properties(AnyAudioImporter PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/magnum$<$<CONFIG:Debug>:-d>/audioimporters
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/magnum$<$<CONFIG:Debug>:-d>/audioimporters
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/magnum$<$<CONFIG:Debug>:-d>/audioimporters)
install(FILES AnyImporter.h ${CMAKE_CURRENT_BINARY_DIR}/configure.h
DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/AnyAudioImporter)

4
src/MagnumPlugins/AnyImageConverter/CMakeLists.txt

@ -43,6 +43,10 @@ if(BUILD_PLUGINS_STATIC AND BUILD_STATIC_PIC)
set_target_properties(AnyImageConverter PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
target_link_libraries(AnyImageConverter PUBLIC MagnumTrade)
set_target_properties(AnyImageConverter PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/magnum$<$<CONFIG:Debug>:-d>/imageconverters
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/magnum$<$<CONFIG:Debug>:-d>/imageconverters
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/magnum$<$<CONFIG:Debug>:-d>/imageconverters)
install(FILES AnyImageConverter.h ${CMAKE_CURRENT_BINARY_DIR}/configure.h
DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/AnyImageConverter)

4
src/MagnumPlugins/AnyImageImporter/CMakeLists.txt

@ -43,6 +43,10 @@ if(BUILD_PLUGINS_STATIC AND BUILD_STATIC_PIC)
set_target_properties(AnyImageImporter PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
target_link_libraries(AnyImageImporter PUBLIC MagnumTrade)
set_target_properties(AnyImageImporter PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/magnum$<$<CONFIG:Debug>:-d>/importers
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/magnum$<$<CONFIG:Debug>:-d>/importers
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/magnum$<$<CONFIG:Debug>:-d>/importers)
install(FILES AnyImageImporter.h ${CMAKE_CURRENT_BINARY_DIR}/configure.h
DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/AnyImageImporter)

4
src/MagnumPlugins/AnySceneImporter/CMakeLists.txt

@ -43,6 +43,10 @@ if(BUILD_PLUGINS_STATIC AND BUILD_STATIC_PIC)
set_target_properties(AnySceneImporter PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
target_link_libraries(AnySceneImporter PUBLIC MagnumTrade)
set_target_properties(AnySceneImporter PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/magnum$<$<CONFIG:Debug>:-d>/importers
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/magnum$<$<CONFIG:Debug>:-d>/importers
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/magnum$<$<CONFIG:Debug>:-d>/importers)
install(FILES AnySceneImporter.h ${CMAKE_CURRENT_BINARY_DIR}/configure.h
DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/AnySceneImporter)

4
src/MagnumPlugins/MagnumFont/CMakeLists.txt

@ -52,6 +52,10 @@ target_link_libraries(MagnumFont PUBLIC Magnum MagnumText MagnumTrade)
if(CORRADE_TARGET_WINDOWS)
target_link_libraries(MagnumFont PUBLIC TgaImporter)
endif()
set_target_properties(MagnumFont PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/magnum$<$<CONFIG:Debug>:-d>/fonts
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/magnum$<$<CONFIG:Debug>:-d>/fonts
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/magnum$<$<CONFIG:Debug>:-d>/fonts)
install(FILES MagnumFont.h ${CMAKE_CURRENT_BINARY_DIR}/configure.h
DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/MagnumFont)

4
src/MagnumPlugins/MagnumFontConverter/CMakeLists.txt

@ -46,6 +46,10 @@ target_link_libraries(MagnumFontConverter PUBLIC Magnum MagnumText MagnumTrade)
if(CORRADE_TARGET_WINDOWS)
target_link_libraries(MagnumFontConverter PUBLIC TgaImageConverter)
endif()
set_target_properties(MagnumFontConverter PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/magnum$<$<CONFIG:Debug>:-d>/fontconverters
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/magnum$<$<CONFIG:Debug>:-d>/fontconverters
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/magnum$<$<CONFIG:Debug>:-d>/fontconverters)
install(FILES MagnumFontConverter.h ${CMAKE_CURRENT_BINARY_DIR}/configure.h
DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/MagnumFontConverter)

4
src/MagnumPlugins/ObjImporter/CMakeLists.txt

@ -43,6 +43,10 @@ if(BUILD_PLUGINS_STATIC AND BUILD_STATIC_PIC)
set_target_properties(ObjImporter PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
target_link_libraries(ObjImporter PUBLIC MagnumTrade MagnumMeshTools)
set_target_properties(ObjImporter PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/magnum$<$<CONFIG:Debug>:-d>/importers
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/magnum$<$<CONFIG:Debug>:-d>/importers
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/magnum$<$<CONFIG:Debug>:-d>/importers)
install(FILES ObjImporter.h ${CMAKE_CURRENT_BINARY_DIR}/configure.h
DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/ObjImporter)

4
src/MagnumPlugins/TgaImageConverter/CMakeLists.txt

@ -43,6 +43,10 @@ if(BUILD_PLUGINS_STATIC AND BUILD_STATIC_PIC)
set_target_properties(TgaImageConverter PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
target_link_libraries(TgaImageConverter PUBLIC MagnumTrade)
set_target_properties(TgaImageConverter PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/magnum$<$<CONFIG:Debug>:-d>/imageconverters
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/magnum$<$<CONFIG:Debug>:-d>/imageconverters
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/magnum$<$<CONFIG:Debug>:-d>/imageconverters)
install(FILES TgaImageConverter.h DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/TgaImageConverter)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/configure.h DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/TgaImageConverter)

4
src/MagnumPlugins/TgaImporter/CMakeLists.txt

@ -44,6 +44,10 @@ if(BUILD_PLUGINS_STATIC AND BUILD_STATIC_PIC)
set_target_properties(TgaImporter PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
target_link_libraries(TgaImporter PUBLIC MagnumTrade)
set_target_properties(TgaImporter PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/magnum$<$<CONFIG:Debug>:-d>/importers
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/magnum$<$<CONFIG:Debug>:-d>/importers
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/magnum$<$<CONFIG:Debug>:-d>/importers)
install(FILES TgaImporter.h ${CMAKE_CURRENT_BINARY_DIR}/configure.h
DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/TgaImporter)

4
src/MagnumPlugins/WavAudioImporter/CMakeLists.txt

@ -59,6 +59,10 @@ if(BUILD_PLUGINS_STATIC AND BUILD_STATIC_PIC)
set_target_properties(WavAudioImporter PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
target_link_libraries(WavAudioImporter PUBLIC Magnum MagnumAudio)
set_target_properties(WavAudioImporter PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/magnum$<$<CONFIG:Debug>:-d>/audioimporters
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/magnum$<$<CONFIG:Debug>:-d>/audioimporters
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/magnum$<$<CONFIG:Debug>:-d>/audioimporters)
install(FILES WavImporter.h ${CMAKE_CURRENT_BINARY_DIR}/configure.h
DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/WavAudioImporter)

Loading…
Cancel
Save