Browse Source

CMake: copy SDL / GLFW DLLs to CMAKE_RUNTIME_OUTPUT_DIRECTORY.

Shall make Windows users' life a bit less painful.
findsdl-include-root
Vladimír Vondruš 7 years ago
parent
commit
ef1fbd8e4b
  1. 7
      doc/changelog.dox
  2. 30
      src/Magnum/Platform/CMakeLists.txt

7
doc/changelog.dox

@ -532,6 +532,13 @@ See also:
- `FindSDL2.cmake` was updated to work with MinGW version 2.0.5 and newer,
since these dropped the old directory hierarchy. Older versions have both
the original and the new hierarchy, so it should work with these as well.
- When using Magnum as a CMake subproject, @ref Platform::GlfwApplication and
@ref Platform::Sdl2Application now copy the GLFW / SDL2 DLLs to
`CMAKE_RUNTIME_OUTPUT_DIRECTORY` (if set) as a post-build step. The DLL
location, if found, is also available through `GLFW_DLL` and
`SDL2_DLL_RELEASE` / `SDL2_DLL_DEBUG` variables for use by 3rd party code.
See also [mosra/magnum#347](https://github.com/mosra/magnum/pull/347) for
more information.
- Updated *extremely* outdated Emscripten boilerplate from the
[base-emscripten bootstrap project](https://github.com/mosra/magnum-bootstrap/tree/base-emscripten)
(the HTML markup was unchanged since 2013, heh)

30
src/Magnum/Platform/CMakeLists.txt

@ -268,6 +268,21 @@ if(WITH_GLFWAPPLICATION)
LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}
ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
# Copy the GLFW DLL next to the place where all executables are stored to
# help people running the apps
if(CMAKE_RUNTIME_OUTPUT_DIRECTORY AND CORRADE_TARGET_WINDOWS AND (GLFW_DLL_DEBUG OR GLFW_DLL_RELEASE))
if(GLFW_DLL_DEBUG AND GLFW_DLL_RELEASE)
add_custom_command(TARGET MagnumGlfwApplication POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<$<CONFIG:Debug>:${GLFW_DLL_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${GLFW_DLL_RELEASE}> ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
elseif(GLFW_DLL_DEBUG)
add_custom_command(TARGET MagnumGlfwApplication POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${GLFW_DLL_DEBUG} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
else()
add_custom_command(TARGET MagnumGlfwApplication POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${GLFW_DLL_RELEASE} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
endif()
endif()
# Magnum GlfwApplication target alias for superprojects
add_library(Magnum::GlfwApplication ALIAS MagnumGlfwApplication)
endif()
@ -323,6 +338,21 @@ if(WITH_SDL2APPLICATION)
LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}
ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
# Copy the SDL2 DLL next to the place where all executables are stored to
# help people running the apps
if(CMAKE_RUNTIME_OUTPUT_DIRECTORY AND CORRADE_TARGET_WINDOWS AND (SDL2_DLL_DEBUG OR SDL2_DLL_RELEASE))
if(SDL2_DLL_DEBUG AND SDL2_DLL_RELEASE)
add_custom_command(TARGET MagnumSdl2Application POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<$<CONFIG:Debug>:${SDL2_DLL_DEBUG}>$<$<NOT:$<CONFIG:Debug>>,${SDL2_DLL_RELEASE}> ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
elseif(SDL2_DLL_DEBUG)
add_custom_command(TARGET MagnumSdl2Application POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SDL2_DLL_DEBUG} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
else()
add_custom_command(TARGET MagnumSdl2Application POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SDL2_DLL_RELEASE} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
endif()
endif()
# Magnum Sdl2Application target alias for superprojects
add_library(Magnum::Sdl2Application ALIAS MagnumSdl2Application)
endif()

Loading…
Cancel
Save