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