1 module dlangui.core.config; 2 3 extern(C) @property dstring DLANGUI_VERSION(); 4 5 //version = USE_CONSOLE; 6 7 version(USE_CONSOLE) { 8 version = NO_OPENGL; 9 version = NO_FREETYPE; 10 enum ENABLE_OPENGL = false; 11 enum ENABLE_FREETYPE = false; 12 enum BACKEND_CONSOLE = true; 13 enum BACKEND_GUI = false; 14 enum BACKEND_SDL = false; 15 enum BACKEND_X11 = false; 16 enum BACKEND_DSFML = false; 17 enum BACKEND_WIN32 = false; 18 enum BACKEND_ANDROID = false; 19 } else { 20 version(USE_EXTERNAL) {} 21 else 22 enum BACKEND_GUI = true; 23 24 version (NO_FREETYPE) { 25 enum ENABLE_FREETYPE = false; 26 } else version (USE_FREETYPE) { 27 enum ENABLE_FREETYPE = true; 28 } else { 29 version (Windows) { 30 enum ENABLE_FREETYPE = false; 31 } else { 32 enum ENABLE_FREETYPE = true; 33 } 34 } 35 36 // provide default configuratino definitions 37 version (USE_SDL) { 38 // SDL backend already selected using version identifier 39 version (USE_OPENGL) { 40 enum ENABLE_OPENGL = true; 41 } else { 42 enum ENABLE_OPENGL = false; 43 } 44 enum BACKEND_SDL = true; 45 enum BACKEND_X11 = false; 46 enum BACKEND_DSFML = false; 47 enum BACKEND_WIN32 = false; 48 enum BACKEND_ANDROID = false; 49 enum BACKEND_CONSOLE = false; 50 } else version (USE_ANDROID) { 51 // Android backend already selected using version identifier 52 version (USE_OPENGL) { 53 enum ENABLE_OPENGL = true; 54 } else { 55 enum ENABLE_OPENGL = false; 56 } 57 enum BACKEND_SDL = false; 58 enum BACKEND_X11 = false; 59 enum BACKEND_DSFML = false; 60 enum BACKEND_WIN32 = false; 61 enum BACKEND_ANDROID = true; 62 enum BACKEND_CONSOLE = false; 63 } else version (USE_X11) { 64 // X11 backend already selected using version identifier 65 version (USE_OPENGL) { 66 enum ENABLE_OPENGL = true; 67 } else { 68 enum ENABLE_OPENGL = false; 69 } 70 enum BACKEND_SDL = false; 71 enum BACKEND_X11 = true; 72 enum BACKEND_DSFML = false; 73 enum BACKEND_WIN32 = false; 74 enum BACKEND_CONSOLE = false; 75 } else version (USE_WIN32) { 76 // Win32 backend already selected using version identifier 77 version (USE_OPENGL) { 78 enum ENABLE_OPENGL = true; 79 } else { 80 enum ENABLE_OPENGL = false; 81 } 82 enum BACKEND_SDL = false; 83 enum BACKEND_X11 = false; 84 enum BACKEND_DSFML = false; 85 enum BACKEND_WIN32 = true; 86 enum BACKEND_ANDROID = false; 87 enum BACKEND_CONSOLE = false; 88 } else version (USE_DSFML) { 89 // DSFML backend already selected using version identifier 90 version (USE_OPENGL) { 91 enum ENABLE_OPENGL = true; 92 } else { 93 enum ENABLE_OPENGL = false; 94 } 95 enum BACKEND_SDL = false; 96 enum BACKEND_X11 = false; 97 enum BACKEND_DSFML = true; 98 enum BACKEND_WIN32 = false; 99 enum BACKEND_ANDROID = false; 100 enum BACKEND_CONSOLE = false; 101 } else version (USE_EXTERNAL) { 102 // External backend already selected using version identifier 103 version (USE_OPENGL) { 104 enum ENABLE_OPENGL = true; 105 } else { 106 enum ENABLE_OPENGL = false; 107 } 108 enum BACKEND_GUI = false; 109 enum BACKEND_CONSOLE = false; 110 enum BACKEND_SDL = false; 111 enum BACKEND_X11 = false; 112 enum BACKEND_DSFML = false; 113 enum BACKEND_WIN32 = false; 114 } else { 115 // no backend selected: set default based on platform 116 version (Windows) { 117 // For Windows 118 version (NO_OPENGL) { 119 enum ENABLE_OPENGL = false; 120 } else { 121 enum ENABLE_OPENGL = true; 122 } 123 enum BACKEND_SDL = false; 124 enum BACKEND_X11 = false; 125 enum BACKEND_DSFML = false; 126 enum BACKEND_WIN32 = true; 127 enum BACKEND_ANDROID = false; 128 enum BACKEND_CONSOLE = false; 129 } else version(Android) { 130 // Default for Linux: use SDL and OpenGL 131 enum ENABLE_OPENGL = true; 132 enum BACKEND_SDL = true; 133 enum BACKEND_X11 = false; 134 enum BACKEND_DSFML = false; 135 enum BACKEND_WIN32 = false; 136 enum BACKEND_ANDROID = true; 137 enum BACKEND_CONSOLE = false; 138 } else version(linux) { 139 // Default for Linux: use SDL and OpenGL 140 version (NO_OPENGL) { 141 enum ENABLE_OPENGL = false; 142 } else { 143 enum ENABLE_OPENGL = true; 144 } 145 enum BACKEND_SDL = true; 146 enum BACKEND_X11 = false; 147 enum BACKEND_DSFML = false; 148 enum BACKEND_WIN32 = false; 149 enum BACKEND_ANDROID = false; 150 enum BACKEND_CONSOLE = false; 151 } else version(OSX) { 152 // Default: use SDL and OpenGL 153 version (NO_OPENGL) { 154 enum ENABLE_OPENGL = false; 155 } else { 156 enum ENABLE_OPENGL = true; 157 } 158 enum BACKEND_SDL = true; 159 enum BACKEND_X11 = false; 160 enum BACKEND_DSFML = false; 161 enum BACKEND_WIN32 = false; 162 enum BACKEND_ANDROID = false; 163 enum BACKEND_CONSOLE = false; 164 } else { 165 // Unknown platform: use SDL and OpenGL 166 version (NO_OPENGL) { 167 enum ENABLE_OPENGL = false; 168 } else { 169 enum ENABLE_OPENGL = true; 170 } 171 enum BACKEND_SDL = true; 172 enum BACKEND_X11 = false; 173 enum BACKEND_DSFML = false; 174 enum BACKEND_WIN32 = false; 175 enum BACKEND_ANDROID = false; 176 enum BACKEND_CONSOLE = false; 177 } 178 } 179 }