forked from libretro/RetroArch
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile.msvc
264 lines (216 loc) · 7.03 KB
/
Makefile.msvc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
TARGET := retroarch.exe
DEBUG = 0
GRIFFIN_BUILD = 0
OS = Win32
ARCH = amd64
#TARGET_ARCH = x86
BUILD_DIR = objs/msvc
CXX_BUILD = 0
WindowsSdkDir = C:\Program Files (x86)\Windows Kits\10\$(NOTHING)
WindowsSDKVersion := 10.0.14393.0\$(NOTHING)
VCINSTALLDIR := C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\$(NOTHING)
HAVE_D3DX := 1
HAVE_D3D8 := 0
HAVE_D3D9 := 1
HAVE_D3D10 := 1
HAVE_D3D11 := 1
HAVE_D3D12 := 1
HAVE_CG := 1
HAVE_OPENGL := 1
HAVE_VULKAN := 1
HAVE_XAUDIO := 1
HAVE_XINPUT := 1
HAVE_WASAPI := 0
HAVE_THREAD_STORAGE := 1
HAVE_WINMM := 1
HAVE_RPNG := 1
HAVE_ZLIB := 1
WANT_ZLIB := 1
HAVE_MENU := 1
HAVE_RGUI := 1
HAVE_XMB := 1
HAVE_MATERIALUI := 1
HAVE_STB_FONT := 1
HAVE_THREADS := 1
HAVE_LIBRETRODB := 1
HAVE_COMMAND := 1
HAVE_STDIN_CMD := 1
HAVE_CMD := 1
HAVE_DYLIB := 1
HAVE_DYNAMIC := 1
HAVE_DINPUT := 1
HAVE_MENU_COMMON := 1
HAVE_BUILTINZLIB := 1
HAVE_RJPEG := 1
HAVE_RBMP := 1
HAVE_RTGA := 1
HAVE_7ZIP := 1
HAVE_NETWORKING := 1
HAVE_NETWORK_CMD := 1
HAVE_OVERLAY := 1
HAVE_LANGEXTRA := 1
HAVE_CHEEVOS := 1
HAVE_SHADERPIPELINE := 1
HAVE_IMAGEVIEWER := 1
include Makefile.common
INCLUDE_DIRS := $(patsubst -isystem%,-I%,$(INCLUDE_DIRS))
CFLAGS := $(filter-out -Wno-unknown-pragmas,$(DEF_FLAGS))
CXXFLAGS := $(filter-out -fpermissive -Wno-switch -Wno-sign-compare -fno-strict-aliasing -Wno-maybe-uninitialized -Wno-reorder -Wno-parentheses,$(CXXFLAGS))
LIBS := $(filter-out -lstdc++,$(LIBS))
ifeq ($(ARCH),x64)
ARCH := amd64
endif
ARCH2 := $(ARCH)
ifeq ($(ARCH),amd64)
ARCH2 := x64
endif
ifeq ($(TARGET_ARCH),)
TARGET_ARCH = $(ARCH)
endif
ifeq ($(TARGET_ARCH),x64)
TARGET_ARCH = amd64
endif
TARGET_ARCH2 = $(TARGET_ARCH)
ifeq ($(TARGET_ARCH2),amd64)
TARGET_ARCH2 = x64
endif
CROSS = $(ARCH)
ifeq ($(ARCH),x86)
CROSS =
endif
INCLUDE := $(VCINSTALLDIR)include;$(VCINSTALLDIR)atlmfc\include;$(WindowsSdkDir)include\$(WindowsSDKVersion)ucrt;$(WindowsSdkDir)include\$(WindowsSDKVersion)shared;$(WindowsSdkDir)include\$(WindowsSDKVersion)um;
LIB := $(VCINSTALLDIR)LIB\$(CROSS);$(VCINSTALLDIR)atlmfc\lib\$(CROSS);$(WindowsSdkDir)lib\$(WindowsSDKVersion)ucrt\$(TARGET_ARCH2);$(WindowsSdkDir)lib\$(WindowsSDKVersion)um\$(TARGET_ARCH2);C:\Program Files (x86)\NVIDIA Corporation\Cg\lib.$(TARGET_ARCH2);C:\Program Files (x86)\Microsoft DirectX SDK (February 2010)\Lib\$(TARGET_ARCH2);
LIBPATH := $(VCINSTALLDIR)LIB\$(CROSS);$(VCINSTALLDIR)atlmfc\lib\$(CROSS);
PATH := $(shell IFS=$$'\n'; cygpath "$(VCINSTALLDIR)bin\\$(CROSS)"):$(shell IFS=$$'\n'; cygpath "$(WindowsSdkDir)\bin\\$(ARCH2)"):$(PATH)
export INCLUDE := $(INCLUDE)
export LIB := $(LIB)
export LIBPATH := $(LIBPATH)
export PATH := $(PATH)
#$(info WindowsSdkDir : $(WindowsSdkDir))
#$(info WindowsSDKVersion : $(WindowsSDKVersion))
#$(info VCINSTALLDIR : $(VCINSTALLDIR))
#$(info INCLUDE : $(INCLUDE))
#$(info LIB : $(LIB))
#$(info LIBPATH : $(LIBPATH))
#$(info PATH : $(PATH))
#$(error end)
DEFINES += -D__SSE__ -D__SSE2__
ifeq ($(TARGET_ARCH2),x64)
DEFINES += -D__x86_64__
else
#DEFINES += -D__i686__
endif
FLAGS += -nologo -MP
FLAGS += -Gm- -Zc:inline -fp:precise -Zc:forScope -GR- -Gd -Oi -volatile:iso
#FLAGS += -Zc:wchar_t -Zp16 -Z7
#FLAGS += -utf-8
#FLAGS += -source-charset:utf-8
CXXFLAGS += $(CFLAGS) -TP -EHsc
ifeq ($(CXX_BUILD),1)
CFLAGS := $(CXXFLAGS)
DEFINES += -DCXX_BUILD
else
CFLAGS += -TC
endif
WARNINGS += -WX -W3
WARNINGS += -wd4101 -wd4996 -wd4244 -wd4267 -wd4090 -wd4305 -wd4146 -wd4334 -wd4018 -wd4800 -wd4838
CC = cl.exe
CXX = cl.exe
LD = link.exe
RC = rc.exe
LIBS += shell32.lib user32.lib gdi32.lib comdlg32.lib winmm.lib ole32.lib
LDFLAGS += -nologo -wx -nxcompat -machine:$(TARGET_ARCH2)
ifeq ($(DEBUG),1)
FLAGS += -GS -Gy -Od -RTC1 -D_SECURE_SCL=1 -Zi
FLAGS += -MDd
LDFLAGS += -DEBUG
DEFINES += -DDEBUG -D_DEBUG
else
FLAGS += -GS- -Gy- -O2 -Ob2 -GF -GT -Oy -Ot -D_SECURE_SCL=0
FLAGS += -MD
endif
ifeq ($(DEBUG),1)
BUILD_DIR := $(BUILD_DIR)-debug
endif
ifeq ($(GRIFFIN_BUILD),1)
BUILD_DIR := $(BUILD_DIR)-griffin
endif
BUILD_DIR := $(BUILD_DIR)-$(TARGET_ARCH2)
ifneq ($(V), 1)
Q := @
endif
ifeq ($(GRIFFIN_BUILD), 1)
OBJ := griffin/griffin.o griffin/griffin_cpp.o
DEFINES += -DHAVE_GRIFFIN -DUSE_MATH_DEFINES
else
BLACKLIST :=
OBJ := $(filter-out $(BLACKLIST),$(OBJ))
endif
DEFINES += -DRARCH_INTERNAL -DHAVE_DYNAMIC -DJSON_STATIC
INCLUDE_DIRS += -I. -Igfx/include
#OBJ := version_git.o
OBJ := $(patsubst %rarch.o,%rarch.res,$(OBJ))
OBJ := $(addprefix $(BUILD_DIR)/,$(OBJ))
OBJ := $(OBJ:.o=.obj)
LDFLAGS += -WX -SUBSYSTEM:WINDOWS -ENTRY:mainCRTStartup
DEFINES := $(patsubst -f%,,$(DEFINES))
LDFLAGS := $(patsubst -l%,%.lib,$(LDFLAGS))
LIBS := $(filter-out -lm,$(LIBS))
LIBS := $(patsubst -l%,%.lib,$(LIBS))
#$(info INCLUDE_DIRS : $(INCLUDE_DIRS))
#$(info DEFINES : $(DEFINES))
#$(info CFLAGS : $(CFLAGS))
#$(info CXXFLAGS : $(CXXFLAGS))
#$(info LDFLAGS : $(LDFLAGS))
#$(info LIBS : $(LIBS))
#$(info OBJ : $(OBJ))
#$(info target : $(TARGET))
#$(info flags : $(FLAGS))
#$(info INCLUDE : $(INCLUDE))
#$(info LIB : $(LIB))
#$(info LIBPATH : $(LIBPATH))
#$(error end)
$(info os : $(OS))
$(info host : $(ARCH))
$(info target : $(TARGET_ARCH))
all: $(TARGET)
%: $(BUILD_DIR)/%
cp $< $@
ifeq ($(DEBUG),1)
%.exe: $(BUILD_DIR)/%.exe
cp $< $@
cp $(BUILD_DIR)/$*.pdb $*.pbd
endif
SHELL:=$(SHELL) -o pipefail
DEPFLAGS = -showIncludes | tee $(BUILD_DIR)/$*.dtemp | sed /'Note: including file:'/d
MAKEDEPS = echo $@: $< \\ > $(BUILD_DIR)/$*.depend && \
grep 'Note: including file:' $(BUILD_DIR)/$*.dtemp \
| sed '/$(subst \,\\,$(WindowsSdkDir))/Id; /$(subst \,\\,$(VCINSTALLDIR))/Id; s/Note: including file:[ ]*//g; s/\\/\//g; s/ /\\ /g; s/.*/ & \\/g' \
>> $(BUILD_DIR)/$*.depend && \
rm -f $(BUILD_DIR)/$*.dtemp
#DEPFLAGS :=
#MAKEDEPS :=
$(BUILD_DIR)/%.obj: %.cpp
@mkdir -p $(dir $@)
$(Q)$(CXX) -c -Fo:$@ $< $(FLAGS) $(CXXFLAGS) $(DEFINES) $(INCLUDE_DIRS) $(WARNINGS) $(DEPFLAGS)
@$(MAKEDEPS)
$(BUILD_DIR)/%.obj: %.c
@mkdir -p $(dir $@)
$(Q)$(CC) -c -Fo:$@ $< $(FLAGS) $(CFLAGS) $(DEFINES) $(INCLUDE_DIRS) $(WARNINGS) $(DEPFLAGS)
@$(MAKEDEPS)
$(BUILD_DIR)/%.res: %.rc
@mkdir -p $(dir $@)
$(Q)$(RC) $<
$(Q)mv $*.res $@
$(BUILD_DIR)/$(TARGET): $(OBJ) .$(TARGET).last
@touch .$(TARGET).last
$(Q)$(LD) $(OBJ) $(LDFLAGS) $(LIBS) -out:$(BUILD_DIR)/$(TARGET)
%.h %.hpp %.depend %.last: ;
clean:
rm -f $(OBJ) $(TARGET)
rm -f $(BUILD_DIR)/$(TARGET)
rm -f .$(TARGET).last
rm -f $(OBJ:.obj=.depend)
.PHONY: clean all
.PRECIOUS: %.depend %.last
-include $(patsubst %.obj,%.depend,$(filter %.obj,$(OBJ)))