From df26073620cf85fd716ccc897648ca333b12f827 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 10 May 2014 17:29:49 +0200 Subject: [PATCH] Enabled other utilities on Windows. --- CMakeLists.txt | 4 ++-- doc/building.dox | 2 +- src/Magnum/Text/CMakeLists.txt | 14 +++++++++----- src/Magnum/Text/fontconverter.cpp | 9 ++++++++- src/Magnum/TextureTools/CMakeLists.txt | 14 +++++++++----- src/Magnum/TextureTools/distancefieldconverter.cpp | 9 ++++++++- 6 files changed, 37 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a3f06d528..bd221393c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,8 +80,8 @@ if((CORRADE_TARGET_UNIX AND NOT APPLE) OR CORRADE_TARGET_NACL OR CORRADE_TARGET_ option(WITH_MAGNUMINFO "Build magnum-info utility" OFF) endif() -# Utilities (currently depending on WindowlessGlxApplication) -if(CORRADE_TARGET_UNIX AND NOT APPLE) +# Utilities (currently only using GLX or WGL) +if((CORRADE_TARGET_UNIX AND NOT APPLE) OR CORRADE_TARGET_WINDOWS) cmake_dependent_option(WITH_FONTCONVERTER "Build magnum-fontconverter utility" OFF "NOT TARGET_GLES" OFF) cmake_dependent_option(WITH_DISTANCEFIELDCONVERTER "Build magnum-distancefieldconverter utility" OFF "NOT TARGET_GLES" OFF) endif() diff --git a/doc/building.dox b/doc/building.dox index 3f07a5501..1bcf0c0a8 100644 --- a/doc/building.dox +++ b/doc/building.dox @@ -204,7 +204,7 @@ platform best: - `WITH_WINDOWLESSWGLAPPLICATION` - @ref Platform::WindowlessWglApplication "WindowlessWglApplication" There are also a few command-line utilities. They are currently available only -on Linux and are disabled by default: +on Linux and Windows, also disabled by default: - `WITH_MAGNUMINFO` - `magnum-info` executable, provides information about the engine and OpenGL capabilities. diff --git a/src/Magnum/Text/CMakeLists.txt b/src/Magnum/Text/CMakeLists.txt index c742bd3f8..418e4999b 100644 --- a/src/Magnum/Text/CMakeLists.txt +++ b/src/Magnum/Text/CMakeLists.txt @@ -60,17 +60,21 @@ install(TARGETS MagnumText install(FILES ${MagnumText_HEADERS} DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/Text) if(WITH_FONTCONVERTER) - if(NOT UNIX OR TARGET_GLES) - message(FATAL_ERROR "magnum-fontconverter is not available on this platform. Set WITH_FONTCONVERTER to OFF to suppress this warning.") - endif() - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/configure.h) include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) add_executable(magnum-fontconverter fontconverter.cpp) - target_link_libraries(magnum-fontconverter MagnumText Magnum MagnumWindowlessGlxApplication ${X11_LIBRARIES}) + + if(UNIX AND NOT TARGET_GLES) + target_link_libraries(magnum-fontconverter MagnumText Magnum MagnumWindowlessGlxApplication ${X11_LIBRARIES}) + elseif(WIN32) + target_link_libraries(magnum-fontconverter MagnumText Magnum MagnumWindowlessWglApplication) + else() + message(FATAL_ERROR "magnum-fontconverter is not available on this platform. Set WITH_FONTCONVERTER to OFF to suppress this warning.") + endif() + install(TARGETS magnum-fontconverter DESTINATION ${MAGNUM_BINARY_INSTALL_DIR}) endif() diff --git a/src/Magnum/Text/fontconverter.cpp b/src/Magnum/Text/fontconverter.cpp index df510b7aa..4f2b04db1 100644 --- a/src/Magnum/Text/fontconverter.cpp +++ b/src/Magnum/Text/fontconverter.cpp @@ -27,12 +27,19 @@ #include #include -#include "Magnum/Platform/WindowlessGlxApplication.h" #include "Magnum/Text/AbstractFont.h" #include "Magnum/Text/AbstractFontConverter.h" #include "Magnum/Text/DistanceFieldGlyphCache.h" #include "Magnum/Trade/AbstractImageConverter.h" +#ifdef CORRADE_TARGET_UNIX +#include "Magnum/Platform/WindowlessGlxApplication.h" +#elif defined(CORRADE_TARGET_WINDOWS) +#include "Magnum/Platform/WindowlessWglApplication.h" +#else +#error No windowless application available on this platform +#endif + #include "configure.h" namespace Magnum { namespace Text { diff --git a/src/Magnum/TextureTools/CMakeLists.txt b/src/Magnum/TextureTools/CMakeLists.txt index 19e06bb5c..e1e2b9318 100644 --- a/src/Magnum/TextureTools/CMakeLists.txt +++ b/src/Magnum/TextureTools/CMakeLists.txt @@ -49,17 +49,21 @@ endif() target_link_libraries(MagnumTextureTools Magnum) if(WITH_DISTANCEFIELDCONVERTER) - if(NOT UNIX OR TARGET_GLES) - message(FATAL_ERROR "magnum-distancefieldconverter is not available on this platform. Set WITH_DISTANCEFIELDCONVERTER to OFF to suppress this warning.") - endif() - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/distancefieldconverterConfigure.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/distancefieldconverterConfigure.h) include_directories(${CMAKE_CURRENT_BINARY_DIR}) add_executable(magnum-distancefieldconverter distancefieldconverter.cpp) - target_link_libraries(magnum-distancefieldconverter MagnumTextureTools Magnum MagnumWindowlessGlxApplication ${X11_LIBRARIES}) + + if(UNIX AND NOT TARGET_GLES) + target_link_libraries(magnum-distancefieldconverter MagnumTextureTools Magnum MagnumWindowlessGlxApplication ${X11_LIBRARIES}) + elseif(WIN32) + target_link_libraries(magnum-distancefieldconverter MagnumTextureTools MagnumWindowlessWglApplication Magnum) + else() + message(FATAL_ERROR "magnum-distancefieldconverter is not available on this platform. Set WITH_DISTANCEFIELDCONVERTER to OFF to suppress this warning.") + endif() + install(TARGETS magnum-distancefieldconverter DESTINATION ${MAGNUM_BINARY_INSTALL_DIR}) endif() diff --git a/src/Magnum/TextureTools/distancefieldconverter.cpp b/src/Magnum/TextureTools/distancefieldconverter.cpp index 3787e7a77..d53f316ee 100644 --- a/src/Magnum/TextureTools/distancefieldconverter.cpp +++ b/src/Magnum/TextureTools/distancefieldconverter.cpp @@ -32,12 +32,19 @@ #include "Magnum/Renderer.h" #include "Magnum/Texture.h" #include "Magnum/TextureFormat.h" -#include "Magnum/Platform/WindowlessGlxApplication.h" #include "Magnum/TextureTools/DistanceField.h" #include "Magnum/Trade/AbstractImporter.h" #include "Magnum/Trade/AbstractImageConverter.h" #include "Magnum/Trade/ImageData.h" +#ifdef CORRADE_TARGET_UNIX +#include "Magnum/Platform/WindowlessGlxApplication.h" +#elif defined(CORRADE_TARGET_WINDOWS) +#include "Magnum/Platform/WindowlessWglApplication.h" +#else +#error No windowless application available on this platform +#endif + #include "distancefieldconverterConfigure.h" namespace Magnum { namespace TextureTools {