2014ǯ08��12��
��Facebook�Ҥ�C/C++�ץ�ץ����å�Warp��Windows�Ķ��ǥӥ��
��Under the Hood: warp, a fast C and C++ preprocessor��
https://code.facebook.com/posts/476987592402291/under-the-hood-warp-a-fast-c-and-c-preprocessor/
https://github.com/facebook/warp
Cent OS 6 �ʳ��Ǥ�ư���ǧ����Ƥ��ʤ������Ǥ���������������Ժ���������̡�Windows �� MSYS + GDC��D Programming Language for GCC�˴Ķ��ǡ��Ȥꤢ���� warp �������ޤǤ����������Τǡ����λ��Υ��Ǥ�����builtin_defines.sh �Ȥ��������륹����ץȤ� git ��ݥ��ȥ�����äƤ��ʤ��褦�ǡ��ɥ饤�Хץ������ warpdrive �������ϼ��Ԥ��ޤ�������
(1) MSYS + GDC �Ķ�����
VMWare ��Τޤä���� Windows 7 64bit �Ķ��ǻ�ޤ�����
��git �� 7-zip �Υ��󥹥ȡ����Ȥ����Ͼ�ά���ޤ�����
- MSYS �Υ��󥹥ȡ���
����� MinGW �ϻ��Ѥ��ʤ��Τǡ�mingw-get-setup.exe �ǡ�msys-base�פΤߤ򥤥󥹥ȡ��뤷�ޤ�����
http://sourceforge.net/projects/mingw/files/Installer/mingw-get/
- GDC �Υ��󥹥ȡ���
����ϡ��ʲ��� x64 �Х��ʥ����Ѥ��ޤ�����
http://gdcproject.org/downloads/binaries/x86_64-w64-mingw32/native_2.065_gcc4.9.0_a8ad6a6678_20140615.7z
7-zip �ǰ��̤���Ƥ���Τǡ�Ŭ���ʽ�� x86_64-gdcproject-mingw32 �Ȥ����ե������Ÿ������ PATH ���̤��Ƥ����Ƥ���������
(����� C:\ ľ����Ÿ�����ơ�MSYS ��ǰ��Ū�� PATH �����ꤷ�ޤ�������
$ export PATH=$PATH:/c/x86_64-gdcproject-mingw32/bin/
(2) warp �Υӥ��
Makefile ���������餯 facebook �ҤΥӥ�ɴĶ���Cent OS 6�ˤ˷���Ǥ��ˤʤäƤ���褦�ʤΤǡ�����δĶ��˹�碌�ƽ������Ƥ��� make ���ޤ�����Windows �� GDC ���ȡ��ץ������̾�� gdc �ǤϤʤ� gdc.exe ���ä��ꡢlibphobos2.a ����libgphobos2.a �ˤʤäƤ����ꡢ��̯�ʺ��ۤ�����ޤ�����
$ diff -u Makefile.orig Makefile --- Makefile.orig 2014-08-12 10:29:35 +0900 +++ Makefile 2014-08-12 13:34:52 +0900 @@ -6,7 +6,7 @@ endif endif -ifeq (gdc,$(notdir $(DC))) +ifeq (gdc.exe,$(notdir $(DC))) DFLAGS=-c -O4 -frelease -fno-bounds-check -fbuiltin OFSYNTAX=-o else @@ -44,7 +44,7 @@ $(DC) $(DFLAGS) $(OFSYNTAX)$@ $(SRCS) warp : warp.o - gcc -m64 -Bthird-party2/binutils/2.21.1/centos6-native/da39a3e/bin/gold -Bthird-party2/glibc/2.17/gcc-4.8.1-glibc-2.17-fb/99df8fc/lib -L/home/aalexandre /bin/../d/phobos/generated/linux/release/default -l:libphobos2.a -lpthread -lm - lrt -o $@ $^ + gcc -m64 -o $@ $^ -lgphobos2 $(WARPDRIVE) : warpdrive.d $(GENERATED_DEFINES) $(DC) $(DFLAGS) $(OFSYNTAX)$@ $^ $ make /c/x86_64-gdcproject-mingw32/bin/gdc.exe -c -O4 -frelease -fno-bounds-check -fbu iltin -owarp.o cmdline.d constexpr.d context.d directive.d expanded.d file.d id. d lexer.d loc.d macros.d main.d number.d outdeps.d ranges.d skip.d sources.d str inglit.d textbuf.d charclass.d gcc -m64 -o warp warp.o -lgphobos2 ./builtin_defines.sh 'cc ' 'c++ ' >generated_defines.d.tmp /bin/sh: ./builtin_defines.sh: No such file or directory make: *** [generated_defines.d] Error 127�����餯 builtin_defines.sh �Ȥ��������륹����ץȤ� git ��ݥ��ȥ��¸�ߤ��ʤ����Ȥ������ǡ��ɥ饤�Хץ������ warpdrive �������ˤϼ��Ԥ��Ƥ��ޤ��ޤ������Ȥꤢ���� warp.exe �ϤǤ��ޤ�����
warp �����Ǥϡ�����ѥ����Í������Ѥߥޥ����ʤɤ��������ꤵ��Ƥ��ʤ��Τǡ�windows.h �ʤɤϤ��ΤޤޤǤϥץ�ץ������Ǥ��ޤ��󤬡��㤨�� _WIN32 ���������Ƥ��ʤ��ȡ��إå��Υץ�ץ���������� #error �ˤʤ�ˡ����ʥץ�ץ�������ǽ�� warp ñ�Τ�ư���褦�Ǥ�������Ĺ�����ʤɤ⥵�ݡ��Ȥ��Ƥ��ޤ���
$ cat test.c #define FOO 1 #define dbg(fmt, ...) \ printf("debug:" fmt, __VA_ARGS__) int f() { dbg("%d %d %d\n", 1, 2, 3); return FOO; } $ warp.exe test.c --stdout # 1 "test.c" # 1 "c:\Work\warp//" # 1 ";��" # 1 "test.c" # 6 "test.c" int f() { printf("debug:" "%d %d %d\n", 1, 2, 3); return 1; # 10 "test.c" }
�����������ñ¤¯¤È´ï¿½Ã±ï¿½Ç¤ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½Ç½ï¿½Ëºï¿½Ã¤ï¿½ GDC �δĶ��Ǥ����̤Υ���ѥ��륨�顼���ФƤ��ޤ���D �ϸ�����ͤ��󥿥���Ķ����Ѳ����㤷���褦�ǡ��ޤ� GDC ���͡��ʿͤ��ӥ�ɤ������ۤ��Ƥ���Τǡ��ɤ��Ȥ����ɤ��Τ����õ����֤Ǥ����ˡ��ǥ�����ޡ����Ҥ� DMD �Ķ��ǻ������ޤǥ���ѥ���ϤǤ�����ΤΡ����٤� DMD �������������֥������ȥե����뤬 GCC �Ǥ��ޤ���󥯤Ǥ�����TDM-GCC �δĶ��� GDC ���ñ¤¤ï¿½ï¿½Æ»È¤Ã¤Æ¤ï¿½ï¿½ï¿½ï¿½ï¿½È¡ï¿½ï¿½ï¿½ï¿½Î»ï¿½ï¿½Ï¤ï¿½ï¿½Ê¤ï¿½Ä¶ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ã¥´ï¿½ï¿½ï¿½ã¤·ï¿½Æ¤ï¿½ï¿½ï¿½ï¿½Ë¡ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ Windows �ʤΤ������Τ���������ڤ�ʬ���Τ���� Cent OS 7 �δĶ��� VMWare ��˽������ƻ����ȡ��Դ���� D ����� Cent OS �δĶ��ǻ�Ժ����������������������Ķ��� Windows �Ǥ� MSYS �Ķ��˻��äƤ����������ơ���ä� Windows ��������ȡ��ºݤϤ��ʤ��ּ�äƤ��ޤ��ޤ������ʺ��פ��С�Cent OS ���ä� Warp �Υӥ�ɤ� D ����Υ��åȥ��åפ��ڤȤ������Ȥ�̵���ä��Τǡ��Ȥ����줿 Ubuntu �Ķ��Ǥ��ɤ��ä��Ȼפ��ޤ�����