Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/actions/helper-build-ldc/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ runs:
-DLLVM_ROOT_DIR="$PWD/../${{ inputs.llvm_dir }}" \
-DD_COMPILER='${{ inputs.host_dc }}' \
-DLDC_LINK_MANUALLY=OFF \
${{ runner.os == 'macOS' && '-DCMAKE_C_COMPILER=/usr/bin/cc' || '' }} \
${{ runner.os == 'macOS' && '-DCMAKE_CXX_COMPILER=/usr/bin/c++' || '' }} \
${{ inputs.specify_install_dir == 'true' && '-DCMAKE_INSTALL_PREFIX="$installDir"' || '' }} \
${{ inputs.specify_install_dir == 'true' && '-DINCLUDE_INSTALL_DIR="$installDir/import"' || '' }} \
${{ inputs.cmake_flags }}
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/supported_llvm_versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ jobs:
os: macos-14
host_dc: ldc-beta
llvm_version: 17.0.5
cmake_flags: -DBUILD_SHARED_LIBS=ON -DRT_SUPPORT_SANITIZERS=ON -DCMAKE_EXE_LINKER_FLAGS=-L/opt/homebrew/opt/zstd/lib -DCMAKE_C_COMPILER=/usr/bin/cc -DCMAKE_CXX_COMPILER=/usr/bin/c++
cmake_flags: -DBUILD_SHARED_LIBS=ON -DRT_SUPPORT_SANITIZERS=ON -DCMAKE_EXE_LINKER_FLAGS=-L/opt/homebrew/opt/zstd/lib
- job_name: macOS 14, LLVM 16, latest LDC beta
os: macos-14
host_dc: ldc-beta
llvm_version: 16.0.5
cmake_flags: -DBUILD_SHARED_LIBS=OFF -DCMAKE_EXE_LINKER_FLAGS=-L/opt/homebrew/opt/zstd/lib -DCMAKE_C_COMPILER=/usr/bin/cc -DCMAKE_CXX_COMPILER=/usr/bin/c++
cmake_flags: -DBUILD_SHARED_LIBS=OFF -DCMAKE_EXE_LINKER_FLAGS=-L/opt/homebrew/opt/zstd/lib
- job_name: Ubuntu 24.04, LLVM 15, latest DMD beta
os: ubuntu-24.04
host_dc: dmd-beta
llvm_version: 15
cmake_flags: -DBUILD_SHARED_LIBS=ON -DRT_SUPPORT_SANITIZERS=ON -DLIB_SUFFIX=64 -DLDC_LINK_MANUALLY=ON
cmake_flags: -DBUILD_SHARED_LIBS=ON -DRT_SUPPORT_SANITIZERS=ON -DLIB_SUFFIX=64
name: ${{ matrix.job_name }}
runs-on: ${{ matrix.os }}
env:
Expand Down Expand Up @@ -124,7 +124,6 @@ jobs:
cmake -G Ninja . \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ROOT_DIR=${{ runner.os == 'Linux' && format('/usr/lib/llvm-{0}', matrix.llvm_version) || '"$PWD/llvm"' }} \
-DLDC_LINK_MANUALLY=OFF \
${{ matrix.cmake_flags }}
ninja obj/ldc2.o all ldc2-unittest all-test-runners
bin/ldc2 --version
Expand Down
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ cmake_minimum_required(VERSION 3.16.0)
if(POLICY CMP0025)
cmake_policy(SET CMP0025 NEW)
endif()
if(POLICY CMP0132)
# see https://github.com/ldc-developers/ldc/issues/3901
cmake_policy(SET CMP0132 NEW)
endif()
if(${CMAKE_VERSION} VERSION_GREATER "3.26.9")
# Prevent implicit dependencies for custom commands, e.g.,
# `obj/ldc2.o` depending on `lib/libldc.a` with LDC_LINK_MANUALLY=ON.
Expand Down
7 changes: 6 additions & 1 deletion cmake/Modules/BuildDExecutable.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,12 @@ function(build_d_executable target_name output_exe d_src_files compiler_args lin

# We need to link against the C++ runtime library.
if(NOT MSVC AND "${D_COMPILER_ID}" STREQUAL "LDMD" AND NOT "${dflags}" MATCHES "(^|;)-gcc=")
set(translated_linker_args "-gcc=${CMAKE_CXX_COMPILER}" ${translated_linker_args})
if(CMAKE_VERSION VERSION_LESS "4.0.0" AND APPLE AND "${CMAKE_CXX_COMPILER}" MATCHES "/Developer/.+/usr/bin/c\\+\\+$")
# see https://github.com/ldc-developers/ldc/issues/3901
set(translated_linker_args "-gcc=/usr/bin/c++" ${translated_linker_args})
else()
set(translated_linker_args "-gcc=${CMAKE_CXX_COMPILER}" ${translated_linker_args})
endif()
endif()

# Use an extra custom target as dependency for the executable in
Expand Down
14 changes: 11 additions & 3 deletions runtime/DRuntimeIntegrationTests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,19 @@ else()
list(REMOVE_ITEM testnames uuid)
endif()

set(musl "")
if(TARGET_SYSTEM MATCHES "musl")
set(musl "IS_MUSL=1")
endif()

set(cc "CC=${CMAKE_C_COMPILER}")
set(cxx "CXX=${CMAKE_CXX_COMPILER}")
if(CMAKE_VERSION VERSION_LESS "4.0.0" AND CMAKE_HOST_APPLE AND "${TARGET_SYSTEM}" MATCHES "APPLE")
# see https://github.com/ldc-developers/ldc/issues/3901
set(cc "")
set(cxx "")
endif()

foreach(name ${testnames})
foreach(build debug release)
set(druntime_path_build ${druntime_path})
Expand All @@ -78,10 +87,9 @@ foreach(name ${testnames})
add_test(NAME ${fullname}
COMMAND ${GNU_MAKE_BIN} -C ${PROJECT_SOURCE_DIR}/druntime/test/${name}
ROOT=${outdir} DMD=${LDMD_EXE_FULL} BUILD=${build} SHARED=1
CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER}
DRUNTIME=${druntime_path_build} DRUNTIMESO=${shared_druntime_path_build}
CFLAGS_BASE=${cflags_base} DFLAGS_BASE=${dflags_base} ${linkdl}
IN_LDC=1 ${musl}
${cc} ${cxx} CFLAGS_BASE=${cflags_base} DFLAGS_BASE=${dflags_base} ${linkdl}
IN_LDC=1 ${musl}
)
set_tests_properties(${fullname} PROPERTIES DEPENDS clean-${fullname})
endforeach()
Expand Down