(MSVC) add Makefile.msvc

This commit is contained in:
aliaspider 2018-01-21 04:12:01 +01:00
parent 094196220d
commit 6b9dc2205b

271
Makefile.msvc Normal file
View File

@ -0,0 +1,271 @@
TARGET := retroarch.exe
DEBUG = 0
GRIFFIN_BUILD = 0
OS = Win32
ARCH = amd64
#TARGET_ARCH = x86
BUILD_DIR = objs/msvc
HAVE_D3DX := 1
HAVE_D3D8 := 0
HAVE_D3D9 := 1
HAVE_D3D11 := 1
HAVE_D3D12 := 1
HAVE_CG := 1
HAVE_OPENGL := 1
HAVE_RPNG := 1
HAVE_ZLIB := 1
WANT_ZLIB := 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_KEYMAPPER := 1
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
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)
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 :=
ifeq ($(TARGET_ARCH),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
CFLAGS += -TC
CXXFLAGS += -TP
WARNINGS += -WX -W3
WARNINGS += -wd4101 -wd4996 -wd4244 -wd4267 -wd4090 -wd4305 -wd4146 -wd4334 -wd4018
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
#LIBS += -ld3d9 -ld3dx9d
else
FLAGS += -GS- -Gy- -O2 -Ob2 -GF -GT -Oy -Ot -D_SECURE_SCL=0
FLAGS += -MD
#LIBS += -ld3d9 -ld3dx9
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
OBJ :=
include Makefile.common
ifeq ($(GRIFFIN_BUILD), 1)
OBJ := griffin/griffin.o
DEFINES_BLACKLIST := -DHAVE_COMPRESSION
DEFINES := $(filter-out $(DEFINES_BLACKLIST),$(DEFINES))
DEFINES += -DHAVE_GRIFFIN -DUSE_MATH_DEFINES
else
DEFINES += -DJSON_STATIC
BLACKLIST :=
OBJ := $(filter-out $(BLACKLIST),$(OBJ))
endif
DEFINES += -DRARCH_INTERNAL -DHAVE_DYNAMIC
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)
#INCDIRS := -I. -Ideps -Ideps/stb -Ideps/libz -Ideps/7zip -Ilibretro-common/include
#CFLAGS = $(FLAGS)
#CXXFLAGS = $(FLAGS)
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
@$(if $(Q), echo CXX $<,)
@mkdir -p $(dir $@)
$(Q)$(CXX) -c -Fo:$@ $< $(FLAGS) $(CXXFLAGS) $(DEFINES) $(INCLUDE_DIRS) $(WARNINGS) $(DEPFLAGS)
@$(MAKEDEPS)
$(BUILD_DIR)/%.obj: %.c
@$(if $(Q), echo CC $<,)
@mkdir -p $(dir $@)
$(Q)$(CC) -c -Fo:$@ $< $(FLAGS) $(CFLAGS) $(DEFINES) $(INCLUDE_DIRS) $(WARNINGS) $(DEPFLAGS)
@$(MAKEDEPS)
$(BUILD_DIR)/%.res: %.rc
@$(if $(Q), echo RC $<,)
@mkdir -p $(dir $@)
$(Q)$(RC) $<
$(Q)mv $*.res $@
$(BUILD_DIR)/$(TARGET): $(OBJ) .$(TARGET).last
@$(if $(Q), echo LD $@,)
@touch .$(TARGET).last
$(Q)$(LD) $(OBJ) $(LDFLAGS) $(LIBS) -out:$(BUILD_DIR)/$(TARGET)
%.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)))