Graphics library for Mercury, including OpenGL bindings, TGA image reading, and X11, Win32, and SDL2 windowing and input.
リビジョン | ad3408cff609fc39360047613287558b48af2d6f (tree) |
---|---|
日時 | 2022-03-14 06:48:29 |
作者 | AlaskanEmily <emily@alas...> |
コミッター | AlaskanEmily |
Add NMake file for MSVC builds
@@ -0,0 +1,129 @@ | ||
1 | +# Microsoft NMake makefile to build Saffron. | |
2 | + | |
3 | +CFLAGS=/nologo /O2 /EHsc /GR- | |
4 | +!IFNDEF MMC | |
5 | +MMC=mercury | |
6 | +!ENDIF | |
7 | +!IFDEF GRADE | |
8 | +GRADE_OPT=--grade=$(GRADE) | |
9 | +!ENDIF | |
10 | +!IFDEF PARALLEL | |
11 | +PARALLEL_OPT=-j $(PARALLEL) | |
12 | +!ENDIF | |
13 | + | |
14 | +.SUFFIXES: | |
15 | + | |
16 | +MMC_OPTS=--use-grade-subdirs --intermodule-optimization -O 7 --output-compile-error-lines 1024 --cflag /DGLOW_DLL | |
17 | +SAFFRON_MMC_OPTS=$(MMC_OPTS) $(GRADE_OPT) $(PARALLEL_OPT) | |
18 | + | |
19 | +ALL=build_saffron | |
20 | +all: $(ALL) | |
21 | + | |
22 | +UTILS=build_saffron_window build_saffron_glow build_saffron_tga | |
23 | +utils: $(UTILS) | |
24 | + | |
25 | +DEMOS=build_saffron_cube_demo | |
26 | +demos: $(DEMOS) | |
27 | + | |
28 | +MMATH_LINK_FLAGS=--search-lib-files-dir "$(MAKEDIR)\mmath" --init-file "$(MAKEDIR)\mmath\mmath.init" | |
29 | +# Used for utils, tests, and demos. That's why it requires the ROOT variable to be set in shell. | |
30 | +SAFFRON_LINK_FLAGS=--search-lib-files-dir "$(MAKEDIR)" --init-file "$(MAKEDIR)\saffron.init" | |
31 | +GLOW_INCLUDE_FLAGS=--c-include-dir "$(MAKEDIR)\glow" | |
32 | +# Transunit, used for testing. | |
33 | +TRANSUNIT_LINK_FLAGS=--search-lib-files-dir "$(MAKEDIR)\test\transunit" --init-file "$(MAKEDIR)\test\transunit\transunit.init" --link-object "$(MAKEDIR)\test\transunit\transunit.lib" | |
34 | +# TGA, used for some demos and has its own tests. | |
35 | +SAFFRON_TGA_LINK_FLAGS=--search-lib-files-dir "$(MAKEDIR)\util\tga" --init-file "$(MAKEDIR)\util\tga\saffron_tga.init" | |
36 | +SAFFRON_GLOW_LINK_FLAGS=--search-lib-files-dir "$(MAKEDIR)\util\glow" --init-file "$(MAKEDIR)\util\glow\saffron_glow.init" $(GLOW_INCLUDE_FLAGS) | |
37 | +SAFFRON_WINDOW_LINK_FLAGS=--search-lib-files-dir "$(MAKEDIR)\util\window" --init-file "$(MAKEDIR)\util\window\saffron_window.init" | |
38 | + | |
39 | +# Primary libraries. | |
40 | +# Note that, for compatibility with older Mercury compilers, we try to copy XYZ.lib to libXYZ.lib. | |
41 | +saffron.lib: build_saffron | |
42 | +build_saffron: build_mmath | |
43 | + $(MMC) $(SAFFRON_MMC_OPTS) $(MMATH_LINK_FLAGS) --make libsaffron | |
44 | + | |
45 | +mmath\mmath.lib: build_mmath | |
46 | +build_mmath: | |
47 | + cd mmath && $(MMC) $(SAFFRON_MMC_OPTS) --make libmmath | |
48 | + | |
49 | +#Utils | |
50 | +glow\glow.dll: build_glow | |
51 | +glow\glow_dll.lib: build_glow | |
52 | +build_glow: | |
53 | + cd glow && $(MAKE) /nologo /fnmakefile glow.dll | |
54 | + | |
55 | +util\glow\saffron_glow.lib: build_saffron_glow | |
56 | +build_saffron_glow: build_saffron_window build_saffron | |
57 | + cd util\glow && $(MMC) $(SAFFRON_MMC_OPTS) $(MMATH_LINK_FLAGS) $(SAFFRON_LINK_FLAGS) $(SAFFRON_WINDOW_LINK_FLAGS) $(GLOW_INCLUDE_FLAGS) --make libsaffron_glow | |
58 | + | |
59 | +util\window\saffron_window.lib: build_saffron_window | |
60 | +build_saffron_window: | |
61 | + cd util\window && $(MMC) $(SAFFRON_MMC_OPTS) $(MMATH_LINK_FLAGS) $(SAFFRON_LINK_FLAGS) --make libsaffron_window | |
62 | + | |
63 | +build_saffron_tga: | |
64 | + cd util\tga && $(MMC) $(SAFFRON_MMC_OPTS) --make libsaffron_tga | |
65 | + | |
66 | +# Demos | |
67 | +demo\glow.dll: glow\glow.dll | |
68 | + COPY /Y glow\glow.dll demo\glow.dll | |
69 | + | |
70 | +# Shared resources between demos and test. | |
71 | +# All of these are copied from the test directory to the demo directory. | |
72 | +demo\res\crate.tga: test\res\tga\crate.tga | |
73 | + COPY /Y test\res\tga\crate.tga demo\res\crate.tga | |
74 | + | |
75 | +demo\res\ctc24.tga: test\res\tga\ctc24.tga | |
76 | + COPY /Y test\res\tga\ctc24.tga demo\res\ctc24.tga | |
77 | + | |
78 | +build_saffron_cube_demo: demo\res\crate.tga build_saffron build_saffron_tga build_saffron_window build_saffron_glow glow\glow_dll.lib demo\glow.dll | |
79 | + cd demo && $(MMC) $(SAFFRON_MMC_OPTS) -E --make saffron_cube_demo $(MMATH_LINK_FLAGS) $(SAFFRON_LINK_FLAGS) $(SAFFRON_GLOW_LINK_FLAGS) $(SAFFRON_WINDOW_LINK_FLAGS) $(SAFFRON_TGA_LINK_FLAGS) -L "$(MAKEDIR)\glow" -lglow_dll --link-object "$(MAKEDIR)\mmath\libmmath.lib" --link-object "$(MAKEDIR)\libsaffron.lib" --link-object "$(MAKEDIR)\util\window\libsaffron_window.lib" --link-object "$(MAKEDIR)\util\glow\libsaffron_glow.lib" --link-object "$(MAKEDIR)\util\tga\libsaffron_tga.lib" -lOpenGL32 | |
80 | + | |
81 | +# Testing | |
82 | +build_transunit: | |
83 | + cd test/transunit && $(MMC) $(SAFFRON_MMC_OPTS) --make libtransunit $(STATIC_MMC_FLAGS) | |
84 | + | |
85 | +test_saffron_tga: build_transunit build_saffron_tga | |
86 | + cd test && $(MMC) $(SAFFRON_MMC_OPTS) --make saffron_tga_test $(TRANSUNIT_LINK_FLAGS) $(SAFFRON_TGA_LINK_FLAGS) | |
87 | + cd test\res/\ga && "$(MAKEDIR)\test\saffron_tga_test" | |
88 | + | |
89 | +# Clean | |
90 | +# We set Path to be empty so that if we are building from an MSYS or Cygwin | |
91 | +# prompt, we don't get their commands. | |
92 | + | |
93 | +clean_mmath: | |
94 | + set "Path=" && RMDIR /Q /S mmath\Mercury | |
95 | + set "Path=" && DEL /Q mmath\mmath.init mmath\*.lib mmath\*.mh mmath\*.err | |
96 | + | |
97 | +clean_saffron: | |
98 | + set "Path=" && RMDIR /Q /S Mercury | |
99 | + set "Path=" && DEL /Q saffron.init *.lib *.mh *.err | |
100 | + | |
101 | +clean_glow: | |
102 | + cd glow && $(MAKE) /nologo /fnmakefile clean | |
103 | + | |
104 | +clean_saffron_glow: | |
105 | + set "Path=" && RMDIR /Q /S util\glow\Mercury | |
106 | + set "Path=" && DEL /Q util\glow\saffron_glow.init util\glow\*.lib util\glow\*.mh util\glow\*.err | |
107 | + | |
108 | +clean_saffron_tga: | |
109 | + set "Path=" && RMDIR /Q /S util\tga\Mercury | |
110 | + set "Path=" && DEL /Q util\tga\saffron_tga.init util\tga\*.lib util\tga\*.mh util\tga\*.err | |
111 | + | |
112 | +clean_saffron_window: | |
113 | + set "Path=" && RMDIR /Q /S util\window\Mercury | |
114 | + set "Path=" && DEL /Q util\window\saffron_window.init util\window\*.lib util\window\*.mh util\window\*.err | |
115 | + | |
116 | +clean_test_saffron_tga: | |
117 | + set "Path=" && DEL /Q util\tga\saffron_tga.init util\tga\s*.lib util\tga\*.mh util\tga\*.err | |
118 | + | |
119 | +clean_saffron_cube_demo: | |
120 | + set "Path=" && DEL /Q demo\safron_cube_demo.exe | |
121 | + | |
122 | +CLEAN=clean_mmath clean_saffron clean_saffron_glow clean_saffron_window clean_saffron_tga clean_glow clean_test_saffron_tga clean_saffron_cube_demo | |
123 | +clean: $(CLEAN) | |
124 | + set "Path=" && DEL /Q demo\res\crate.tga demo\res\ctc24.tga | |
125 | + set "Path=" && RMDIR /Q /S test\Mercury | |
126 | + set "Path=" && DEL /Q test\*.mh test\*.err | |
127 | + set "Path=" && RMDIR /Q /S demo\Mercury | |
128 | + set "Path=" && DEL /Q demo\*.mh demo\*.err demo\*.dll | |
129 | + |