Skip to content

Commit

Permalink
[druntime: Pass D_EXTRA_FLAGS and RT_CFLAGS in {C,D}FLAGS_BASE for ma…
Browse files Browse the repository at this point in the history
…ke-based integration tests]
  • Loading branch information
kinke committed Sep 12, 2024
1 parent 0dcf778 commit 7f31303
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
15 changes: 9 additions & 6 deletions runtime/DRuntimeIntegrationTests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,13 @@ else()
endif()
endif()

if(NOT "${TARGET_SYSTEM}" MATCHES "MSVC")
set(cflags_base "CFLAGS_BASE=-Wall -Wl,-rpath,${CMAKE_BINARY_DIR}/lib${LIB_SUFFIX}")
string(REPLACE ";" " " dflags_base "${D_EXTRA_FLAGS}")

string(REPLACE ";" " " cflags_base "${RT_CFLAGS}")
if("${TARGET_SYSTEM}" MATCHES "MSVC")
set(cflags_base "${cflags_base} /Wall")
else()
set(cflags_base "${cflags_base} -Wall -Wl,-rpath,${CMAKE_BINARY_DIR}/lib${LIB_SUFFIX}")
endif()

set(linkdl "")
Expand All @@ -56,8 +61,6 @@ else()
list(REMOVE_ITEM testnames uuid)
endif()

string(REPLACE ";" " " LDMD_CMD "${LDMD_EXE_FULL} ${D_EXTRA_FLAGS}")

foreach(name ${testnames})
foreach(build debug release)
set(druntime_path_build ${druntime_path})
Expand All @@ -74,9 +77,9 @@ foreach(name ${testnames})
)
add_test(NAME ${fullname}
COMMAND ${GNU_MAKE_BIN} -C ${PROJECT_SOURCE_DIR}/druntime/test/${name}
ROOT=${outdir} DMD=${LDMD_CMD} BUILD=${build}
ROOT=${outdir} DMD=${LDMD_EXE_FULL} BUILD=${build} SHARED=1
DRUNTIME=${druntime_path_build} DRUNTIMESO=${shared_druntime_path_build}
SHARED=1 ${cflags_base} ${linkdl}
CFLAGS_BASE=${cflags_base} DFLAGS_BASE=${dflags_base} ${linkdl}
)
set_tests_properties(${fullname} PROPERTIES DEPENDS clean-${fullname})
endforeach()
Expand Down
4 changes: 2 additions & 2 deletions runtime/druntime/test/common.mak
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ ifeq (,$(findstring ldmd2,$(DMD)))
CFLAGS_BASE+=--target=x86_64-darwin-apple # ARM cpu is not supported by dmd
endif
endif
# LDC: use `-defaultlib=druntime-ldc [-link-defaultlib-shared]` instead of `-defaultlib= -L$(DRUNTIME[_IMPLIB])`
DFLAGS:=$(MODEL_FLAG) $(PIC) -w -I../../src -I../../import -I$(SRC) -defaultlib=$(if $(findstring ldmd2,$(DMD)),druntime-ldc,) -preview=dip1000 $(if $(findstring $(OS),windows),,-L-lpthread -L-lm $(LINKDL))
# LDC: include optional DFLAGS_BASE and use `-defaultlib=druntime-ldc [-link-defaultlib-shared]` instead of `-defaultlib= -L$(DRUNTIME[_IMPLIB])`
DFLAGS:=$(MODEL_FLAG) $(PIC) $(DFLAGS_BASE) -w -I../../src -I../../import -I$(SRC) -defaultlib=$(if $(findstring ldmd2,$(DMD)),druntime-ldc,) -preview=dip1000 $(if $(findstring $(OS),windows),,-L-lpthread -L-lm $(LINKDL))
# LINK_SHARED may be set by importing makefile
ifeq (,$(findstring ldmd2,$(DMD)))
DFLAGS+=$(if $(LINK_SHARED),-L$(DRUNTIME_IMPLIB) $(if $(findstring $(OS),windows),-dllimport=all),-L$(DRUNTIME))
Expand Down

0 comments on commit 7f31303

Please sign in to comment.