Skip to content

Commit

Permalink
(tools) add the tool used to generate the d3d headers.
Browse files Browse the repository at this point in the history
  • Loading branch information
aliaspider committed Jan 21, 2018
1 parent 6b9dc22 commit c8027eb
Show file tree
Hide file tree
Showing 5 changed files with 995 additions and 8 deletions.
24 changes: 23 additions & 1 deletion wiiu/slang/peglib.h → deps/peglib/peglib.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//
//
// peglib.h
//
// Copyright (c) 2015-17 Yuji Hirose. All rights reserved.
Expand Down Expand Up @@ -2238,6 +2238,20 @@ struct AstBase : public Annotation

std::vector<std::shared_ptr<AstBase<Annotation>>> nodes;
std::shared_ptr<AstBase<Annotation>> parent;
static peg::AstBase<Annotation> empty;
AstBase<Annotation>& operator [] (const char* name)
{
for(std::shared_ptr<AstBase<Annotation>>& node : nodes)
{
if(node->name == name)
return *node;
}
return empty;
}
operator const char *()
{
return token.c_str();
}
};

template <typename T>
Expand Down Expand Up @@ -2770,6 +2784,14 @@ struct peg_token_range {

} // namespace peg


template<class _Elem, class _Traits, typename Annotation>
std::basic_ios<_Elem, _Traits> &operator << (std::basic_ios<_Elem, _Traits> &ios,
peg::AstBase<Annotation> &node)
{
return ios << node.token.c_str();
}

#endif

// vim: et ts=4 sw=4 cin cino={1s ff=unix
160 changes: 160 additions & 0 deletions tools/com-parser/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@

TARGET = com-parse
DEBUG = 0
GENDEPS = 1
TARGET_ARCH = amd64
OS ?= win32


OBJ :=
OBJ += com-parse.o



EXE_EXT := $(suffix $(wildcard $(MAKE).*))

ifeq ($(compiler),)
ifeq ($(patsubst %.exe,%,$(basename $(CC))),cl)
compiler = msvc
else
compiler = gcc
endif
endif

CC_OUT = -o $(NOTHING)
CXX_OUT = $(CC_OUT)
LD_OUT = $(CC_OUT)
OBJ_EXT := o

ifeq ($(DEBUG),1)
DEFINES += -DDEBUG -D_DEBUG
endif

ifeq ($(compiler),msvc)
ARCH = amd64
ARCH2 = x64
TARGET_ARCH2 = x64
CROSS = amd64
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)

DEFINES :=
FLAGS += -nologo
FLAGS += -Gm- -Zc:inline -fp:precise -Zc:forScope -Gd -Oi -volatile:iso
#FLAGS += -GR-
CFLAGS += -TC
CXXFLAGS += -TP -EHsc
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
else
FLAGS += -GS- -Gy- -O2 -Ob2 -GF -GT -Oy -Ot -D_SECURE_SCL=0
FLAGS += -MD
endif
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))
DEPFLAGS = -showIncludes | tee $*.dtemp | sed /'Note: including file:'/d
MAKEDEPS = echo $@: $< \\ > $*.depend && \
grep 'Note: including file:' $*.dtemp \
| sed '/$(subst \,\\,$(WindowsSdkDir))/Id; /$(subst \,\\,$(VCINSTALLDIR))/Id; s/Note: including file:[ ]*//g; s/\\/\//g; s/ /\\ /g; s/.*/ & \\/g' \
>> $*.depend && \
rm -f $*.dtemp

OBJ_EXT := obj
CC_OUT := -Fo:
CXX_OUT := $(CC_OUT)
LD_OUT := -out:
else
RC := windres
DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD_DIR)$*.depend
LD = $(CXX)
ifeq ($(DEBUG),1)
FLAGS += -g -O0
else
FLAGS += -O3
endif
endif


INCLUDE_DIRS += -I. -I../../deps/peglib


$(info os : $(OS))
$(info host : $(ARCH))
$(info target : $(TARGET_ARCH))
$(info compiler : $(compiler))

all: $(TARGET)$(EXE_EXT)

%.h:
touch $*.tmp
$(CXX) $*.tmp -DCINTERFACE -D_REFIID_DEFINED= -D_REFGUID_DEFINED= -D_HRESULT_DEFINED= \
-EP -FI $@ $(FLAGS) $(CXXFLAGS) $(DEFINES) $(INCLUDE_DIRS) $(WARNINGS) > $@
rm $*.tmp

SHELL:=$(SHELL) -o pipefail


ifeq ($(GENDEPS),0)
DEPFLAGS :=
MAKEDEPS :=
endif

%.$(OBJ_EXT): %.cpp
$(CXX) -c $(CXX_OUT)$@ $< $(FLAGS) $(CXXFLAGS) $(DEFINES) $(INCLUDE_DIRS) $(WARNINGS) $(DEPFLAGS)
@$(MAKEDEPS)

%.$(OBJ_EXT): %.c
$(CC) -c $(CC_OUT)$@ $< $(FLAGS) $(CFLAGS) $(DEFINES) $(INCLUDE_DIRS) $(WARNINGS) $(DEPFLAGS)
@$(MAKEDEPS)

%.res: %.rc
$(RC) $<
mv $*.res $@

$(TARGET)$(EXE_EXT): $(OBJ) .$(TARGET).last
@touch .$(TARGET).last
$(LD) $(OBJ) $(LDFLAGS) $(LIBS) $(LD_OUT)$@


%.depend: ;
%.last: ;
.FORCE:

clean:
rm -f $(OBJ) $(TARGET)$(EXE_EXT)
rm -f $(TARGET)
rm -f .$(TARGET).last
rm -f $(OBJ:.obj=.depend)

.PHONY: clean all
.PRECIOUS: %.depend %.last

-include $(patsubst %.obj,%.depend,$(filter %.obj,$(OBJ)))
Loading

0 comments on commit c8027eb

Please sign in to comment.