annotate Makefile @ 16:617c6dcddbe2

add: matrix multiplications, tests
author Sam <sam@basx.dev>
date Fri, 30 Dec 2022 15:56:17 +0700
parents dde536a70483
children 90e117952f74
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
5daf3f236d87 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
1 SOURCES := $(shell find src -name '*.nim')
10
0660ba9d1930 did: make it work on windows
sam <sam@basx.dev>
parents: 8
diff changeset
2 COMPILE_OPTIONS := --path:src --mm:orc --experimental:strictEffects --threads:on --app:gui
2
213fdf8d31dd did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents: 1
diff changeset
3 DEBUG_OPTIONS := --debugger:native --checks:on --assertions:on
213fdf8d31dd did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents: 1
diff changeset
4 RELEASE_OPTIONS := -d:release --checks:off --assertions:off
15
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
5 WINDOWS_DEBUG_OPTIONS := --cc:vcc --passC:'/MDd' --passL:'ucrtd.lib'
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
6 WINDOWS_RELEASE_OPTIONS := --cc:vcc --passC:'/MD' --passL:'ucrt.lib'
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
7
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
8 # HACK to get cross-compilation working --------------------------------
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
9
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
10 # anywhere with a windows filesystem that has the visual basic compiler tools installed
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
11 WINDOWS_BASE := /mnt
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
12
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
13 # path variables, need to have correct versions
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
14 WINDOWS_PROGAMS := ${WINDOWS_BASE}/Program Files (x86)
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
15 MSVC_BUILDTOOLS_PATH := ${WINDOWS_PROGAMS}/Microsoft Visual Studio/2022/BuildTools/VC
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
16 WINDOWS_KIT_INCLUDE_BASE := ${WINDOWS_PROGAMS}/Windows Kits/10/Include/10.0.22000.0
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
17 WINDOWS_KIT_LIBS_BASE := ${WINDOWS_PROGAMS}/Windows Kits/10/Lib/10.0.22000.0
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
18 MSVC_PATH := ${MSVC_BUILDTOOLS_PATH}/Tools/MSVC/14.34.31933
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
19
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
20 MSVC_ADDITIONAL_PATH := ${MSVC_BUILDTOOLS_PATH}/Auxiliary/Build/
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
21 CL_DIR := ${MSVC_PATH}/bin/Hostx64/x64/
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
22 CL_INCL_DIR := ${MSVC_PATH}/include
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
23 WINE_NIM_VERSION := 1.6.10
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
24
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
25 # nim command:
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
26 WINE_NIM := WINEPATH="${CL_DIR}" wine ./build/nim_windows/nim-${WINE_NIM_VERSION}/bin/nim.exe --path:"${MSVC_ADDITIONAL_PATH}" --path:"${CL_INCL_DIR}" --passC:'/I "${CL_INCL_DIR}"' --passC:'/I "${WINDOWS_KIT_INCLUDE_BASE}/ucrt"' --passC:'/I "${WINDOWS_KIT_INCLUDE_BASE}/um"' --passC:'/I "${WINDOWS_KIT_INCLUDE_BASE}/shared"' --passL:'/LIBPATH:"${WINDOWS_KIT_LIBS_BASE}/ucrt/x64"' --passL:'/LIBPATH:"${WINDOWS_KIT_LIBS_BASE}/um/x64"' --passL:'/LIBPATH:"${MSVC_PATH}/lib/x64"'
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
27
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
28 # end of HACK-----------------------------------------------------------
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
29
0
5daf3f236d87 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
30
13
a571db114152 add: vector/matrix modules, tests, nim config script
Sam <sam@basx.dev>
parents: 12
diff changeset
31 make_dirs:
a571db114152 add: vector/matrix modules, tests, nim config script
Sam <sam@basx.dev>
parents: 12
diff changeset
32 mkdir -p build/debug/linux
a571db114152 add: vector/matrix modules, tests, nim config script
Sam <sam@basx.dev>
parents: 12
diff changeset
33 mkdir -p build/release/linux
a571db114152 add: vector/matrix modules, tests, nim config script
Sam <sam@basx.dev>
parents: 12
diff changeset
34 mkdir -p build/debug/windows
a571db114152 add: vector/matrix modules, tests, nim config script
Sam <sam@basx.dev>
parents: 12
diff changeset
35 mkdir -p build/release/windows
a571db114152 add: vector/matrix modules, tests, nim config script
Sam <sam@basx.dev>
parents: 12
diff changeset
36
a571db114152 add: vector/matrix modules, tests, nim config script
Sam <sam@basx.dev>
parents: 12
diff changeset
37 # build hello_triangle
a571db114152 add: vector/matrix modules, tests, nim config script
Sam <sam@basx.dev>
parents: 12
diff changeset
38 build/debug/linux/hello_triangle: ${SOURCES} make_dirs
12
9e5fe647ff91 did: cleanup up a bit
Sam <sam@basx.dev>
parents: 10
diff changeset
39 nim c ${COMPILE_OPTIONS} ${DEBUG_OPTIONS} -o:$@ examples/hello_triangle.nim
13
a571db114152 add: vector/matrix modules, tests, nim config script
Sam <sam@basx.dev>
parents: 12
diff changeset
40 build/release/linux/hello_triangle: ${SOURCES} make_dirs
12
9e5fe647ff91 did: cleanup up a bit
Sam <sam@basx.dev>
parents: 10
diff changeset
41 nim c ${COMPILE_OPTIONS} ${RELEASE_OPTIONS} -o:$@ examples/hello_triangle.nim
15
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
42 build/debug/windows/hello_triangle.exe: ${SOURCES} make_dirs build/nim_windows
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
43 ${WINE_NIM} c ${COMPILE_OPTIONS} ${DEBUG_OPTIONS} ${WINDOWS_DEBUG_OPTIONS} -o:$@ examples/hello_triangle.nim
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
44 build/release/windows/hello_triangle.exe: ${SOURCES} make_dirs build/nim_windows
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
45 ${WINE_NIM} c ${COMPILE_OPTIONS} ${RELEASE_OPTIONS} ${WINDOWS_RELEASE_OPTIONS} -o:$@ examples/hello_triangle.nim
2
213fdf8d31dd did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents: 1
diff changeset
46
12
9e5fe647ff91 did: cleanup up a bit
Sam <sam@basx.dev>
parents: 10
diff changeset
47 build_all_linux: build/debug/linux/hello_triangle build/release/linux/hello_triangle
9e5fe647ff91 did: cleanup up a bit
Sam <sam@basx.dev>
parents: 10
diff changeset
48 build_all_windows: build/debug/windows/hello_triangle.exe build/release/windows/hello_triangle.exe
13
a571db114152 add: vector/matrix modules, tests, nim config script
Sam <sam@basx.dev>
parents: 12
diff changeset
49 build_all: build_all_linux build_all_windows
8
1134f41a49e9 add: a few missing changes
Sam <sam@basx.dev>
parents: 5
diff changeset
50
15
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
51 # clean
12
9e5fe647ff91 did: cleanup up a bit
Sam <sam@basx.dev>
parents: 10
diff changeset
52 clean:
9e5fe647ff91 did: cleanup up a bit
Sam <sam@basx.dev>
parents: 10
diff changeset
53 rm -rf build
15
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
54 # clean thirdparty too?
12
9e5fe647ff91 did: cleanup up a bit
Sam <sam@basx.dev>
parents: 10
diff changeset
55
16
617c6dcddbe2 add: matrix multiplications, tests
Sam <sam@basx.dev>
parents: 15
diff changeset
56 .PHONY: tests
617c6dcddbe2 add: matrix multiplications, tests
Sam <sam@basx.dev>
parents: 15
diff changeset
57
15
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
58 # tests
13
a571db114152 add: vector/matrix modules, tests, nim config script
Sam <sam@basx.dev>
parents: 12
diff changeset
59 tests:
a571db114152 add: vector/matrix modules, tests, nim config script
Sam <sam@basx.dev>
parents: 12
diff changeset
60 testament p tests/
a571db114152 add: vector/matrix modules, tests, nim config script
Sam <sam@basx.dev>
parents: 12
diff changeset
61
5
4ed9cb098315 add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 3
diff changeset
62 # publish
12
9e5fe647ff91 did: cleanup up a bit
Sam <sam@basx.dev>
parents: 10
diff changeset
63 publish_linux_debug: build/debug/linux/hello_triangle
5
4ed9cb098315 add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 3
diff changeset
64 scp $< basx.dev:/var/www/public.basx.dev/joni/linux/debug/
12
9e5fe647ff91 did: cleanup up a bit
Sam <sam@basx.dev>
parents: 10
diff changeset
65 publish_linux_release: build/release/linux/hello_triangle
5
4ed9cb098315 add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 3
diff changeset
66 scp $< basx.dev:/var/www/public.basx.dev/joni/linux/release/
12
9e5fe647ff91 did: cleanup up a bit
Sam <sam@basx.dev>
parents: 10
diff changeset
67 publish_windows_debug: build/debug/linux/hello_triangle
5
4ed9cb098315 add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 3
diff changeset
68 scp $< basx.dev:/var/www/public.basx.dev/joni/windows/debug/
12
9e5fe647ff91 did: cleanup up a bit
Sam <sam@basx.dev>
parents: 10
diff changeset
69 publish_windows_release: build/release/linux/hello_triangle
5
4ed9cb098315 add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 3
diff changeset
70 scp $< basx.dev:/var/www/public.basx.dev/joni/windows/release/
4ed9cb098315 add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 3
diff changeset
71
15
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
72 publish_all_linux: publish_linux_debug publish_linux_release
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
73 publish_all_windows: publish_windows_debug publish_windows_release
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
74 publish_all: publish_all_linux publish_all_windows
5
4ed9cb098315 add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 3
diff changeset
75
4ed9cb098315 add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 3
diff changeset
76
4ed9cb098315 add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 3
diff changeset
77 # download thirdparty-libraries
2
213fdf8d31dd did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents: 1
diff changeset
78
5
4ed9cb098315 add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 3
diff changeset
79 thirdparty/lib/glslang/linux_debug:
4ed9cb098315 add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 3
diff changeset
80 mkdir -p $@
4ed9cb098315 add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 3
diff changeset
81 wget --directory-prefix=$@ https://github.com/KhronosGroup/glslang/releases/download/master-tot/glslang-master-linux-Debug.zip
15
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
82 unzip glslang-master-linux-Debug.zip -d $@
5
4ed9cb098315 add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 3
diff changeset
83 thirdparty/lib/glslang/linux_release:
4ed9cb098315 add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 3
diff changeset
84 mkdir -p $@
4ed9cb098315 add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 3
diff changeset
85 wget --directory-prefix=$@ https://github.com/KhronosGroup/glslang/releases/download/master-tot/glslang-master-linux-Release.zip
15
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
86 unzip glslang-master-linux-Release.zip -d $@
5
4ed9cb098315 add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 3
diff changeset
87 thirdparty/lib/glslang/windows_debug:
4ed9cb098315 add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 3
diff changeset
88 mkdir -p $@
4ed9cb098315 add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 3
diff changeset
89 wget --directory-prefix=$@ https://github.com/KhronosGroup/glslang/releases/download/master-tot/glslang-master-windows-x64-Debug.zip
15
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
90 unzip glslang-master-windows-x64-Debug.zip -d $@
5
4ed9cb098315 add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 3
diff changeset
91 thirdparty/lib/glslang/windows_release:
4ed9cb098315 add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 3
diff changeset
92 mkdir -p $@
4ed9cb098315 add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 3
diff changeset
93 wget --directory-prefix=$@ https://github.com/KhronosGroup/glslang/releases/download/master-tot/glslang-master-windows-x64-Release.zip
15
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
94 unzip glslang-master-windows-x64-Release.zip -d $@
3
5d54ef652619 add: skeleton to download thirdparty builds
Sam <sam@basx.dev>
parents: 2
diff changeset
95
5
4ed9cb098315 add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 3
diff changeset
96 thirdparty/lib/spirv-tools/linux_debug:
4ed9cb098315 add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 3
diff changeset
97 mkdir -p $@
4ed9cb098315 add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 3
diff changeset
98 wget --directory-prefix=$@ https://storage.googleapis.com/spirv-tools/artifacts/prod/graphics_shader_compiler/spirv-tools/linux-gcc-debug/continuous/1899/20221216-081758/install.tgz
15
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
99 tar --directory $@ -xf $@/install.tgz
5
4ed9cb098315 add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 3
diff changeset
100 thirdparty/lib/spirv-tools/linux_release:
4ed9cb098315 add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 3
diff changeset
101 mkdir -p $@
4ed9cb098315 add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 3
diff changeset
102 wget --directory-prefix=$@ https://storage.googleapis.com/spirv-tools/artifacts/prod/graphics_shader_compiler/spirv-tools/linux-gcc-release/continuous/1889/20221216-081754/install.tgz
15
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
103 tar --directory $@ -xf $@/install.tgz
5
4ed9cb098315 add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 3
diff changeset
104 thirdparty/lib/spirv-tools/windows_debug:
4ed9cb098315 add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 3
diff changeset
105 mkdir -p $@
4ed9cb098315 add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 3
diff changeset
106 wget --directory-prefix=$@ https://storage.googleapis.com/spirv-tools/artifacts/prod/graphics_shader_compiler/spirv-tools/windows-msvc-2017-debug/continuous/1599/20221216-081803/install.zip
15
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
107 unzip $@/install.zip -d $@
5
4ed9cb098315 add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 3
diff changeset
108 thirdparty/lib/spirv-tools/windows_release:
4ed9cb098315 add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 3
diff changeset
109 mkdir -p $@
4ed9cb098315 add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 3
diff changeset
110 wget --directory-prefix=$@ https://storage.googleapis.com/spirv-tools/artifacts/prod/graphics_shader_compiler/spirv-tools/windows-msvc-2017-release/continuous/1885/20221216-081805/install.zip
15
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
111 unzip $@/install.zip -d $@
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
112
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
113 # set up cross compilation to compile for windows on linux
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
114 build/nim_windows/:
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
115 mkdir -p build/nim_windows
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
116 wget --directory-prefix=$@ https://nim-lang.org/download/nim-${WINE_NIM_VERSION}_x64.zip
dde536a70483 add: windows builds
Sam <sam@basx.dev>
parents: 13
diff changeset
117 unzip $@/nim-${WINE_NIM_VERSION}_x64.zip -d $@