@@ -277,41 +277,17 @@ endif()
277
277
set (build_switches "-defaultlib=${build_defaultlib} " ${switches} )
278
278
set (install_switches ${switches} )
279
279
280
- set (build_libdir "${CMAKE_BINARY_DIR} /lib${LIB_SUFFIX} " )
281
- set (install_libdir "${CMAKE_INSTALL_LIBDIR} " )
282
-
283
- # Default -rpath linker option when linking against shared libraries.
284
- if (SHARED_LIBS_SUPPORTED )
285
- set (build_rpath "${build_libdir} " )
286
- set (install_rpath "${install_libdir} " )
287
- endif ()
288
-
289
- makeConfSection (NAME "30-ldc-runtime-lib${LIB_SUFFIX} "
290
- SECTION "default"
291
-
292
- BUILD
293
- SWITCHES ${build_switches}
294
- LIB_DIRS OVERRIDE ${build_libdir}
295
- RPATH ${build_rpath}
296
-
297
- INSTALL
298
- SWITCHES ${install_switches}
299
- LIB_DIRS OVERRIDE ${install_libdir}
300
- RPATH ${install_rpath}
301
- )
280
+ # comp_args are arguments passed to ldc2 to change the triple
281
+ function (makeTripleConfig comp_args suffix build_libdir install_libdir )
282
+ set (name "30-ldc-runtime-lib${suffix} " )
283
+ set (sectionPlaceholder "LDC_CONF_MULTILIB_TRIPLE_REGEX" )
302
284
303
- # macOS has fat libraries; otherwise, append a separate config file section for the
304
- # multilib target and override the lib directory.
305
- if (MULTILIB AND NOT "${TARGET_SYSTEM} " MATCHES "APPLE" )
306
- set (build_libdir "${CMAKE_BINARY_DIR} /lib${MULTILIB_SUFFIX} " )
307
- set (install_libdir "${CMAKE_INSTALL_PREFIX} /lib${MULTILIB_SUFFIX} " )
285
+ # Default -rpath linker option when linking against shared libraries.
308
286
if (SHARED_LIBS_SUPPORTED )
309
287
set (build_rpath "${build_libdir} " )
310
288
set (install_rpath "${install_libdir} " )
311
289
endif ()
312
290
313
- set (name "31-ldc-runtime-lib${MULTILIB_SUFFIX} " )
314
- set (sectionPlaceholder "LDC_CONF_MULTILIB_TRIPLE_REGEX" )
315
291
makeConfSection (NAME "${name} "
316
292
SECTION "${sectionPlaceholder} "
317
293
@@ -320,8 +296,8 @@ if(MULTILIB AND NOT "${TARGET_SYSTEM}" MATCHES "APPLE")
320
296
RPATH ${build_rpath}
321
297
322
298
INSTALL
323
- LIB_DIRS OVERRIDE ${install_libdir}
324
- RPATH ${install_rpath}
299
+ LIB_DIRS ${install_libdir}
300
+ RPATH ${install_rpath}
325
301
)
326
302
327
303
set (build_conf "${LDC2_BUILD_CONF} /${name} .conf" )
@@ -336,13 +312,13 @@ if(MULTILIB AND NOT "${TARGET_SYSTEM}" MATCHES "APPLE")
336
312
"${conf} "
337
313
"${sectionPlaceholder} "
338
314
# Next arguments are a compiler invocation for the desired triple
339
- "${LDC_EXE_FULL} " -m${MULTILIB_SUFFIX }
315
+ "${LDC_EXE_FULL} " ${D_FLAGS} ${comp_args }
340
316
)
341
317
if (LDC_EXE )
342
- # We need to get the -m32 target triple but the compiler
343
- # is not built yet. We can't depend on LDC_EXE since that
344
- # would cause a cycle so pass-through the needed commands
345
- # up to the root project and let it run them as POST_BUILD
318
+ # We need to get the target triple but the compiler is not
319
+ # built yet. We can't depend on LDC_EXE since that would
320
+ # cause a cycle so pass-through the needed commands up to
321
+ # the root project and let it run them as POST_BUILD
346
322
# commands. This avoids adding the config_files as
347
323
# transitive dependencies to all compiled D files.
348
324
#
@@ -356,6 +332,22 @@ if(MULTILIB AND NOT "${TARGET_SYSTEM}" MATCHES "APPLE")
356
332
execute_process (COMMAND ${fill_cmd} )
357
333
endif ()
358
334
endforeach ()
335
+
336
+ set (_ALL_CONF_INSTALL_FILES "${_ALL_CONF_INSTALL_FILES} " PARENT_SCOPE )
337
+ set (_LDC_POST_BUILD_COMMANDS "${_LDC_POST_BUILD_COMMANDS} " PARENT_SCOPE )
338
+ set (_LDC_POST_BUILD_BYPRODUCTS "${_LDC_POST_BUILD_BYPRODUCTS} " PARENT_SCOPE )
339
+ endfunction ()
340
+
341
+ set (build_libdir "${CMAKE_BINARY_DIR} /lib${LIB_SUFFIX} " )
342
+ set (install_libdir "${CMAKE_INSTALL_LIBDIR} " )
343
+ makeTripleConfig ("" "${LIB_SUFFIX} " "${build_libdir} " "${install_libdir} " )
344
+
345
+ # macOS has fat libraries; otherwise, append a separate config file section for the
346
+ # multilib target and override the lib directory.
347
+ if (MULTILIB AND NOT "${TARGET_SYSTEM} " MATCHES "APPLE" )
348
+ set (build_libdir "${CMAKE_BINARY_DIR} /lib${MULTILIB_SUFFIX} " )
349
+ set (install_libdir "${CMAKE_INSTALL_PREFIX} /lib${MULTILIB_SUFFIX} " )
350
+ makeTripleConfig ("-m${MULTILIB_SUFFIX} " "${MULTILIB_SUFFIX} " "${build_libdir} " "${install_libdir} " )
359
351
endif ()
360
352
361
353
if (LDC_EXE )
0 commit comments