1 
2 //          Copyright Michael D. Parker 2018.
3 // Distributed under the Boost Software License, Version 1.0.
4 //    (See accompanying file LICENSE_1_0.txt or copy at
5 //          http://www.boost.org/LICENSE_1_0.txt)
6 
7 module bindbc.sdl.config;
8 
9 enum SDLSupport {
10     noLibrary,
11     badLibrary,
12     sdl200      = 200,
13     sdl201      = 201,
14     sdl202      = 202,
15     sdl203      = 203,
16     sdl204      = 204,
17     sdl205      = 205,
18     sdl206      = 206,
19     sdl207      = 207,
20     sdl208      = 208,
21     sdl209      = 209,
22     sdl2010     = 2010,
23     sdl2012     = 2012,
24 }
25 
26 version(BindBC_Static) version = BindSDL_Static;
27 version(BindSDL_Static) enum staticBinding = true;
28 else enum staticBinding = false;
29 
30 version(SDL_2012) enum sdlSupport = SDLSupport.sdl2012;
31 else version(SDL_2010) enum sdlSupport = SDLSupport.sdl2010;
32 else version(SDL_209) enum sdlSupport = SDLSupport.sdl209;
33 else version(SDL_208) enum sdlSupport = SDLSupport.sdl208;
34 else version(SDL_207) enum sdlSupport = SDLSupport.sdl207;
35 else version(SDL_206) enum sdlSupport = SDLSupport.sdl206;
36 else version(SDL_205) enum sdlSupport = SDLSupport.sdl205;
37 else version(SDL_204) enum sdlSupport = SDLSupport.sdl204;
38 else version(SDL_203) enum sdlSupport = SDLSupport.sdl203;
39 else version(SDL_202) enum sdlSupport = SDLSupport.sdl202;
40 else version(SDL_201) enum sdlSupport = SDLSupport.sdl201;
41 else enum sdlSupport = SDLSupport.sdl200;
42 
43 version(SDL_Image) version = BindSDL_Image;
44 else version(SDL_Image_200) version = BindSDL_Image;
45 else version(SDL_Image_201) version = BindSDL_Image;
46 else version(SDL_Image_202) version = BindSDL_Image;
47 else version(SDL_Image_203) version = BindSDL_Image;
48 else version(SDL_Image_204) version = BindSDL_Image;
49 else version(SDL_Image_205) version = BindSDL_Image;
50 version(BindSDL_Image) enum bindSDLImage = true;
51 else enum bindSDLImage = false;
52 
53 version(SDL_Mixer) version = BindSDL_Mixer;
54 else version(SDL_Mixer_200) version = BindSDL_Mixer;
55 else version(SDL_Mixer_201) version = BindSDL_Mixer;
56 else version(SDL_Mixer_202) version = BindSDL_Mixer;
57 else version(SDL_Mixer_204) version = BindSDL_Mixer;
58 version(BindSDL_Mixer) enum bindSDLMixer = true;
59 else enum bindSDLMixer = false;
60 
61 version(SDL_Net) version = BindSDL_Net;
62 else version(SDL_Net_200) version = BindSDL_Net;
63 else version(SDL_Net_201) version = BindSDL_Net;
64 version(BindSDL_Net) enum bindSDLNet = true;
65 else enum bindSDLNet = false;
66 
67 version(SDL_TTF) version = BindSDL_TTF;
68 else version(SDL_TTF_2012) version = BindSDL_TTF;
69 else version(SDL_TTF_2013) version = BindSDL_TTF;
70 else version(SDL_TTF_2014) version = BindSDL_TTF;
71 version(BindSDL_TTF) enum bindSDLTTF = true;
72 else enum bindSDLTTF = false;
73 
74 enum expandEnum(EnumType, string fqnEnumType = EnumType.stringof) = (){
75     string expandEnum = "enum {";
76     foreach(m;__traits(allMembers, EnumType)) {
77         expandEnum ~= m ~ " = " ~ fqnEnumType ~ "." ~ m ~ ",";
78     }
79     expandEnum  ~= "}";
80     return expandEnum;
81 }();