Mercurial > games > semicongine
comparison Makefile @ 483:73a0954beabd
did: improve alotof_triangles example, remove glslang lib, use only binary, easier cross-compilation
author | Sam <sam@basx.dev> |
---|---|
date | Wed, 11 Jan 2023 00:43:17 +0700 |
parents | 1670f8e70964 |
children | 71bbe11d8de8 |
comparison
equal
deleted
inserted
replaced
482:1670f8e70964 | 483:73a0954beabd |
---|---|
1 SOURCES := $(shell find src -name '*.nim') | 1 SOURCES := $(shell find src -name '*.nim') |
2 | |
3 # HACK to get cross-compilation working -------------------------------- | |
4 | |
5 # anywhere with a windows filesystem that has the visual basic compiler tools installed | |
6 WINDOWS_BASE := /mnt | |
7 | |
8 # path variables, need to have correct versions | |
9 WINDOWS_PROGAMS := ${WINDOWS_BASE}/Program Files (x86) | |
10 MSVC_BUILDTOOLS_PATH := ${WINDOWS_PROGAMS}/Microsoft Visual Studio/2022/BuildTools/VC | |
11 WINDOWS_KIT_INCLUDE_BASE := ${WINDOWS_PROGAMS}/Windows Kits/10/Include/10.0.22000.0 | |
12 WINDOWS_KIT_LIBS_BASE := ${WINDOWS_PROGAMS}/Windows Kits/10/Lib/10.0.22000.0 | |
13 MSVC_PATH := ${MSVC_BUILDTOOLS_PATH}/Tools/MSVC/14.34.31933 | |
14 | |
15 MSVC_ADDITIONAL_PATH := ${MSVC_BUILDTOOLS_PATH}/Auxiliary/Build/ | |
16 CL_DIR := ${MSVC_PATH}/bin/Hostx64/x64/ | |
17 CL_INCL_DIR := ${MSVC_PATH}/include | |
18 WINE_NIM_VERSION := 1.6.10 | |
19 | |
20 # nim command: | |
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"' | |
22 | |
23 # end of HACK----------------------------------------------------------- | |
24 | |
25 | 2 |
26 # build hello_triangle | 3 # build hello_triangle |
27 build/debug/linux/hello_triangle: ${SOURCES} | 4 build/debug/linux/hello_triangle: ${SOURCES} |
28 nim build_linux_debug -o:$@ examples/hello_triangle.nim | 5 nim build_linux_debug -o:$@ examples/hello_triangle.nim |
29 build/release/linux/hello_triangle: ${SOURCES} | 6 build/release/linux/hello_triangle: ${SOURCES} |
30 nim build_linux_release -o:$@ examples/hello_triangle.nim | 7 nim build_linux_release -o:$@ examples/hello_triangle.nim |
31 build/debug/windows/hello_triangle.exe: ${SOURCES} build/nim_windows | 8 build/debug/windows/hello_triangle.exe: ${SOURCES} build/nim_windows |
32 ${WINE_NIM} build_windows_debug -o:$@ examples/hello_triangle.nim | 9 # ${WINE_NIM} build_windows_debug -o:$@ examples/hello_triangle.nim |
10 nim build_windows_debug -o:$@ examples/hello_triangle.nim | |
33 build/release/windows/hello_triangle.exe: ${SOURCES} build/nim_windows | 11 build/release/windows/hello_triangle.exe: ${SOURCES} build/nim_windows |
34 ${WINE_NIM} build_windows_release -o:$@ examples/hello_triangle.nim | 12 nim build_windows_release -o:$@ examples/hello_triangle.nim |
35 | 13 |
14 # build alotof_triangles | |
36 build/debug/linux/alotof_triangles: ${SOURCES} | 15 build/debug/linux/alotof_triangles: ${SOURCES} |
37 nim build_linux_debug -o:$@ examples/alotof_triangles.nim | 16 nim build_linux_debug -o:$@ examples/alotof_triangles.nim |
38 build/release/linux/alotof_triangles: ${SOURCES} | 17 build/release/linux/alotof_triangles: ${SOURCES} |
39 nim build_linux_release -o:$@ examples/alotof_triangles.nim | 18 nim build_linux_release -o:$@ examples/alotof_triangles.nim |
40 build/debug/windows/alotof_triangles.exe: ${SOURCES} build/nim_windows | 19 build/debug/windows/alotof_triangles.exe: ${SOURCES} build/nim_windows |
41 ${WINE_NIM} build_windows_debug -o:$@ examples/alotof_triangles.nim | 20 nim build_windows_debug -o:$@ examples/alotof_triangles.nim |
42 build/release/windows/alotof_triangles.exe: ${SOURCES} build/nim_windows | 21 build/release/windows/alotof_triangles.exe: ${SOURCES} build/nim_windows |
43 ${WINE_NIM} build_windows_release -o:$@ examples/alotof_triangles.nim | 22 nim build_windows_release -o:$@ examples/alotof_triangles.nim |
44 | 23 |
45 build_all_linux: build/debug/linux/hello_triangle build/release/linux/hello_triangle | 24 build_all_linux_hello_triangle: build/debug/linux/hello_triangle build/release/linux/hello_triangle |
46 build_all_windows: build/debug/windows/hello_triangle.exe build/release/windows/hello_triangle.exe | 25 build_all_windows_hello_triangle: build/debug/windows/hello_triangle.exe build/release/windows/hello_triangle.exe |
47 build_all: build_all_linux build_all_windows | 26 build_all_hello_triangle: build_all_linux_hello_triangle build_all_windows_hello_triangle |
27 | |
28 build_all_linux_alotof_triangles: build/debug/linux/alotof_triangles build/release/linux/alotof_triangles | |
29 build_all_windows_alotof_triangles: build/debug/windows/alotof_triangles.exe build/release/windows/alotof_triangles.exe | |
30 build_all_alotof_triangles: build_all_linux_alotof_triangles build_all_windows_alotof_triangles | |
48 | 31 |
49 # clean | 32 # clean |
50 clean: | 33 clean: |
51 rm -rf build | 34 rm -rf build |
52 # clean thirdparty too? | 35 rm -rf thirdparty |
53 | 36 |
54 .PHONY: tests | 37 .PHONY: tests |
38 .PHONY: glslang-master-linux-Debug.zip | |
39 .PHONY: glslang-master-linux-Release.zip | |
40 .PHONY: glslang-master-windows-x64-Debug.zip | |
41 .PHONY: glslang-master-windows-x64-Release.zip | |
55 | 42 |
56 # tests | 43 # tests |
57 tests: | 44 tests: |
58 testament p tests/ | 45 testament p tests/ |
59 | 46 |
60 # publish | 47 # publish |
61 publish_linux_debug: build/debug/linux/hello_triangle | 48 publish_linux_debug_hello_triangle: build/debug/linux/hello_triangle |
62 scp $< basx.dev:/var/www/public.basx.dev/joni/linux/debug/ | 49 scp $< basx.dev:/var/www/public.basx.dev/joni/linux/debug/ |
63 publish_linux_release: build/release/linux/hello_triangle | 50 publish_linux_release_hello_triangle: build/release/linux/hello_triangle |
64 scp $< basx.dev:/var/www/public.basx.dev/joni/linux/release/ | 51 scp $< basx.dev:/var/www/public.basx.dev/joni/linux/release/ |
65 publish_windows_debug: build/debug/linux/hello_triangle | 52 publish_windows_debug_hello_triangle: build/debug/linux/hello_triangle.exe |
66 scp $< basx.dev:/var/www/public.basx.dev/joni/windows/debug/ | 53 scp $< basx.dev:/var/www/public.basx.dev/joni/windows/debug/ |
67 publish_windows_release: build/release/linux/hello_triangle | 54 publish_windows_release_hello_triangle: build/release/linux/hello_triangle.exe |
68 scp $< basx.dev:/var/www/public.basx.dev/joni/windows/release/ | 55 scp $< basx.dev:/var/www/public.basx.dev/joni/windows/release/ |
56 publish_all_linux_hello_triangle: publish_linux_debug_hello_triangle publish_linux_release_hello_triangle | |
57 publish_all_windows_hello_triangle: publish_windows_debug_hello_triangle publish_windows_release_hello_triangle | |
58 publish_all_alotof_hello_triangle: publish_all_linux_hello_triangle publish_all_windows_hello_triangle | |
69 | 59 |
70 publish_all_linux: publish_linux_debug publish_linux_release | 60 publish_linux_debug_alotof_triangles: build/debug/linux/alotof_triangles |
71 publish_all_windows: publish_windows_debug publish_windows_release | 61 scp $< basx.dev:/var/www/public.basx.dev/joni/linux/debug/ |
72 publish_all: publish_all_linux publish_all_windows | 62 publish_linux_release_alotof_triangles: build/release/linux/alotof_triangles |
63 scp $< basx.dev:/var/www/public.basx.dev/joni/linux/release/ | |
64 publish_windows_debug_alotof_triangles: build/debug/linux/alotof_triangles.exe | |
65 scp $< basx.dev:/var/www/public.basx.dev/joni/windows/debug/ | |
66 publish_windows_release_alotof_triangles: build/release/linux/alotof_triangles.exe | |
67 scp $< basx.dev:/var/www/public.basx.dev/joni/windows/release/ | |
68 publish_all_linux_alotof_triangles: publish_linux_debug_alotof_triangles publish_linux_release_alotof_triangles | |
69 publish_all_windows_alotof_triangles: publish_windows_debug_alotof_triangles publish_windows_release_alotof_triangles | |
70 publish_all_alotof_triangles: publish_all_linux_alotof_triangles publish_all_windows_alotof_triangles | |
73 | 71 |
74 | 72 |
75 # download thirdparty-libraries | 73 # download thirdparty-libraries |
76 | 74 |
77 thirdparty/lib/glslang/linux_debug: | 75 thirdparty/bin/linux: glslang-master-linux-Release.zip |
78 mkdir -p $@ | 76 mkdir -p $@ |
79 wget --directory-prefix=$@ https://github.com/KhronosGroup/glslang/releases/download/master-tot/glslang-master-linux-Debug.zip | 77 cd $@ && wget https://github.com/KhronosGroup/glslang/releases/download/master-tot/$< |
80 unzip glslang-master-linux-Debug.zip -d $@ | 78 cd $@ && unzip $< |
81 thirdparty/lib/glslang/linux_release: | 79 cd $@ && mv bin/* . |
80 cd $@ && rm -rf $< bin lib include | |
81 thirdparty/bin/windows: glslang-master-windows-x64-Release.zip | |
82 mkdir -p $@ | 82 mkdir -p $@ |
83 wget --directory-prefix=$@ https://github.com/KhronosGroup/glslang/releases/download/master-tot/glslang-master-linux-Release.zip | 83 cd $@ && wget https://github.com/KhronosGroup/glslang/releases/download/master-tot/$< |
84 unzip glslang-master-linux-Release.zip -d $@ | 84 cd $@ && unzip $< |
85 thirdparty/lib/glslang/windows_debug: | 85 cd $@ && mv bin/* . |
86 mkdir -p $@ | 86 cd $@ && rm -rf $< bin lib include |
87 wget --directory-prefix=$@ https://github.com/KhronosGroup/glslang/releases/download/master-tot/glslang-master-windows-x64-Debug.zip | |
88 unzip glslang-master-windows-x64-Debug.zip -d $@ | |
89 thirdparty/lib/glslang/windows_release: | |
90 mkdir -p $@ | |
91 wget --directory-prefix=$@ https://github.com/KhronosGroup/glslang/releases/download/master-tot/glslang-master-windows-x64-Release.zip | |
92 unzip glslang-master-windows-x64-Release.zip -d $@ | |
93 | |
94 thirdparty/lib/spirv-tools/linux_debug: | |
95 mkdir -p $@ | |
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 | |
97 tar --directory $@ -xf $@/install.tgz | |
98 thirdparty/lib/spirv-tools/linux_release: | |
99 mkdir -p $@ | |
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 | |
101 tar --directory $@ -xf $@/install.tgz | |
102 thirdparty/lib/spirv-tools/windows_debug: | |
103 mkdir -p $@ | |
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 | |
105 unzip $@/install.zip -d $@ | |
106 thirdparty/lib/spirv-tools/windows_release: | |
107 mkdir -p $@ | |
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 | |
109 unzip $@/install.zip -d $@ | |
110 | |
111 # set up cross compilation to compile for windows on linux | |
112 build/nim_windows/: | |
113 mkdir -p build/nim_windows | |
114 wget --directory-prefix=$@ https://nim-lang.org/download/nim-${WINE_NIM_VERSION}_x64.zip | |
115 unzip $@/nim-${WINE_NIM_VERSION}_x64.zip -d $@ |