diff --git a/CMakeLists.txt b/CMakeLists.txt index 9a351e9ca..5fc4e96ff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,6 +67,10 @@ 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 @@ -75,13 +79,13 @@ if(NOT CORRADE_TARGET_NACL AND NOT CORRADE_TARGET_ANDROID) option(WITH_SDL2APPLICATION "Build Sdl2Application library" OFF) endif() -# Magnum Info (currently only using GLX or WGL or on NaCl) -if((CORRADE_TARGET_UNIX AND NOT APPLE) OR CORRADE_TARGET_NACL OR CORRADE_TARGET_WINDOWS) +# Magnum Info (currently only using GLX, CGL or WGL or on NaCl) +if(CORRADE_TARGET_UNIX OR CORRADE_TARGET_NACL OR CORRADE_TARGET_WINDOWS) option(WITH_MAGNUMINFO "Build magnum-info utility" OFF) endif() -# Utilities (currently only using GLX or WGL) -if((CORRADE_TARGET_UNIX AND NOT APPLE) OR CORRADE_TARGET_WINDOWS) +# Utilities (currently only using GLX, CGL or WGL) +if(CORRADE_TARGET_UNIX 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/CONTRIBUTORS.md b/CONTRIBUTORS.md new file mode 100644 index 000000000..5de717cf0 --- /dev/null +++ b/CONTRIBUTORS.md @@ -0,0 +1,14 @@ +Contributors to Magnum library +------------------------------ + +* Miguel Martin ([@miguelmartin75](https://github.com/miguelmartin75)) -- + initial Mac OS X port, various other improvements +* Travis Watkins ([@amaranth](https://github.com/amaranth)) -- support for + windowless applications under Mac OS X +* [@ArEnSc](https://github.com/ArEnSc) / [@michael-chung](https://github.com/michael-chung) -- + initial implementation of windowless applications under Mac OS X, Mac OS X + port improvements +* Stefan Wasilewski ([@smw](https://github.com/smw)) -- Mac OS X port + improvements + +Big thanks to everyone involved! diff --git a/README.md b/README.md index 5a22c7889..83e98b7be 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ Platforms: * **Linux** and embedded Linux (natively using GLX/EGL and Xlib or through SDL2 or GLUT toolkit) * **Windows** (through SDL2 or GLUT toolkit) -* **OS X** (through SDL2 toolkit, thanks to [Miguel Martin](https://github.com/miguelishawt)) +* **OS X** (through SDL2 toolkit) * **Android** 2.3 (API Level 9) and higher * **Google Chrome** (through [Native Client](https://developers.google.com/native-client/), both `newlib` and `glibc` toolchains are supported) @@ -171,6 +171,12 @@ idea? Feel free to visit my website or contact me at: * E-mail -- mosra@centrum.cz * Jabber -- mosra@jabbim.cz +CONTRIBUTORS +============ + +See [CONTRIBUTORS.md](CONTRIBUTORS.md) file for details. Big thanks to everyone +involved! + LICENSE ======= diff --git a/doc/building.dox b/doc/building.dox index 611800b3b..deea29f38 100644 --- a/doc/building.dox +++ b/doc/building.dox @@ -199,12 +199,13 @@ platform best: - `WITH_NACLAPPLICATION` - @ref Platform::NaClApplication "NaClApplication" - `WITH_SDL2APPLICATION` - @ref Platform::Sdl2Application "Sdl2Application" - `WITH_XEGLAPPLICATION` - @ref Platform::XEglApplication "XEglApplication" +- `WITH_WINDOWLESSCGLAPPLICATION` - @ref Platform::WindowlessCglApplication "WindowlessCglApplication" - `WITH_WINDOWLESSGLXAPPLICATION` - @ref Platform::WindowlessGlxApplication "WindowlessGlxApplication" - `WITH_WINDOWLESSNACLAPPLICATION` - @ref Platform::WindowlessNaClApplication "WindowlessNaClApplication" - `WITH_WINDOWLESSWGLAPPLICATION` - @ref Platform::WindowlessWglApplication "WindowlessWglApplication" There are also a few command-line utilities. They are currently available only -on Linux and Windows, also disabled by default: +on Linux, Mac OS X and Windows, also disabled by default: - `WITH_MAGNUMINFO` - `magnum-info` executable, provides information about the engine and OpenGL capabilities. diff --git a/doc/cmake.dox b/doc/cmake.dox index 35c0e1029..b41db7848 100644 --- a/doc/cmake.dox +++ b/doc/cmake.dox @@ -88,6 +88,7 @@ Platform namespace is split into more components: - `%NaClApplication` -- @ref Platform::NaClApplication "NaClApplication" - `%Sdl2Application` -- @ref Platform::Sdl2Application "Sdl2Application" - `%XEglApplication` -- @ref Platform::XEglApplication "XEglApplication" +- `%WindowlessCglApplication` -- @ref Platform::WindowlessCglApplication "WindowlessCglApplication" - `%WindowlessGlxApplication` -- @ref Platform::WindowlessGlxApplication "WindowlessGlxApplication" - `%WindowlessNaClApplication` -- @ref Platform::WindowlessNaClApplication "WindowlessNaClApplication" - `%WindowlessWglApplication` -- @ref Platform::WindowlessWglApplication "WindowlessWglApplication" diff --git a/modules/FindMagnum.cmake b/modules/FindMagnum.cmake index f927e1cfd..a75f53977 100644 --- a/modules/FindMagnum.cmake +++ b/modules/FindMagnum.cmake @@ -47,6 +47,7 @@ # NaClApplication - NaCl application # Sdl2Application - SDL2 application # XEglApplication - X/EGL application +# WindowlessCglApplication - Windowless CGL application # WindowlessGlxApplication - Windowless GLX application # WindowlessNaClApplication - Windowless NaCl application # WindowlessWglApplication - Windowless WGL application diff --git a/package/archlinux/PKGBUILD-mingw32 b/package/archlinux/PKGBUILD-mingw32 deleted file mode 100644 index 3d678b8a3..000000000 --- a/package/archlinux/PKGBUILD-mingw32 +++ /dev/null @@ -1,38 +0,0 @@ -# Author: mosra -pkgname=mingw32-magnum -pkgver=dev -pkgrel=1 -pkgdesc="C++11 and OpenGL 2D/3D graphics engine (mingw32)" -arch=('any') -url="http://mosra.cz/blog/magnum.php" -license=('MIT') -depends=('mingw32-runtime' 'mingw32-corrade' 'mingw32-freeglut' 'mingw32-openal') -makedepends=('mingw32-gcc' 'cmake' 'ninja' 'corrade') -options=('!buildflags' '!strip' 'staticlibs') - -build() { - mkdir -p "$startdir/build-win" - cd "$startdir/build-win" - - unset LDFLAGS - - cmake .. \ - -DCMAKE_TOOLCHAIN_FILE=../toolchains/archlinux/basic-mingw32.cmake \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=/usr/i486-mingw32 \ - -DWITH_AUDIO=ON \ - -DWITH_GLUTAPPLICATION=ON \ - -DWITH_MAGNUMFONT=ON \ - -DWITH_MAGNUMFONTCONVERTER=ON \ - -DWITH_OBJIMPORTER=ON \ - -DWITH_TGAIMAGECONVERTER=ON \ - -DWITH_TGAIMPORTER=ON \ - -DWITH_WAVAUDIOIMPORTER=ON \ - -G Ninja - ninja -} - -package() { - cd "$startdir/build-win" - DESTDIR="$pkgdir/" ninja install/strip -} diff --git a/src/Magnum/Platform/CMakeLists.txt b/src/Magnum/Platform/CMakeLists.txt index 1597e2204..e22996b88 100644 --- a/src/Magnum/Platform/CMakeLists.txt +++ b/src/Magnum/Platform/CMakeLists.txt @@ -191,6 +191,16 @@ if(WITH_WINDOWLESSWGLAPPLICATION) ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}) endif() +# Windowless CGL application +if(WITH_WINDOWLESSCGLAPPLICATION) + add_library(MagnumWindowlessCglApplication STATIC WindowlessCglApplication.cpp) + install(FILES WindowlessCglApplication.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/Platform) + install(TARGETS MagnumWindowlessCglApplication + RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR} + LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR} + ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}) +endif() + # Abstract X application if(NEED_ABSTRACTXAPPLICATION) add_library(MagnumAbstractXApplication OBJECT AbstractXApplication.cpp) @@ -228,6 +238,8 @@ if(WITH_MAGNUMINFO) target_link_libraries(magnum-info MagnumWindowlessNaClApplication ppapi_cpp ppapi) 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/WindowlessCglApplication.cpp b/src/Magnum/Platform/WindowlessCglApplication.cpp new file mode 100644 index 000000000..207e0fd60 --- /dev/null +++ b/src/Magnum/Platform/WindowlessCglApplication.cpp @@ -0,0 +1,131 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013, 2014 + Vladimír Vondruš + Copyright © 2013 + Copyright © 2014 Travis Watkins + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include "WindowlessCglApplication.h" + +#include +#include + +#include "Magnum/Context.h" + +namespace Magnum { namespace Platform { + +/** @todo Delegating constructor when support for GCC 4.6 is dropped */ + +WindowlessCglApplication::WindowlessCglApplication(const Arguments&, const Configuration& configuration): c(nullptr) { + createContext(configuration); +} + +#ifndef DOXYGEN_GENERATING_OUTPUT +WindowlessCglApplication::WindowlessCglApplication(const Arguments&): c(nullptr) { + createContext(); +} +#endif + +WindowlessCglApplication::WindowlessCglApplication(const Arguments&, std::nullptr_t): c(nullptr) {} + +void WindowlessCglApplication::createContext() { createContext({}); } + +void WindowlessCglApplication::createContext(const Configuration& configuration) { + if(!tryCreateContext(configuration)) std::exit(1); +} + +bool WindowlessCglApplication::tryCreateContext(const Configuration&) { + CORRADE_ASSERT(!c, "Platform::WindowlessCglApplication::tryCreateContext(): context already created", false); + + /* Check version */ + int nPix = 0; + GLint major, minor; + CGLGetVersion(&major, &minor); + CGLError cglError; + + if(major == 2 && minor < 1) { + Error() << "Platform::WindowlessCglApplication::tryCreateContext(): OpenGL version 2.1 or greater is required"; + return false; + } + + + CGLPixelFormatAttribute pfAttributesGL_3_2[4] = { + kCGLPFAAccelerated, + kCGLPFAOpenGLProfile, + (CGLPixelFormatAttribute) kCGLOGLPVersion_3_2_Core, + (CGLPixelFormatAttribute) 0 + }; + + cglError = CGLChoosePixelFormat(pfAttributesGL_3_2,&pixelFormat,&nPix); + + if(cglError == kCGLBadPixelFormat) { + Error() << "Platform::WindowlessCglApplication::tryCreateContext(): OpenGL version 3.2 has failed trying GL version 3.0"; + + CGLPixelFormatAttribute pfAttributesGL3[4] = { + kCGLPFAAccelerated, + kCGLPFAOpenGLProfile, + (CGLPixelFormatAttribute) kCGLOGLPVersion_GL3_Core, + (CGLPixelFormatAttribute) 0 + }; + + cglError = CGLChoosePixelFormat(pfAttributesGL3,&pixelFormat,&nPix); + + if(cglError == kCGLBadPixelFormat) { + Error() << "Platform::WindowlessCglApplication::tryCreateContext(): OpenGL version 3.0 has failed trying GL version Legacy"; + + CGLPixelFormatAttribute pfAttributesLegacy[4] = { + kCGLPFAAccelerated, + kCGLPFAOpenGLProfile, + (CGLPixelFormatAttribute) kCGLOGLPVersion_Legacy, + (CGLPixelFormatAttribute) 0 + }; + + cglError = CGLChoosePixelFormat(pfAttributesLegacy,&pixelFormat,&nPix); + + if(cglError == kCGLBadPixelFormat) + { + Error() << "Platform::WindowlessCglApplication::tryCreateContext(): Context could not be created"; + return false; + } + } + } + + cglError = CGLCreateContext(pixelFormat, NULL, &context); + if(cglError == kCGLBadContext) { + Error() << "Platform::WindowlessCglApplication::tryCreateContext(): cannot create context"; + return false; + } + + cglError = CGLSetCurrentContext(context); + c = new Context; + return true; +} + +WindowlessCglApplication::~WindowlessCglApplication() { + delete c; + + CGLDestroyContext(context); + CGLDestroyPixelFormat(pixelFormat); +} + +}} diff --git a/src/Magnum/Platform/WindowlessCglApplication.h b/src/Magnum/Platform/WindowlessCglApplication.h new file mode 100644 index 000000000..f86274ac1 --- /dev/null +++ b/src/Magnum/Platform/WindowlessCglApplication.h @@ -0,0 +1,202 @@ +#ifndef Magnum_Platform_WindowlessCglApplication_h +#define Magnum_Platform_WindowlessCglApplication_h +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013, 2014 + Vladimír Vondruš + Copyright © 2013 + Copyright © 2014 Travis Watkins + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +/** @file + * @brief Class @ref Magnum::Platform::WindowlessCglApplication, macro @ref MAGNUM_WINDOWLESSCGLAPPLICATION_MAIN() + */ + +#include "Magnum/OpenGL.h" +#include +#include +#include + +#include "Magnum/Magnum.h" + +namespace Magnum { namespace Platform { + +/** +@brief Windowless CGL application + +Application for offscreen rendering using pure CGL. + +This application library is available on desktop OpenGL on OS X. It +is built if `WITH_WINDOWLESSCGLAPPLICATION` is enabled in CMake. + +## Bootstrap application + +Fully contained windowless application using @ref WindowlessCglApplication +along with CMake setup is available in `base-windowless` branch of +[Magnum Bootstrap](https://github.com/mosra/magnum-bootstrap) +repository, download it as [tar.gz](https://github.com/mosra/magnum-bootstrap/archive/base-windowless.tar.gz) +or [zip](https://github.com/mosra/magnum-bootstrap/archive/base-windowless.zip) +file. 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 + +## General usage + +In CMake you need to request `%WindowlessCglApplication` component, add +`${MAGNUM_WINDOWLESSCGLAPPLICATION_INCLUDE_DIRS}` to include path and link to +`${MAGNUM_WINDOWLESSCGLAPPLICATION_LIBRARIES}`. If no other windowless +application is requested, you can also use generic +`${MAGNUM_WINDOWLESSAPPLICATION_INCLUDE_DIRS}` and +`${MAGNUM_WINDOWLESSAPPLICATION_LIBRARIES}` aliases to simplify porting. See +@ref building and @ref cmake for more information. + +Place your code into @ref exec(). The subclass can be then used directly in +`main()` -- see convenience macro @ref MAGNUM_WINDOWLESSCGLAPPLICATION_MAIN(). +See @ref platform for more information. +@code +class MyApplication: public Platform::WindowlessCglApplication { + // implement required methods... +}; +MAGNUM_WINDOWLESSCGLAPPLICATION_MAIN(MyApplication) +@endcode + +If no other application header is included, this class is also aliased to +`Platform::WindowlessApplication` and the macro is aliased to +`MAGNUM_WINDOWLESSAPPLICATION_MAIN()` to simplify porting. +*/ +class WindowlessCglApplication { + public: + /** @brief Application arguments */ + struct Arguments { + int& argc; /**< @brief Argument count */ + char** argv; /**< @brief Argument values */ + }; + + class Configuration; + + /** @copydoc Sdl2Application::Sdl2Application(const Arguments&, const Configuration&) */ + #ifdef DOXYGEN_GENERATING_OUTPUT + explicit WindowlessCglApplication(const Arguments& arguments, const Configuration& configuration = Configuration()); + #else + /* To avoid "invalid use of incomplete type" */ + explicit WindowlessCglApplication(const Arguments& arguments, const Configuration& configuration); + explicit WindowlessCglApplication(const Arguments& arguments); + #endif + + /** @copydoc Sdl2Application::Sdl2Application(const Arguments&, std::nullptr_t) */ + explicit WindowlessCglApplication(const Arguments& arguments, std::nullptr_t); + + /** @brief Copying is not allowed */ + WindowlessCglApplication(const WindowlessCglApplication&) = delete; + + /** @brief Moving is not allowed */ + WindowlessCglApplication(WindowlessCglApplication&&) = delete; + + /** @brief Copying is not allowed */ + WindowlessCglApplication& operator=(const WindowlessCglApplication&) = delete; + + /** @brief Moving is not allowed */ + WindowlessCglApplication& operator=(WindowlessCglApplication&&) = delete; + + /** + * @brief Execute application + * @return Value for returning from `main()` + * + * See @ref MAGNUM_WINDOWLESSCGLAPPLICATION_MAIN() for usage + * information. + */ + virtual int exec() = 0; + + protected: + /* Nobody will need to have (and delete) WindowlessCglApplication*, + thus this is faster than public pure virtual destructor */ + ~WindowlessCglApplication(); + + /** @copydoc Sdl2Application::createContext() */ + #ifdef DOXYGEN_GENERATING_OUTPUT + void createContext(const Configuration& configuration = Configuration()); + #else + /* To avoid "invalid use of incomplete type" */ + void createContext(const Configuration& configuration); + void createContext(); + #endif + + /** @copydoc Sdl2Application::tryCreateContext() */ + bool tryCreateContext(const Configuration& configuration); + + private: + CGLContextObj context; + CGLPixelFormatObj pixelFormat; + + Context* c; +}; + +/** +@brief %Configuration + +@see @ref WindowlessCglApplication(), @ref createContext(), + @ref tryCreateContext() +*/ +class WindowlessCglApplication::Configuration { + public: + constexpr /*implicit*/ Configuration() {} +}; + +/** @hideinitializer +@brief Entry point for windowless CGL application +@param className Class name + +See @ref Magnum::Platform::WindowlessCglApplication "Platform::WindowlessCglApplication" +for usage information. This macro abstracts out platform-specific entry point +code and is equivalent to the following, see @ref portability-applications for +more information. +@code +int main(int argc, char** argv) { + className app({argc, argv}); + return app.exec(); +} +@endcode +When no other windowless application header is included this macro is also +aliased to `MAGNUM_WINDOWLESSAPPLICATION_MAIN()`. +*/ +#define MAGNUM_WINDOWLESSCGLAPPLICATION_MAIN(className) \ + int main(int argc, char** argv) { \ + className app({argc, argv}); \ + return app.exec(); \ + } + +#ifndef DOXYGEN_GENERATING_OUTPUT +#ifndef MAGNUM_WINDOWLESSAPPLICATION_MAIN +typedef WindowlessCglApplication WindowlessApplication; +#define MAGNUM_WINDOWLESSAPPLICATION_MAIN(className) MAGNUM_WINDOWLESSCGLAPPLICATION_MAIN(className) +#else +#undef MAGNUM_WINDOWLESSAPPLICATION_MAIN +#endif +#endif + +}} + +#endif diff --git a/src/Magnum/Platform/magnum-info.cpp b/src/Magnum/Platform/magnum-info.cpp index 9e7191752..4600287d7 100644 --- a/src/Magnum/Platform/magnum-info.cpp +++ b/src/Magnum/Platform/magnum-info.cpp @@ -53,6 +53,8 @@ #ifdef CORRADE_TARGET_NACL #include "Magnum/Platform/WindowlessNaClApplication.h" +#elif defined(__APPLE__) +#include "Magnum/Platform/WindowlessCglApplication.h" #elif defined(CORRADE_TARGET_UNIX) #include "Magnum/Platform/WindowlessGlxApplication.h" #elif defined(CORRADE_TARGET_WINDOWS) @@ -101,6 +103,8 @@ MagnumInfo::MagnumInfo(const Arguments& arguments): Platform::WindowlessApplicat #ifdef CORRADE_TARGET_NACL Debug() << "Used application: Platform::WindowlessNaClApplication"; + #elif defined(__APPLE__) + Debug() << "Used application: Platform::WindowlessCglApplication"; #else Debug() << "Used application: Platform::WindowlessGlxApplication"; #endif diff --git a/src/Magnum/Text/CMakeLists.txt b/src/Magnum/Text/CMakeLists.txt index 418e4999b..d5082cc06 100644 --- a/src/Magnum/Text/CMakeLists.txt +++ b/src/Magnum/Text/CMakeLists.txt @@ -67,7 +67,9 @@ if(WITH_FONTCONVERTER) add_executable(magnum-fontconverter fontconverter.cpp) - if(UNIX AND NOT TARGET_GLES) + if(APPLE) + target_link_libraries(magnum-fontconverter MagnumText Magnum MagnumWindowlessCglApplication) + elseif(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) diff --git a/src/Magnum/Text/fontconverter.cpp b/src/Magnum/Text/fontconverter.cpp index 4f2b04db1..c5d0bed7d 100644 --- a/src/Magnum/Text/fontconverter.cpp +++ b/src/Magnum/Text/fontconverter.cpp @@ -32,7 +32,9 @@ #include "Magnum/Text/DistanceFieldGlyphCache.h" #include "Magnum/Trade/AbstractImageConverter.h" -#ifdef CORRADE_TARGET_UNIX +#ifdef __APPLE__ +#include "Magnum/Platform/WindowlessCglApplication.h" +#elif defined(CORRADE_TARGET_UNIX) #include "Magnum/Platform/WindowlessGlxApplication.h" #elif defined(CORRADE_TARGET_WINDOWS) #include "Magnum/Platform/WindowlessWglApplication.h" diff --git a/src/Magnum/TextureTools/CMakeLists.txt b/src/Magnum/TextureTools/CMakeLists.txt index e1e2b9318..43ff501c6 100644 --- a/src/Magnum/TextureTools/CMakeLists.txt +++ b/src/Magnum/TextureTools/CMakeLists.txt @@ -56,7 +56,9 @@ if(WITH_DISTANCEFIELDCONVERTER) add_executable(magnum-distancefieldconverter distancefieldconverter.cpp) - if(UNIX AND NOT TARGET_GLES) + if(APPLE) + target_link_libraries(magnum-distancefieldconverter MagnumTextureTools MagnumWindowlessCglApplication Magnum) + elseif(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) diff --git a/src/Magnum/TextureTools/distancefieldconverter.cpp b/src/Magnum/TextureTools/distancefieldconverter.cpp index d53f316ee..d35514467 100644 --- a/src/Magnum/TextureTools/distancefieldconverter.cpp +++ b/src/Magnum/TextureTools/distancefieldconverter.cpp @@ -37,7 +37,9 @@ #include "Magnum/Trade/AbstractImageConverter.h" #include "Magnum/Trade/ImageData.h" -#ifdef CORRADE_TARGET_UNIX +#ifdef __APPLE__ +#include "Magnum/Platform/WindowlessCglApplication.h" +#elif defined(CORRADE_TARGET_UNIX) #include "Magnum/Platform/WindowlessGlxApplication.h" #elif defined(CORRADE_TARGET_WINDOWS) #include "Magnum/Platform/WindowlessWglApplication.h"