mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 21:21:48 +03:00
druntime: Merge test/stdcpp/win64.mak into Makefile
This commit is contained in:
parent
b99b9d2c20
commit
28cbd2fe8f
7 changed files with 76 additions and 92 deletions
|
@ -24,10 +24,7 @@ set LDC_DIR=%DMD_DIR%\ldc2-%LDC_VERSION%-windows-multilib
|
|||
if "%D_COMPILER%" == "ldc" set HOST_DMD=%LDC_DIR%\bin\ldmd2.exe
|
||||
if "%D_COMPILER%" == "dmd" set HOST_DMD=%DMD_DIR%\dmd2\windows\bin\dmd.exe
|
||||
|
||||
REM take the first found cl.exe, in case there was already one in the path when vcvarsall.bat was called
|
||||
FOR /F "tokens=* USEBACKQ" %%F IN (`where cl.exe`) DO (SET MSVC_CC=%%~fsF
|
||||
goto CC_DONE)
|
||||
:CC_DONE
|
||||
set MSVC_CC=cl.exe
|
||||
FOR /F "tokens=* USEBACKQ" %%F IN (`where lib.exe`) DO (SET MSVC_AR=%%~fsF)
|
||||
|
||||
REM add grep to PATH
|
||||
|
|
|
@ -35,7 +35,7 @@ if [ "$MODEL" == "32omf" ] ; then
|
|||
AR="$PWD/dm/bin/lib.exe"
|
||||
export CPPCMD="$PWD/dm/bin/sppn.exe"
|
||||
else
|
||||
CC="$(where cl.exe)"
|
||||
CC="cl.exe"
|
||||
AR="$(where lib.exe)" # must be done before installing dmd
|
||||
fi
|
||||
|
||||
|
|
|
@ -416,7 +416,7 @@ ifeq ($(HAS_ADDITIONAL_TESTS),1)
|
|||
test/aa test/cpuid test/gc test/hash test/lifetime \
|
||||
test/thread test/unittest test/imports test/betterc test/config \
|
||||
test/traits test/uuid test/valgrind
|
||||
ifneq (windows,$(OS)) # FIXME
|
||||
ifneq (32omf,$(MODEL))
|
||||
ADDITIONAL_TESTS+=test/stdcpp
|
||||
endif
|
||||
ADDITIONAL_TESTS+=$(if $(SHARED),test/shared,)
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
@echo off
|
||||
echo _MSC_VER > ver.c
|
||||
cl /nologo /EP ver.c > ver_raw.txt
|
||||
findstr /v /r /c:"^$" "ver_raw.txt" > "ver.txt"
|
||||
set /P _MSC_VER=< ver.txt
|
||||
echo set _MSC_VER=%_MSC_VER%
|
||||
if exist cflags.txt del /q cflags.txt
|
||||
if exist dflags.txt del /q dflags.txt
|
||||
if exist add_tests.txt del /q add_tests.txt
|
||||
if %_MSC_VER% GTR 1900 echo /std:c++17 > cflags.txt
|
||||
if %_MSC_VER% GTR 1900 echo -extern-std=c++17 > dflags.txt
|
||||
if %_MSC_VER% GTR 1900 echo string_view > add_tests.txt
|
||||
del ver.c ver_raw.txt
|
|
@ -1,5 +1,42 @@
|
|||
include ../common.mak
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
ifeq (windows,$(OS))
|
||||
|
||||
CC:=cl
|
||||
EXTRA_CXXFLAGS:=/EHsc
|
||||
EXTRA_DFLAGS:=
|
||||
|
||||
TESTS:=allocator array memory new string utility vector
|
||||
|
||||
MSC_VER:=$(strip $(shell $(CC) /nologo /EP msc_ver.c))
|
||||
ifeq ($(shell test $(MSC_VER) -gt 1900; echo $$?),0)
|
||||
EXTRA_CXXFLAGS+=/std:c++17
|
||||
EXTRA_DFLAGS+=-extern-std=c++17
|
||||
TESTS+=string_view
|
||||
endif
|
||||
|
||||
all: $(addprefix $(ROOT)/,$(TESTS))
|
||||
|
||||
$(ROOT)/%: $(SRC)/%.cpp $(SRC)/%_test.d
|
||||
@echo Testing $*
|
||||
@mkdir -p $(dir $@)
|
||||
|
||||
$(QUIET)$(CC) /MT $(EXTRA_CXXFLAGS) -c /Fo$@_cpp$(DOTOBJ) $<
|
||||
$(QUIET)$(DMD) -mscrtlib=libcmt $(DFLAGS) $(EXTRA_DFLAGS) -main -unittest -version=CoreUnittest -version=_MSC_VER_$(MSC_VER) $@_cpp$(DOTOBJ) -run $(SRC)/$*_test.d
|
||||
|
||||
$(QUIET)$(CC) /MD $(EXTRA_CXXFLAGS) -c /Fo$@_cpp$(DOTOBJ) $<
|
||||
$(QUIET)$(DMD) -mscrtlib=msvcrt $(DFLAGS) $(EXTRA_DFLAGS) -main -unittest -version=CoreUnittest -version=_MSC_VER_$(MSC_VER) $@_cpp$(DOTOBJ) -run $(SRC)/$*_test.d
|
||||
|
||||
$(QUIET)$(CC) /MTd $(EXTRA_CXXFLAGS) -c /Fo$@_cpp$(DOTOBJ) $<
|
||||
$(QUIET)$(DMD) -mscrtlib=libcmtd $(DFLAGS) $(EXTRA_DFLAGS) -main -unittest -version=CoreUnittest -version=_MSC_VER_$(MSC_VER) $@_cpp$(DOTOBJ) -run $(SRC)/$*_test.d
|
||||
|
||||
$(QUIET)$(CC) /MDd $(EXTRA_CXXFLAGS) -c /Fo$@_cpp$(DOTOBJ) $<
|
||||
$(QUIET)$(DMD) -mscrtlib=msvcrtd $(DFLAGS) $(EXTRA_DFLAGS) -main -unittest -version=CoreUnittest -version=_MSC_VER_$(MSC_VER) $@_cpp$(DOTOBJ) -run $(SRC)/$*_test.d
|
||||
|
||||
else # Posix:
|
||||
|
||||
HASCPP17:=`echo wow | $(CXX) -std=c++17 -E -xc++ - > /dev/null 2>&1 && echo yes`
|
||||
|
||||
TESTS:=allocator new utility
|
||||
|
@ -30,51 +67,51 @@ ifneq (yes,$(HASCPP17))
|
|||
TESTS17:=
|
||||
endif
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS))) $(addprefix $(ROOT)/,$(addsuffix _11.done,$(TESTS11))) $(addprefix $(ROOT)/,$(addsuffix _17.done,$(TESTS17))) $(addprefix $(ROOT)/,$(addsuffix _old.done,$(OLDABITESTS))) $(addprefix $(ROOT)/,$(addsuffix _libcpp.done,$(LIBCPPTESTS)))
|
||||
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS))) $(addprefix $(ROOT)/,$(addsuffix _11.done,$(TESTS11))) $(addprefix $(ROOT)/,$(addsuffix _17.done,$(TESTS17))) $(addprefix $(ROOT)/,$(addsuffix _old.done,$(OLDABITESTS)))
|
||||
|
||||
# run C++98 tests
|
||||
$(ROOT)/%.done : $(ROOT)/%
|
||||
$(ROOT)/%.done: $(ROOT)/%$(DOTEXE)
|
||||
@echo Testing $*
|
||||
$(QUIET)$(TIMELIMIT)$(ROOT)/$* $(RUN_ARGS)
|
||||
@touch $@
|
||||
# run C++11 tests
|
||||
$(ROOT)/%_11.done : $(ROOT)/%_11
|
||||
$(ROOT)/%_11.done: $(ROOT)/%_11$(DOTEXE)
|
||||
@echo Testing $*_11
|
||||
$(QUIET)$(TIMELIMIT)$(ROOT)/$*_11 $(RUN_ARGS)
|
||||
@touch $@
|
||||
# run C++17 tests
|
||||
$(ROOT)/%_17.done : $(ROOT)/%_17
|
||||
$(ROOT)/%_17.done: $(ROOT)/%_17$(DOTEXE)
|
||||
@echo Testing $*_17
|
||||
$(QUIET)$(TIMELIMIT)$(ROOT)/$*_17 $(RUN_ARGS)
|
||||
@touch $@
|
||||
# run libstdc++ _GLIBCXX_USE_CXX11_ABI=0 tests
|
||||
$(ROOT)/%_old.done : $(ROOT)/%_old
|
||||
$(ROOT)/%_old.done: $(ROOT)/%_old$(DOTEXE)
|
||||
@echo Testing $*_old
|
||||
$(QUIET)$(TIMELIMIT)$(ROOT)/$*_old $(RUN_ARGS)
|
||||
@touch $@
|
||||
|
||||
# build C++98 tests
|
||||
$(ROOT)/%: $(SRC)/%.cpp $(SRC)/%_test.d
|
||||
mkdir -p $(dir $@)
|
||||
$(QUIET)$(DMD) $(DFLAGS) -extern-std=c++98 -main -unittest -version=CoreUnittest -c -of=$(ROOT)/$*_d.o $(SRC)/$*_test.d
|
||||
$(QUIET)$(CXX) $(CXXFLAGS_BASE) -std=c++98 -o $@ $< $(ROOT)/$*_d.o $(DRUNTIME) -lpthread $(LDL)
|
||||
$(ROOT)/%$(DOTEXE): $(SRC)/%.cpp $(SRC)/%_test.d
|
||||
@mkdir -p $(dir $@)
|
||||
$(QUIET)$(DMD) $(DFLAGS) -extern-std=c++98 -main -unittest -version=CoreUnittest -c -of=$(ROOT)/$*_d$(DOTOBJ) $(SRC)/$*_test.d
|
||||
$(QUIET)$(CXX) $(CXXFLAGS_BASE) -std=c++98 -o $@ $< $(ROOT)/$*_d$(DOTOBJ) $(DRUNTIME) -lpthread $(LDL)
|
||||
# build C++11 tests
|
||||
$(ROOT)/%_11: $(SRC)/%.cpp $(SRC)/%_test.d
|
||||
mkdir -p $(dir $@)
|
||||
$(QUIET)$(DMD) $(DFLAGS) -extern-std=c++11 -main -unittest -version=CoreUnittest -c -of=$(ROOT)/$*_11_d.o $(SRC)/$*_test.d
|
||||
$(QUIET)$(CXX) $(CXXFLAGS_BASE) -std=c++11 -o $@ $< $(ROOT)/$*_11_d.o $(DRUNTIME) -lpthread $(LDL)
|
||||
$(ROOT)/%_11$(DOTEXE): $(SRC)/%.cpp $(SRC)/%_test.d
|
||||
@mkdir -p $(dir $@)
|
||||
$(QUIET)$(DMD) $(DFLAGS) -extern-std=c++11 -main -unittest -version=CoreUnittest -c -of=$(ROOT)/$*_11_d$(DOTOBJ) $(SRC)/$*_test.d
|
||||
$(QUIET)$(CXX) $(CXXFLAGS_BASE) -std=c++11 -o $@ $< $(ROOT)/$*_11_d$(DOTOBJ) $(DRUNTIME) -lpthread $(LDL)
|
||||
# build C++17 tests
|
||||
$(ROOT)/%_17: $(SRC)/%.cpp $(SRC)/%_test.d
|
||||
mkdir -p $(dir $@)
|
||||
$(QUIET)$(DMD) $(DFLAGS) -extern-std=c++17 -main -unittest -version=CoreUnittest -c -of=$(ROOT)/$*_17_d.o $(SRC)/$*_test.d
|
||||
$(QUIET)$(CXX) $(CXXFLAGS_BASE) -std=c++17 -o $@ $< $(ROOT)/$*_17_d.o $(DRUNTIME) -lpthread $(LDL)
|
||||
$(ROOT)/%_17$(DOTEXE): $(SRC)/%.cpp $(SRC)/%_test.d
|
||||
@mkdir -p $(dir $@)
|
||||
$(QUIET)$(DMD) $(DFLAGS) -extern-std=c++17 -main -unittest -version=CoreUnittest -c -of=$(ROOT)/$*_17_d$(DOTOBJ) $(SRC)/$*_test.d
|
||||
$(QUIET)$(CXX) $(CXXFLAGS_BASE) -std=c++17 -o $@ $< $(ROOT)/$*_17_d$(DOTOBJ) $(DRUNTIME) -lpthread $(LDL)
|
||||
# build libstdc++ _GLIBCXX_USE_CXX11_ABI=0 tests
|
||||
$(ROOT)/%_old: $(SRC)/%.cpp $(SRC)/%_test.d
|
||||
mkdir -p $(dir $@)
|
||||
$(QUIET)$(DMD) $(DFLAGS) -version=_GLIBCXX_USE_CXX98_ABI -main -unittest -version=CoreUnittest -c -of=$(ROOT)/$*_old_d.o $(SRC)/$*_test.d
|
||||
$(QUIET)$(CXX) $(CXXFLAGS_BASE) -D_GLIBCXX_USE_CXX11_ABI=0 -o $@ $< $(ROOT)/$*_old_d.o $(DRUNTIME) -lpthread $(LDL)
|
||||
$(ROOT)/%_old$(DOTEXE): $(SRC)/%.cpp $(SRC)/%_test.d
|
||||
@mkdir -p $(dir $@)
|
||||
$(QUIET)$(DMD) $(DFLAGS) -version=_GLIBCXX_USE_CXX98_ABI -main -unittest -version=CoreUnittest -c -of=$(ROOT)/$*_old_d$(DOTOBJ) $(SRC)/$*_test.d
|
||||
$(QUIET)$(CXX) $(CXXFLAGS_BASE) -D_GLIBCXX_USE_CXX11_ABI=0 -o $@ $< $(ROOT)/$*_old_d$(DOTOBJ) $(DRUNTIME) -lpthread $(LDL)
|
||||
|
||||
endif # end Posix
|
||||
|
||||
clean:
|
||||
rm -rf $(GENERATED)
|
||||
|
|
1
druntime/test/stdcpp/msc_ver.c
Normal file
1
druntime/test/stdcpp/msc_ver.c
Normal file
|
@ -0,0 +1 @@
|
|||
_MSC_VER
|
|
@ -1,38 +0,0 @@
|
|||
# built from the druntime top-level folder
|
||||
# to be overwritten by caller
|
||||
DMD=dmd
|
||||
MODEL=64
|
||||
DRUNTIMELIB=druntime64.lib
|
||||
CC=cl
|
||||
|
||||
TESTS=array allocator memory new string utility vector
|
||||
|
||||
_MSC_VER=$(file < ..\..\ver.txt)
|
||||
ADD_CFLAGS=$(file < ..\..\cflags.txt)
|
||||
ADD_DFLAGS=$(file < ..\..\dflags.txt)
|
||||
ADD_TESTS=$(file < ..\..\add_tests.txt)
|
||||
|
||||
TESTS=$(TESTS) $(ADD_TESTS)
|
||||
|
||||
test: $(TESTS)
|
||||
|
||||
$(TESTS):
|
||||
"$(CC)" -c /Fo$@_cpp.obj test\stdcpp\src\$@.cpp /EHsc /MT $(ADD_CFLAGS)
|
||||
"$(DMD)" -of=$@.exe -m$(MODEL) -conf= -Iimport -defaultlib=$(DRUNTIMELIB) -main -unittest -version=CoreUnittest -version=_MSC_VER_$(_MSC_VER) -mscrtlib=libcmt $(ADD_DFLAGS) test\stdcpp\src\$@_test.d $@_cpp.obj
|
||||
$@.exe
|
||||
del $@.exe $@.obj $@_cpp.obj
|
||||
|
||||
"$(CC)" -c /Fo$@_cpp.obj test\stdcpp\src\$@.cpp /EHsc /MD $(ADD_CFLAGS)
|
||||
"$(DMD)" -of=$@.exe -m$(MODEL) -conf= -Iimport -defaultlib=$(DRUNTIMELIB) -main -unittest -version=CoreUnittest -version=_MSC_VER_$(_MSC_VER) -mscrtlib=msvcrt $(ADD_DFLAGS) test\stdcpp\src\$@_test.d $@_cpp.obj
|
||||
$@.exe
|
||||
del $@.exe $@.obj $@_cpp.obj
|
||||
|
||||
"$(CC)" -c /Fo$@_cpp.obj test\stdcpp\src\$@.cpp /EHsc /MTd $(ADD_CFLAGS)
|
||||
"$(DMD)" -of=$@.exe -m$(MODEL) -conf= -Iimport -defaultlib=$(DRUNTIMELIB) -main -unittest -version=CoreUnittest -version=_MSC_VER_$(_MSC_VER) -mscrtlib=libcmtd $(ADD_DFLAGS) test\stdcpp\src\$@_test.d $@_cpp.obj
|
||||
$@.exe
|
||||
del $@.exe $@.obj $@_cpp.obj
|
||||
|
||||
"$(CC)" -c /Fo$@_cpp.obj test\stdcpp\src\$@.cpp /EHsc /MDd $(ADD_CFLAGS)
|
||||
"$(DMD)" -of=$@.exe -m$(MODEL) -conf= -Iimport -defaultlib=$(DRUNTIMELIB) -main -unittest -version=CoreUnittest -version=_MSC_VER_$(_MSC_VER) -mscrtlib=msvcrtd $(ADD_DFLAGS) test\stdcpp\src\$@_test.d $@_cpp.obj
|
||||
$@.exe
|
||||
del $@.exe $@.obj $@_cpp.obj
|
Loading…
Add table
Add a link
Reference in a new issue