Mercurial > games > semicongine
annotate config.nims @ 1210:570ac1620fb6 compiletime-tests
fix: make uniform-block-arrays working
| author | sam <sam@basx.dev> |
|---|---|
| date | Wed, 17 Jul 2024 00:30:49 +0700 |
| parents | 2e0b527c2753 |
| children | 3c3d4d7a8ecd |
| rev | line source |
|---|---|
|
33
94c38e4b5782
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
24
diff
changeset
|
1 import std/strformat |
|
94c38e4b5782
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
24
diff
changeset
|
2 import std/strutils |
|
94c38e4b5782
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
24
diff
changeset
|
3 import std/os |
| 18 | 4 |
|
950
fe48b091e83f
did: tons of small improvments, on the way to make GPU sync (more) correct I guess
sam <sam@basx.dev>
parents:
438
diff
changeset
|
5 import semicongine/build |
| 18 | 6 |
|
950
fe48b091e83f
did: tons of small improvments, on the way to make GPU sync (more) correct I guess
sam <sam@basx.dev>
parents:
438
diff
changeset
|
7 # TODO: totally update this file!! |
|
213
b5d9410a8184
add: resource packaging and loading for different resource types, simplify build commands, update readme
Sam <sam@basx.dev>
parents:
207
diff
changeset
|
8 |
| 383 | 9 switch("nimblePath", "nimbledeps/pkgs2") |
| 1172 | 10 switch("define", "nimPreviewHashRef") |
| 383 | 11 |
|
950
fe48b091e83f
did: tons of small improvments, on the way to make GPU sync (more) correct I guess
sam <sam@basx.dev>
parents:
438
diff
changeset
|
12 task build_dev, "build dev": |
|
fe48b091e83f
did: tons of small improvments, on the way to make GPU sync (more) correct I guess
sam <sam@basx.dev>
parents:
438
diff
changeset
|
13 semicongine_build_switches(buildname = "dev") |
| 18 | 14 setCommand "c" |
|
950
fe48b091e83f
did: tons of small improvments, on the way to make GPU sync (more) correct I guess
sam <sam@basx.dev>
parents:
438
diff
changeset
|
15 let outdir = semicongine_builddir(buildname = "dev") |
| 979 | 16 semicongine_pack(outdir, bundleType = "exe", resourceRoot = "tests/resources", withSteam = false) |
| 17 | |
| 18 task build_dev_zip, "build dev zip": | |
| 19 semicongine_build_switches(buildname = "dev") | |
| 20 setCommand "c" | |
| 21 let outdir = semicongine_builddir(buildname = "dev") | |
| 22 semicongine_pack(outdir, bundleType = "zip", resourceRoot = "tests/resources", withSteam = false) | |
| 23 | |
| 24 task build_dev_dir, "build dev dir": | |
| 25 semicongine_build_switches(buildname = "dev") | |
| 26 setCommand "c" | |
| 27 let outdir = semicongine_builddir(buildname = "dev") | |
| 28 semicongine_pack(outdir, bundleType = "dir", resourceRoot = "tests/resources", withSteam = false) | |
|
950
fe48b091e83f
did: tons of small improvments, on the way to make GPU sync (more) correct I guess
sam <sam@basx.dev>
parents:
438
diff
changeset
|
29 |
|
fe48b091e83f
did: tons of small improvments, on the way to make GPU sync (more) correct I guess
sam <sam@basx.dev>
parents:
438
diff
changeset
|
30 task build_release, "build release": |
|
fe48b091e83f
did: tons of small improvments, on the way to make GPU sync (more) correct I guess
sam <sam@basx.dev>
parents:
438
diff
changeset
|
31 switch "define", "release" |
|
fe48b091e83f
did: tons of small improvments, on the way to make GPU sync (more) correct I guess
sam <sam@basx.dev>
parents:
438
diff
changeset
|
32 switch "app", "gui" |
|
fe48b091e83f
did: tons of small improvments, on the way to make GPU sync (more) correct I guess
sam <sam@basx.dev>
parents:
438
diff
changeset
|
33 semicongine_build_switches(buildname = "release") |
|
fe48b091e83f
did: tons of small improvments, on the way to make GPU sync (more) correct I guess
sam <sam@basx.dev>
parents:
438
diff
changeset
|
34 setCommand "c" |
|
fe48b091e83f
did: tons of small improvments, on the way to make GPU sync (more) correct I guess
sam <sam@basx.dev>
parents:
438
diff
changeset
|
35 let outdir = semicongine_builddir(buildname = "release") |
| 979 | 36 semicongine_pack(outdir, bundleType = "exe", resourceRoot = "tests/resources", withSteam = false) |
|
950
fe48b091e83f
did: tons of small improvments, on the way to make GPU sync (more) correct I guess
sam <sam@basx.dev>
parents:
438
diff
changeset
|
37 |
| 18 | 38 |
|
213
b5d9410a8184
add: resource packaging and loading for different resource types, simplify build commands, update readme
Sam <sam@basx.dev>
parents:
207
diff
changeset
|
39 task build_all_debug, "build all examples for debug": |
|
33
94c38e4b5782
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
24
diff
changeset
|
40 for file in listFiles("examples"): |
|
94c38e4b5782
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
24
diff
changeset
|
41 if file.endsWith(".nim"): |
|
213
b5d9410a8184
add: resource packaging and loading for different resource types, simplify build commands, update readme
Sam <sam@basx.dev>
parents:
207
diff
changeset
|
42 exec(&"nim build {file}") |
|
33
94c38e4b5782
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
24
diff
changeset
|
43 |
|
213
b5d9410a8184
add: resource packaging and loading for different resource types, simplify build commands, update readme
Sam <sam@basx.dev>
parents:
207
diff
changeset
|
44 task build_all_release, "build all examples for release": |
|
33
94c38e4b5782
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
24
diff
changeset
|
45 for file in listFiles("examples"): |
|
94c38e4b5782
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
24
diff
changeset
|
46 if file.endsWith(".nim"): |
|
213
b5d9410a8184
add: resource packaging and loading for different resource types, simplify build commands, update readme
Sam <sam@basx.dev>
parents:
207
diff
changeset
|
47 exec(&"nim build -d:release {file}") |
|
33
94c38e4b5782
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
24
diff
changeset
|
48 |
|
316
b145a05c2459
add: changing rendering system, not finished yet, also upgrading to Nim 2
Sam <sam@basx.dev>
parents:
273
diff
changeset
|
49 task test_all, "Run all test programs": |
|
b145a05c2459
add: changing rendering system, not finished yet, also upgrading to Nim 2
Sam <sam@basx.dev>
parents:
273
diff
changeset
|
50 for file in listFiles("tests"): |
| 438 | 51 if file.endsWith(".nim") and not file.endsWith("test_resources.nim"): |
| 979 | 52 exec(&"nim build_dev --run {file}") |
|
316
b145a05c2459
add: changing rendering system, not finished yet, also upgrading to Nim 2
Sam <sam@basx.dev>
parents:
273
diff
changeset
|
53 |
| 979 | 54 exec("nim build_dev --run tests/test_resources.nim") |
| 55 exec("nim build_dev_zip --run tests/test_resources.nim") | |
| 56 exec("nim build_dev_dir --run tests/test_resources.nim") | |
| 438 | 57 |
|
1140
5934c5615f13
did: update all examples to work with latest refactoring
sam <sam@basx.dev>
parents:
979
diff
changeset
|
58 task example_all, "Run all example programs": |
|
5934c5615f13
did: update all examples to work with latest refactoring
sam <sam@basx.dev>
parents:
979
diff
changeset
|
59 for file in listFiles("examples"): |
|
5934c5615f13
did: update all examples to work with latest refactoring
sam <sam@basx.dev>
parents:
979
diff
changeset
|
60 if file.endsWith(".nim"): |
|
5934c5615f13
did: update all examples to work with latest refactoring
sam <sam@basx.dev>
parents:
979
diff
changeset
|
61 exec(&"nim build_dev --run {file}") |
|
5934c5615f13
did: update all examples to work with latest refactoring
sam <sam@basx.dev>
parents:
979
diff
changeset
|
62 |
|
33
94c38e4b5782
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
24
diff
changeset
|
63 task publish, "publish all build": |
| 248 | 64 for file in listDirs("build/debug/linux"): |
| 252 | 65 exec(&"scp -r {file} sam@mail.basx.dev:/var/www/public.basx.dev/semicongine/debug/linux/") |
| 66 for file in listDirs("build/release/linux"): | |
| 67 exec(&"scp -r {file} sam@mail.basx.dev:/var/www/public.basx.dev/semicongine/release/linux/") | |
| 68 for file in listDirs("build/debug/windows"): | |
| 69 exec(&"scp -r {file} sam@mail.basx.dev:/var/www/public.basx.dev/semicongine/debug/windows/") | |
| 70 for file in listDirs("build/release/windows"): | |
| 71 exec(&"scp -r {file} sam@mail.basx.dev:/var/www/public.basx.dev/semicongine/release/windows/") | |
| 53 | 72 |
| 36 | 73 task glslangValidator, "Download glslangValidator (required for linux compilation)": |
|
62
7153eadb07eb
fix: some formatting, bug when opening on windows.
Sam <sam@basx.dev>
parents:
55
diff
changeset
|
74 let dirname = "/tmp/glslang_download" |
| 36 | 75 exec &"mkdir -p {dirname}" |
| 76 exec &"cd {dirname} && wget https://github.com/KhronosGroup/glslang/releases/download/master-tot/glslang-master-linux-Release.zip" | |
| 77 exec &"cd {dirname} && unzip *.zip" | |
| 78 exec &"mv {dirname}/bin/glslangValidator examples/" | |
| 79 exec &"rm -rf {dirname}" | |
| 80 | |
| 81 task glslangValidator_exe, "Download glslangValidator.exe (required for windows compilation)": | |
|
213
b5d9410a8184
add: resource packaging and loading for different resource types, simplify build commands, update readme
Sam <sam@basx.dev>
parents:
207
diff
changeset
|
82 # TODO: make this work on windows |
|
62
7153eadb07eb
fix: some formatting, bug when opening on windows.
Sam <sam@basx.dev>
parents:
55
diff
changeset
|
83 let dirname = "/tmp/glslang_download" |
| 36 | 84 exec &"mkdir -p {dirname}" |
| 85 exec &"cd {dirname} && wget https://github.com/KhronosGroup/glslang/releases/download/master-tot/glslang-master-windows-x64-Release.zip" | |
| 86 exec &"cd {dirname} && unzip *.zip" | |
| 87 exec &"mv {dirname}/bin/glslangValidator.exe examples/" | |
| 88 exec &"rm -rf {dirname}" | |
|
33
94c38e4b5782
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
24
diff
changeset
|
89 |
|
62
7153eadb07eb
fix: some formatting, bug when opening on windows.
Sam <sam@basx.dev>
parents:
55
diff
changeset
|
90 task run_all, "Run all binaries": |
| 39 | 91 for file in listFiles("build/debug/linux"): |
| 92 exec file | |
| 93 for file in listFiles("build/release/linux"): | |
| 94 exec file | |
| 95 for file in listFiles("build/debug/windows"): | |
| 96 exec &"wine {file}" | |
| 97 for file in listFiles("build/release/windows"): | |
| 98 exec &"wine {file}" | |
|
46
9e81f06a5c57
add: some changes to build on windows host
Sam <sam@basx.dev>
parents:
44
diff
changeset
|
99 |
|
78
f67496a189cb
add: vulkan api generator, not finished yet
Sam <sam@basx.dev>
parents:
62
diff
changeset
|
100 task get_vulkan_wrapper, "Download vulkan wrapper": |
|
f67496a189cb
add: vulkan api generator, not finished yet
Sam <sam@basx.dev>
parents:
62
diff
changeset
|
101 exec &"curl https://raw.githubusercontent.com/nimgl/nimgl/master/src/nimgl/vulkan.nim > src/semicongine/vulkan/c_api.nim" |
|
f67496a189cb
add: vulkan api generator, not finished yet
Sam <sam@basx.dev>
parents:
62
diff
changeset
|
102 |
|
f67496a189cb
add: vulkan api generator, not finished yet
Sam <sam@basx.dev>
parents:
62
diff
changeset
|
103 task generate_vulkan_api, "Generate Vulkan API": |
|
194
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
83
diff
changeset
|
104 selfExec &"c -d:ssl --run src/vulkan_api/vulkan_api_generator.nim" |
|
82
9e7937b7bcc8
did: complete vulkan api generator pipeline for now
Sam <sam@basx.dev>
parents:
78
diff
changeset
|
105 mkDir "src/semicongine/vulkan/" |
|
207
81fab407a479
add: some adjustment to the last refactoring :P
Sam <sam@basx.dev>
parents:
194
diff
changeset
|
106 mkDir "src/semicongine/core/" |
|
81fab407a479
add: some adjustment to the last refactoring :P
Sam <sam@basx.dev>
parents:
194
diff
changeset
|
107 cpFile "src/vulkan_api/output/api.nim", "src/semicongine/core/api.nim" |
|
82
9e7937b7bcc8
did: complete vulkan api generator pipeline for now
Sam <sam@basx.dev>
parents:
78
diff
changeset
|
108 cpDir "src/vulkan_api/output/platform", "src/semicongine/vulkan/platform" |
|
78
f67496a189cb
add: vulkan api generator, not finished yet
Sam <sam@basx.dev>
parents:
62
diff
changeset
|
109 |
|
46
9e81f06a5c57
add: some changes to build on windows host
Sam <sam@basx.dev>
parents:
44
diff
changeset
|
110 if getCommand() in ["c", "compile", "r", "dump", "check", "idetools"]: |
|
213
b5d9410a8184
add: resource packaging and loading for different resource types, simplify build commands, update readme
Sam <sam@basx.dev>
parents:
207
diff
changeset
|
111 if defined(linux): |
| 438 | 112 --d: VK_USE_PLATFORM_XLIB_KHR |
|
213
b5d9410a8184
add: resource packaging and loading for different resource types, simplify build commands, update readme
Sam <sam@basx.dev>
parents:
207
diff
changeset
|
113 if defined(windows): |
| 438 | 114 --d: VK_USE_PLATFORM_WIN32_KHR |
