comparison config.nims @ 1222:3c3d4d7a8ecd compiletime-tests

did: cleanup config file
author sam <sam@basx.dev>
date Wed, 17 Jul 2024 21:08:15 +0700
parents 2e0b527c2753
children 55896320c8bf
comparison
equal deleted inserted replaced
1221:000befd9479f 1222:3c3d4d7a8ecd
1 import std/strformat 1 import std/strformat
2 import std/strutils 2 import std/strutils
3 import std/os 3 import std/os
4 4
5 import semicongine/build 5 import semicongine/build
6
7 # TODO: totally update this file!!
8
9 switch("nimblePath", "nimbledeps/pkgs2")
10 switch("define", "nimPreviewHashRef")
11 6
12 task build_dev, "build dev": 7 task build_dev, "build dev":
13 semicongine_build_switches(buildname = "dev") 8 semicongine_build_switches(buildname = "dev")
14 setCommand "c" 9 setCommand "c"
15 let outdir = semicongine_builddir(buildname = "dev") 10 let outdir = semicongine_builddir(buildname = "dev")
53 48
54 exec("nim build_dev --run tests/test_resources.nim") 49 exec("nim build_dev --run tests/test_resources.nim")
55 exec("nim build_dev_zip --run tests/test_resources.nim") 50 exec("nim build_dev_zip --run tests/test_resources.nim")
56 exec("nim build_dev_dir --run tests/test_resources.nim") 51 exec("nim build_dev_dir --run tests/test_resources.nim")
57 52
58 task example_all, "Run all example programs":
59 for file in listFiles("examples"):
60 if file.endsWith(".nim"):
61 exec(&"nim build_dev --run {file}")
62
63 task publish, "publish all build":
64 for file in listDirs("build/debug/linux"):
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/")
72
73 task glslangValidator, "Download glslangValidator (required for linux compilation)":
74 let dirname = "/tmp/glslang_download"
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)":
82 # TODO: make this work on windows
83 let dirname = "/tmp/glslang_download"
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}"
89
90 task run_all, "Run all binaries": 53 task run_all, "Run all binaries":
91 for file in listFiles("build/debug/linux"): 54 for file in listFiles("build/debug/linux"):
92 exec file 55 exec file
93 for file in listFiles("build/release/linux"): 56 for file in listFiles("build/release/linux"):
94 exec file 57 exec file
95 for file in listFiles("build/debug/windows"): 58 for file in listFiles("build/debug/windows"):
96 exec &"wine {file}" 59 exec &"wine {file}"
97 for file in listFiles("build/release/windows"): 60 for file in listFiles("build/release/windows"):
98 exec &"wine {file}" 61 exec &"wine {file}"
99 62
100 task get_vulkan_wrapper, "Download vulkan wrapper":
101 exec &"curl https://raw.githubusercontent.com/nimgl/nimgl/master/src/nimgl/vulkan.nim > src/semicongine/vulkan/c_api.nim"
102
103 task generate_vulkan_api, "Generate Vulkan API":
104 selfExec &"c -d:ssl --run src/vulkan_api/vulkan_api_generator.nim"
105 mkDir "src/semicongine/vulkan/"
106 mkDir "src/semicongine/core/"
107 cpFile "src/vulkan_api/output/api.nim", "src/semicongine/core/api.nim"
108 cpDir "src/vulkan_api/output/platform", "src/semicongine/vulkan/platform"
109
110 if getCommand() in ["c", "compile", "r", "dump", "check", "idetools"]: 63 if getCommand() in ["c", "compile", "r", "dump", "check", "idetools"]:
111 if defined(linux): 64 if defined(linux):
112 --d: VK_USE_PLATFORM_XLIB_KHR 65 --d: VK_USE_PLATFORM_XLIB_KHR
113 if defined(windows): 66 if defined(windows):
114 --d: VK_USE_PLATFORM_WIN32_KHR 67 --d: VK_USE_PLATFORM_WIN32_KHR