@@ -2,29 +2,36 @@ import os
22
33os.chdir(os.dir(os.executable()))!
44
5- res : = os.execute('sdl2- config -- version')
5+ mut res : = os.execute('sdl2- config -- version')
66if res.exit_code != 0 {
7- println('sdl2- config is missing')
8- exit(1 )
7+ println('sdl2- config is missing. Trying pkg- config...')
8+ pkgconf : = os.find_abs_path_of_executable('pkg- config') or { '' }
9+ if ! os.is_executable(pkgconf) {
10+ println('pkg- config not found. Giving up')
11+ exit(1 )
12+ }
13+ res = os.execute('pkg- config -- modversion sdl2')
14+ if res.exit_code != 0 {
15+ println('SDL2 is missing. Trying SDL3...')
16+ res = os.execute('pkg- config -- modversion sdl3')
17+ if res.exit_code != 0 {
18+ println('SDL3 is missing. Giving up')
19+ exit(1 )
20+ }
21+ }
922}
1023system_version : = res.output.trim_space()
1124println('Your version is ${system_version}')
1225
1326remotes : = os.execute('git branch - r -- list')
1427if remotes.exit_code != 0 {
15- println('git is missing')
28+ println('git is missing. Giving up ')
1629 exit(1 )
1730}
18- mut supported_versions : = remotes.output.split_into_lines().map(it.trim_space()).filter(it.starts_with('origin / 2 ')).map(it.all_after('origin / '))
19- supported_versions.insert( 0 , ' 2.0 . 8 ') // master
31+ supported_versions : = remotes.output.split_into_lines().map(it.trim_space()).filter(
32+ it.starts_with('origin / 2 ') || it.starts_with('origin / 3 ')).map(it.all_after('origin / '))
2033println('The SDL module officially supports these versions of SDL: \n ${supported_versions}')
2134
22- if system_version == '2.0 .8 ' {
23- println('Setting up the repository to branch master, that exactly matches your system SDL version 2.0 .8 ')
24- os.system('git checkout master')
25- exit(0 )
26- }
27-
2835if system_version in supported_versions {
2936 println('Setting up the repository to branch ${system_version} that exactly matches your system SDL version')
3037 os.system('git checkout ${system_version}')
0 commit comments