1 
2 //          Copyright 2018 - 2021 Michael D. Parker
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     sdl2014     = 2014,
25 }
26 
27 version(BindBC_Static) version = BindSDL_Static;
28 version(BindSDL_Static) enum staticBinding = true;
29 else enum staticBinding = false;
30 
31 version(SDL_2014) enum sdlSupport = SDLSupport.sdl2014;
32 else version(SDL_2012) enum sdlSupport = SDLSupport.sdl2012;
33 else version(SDL_2010) enum sdlSupport = SDLSupport.sdl2010;
34 else version(SDL_209) enum sdlSupport = SDLSupport.sdl209;
35 else version(SDL_208) enum sdlSupport = SDLSupport.sdl208;
36 else version(SDL_207) enum sdlSupport = SDLSupport.sdl207;
37 else version(SDL_206) enum sdlSupport = SDLSupport.sdl206;
38 else version(SDL_205) enum sdlSupport = SDLSupport.sdl205;
39 else version(SDL_204) enum sdlSupport = SDLSupport.sdl204;
40 else version(SDL_203) enum sdlSupport = SDLSupport.sdl203;
41 else version(SDL_202) enum sdlSupport = SDLSupport.sdl202;
42 else version(SDL_201) enum sdlSupport = SDLSupport.sdl201;
43 else enum sdlSupport = SDLSupport.sdl200;
44 
45 version(SDL_Image) version = BindSDL_Image;
46 else version(SDL_Image_200) version = BindSDL_Image;
47 else version(SDL_Image_201) version = BindSDL_Image;
48 else version(SDL_Image_202) version = BindSDL_Image;
49 else version(SDL_Image_203) version = BindSDL_Image;
50 else version(SDL_Image_204) version = BindSDL_Image;
51 else version(SDL_Image_205) version = BindSDL_Image;
52 version(BindSDL_Image) enum bindSDLImage = true;
53 else enum bindSDLImage = false;
54 
55 version(SDL_Mixer) version = BindSDL_Mixer;
56 else version(SDL_Mixer_200) version = BindSDL_Mixer;
57 else version(SDL_Mixer_201) version = BindSDL_Mixer;
58 else version(SDL_Mixer_202) version = BindSDL_Mixer;
59 else version(SDL_Mixer_204) version = BindSDL_Mixer;
60 version(BindSDL_Mixer) enum bindSDLMixer = true;
61 else enum bindSDLMixer = false;
62 
63 version(SDL_Net) version = BindSDL_Net;
64 else version(SDL_Net_200) version = BindSDL_Net;
65 else version(SDL_Net_201) version = BindSDL_Net;
66 version(BindSDL_Net) enum bindSDLNet = true;
67 else enum bindSDLNet = false;
68 
69 version(SDL_TTF) version = BindSDL_TTF;
70 else version(SDL_TTF_2012) version = BindSDL_TTF;
71 else version(SDL_TTF_2013) version = BindSDL_TTF;
72 else version(SDL_TTF_2014) version = BindSDL_TTF;
73 version(BindSDL_TTF) enum bindSDLTTF = true;
74 else enum bindSDLTTF = false;
75 
76 enum expandEnum(EnumType, string fqnEnumType = EnumType.stringof) = (){
77     string expandEnum = "enum {";
78     foreach(m;__traits(allMembers, EnumType)) {
79         expandEnum ~= m ~ " = " ~ fqnEnumType ~ "." ~ m ~ ",";
80     }
81     expandEnum  ~= "}";
82     return expandEnum;
83 }();