annotate Makefile @ 482:1670f8e70964

add: clean examples, update build configs
author Sam <sam@basx.dev>
date Tue, 10 Jan 2023 00:24:37 +0700
parents 16842d15319a
children b45a5d338cd0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
461
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
1 SOURCES := $(shell find src -name '*.nim')
476
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
2
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
3 # HACK to get cross-compilation working --------------------------------
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
4
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
5 # anywhere with a windows filesystem that has the visual basic compiler tools installed
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
6 WINDOWS_BASE := /mnt
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
7
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
8 # path variables, need to have correct versions
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
9 WINDOWS_PROGAMS := ${WINDOWS_BASE}/Program Files (x86)
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
10 MSVC_BUILDTOOLS_PATH := ${WINDOWS_PROGAMS}/Microsoft Visual Studio/2022/BuildTools/VC
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
11 WINDOWS_KIT_INCLUDE_BASE := ${WINDOWS_PROGAMS}/Windows Kits/10/Include/10.0.22000.0
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
12 WINDOWS_KIT_LIBS_BASE := ${WINDOWS_PROGAMS}/Windows Kits/10/Lib/10.0.22000.0
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
13 MSVC_PATH := ${MSVC_BUILDTOOLS_PATH}/Tools/MSVC/14.34.31933
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
14
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
15 MSVC_ADDITIONAL_PATH := ${MSVC_BUILDTOOLS_PATH}/Auxiliary/Build/
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
16 CL_DIR := ${MSVC_PATH}/bin/Hostx64/x64/
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
17 CL_INCL_DIR := ${MSVC_PATH}/include
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
18 WINE_NIM_VERSION := 1.6.10
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
19
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
20 # nim command:
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
21 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"'
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
22
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
23 # end of HACK-----------------------------------------------------------
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
24
461
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
25
474
d4750f2e0760 add: vector/matrix modules, tests, nim config script
Sam <sam@basx.dev>
parents: 473
diff changeset
26 # build hello_triangle
479
16842d15319a add: basic vertex buffer functionality
Sam <sam@basx.dev>
parents: 477
diff changeset
27 build/debug/linux/hello_triangle: ${SOURCES}
482
1670f8e70964 add: clean examples, update build configs
Sam <sam@basx.dev>
parents: 479
diff changeset
28 nim build_linux_debug -o:$@ examples/hello_triangle.nim
479
16842d15319a add: basic vertex buffer functionality
Sam <sam@basx.dev>
parents: 477
diff changeset
29 build/release/linux/hello_triangle: ${SOURCES}
482
1670f8e70964 add: clean examples, update build configs
Sam <sam@basx.dev>
parents: 479
diff changeset
30 nim build_linux_release -o:$@ examples/hello_triangle.nim
1670f8e70964 add: clean examples, update build configs
Sam <sam@basx.dev>
parents: 479
diff changeset
31 build/debug/windows/hello_triangle.exe: ${SOURCES} build/nim_windows
1670f8e70964 add: clean examples, update build configs
Sam <sam@basx.dev>
parents: 479
diff changeset
32 ${WINE_NIM} build_windows_debug -o:$@ examples/hello_triangle.nim
479
16842d15319a add: basic vertex buffer functionality
Sam <sam@basx.dev>
parents: 477
diff changeset
33 build/release/windows/hello_triangle.exe: ${SOURCES} build/nim_windows
482
1670f8e70964 add: clean examples, update build configs
Sam <sam@basx.dev>
parents: 479
diff changeset
34 ${WINE_NIM} build_windows_release -o:$@ examples/hello_triangle.nim
1670f8e70964 add: clean examples, update build configs
Sam <sam@basx.dev>
parents: 479
diff changeset
35
1670f8e70964 add: clean examples, update build configs
Sam <sam@basx.dev>
parents: 479
diff changeset
36 build/debug/linux/alotof_triangles: ${SOURCES}
1670f8e70964 add: clean examples, update build configs
Sam <sam@basx.dev>
parents: 479
diff changeset
37 nim build_linux_debug -o:$@ examples/alotof_triangles.nim
1670f8e70964 add: clean examples, update build configs
Sam <sam@basx.dev>
parents: 479
diff changeset
38 build/release/linux/alotof_triangles: ${SOURCES}
1670f8e70964 add: clean examples, update build configs
Sam <sam@basx.dev>
parents: 479
diff changeset
39 nim build_linux_release -o:$@ examples/alotof_triangles.nim
1670f8e70964 add: clean examples, update build configs
Sam <sam@basx.dev>
parents: 479
diff changeset
40 build/debug/windows/alotof_triangles.exe: ${SOURCES} build/nim_windows
1670f8e70964 add: clean examples, update build configs
Sam <sam@basx.dev>
parents: 479
diff changeset
41 ${WINE_NIM} build_windows_debug -o:$@ examples/alotof_triangles.nim
1670f8e70964 add: clean examples, update build configs
Sam <sam@basx.dev>
parents: 479
diff changeset
42 build/release/windows/alotof_triangles.exe: ${SOURCES} build/nim_windows
1670f8e70964 add: clean examples, update build configs
Sam <sam@basx.dev>
parents: 479
diff changeset
43 ${WINE_NIM} build_windows_release -o:$@ examples/alotof_triangles.nim
463
91544fc1afe5 did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents: 462
diff changeset
44
473
04b8471bdab4 did: cleanup up a bit
Sam <sam@basx.dev>
parents: 471
diff changeset
45 build_all_linux: build/debug/linux/hello_triangle build/release/linux/hello_triangle
04b8471bdab4 did: cleanup up a bit
Sam <sam@basx.dev>
parents: 471
diff changeset
46 build_all_windows: build/debug/windows/hello_triangle.exe build/release/windows/hello_triangle.exe
474
d4750f2e0760 add: vector/matrix modules, tests, nim config script
Sam <sam@basx.dev>
parents: 473
diff changeset
47 build_all: build_all_linux build_all_windows
469
ed49f1cdd8b7 add: a few missing changes
Sam <sam@basx.dev>
parents: 466
diff changeset
48
476
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
49 # clean
473
04b8471bdab4 did: cleanup up a bit
Sam <sam@basx.dev>
parents: 471
diff changeset
50 clean:
04b8471bdab4 did: cleanup up a bit
Sam <sam@basx.dev>
parents: 471
diff changeset
51 rm -rf build
476
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
52 # clean thirdparty too?
473
04b8471bdab4 did: cleanup up a bit
Sam <sam@basx.dev>
parents: 471
diff changeset
53
477
f226c99b5043 add: matrix multiplications, tests
Sam <sam@basx.dev>
parents: 476
diff changeset
54 .PHONY: tests
f226c99b5043 add: matrix multiplications, tests
Sam <sam@basx.dev>
parents: 476
diff changeset
55
476
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
56 # tests
474
d4750f2e0760 add: vector/matrix modules, tests, nim config script
Sam <sam@basx.dev>
parents: 473
diff changeset
57 tests:
d4750f2e0760 add: vector/matrix modules, tests, nim config script
Sam <sam@basx.dev>
parents: 473
diff changeset
58 testament p tests/
d4750f2e0760 add: vector/matrix modules, tests, nim config script
Sam <sam@basx.dev>
parents: 473
diff changeset
59
466
1dd9e2393a9e add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 464
diff changeset
60 # publish
473
04b8471bdab4 did: cleanup up a bit
Sam <sam@basx.dev>
parents: 471
diff changeset
61 publish_linux_debug: build/debug/linux/hello_triangle
466
1dd9e2393a9e add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 464
diff changeset
62 scp $< basx.dev:/var/www/public.basx.dev/joni/linux/debug/
473
04b8471bdab4 did: cleanup up a bit
Sam <sam@basx.dev>
parents: 471
diff changeset
63 publish_linux_release: build/release/linux/hello_triangle
466
1dd9e2393a9e add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 464
diff changeset
64 scp $< basx.dev:/var/www/public.basx.dev/joni/linux/release/
473
04b8471bdab4 did: cleanup up a bit
Sam <sam@basx.dev>
parents: 471
diff changeset
65 publish_windows_debug: build/debug/linux/hello_triangle
466
1dd9e2393a9e add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 464
diff changeset
66 scp $< basx.dev:/var/www/public.basx.dev/joni/windows/debug/
473
04b8471bdab4 did: cleanup up a bit
Sam <sam@basx.dev>
parents: 471
diff changeset
67 publish_windows_release: build/release/linux/hello_triangle
466
1dd9e2393a9e add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 464
diff changeset
68 scp $< basx.dev:/var/www/public.basx.dev/joni/windows/release/
1dd9e2393a9e add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 464
diff changeset
69
476
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
70 publish_all_linux: publish_linux_debug publish_linux_release
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
71 publish_all_windows: publish_windows_debug publish_windows_release
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
72 publish_all: publish_all_linux publish_all_windows
466
1dd9e2393a9e add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 464
diff changeset
73
1dd9e2393a9e add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 464
diff changeset
74
1dd9e2393a9e add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 464
diff changeset
75 # download thirdparty-libraries
463
91544fc1afe5 did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents: 462
diff changeset
76
466
1dd9e2393a9e add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 464
diff changeset
77 thirdparty/lib/glslang/linux_debug:
1dd9e2393a9e add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 464
diff changeset
78 mkdir -p $@
1dd9e2393a9e add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 464
diff changeset
79 wget --directory-prefix=$@ https://github.com/KhronosGroup/glslang/releases/download/master-tot/glslang-master-linux-Debug.zip
476
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
80 unzip glslang-master-linux-Debug.zip -d $@
466
1dd9e2393a9e add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 464
diff changeset
81 thirdparty/lib/glslang/linux_release:
1dd9e2393a9e add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 464
diff changeset
82 mkdir -p $@
1dd9e2393a9e add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 464
diff changeset
83 wget --directory-prefix=$@ https://github.com/KhronosGroup/glslang/releases/download/master-tot/glslang-master-linux-Release.zip
476
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
84 unzip glslang-master-linux-Release.zip -d $@
466
1dd9e2393a9e add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 464
diff changeset
85 thirdparty/lib/glslang/windows_debug:
1dd9e2393a9e add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 464
diff changeset
86 mkdir -p $@
1dd9e2393a9e add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 464
diff changeset
87 wget --directory-prefix=$@ https://github.com/KhronosGroup/glslang/releases/download/master-tot/glslang-master-windows-x64-Debug.zip
476
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
88 unzip glslang-master-windows-x64-Debug.zip -d $@
466
1dd9e2393a9e add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 464
diff changeset
89 thirdparty/lib/glslang/windows_release:
1dd9e2393a9e add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 464
diff changeset
90 mkdir -p $@
1dd9e2393a9e add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 464
diff changeset
91 wget --directory-prefix=$@ https://github.com/KhronosGroup/glslang/releases/download/master-tot/glslang-master-windows-x64-Release.zip
476
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
92 unzip glslang-master-windows-x64-Release.zip -d $@
464
7cae1900c9a7 add: skeleton to download thirdparty builds
Sam <sam@basx.dev>
parents: 463
diff changeset
93
466
1dd9e2393a9e add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 464
diff changeset
94 thirdparty/lib/spirv-tools/linux_debug:
1dd9e2393a9e add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 464
diff changeset
95 mkdir -p $@
1dd9e2393a9e add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 464
diff changeset
96 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
476
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
97 tar --directory $@ -xf $@/install.tgz
466
1dd9e2393a9e add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 464
diff changeset
98 thirdparty/lib/spirv-tools/linux_release:
1dd9e2393a9e add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 464
diff changeset
99 mkdir -p $@
1dd9e2393a9e add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 464
diff changeset
100 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
476
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
101 tar --directory $@ -xf $@/install.tgz
466
1dd9e2393a9e add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 464
diff changeset
102 thirdparty/lib/spirv-tools/windows_debug:
1dd9e2393a9e add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 464
diff changeset
103 mkdir -p $@
1dd9e2393a9e add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 464
diff changeset
104 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
476
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
105 unzip $@/install.zip -d $@
466
1dd9e2393a9e add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 464
diff changeset
106 thirdparty/lib/spirv-tools/windows_release:
1dd9e2393a9e add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 464
diff changeset
107 mkdir -p $@
1dd9e2393a9e add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents: 464
diff changeset
108 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
476
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
109 unzip $@/install.zip -d $@
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
110
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
111 # set up cross compilation to compile for windows on linux
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
112 build/nim_windows/:
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
113 mkdir -p build/nim_windows
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
114 wget --directory-prefix=$@ https://nim-lang.org/download/nim-${WINE_NIM_VERSION}_x64.zip
6862ca8c1324 add: windows builds
Sam <sam@basx.dev>
parents: 474
diff changeset
115 unzip $@/nim-${WINE_NIM_VERSION}_x64.zip -d $@