@@ -35,7 +35,6 @@ endif()
35
35
36
36
set (MULTILIB OFF CACHE BOOL "Build both 32/64 bit runtime libraries" )
37
37
set (BUILD_LTO_LIBS OFF CACHE BOOL "Also build the runtime as LLVM bitcode libraries for LTO" )
38
- set (INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX} /include /d CACHE PATH "Path to install D modules to" )
39
38
set (BUILD_SHARED_LIBS AUTO CACHE STRING "Whether to build the runtime as a shared library (ON|OFF|BOTH)" )
40
39
set (D_FLAGS -w;-de;-preview=dip1000;-preview=dtorfields;-preview=fieldwise CACHE STRING "Runtime D compiler flags, separated by ';'" )
41
40
set (D_EXTRA_FLAGS "" CACHE STRING "Runtime extra D compiler flags, separated by ';'" )
@@ -301,8 +300,11 @@ endif()
301
300
# LLD 8+ requires (new) `--export-dynamic` for WebAssembly (https://github.com/ldc-developers/ldc/issues/3023).
302
301
set (WASM_DEFAULT_LDC_SWITCHES "${WASM_DEFAULT_LDC_SWITCHES} \n \" -L--export-dynamic\" ," )
303
302
304
- # Directory filled with auto-generated import files
305
- set (LDC_BUILD_IMPORT_DIR "${PROJECT_BINARY_DIR} /import" )
303
+ # Note: normally inherited from LDC CMake parent build, and only needed for ldc2_install.conf
304
+ set (INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX} /include/d" CACHE PATH "Path the D modules are installed to" )
305
+
306
+ # Note: default value only works if embedded in LDC CMake parent build, but only needed for ImportC (__importc_builtins.di) and non-install ldc2.conf
307
+ set (LDC_GCCBUILTINS_IMPORT_DIR "${CMAKE_BINARY_DIR} /import" CACHE PATH "Directory filled with auto-generated ldc/gccbuiltins_*.di files" )
306
308
307
309
# Generate .conf files
308
310
if (LDC_EXE)
@@ -369,36 +371,6 @@ install(FILES ${install_conf_path} DESTINATION ${CONF_INST_DIR} RENAME ${CONFIG_
369
371
# druntime/Phobos compilation helpers.
370
372
#
371
373
372
- set (GCCBUILTINS "" )
373
- if (TARGET gen_gccbuiltins)
374
- file (MAKE_DIRECTORY "${LDC_BUILD_IMPORT_DIR} /ldc" )
375
-
376
- function (gen_gccbuiltins name )
377
- set (module "${LDC_BUILD_IMPORT_DIR} /ldc/gccbuiltins_${name} .di" )
378
- if (GCCBUILTINS STREQUAL "" )
379
- set (GCCBUILTINS "${module} " PARENT_SCOPE)
380
- else ()
381
- set (GCCBUILTINS "${GCCBUILTINS} ;${module} " PARENT_SCOPE)
382
- endif ()
383
- add_custom_command (
384
- OUTPUT ${module}
385
- COMMAND gen_gccbuiltins ${module} "${name} "
386
- DEPENDS gen_gccbuiltins
387
- )
388
- endfunction ()
389
-
390
- set (target_arch "AArch64;AMDGPU;ARM;Mips;RISCV;NVPTX;PowerPC;SystemZ;X86" )
391
- set (target_name "aarch64;amdgcn;arm;mips;riscv;nvvm;ppc;s390;x86" )
392
-
393
- foreach (target ${LLVM_TARGETS_TO_BUILD} )
394
- list (FIND target_arch ${target} idx)
395
- if (idx GREATER -1)
396
- list (GET target_name ${idx} name )
397
- gen_gccbuiltins(${name} )
398
- endif ()
399
- endforeach ()
400
- endif ()
401
-
402
374
# Always build zlib and other C parts of the runtime in release mode, regardless
403
375
# of what the user chose for LDC itself. Also add other C_FLAGS here.
404
376
# 1) Set up CMAKE_C_FLAGS_RELEASE
@@ -449,7 +421,7 @@ macro(dc src_files src_basedir d_flags output_basedir emit_bc all_at_once single
449
421
450
422
# dc_deps can only contain paths, otherwise cmake will ignore the dependency.
451
423
# See: https://github.com/ldc-developers/ldc/pull/4743#issuecomment-2323156173
452
- set (dc_deps ${LDC_EXE_FULL} ${GCCBUILTINS} )
424
+ set (dc_deps ${LDC_EXE_FULL} )
453
425
if (TARGET add-multilib-section)
454
426
# Make sure the config files are available before invoking LDC.
455
427
set (dc_deps ${dc_deps} add-multilib-section)
@@ -564,7 +536,7 @@ macro(compile_druntime d_flags lib_suffix path_suffix emit_bc all_at_once single
564
536
endif ()
565
537
dc("${DRUNTIME_D} "
566
538
"${RUNTIME_DIR} /src"
567
- "-conf=;${d_flags} ;${DRUNTIME_EXTRA_FLAGS} ;-I${RUNTIME_DIR} /src;-I ${LDC_BUILD_IMPORT_DIR} "
539
+ "-conf=;${d_flags} ;${DRUNTIME_EXTRA_FLAGS} ;-I${RUNTIME_DIR} /src"
568
540
"${PROJECT_BINARY_DIR} /objects${target_suffix} "
569
541
"${emit_bc} "
570
542
"${all_at_once} "
@@ -900,19 +872,6 @@ foreach(libname ${libs_to_install})
900
872
endif ()
901
873
endforeach ()
902
874
903
- set (DRUNTIME_PACKAGES core etc ldc)
904
-
905
- install (FILES ${RUNTIME_DIR} /src/object.d ${RUNTIME_DIR} /src/__importc_builtins.di ${RUNTIME_DIR} /src/importc.h DESTINATION ${INCLUDE_INSTALL_DIR} )
906
- foreach (p ${DRUNTIME_PACKAGES} )
907
- install (DIRECTORY ${RUNTIME_DIR} /src/${p} DESTINATION ${INCLUDE_INSTALL_DIR} FILES_MATCHING PATTERN "*.d" )
908
- install (DIRECTORY ${RUNTIME_DIR} /src/${p} DESTINATION ${INCLUDE_INSTALL_DIR} FILES_MATCHING PATTERN "*.di" )
909
- endforeach ()
910
- if (PHOBOS2_DIR)
911
- install (DIRECTORY ${PHOBOS2_DIR} /std DESTINATION ${INCLUDE_INSTALL_DIR} FILES_MATCHING PATTERN "*.d" )
912
- install (DIRECTORY ${PHOBOS2_DIR} /etc DESTINATION ${INCLUDE_INSTALL_DIR} FILES_MATCHING PATTERN "*.d" )
913
- endif ()
914
- install (FILES ${GCCBUILTINS} DESTINATION ${INCLUDE_INSTALL_DIR} /ldc)
915
-
916
875
917
876
#
918
877
# Test targets.
0 commit comments