diff --git a/CMakeLists.txt b/CMakeLists.txt index 6dbfe3073..c2c38630d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,8 +58,12 @@ if(CORRADE_TARGET_NACL) elseif(CORRADE_TARGET_ANDROID) option(WITH_ANDROIDAPPLICATION "Build AndroidApplication library" OFF) +# OS X-specific application libraries +elseif(CORRADE_TARGET_APPLE) + cmake_dependent_option(WITH_WINDOWLESSCGLAPPLICATION "Build WindowlessCglApplication library" OFF "NOT WITH_MAGNUMINFO;NOT WITH_FONTCONVERTER;NOT WITH_DISTANCEFIELDCONVERTER" ON) + # X11, GLX and EGL-specific application libraries -elseif(CORRADE_TARGET_UNIX AND NOT APPLE) +elseif(CORRADE_TARGET_UNIX) option(WITH_GLXAPPLICATION "Build GlxApplication library" OFF) cmake_dependent_option(WITH_WINDOWLESSGLXAPPLICATION "Build WindowlessGlxApplication library" OFF "NOT WITH_MAGNUMINFO;NOT WITH_FONTCONVERTER;NOT WITH_DISTANCEFIELDCONVERTER" ON) cmake_dependent_option(WITH_XEGLAPPLICATION "Build XEglApplication library" OFF "TARGET_GLES" OFF) @@ -67,10 +71,6 @@ elseif(CORRADE_TARGET_UNIX AND NOT APPLE) # Windows-specific application libraries elseif(CORRADE_TARGET_WINDOWS) cmake_dependent_option(WITH_WINDOWLESSWGLAPPLICATION "Build WindowlessWglApplication library" OFF "NOT WITH_MAGNUMINFO;NOT WITH_FONTCONVERTER;NOT WITH_DISTANCEFIELDCONVERTER" ON) - -# OS X-specific application libraries -elseif(APPLE) - cmake_dependent_option(WITH_WINDOWLESSCGLAPPLICATION "Build WindowlessCglApplication library" OFF "NOT WITH_MAGNUMINFO;NOT WITH_FONTCONVERTER;NOT WITH_DISTANCEFIELDCONVERTER" ON) endif() # Platform-independent (almost) application libraries diff --git a/modules/FindMagnum.cmake b/modules/FindMagnum.cmake index 559bc6247..22b5d029e 100644 --- a/modules/FindMagnum.cmake +++ b/modules/FindMagnum.cmake @@ -230,7 +230,7 @@ endif() # ${MAGNUM_LIBRARIES} listed in dependencies also after all other library names # to avoid linker errors. Applicaiton libraries are often last thus it is # +- sufficient to add it there only. -if(WIN32 OR MAGNUM_BUILD_STATIC) +if(CORRADE_TARGET_WINDOWS OR MAGNUM_BUILD_STATIC) set(_WINDOWCONTEXT_MAGNUM_LIBRARIES_DEPENDENCY ${MAGNUM_LIBRARIES}) endif() diff --git a/src/Magnum/Audio/Audio.cpp b/src/Magnum/Audio/Audio.cpp index 4eb4ebbcb..90e4ea522 100644 --- a/src/Magnum/Audio/Audio.cpp +++ b/src/Magnum/Audio/Audio.cpp @@ -33,7 +33,7 @@ namespace Magnum { namespace Audio { /* Verify types */ static_assert(std::is_same::value, "ALubyte is not the same as UnsignedByte"); /** @todo Why `ALbyte` is defined as `char` and not `signed char` on OSX? */ -#ifndef __APPLE__ +#ifndef CORRADE_TARGET_APPLE static_assert(std::is_same::value, "ALbyte is not the same as Byte"); #else static_assert(std::is_signed::value && sizeof(ALbyte) == 1, "ALbyte does not have the same characteristics as Byte"); diff --git a/src/Magnum/CMakeLists.txt b/src/Magnum/CMakeLists.txt index 765addc03..c3b0cf490 100644 --- a/src/Magnum/CMakeLists.txt +++ b/src/Magnum/CMakeLists.txt @@ -242,7 +242,7 @@ if(BUILD_TESTS) # 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(WIN32 AND NOT CMAKE_CROSSCOMPILING) + if(CORRADE_TARGET_WINDOWS AND NOT CMAKE_CROSSCOMPILING) install(TARGETS MagnumMathTestLib RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR} LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR} diff --git a/src/Magnum/MeshTools/CMakeLists.txt b/src/Magnum/MeshTools/CMakeLists.txt index 67f9a9a82..e700d6f0f 100644 --- a/src/Magnum/MeshTools/CMakeLists.txt +++ b/src/Magnum/MeshTools/CMakeLists.txt @@ -91,7 +91,7 @@ if(BUILD_TESTS) # 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(WIN32 AND NOT CMAKE_CROSSCOMPILING) + if(CORRADE_TARGET_WINDOWS AND NOT CMAKE_CROSSCOMPILING) install(TARGETS MagnumMeshToolsTestLib RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR} LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR} diff --git a/src/Magnum/Platform/CMakeLists.txt b/src/Magnum/Platform/CMakeLists.txt index e22996b88..09087aca0 100644 --- a/src/Magnum/Platform/CMakeLists.txt +++ b/src/Magnum/Platform/CMakeLists.txt @@ -232,14 +232,14 @@ endif() # Magnum Info if(WITH_MAGNUMINFO) add_executable(magnum-info magnum-info.cpp) - if(UNIX AND NOT CORRADE_TARGET_NACL AND NOT APPLE) - target_link_libraries(magnum-info MagnumWindowlessGlxApplication ${X11_LIBRARIES}) + if(CORRADE_TARGET_APPLE) + target_link_libraries(magnum-info MagnumWindowlessCglApplication) elseif(CORRADE_TARGET_NACL) target_link_libraries(magnum-info MagnumWindowlessNaClApplication ppapi_cpp ppapi) + elseif(CORRADE_TARGET_UNIX) + target_link_libraries(magnum-info MagnumWindowlessGlxApplication ${X11_LIBRARIES}) elseif(CORRADE_TARGET_WINDOWS) target_link_libraries(magnum-info MagnumWindowlessWglApplication) - elseif(APPLE) - target_link_libraries(magnum-info MagnumWindowlessCglApplication) else() message(FATAL_ERROR "magnum-info is not available on this platform. Set WITH_MAGNUMINFO to OFF to skip building it.") endif() diff --git a/src/Magnum/Platform/Sdl2Application.cpp b/src/Magnum/Platform/Sdl2Application.cpp index 7b7f91256..026ca4a76 100644 --- a/src/Magnum/Platform/Sdl2Application.cpp +++ b/src/Magnum/Platform/Sdl2Application.cpp @@ -143,7 +143,7 @@ bool Sdl2Application::tryCreateContext(const Configuration& configuration) { in Apple's GL drivers, thus we would be forever stuck on 2.1 without the new features. In practice SDL fails to create 2.1 context on recent OS X versions. */ - #elif defined(__APPLE__) + #elif defined(CORRADE_TARGET_APPLE) else { SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2); @@ -161,7 +161,7 @@ bool Sdl2Application::tryCreateContext(const Configuration& configuration) { } /* Fall back to GL 2.1, if 3.2 context creation fails on OS X */ - #ifdef __APPLE__ + #ifdef CORRADE_TARGET_APPLE if(!(context = SDL_GL_CreateContext(window))){ Warning() << "Platform::Sdl2Application::tryCreateContext(): cannot create core context:" << SDL_GetError() << "(falling back to compatibility context)"; SDL_DestroyWindow(window); diff --git a/src/Magnum/Platform/magnum-info.cpp b/src/Magnum/Platform/magnum-info.cpp index 94277c581..bc24d5ebe 100644 --- a/src/Magnum/Platform/magnum-info.cpp +++ b/src/Magnum/Platform/magnum-info.cpp @@ -52,7 +52,7 @@ #ifdef CORRADE_TARGET_NACL #include "Magnum/Platform/WindowlessNaClApplication.h" -#elif defined(__APPLE__) +#elif defined(CORRADE_TARGET_APPLE) #include "Magnum/Platform/WindowlessCglApplication.h" #elif defined(CORRADE_TARGET_UNIX) #include "Magnum/Platform/WindowlessGlxApplication.h" @@ -102,10 +102,14 @@ MagnumInfo::MagnumInfo(const Arguments& arguments): Platform::WindowlessApplicat #ifdef CORRADE_TARGET_NACL Debug() << "Used application: Platform::WindowlessNaClApplication"; - #elif defined(__APPLE__) + #elif defined(CORRADE_TARGET_APPLE) Debug() << "Used application: Platform::WindowlessCglApplication"; - #else + #elif defined(CORRADE_TARGET_UNIX) Debug() << "Used application: Platform::WindowlessGlxApplication"; + #elif defined(CORRADE_TARGET_WINDOWS) + Debug() << "Used application: Platform::WindowlessWglApplication"; + #else + #error No windowless application available on this platform #endif Debug() << "Compilation flags:"; #ifdef CORRADE_GCC47_COMPATIBILITY diff --git a/src/Magnum/SceneGraph/CMakeLists.txt b/src/Magnum/SceneGraph/CMakeLists.txt index 4b4c42b4b..f9166bec9 100644 --- a/src/Magnum/SceneGraph/CMakeLists.txt +++ b/src/Magnum/SceneGraph/CMakeLists.txt @@ -104,7 +104,7 @@ if(BUILD_TESTS) # 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(WIN32 AND NOT CMAKE_CROSSCOMPILING) + if(CORRADE_TARGET_WINDOWS AND NOT CMAKE_CROSSCOMPILING) install(TARGETS MagnumSceneGraphTestLib RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR} LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR} diff --git a/src/Magnum/Text/CMakeLists.txt b/src/Magnum/Text/CMakeLists.txt index d5082cc06..50e59a4a8 100644 --- a/src/Magnum/Text/CMakeLists.txt +++ b/src/Magnum/Text/CMakeLists.txt @@ -67,11 +67,11 @@ if(WITH_FONTCONVERTER) add_executable(magnum-fontconverter fontconverter.cpp) - if(APPLE) + if(CORRADE_TARGET_APPLE) target_link_libraries(magnum-fontconverter MagnumText Magnum MagnumWindowlessCglApplication) - elseif(UNIX AND NOT TARGET_GLES) + elseif(CORRADE_TARGET_UNIX AND NOT TARGET_GLES) target_link_libraries(magnum-fontconverter MagnumText Magnum MagnumWindowlessGlxApplication ${X11_LIBRARIES}) - elseif(WIN32) + elseif(CORRADE_TARGET_WINDOWS) 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.") diff --git a/src/Magnum/Text/fontconverter.cpp b/src/Magnum/Text/fontconverter.cpp index c5d0bed7d..690c87784 100644 --- a/src/Magnum/Text/fontconverter.cpp +++ b/src/Magnum/Text/fontconverter.cpp @@ -32,7 +32,7 @@ #include "Magnum/Text/DistanceFieldGlyphCache.h" #include "Magnum/Trade/AbstractImageConverter.h" -#ifdef __APPLE__ +#ifdef CORRADE_TARGET_APPLE #include "Magnum/Platform/WindowlessCglApplication.h" #elif defined(CORRADE_TARGET_UNIX) #include "Magnum/Platform/WindowlessGlxApplication.h" diff --git a/src/Magnum/TextureTools/CMakeLists.txt b/src/Magnum/TextureTools/CMakeLists.txt index 43ff501c6..d5ad0a28d 100644 --- a/src/Magnum/TextureTools/CMakeLists.txt +++ b/src/Magnum/TextureTools/CMakeLists.txt @@ -56,11 +56,11 @@ if(WITH_DISTANCEFIELDCONVERTER) add_executable(magnum-distancefieldconverter distancefieldconverter.cpp) - if(APPLE) + if(CORRADE_TARGET_APPLE) target_link_libraries(magnum-distancefieldconverter MagnumTextureTools MagnumWindowlessCglApplication Magnum) - elseif(UNIX AND NOT TARGET_GLES) + elseif(CORRADE_TARGET_UNIX AND NOT TARGET_GLES) target_link_libraries(magnum-distancefieldconverter MagnumTextureTools Magnum MagnumWindowlessGlxApplication ${X11_LIBRARIES}) - elseif(WIN32) + elseif(CORRADE_TARGET_WINDOWS) 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.") diff --git a/src/Magnum/TextureTools/distancefieldconverter.cpp b/src/Magnum/TextureTools/distancefieldconverter.cpp index d35514467..e15448bf4 100644 --- a/src/Magnum/TextureTools/distancefieldconverter.cpp +++ b/src/Magnum/TextureTools/distancefieldconverter.cpp @@ -37,7 +37,7 @@ #include "Magnum/Trade/AbstractImageConverter.h" #include "Magnum/Trade/ImageData.h" -#ifdef __APPLE__ +#ifdef CORRADE_TARGET_APPLE #include "Magnum/Platform/WindowlessCglApplication.h" #elif defined(CORRADE_TARGET_UNIX) #include "Magnum/Platform/WindowlessGlxApplication.h" diff --git a/src/MagnumPlugins/MagnumFont/CMakeLists.txt b/src/MagnumPlugins/MagnumFont/CMakeLists.txt index deaf8383e..a6c112d60 100644 --- a/src/MagnumPlugins/MagnumFont/CMakeLists.txt +++ b/src/MagnumPlugins/MagnumFont/CMakeLists.txt @@ -38,7 +38,7 @@ add_plugin(MagnumFont ${MAGNUM_PLUGINS_FONT_DEBUG_INSTALL_DIR} ${MAGNUM_PLUGINS_ pluginRegistration.cpp) target_link_libraries(MagnumFont Magnum MagnumText) -if(WIN32) +if(CORRADE_TARGET_WINDOWS) target_link_libraries(MagnumFont TgaImporter) endif() @@ -51,7 +51,7 @@ if(BUILD_GL_TESTS) # 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(WIN32 AND NOT CMAKE_CROSSCOMPILING) + if(CORRADE_TARGET_WINDOWS AND NOT CMAKE_CROSSCOMPILING) install(TARGETS MagnumMagnumFontTestLib RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR} LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR} diff --git a/src/MagnumPlugins/MagnumFontConverter/CMakeLists.txt b/src/MagnumPlugins/MagnumFontConverter/CMakeLists.txt index 49bf22a76..d6ef7f848 100644 --- a/src/MagnumPlugins/MagnumFontConverter/CMakeLists.txt +++ b/src/MagnumPlugins/MagnumFontConverter/CMakeLists.txt @@ -38,7 +38,7 @@ add_plugin(MagnumFontConverter ${MAGNUM_PLUGINS_FONTCONVERTER_DEBUG_INSTALL_DIR} pluginRegistration.cpp) target_link_libraries(MagnumFontConverter Magnum MagnumText) -if(WIN32) +if(CORRADE_TARGET_WINDOWS) target_link_libraries(MagnumFontConverter TgaImageConverter) endif() @@ -51,7 +51,7 @@ if(BUILD_GL_TESTS) # 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(WIN32 AND NOT CMAKE_CROSSCOMPILING) + if(CORRADE_TARGET_WINDOWS AND NOT CMAKE_CROSSCOMPILING) install(TARGETS MagnumMagnumFontConverterTestLib RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR} LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR} diff --git a/src/MagnumPlugins/ObjImporter/CMakeLists.txt b/src/MagnumPlugins/ObjImporter/CMakeLists.txt index f90a0bd4b..b8a62f5b7 100644 --- a/src/MagnumPlugins/ObjImporter/CMakeLists.txt +++ b/src/MagnumPlugins/ObjImporter/CMakeLists.txt @@ -43,7 +43,7 @@ if(BUILD_TESTS) # 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(WIN32 AND NOT CMAKE_CROSSCOMPILING) + if(CORRADE_TARGET_WINDOWS AND NOT CMAKE_CROSSCOMPILING) install(TARGETS MagnumObjImporterTestLib RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR} LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR} diff --git a/src/MagnumPlugins/TgaImageConverter/CMakeLists.txt b/src/MagnumPlugins/TgaImageConverter/CMakeLists.txt index 47676f258..08f4ff875 100644 --- a/src/MagnumPlugins/TgaImageConverter/CMakeLists.txt +++ b/src/MagnumPlugins/TgaImageConverter/CMakeLists.txt @@ -47,7 +47,7 @@ if(BUILD_TESTS) # 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(WIN32 AND NOT CMAKE_CROSSCOMPILING) + if(CORRADE_TARGET_WINDOWS AND NOT CMAKE_CROSSCOMPILING) install(TARGETS MagnumTgaImageConverterTestLib RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR} LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR} diff --git a/src/MagnumPlugins/TgaImporter/CMakeLists.txt b/src/MagnumPlugins/TgaImporter/CMakeLists.txt index 7e6685b8a..afb01bc62 100644 --- a/src/MagnumPlugins/TgaImporter/CMakeLists.txt +++ b/src/MagnumPlugins/TgaImporter/CMakeLists.txt @@ -48,7 +48,7 @@ if(BUILD_TESTS) # 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(WIN32 AND NOT CMAKE_CROSSCOMPILING) + if(CORRADE_TARGET_WINDOWS AND NOT CMAKE_CROSSCOMPILING) install(TARGETS MagnumTgaImporterTestLib RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR} LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR} diff --git a/src/MagnumPlugins/WavAudioImporter/CMakeLists.txt b/src/MagnumPlugins/WavAudioImporter/CMakeLists.txt index 27179d2a9..3660b3128 100644 --- a/src/MagnumPlugins/WavAudioImporter/CMakeLists.txt +++ b/src/MagnumPlugins/WavAudioImporter/CMakeLists.txt @@ -54,7 +54,7 @@ if(BUILD_TESTS) # 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(WIN32 AND NOT CMAKE_CROSSCOMPILING) + if(CORRADE_TARGET_WINDOWS AND NOT CMAKE_CROSSCOMPILING) install(TARGETS MagnumWavAudioImporterTestLib RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR} LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}