@@ -277,51 +277,29 @@ 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
318
294
BUILD
295
+ SWITCHES ${build_switches}
319
296
LIB_DIRS OVERRIDE ${build_libdir}
320
297
RPATH ${build_rpath}
321
298
322
299
INSTALL
323
- LIB_DIRS OVERRIDE ${install_libdir}
324
- RPATH ${install_rpath}
300
+ SWITCHES ${install_switches}
301
+ LIB_DIRS ${install_libdir}
302
+ RPATH ${install_rpath}
325
303
)
326
304
327
305
set (build_conf "${LDC2_BUILD_CONF} /${name} .conf" )
@@ -336,13 +314,13 @@ if(MULTILIB AND NOT "${TARGET_SYSTEM}" MATCHES "APPLE")
336
314
"${conf} "
337
315
"${sectionPlaceholder} "
338
316
# Next arguments are a compiler invocation for the desired triple
339
- "${LDC_EXE_FULL} " -m${MULTILIB_SUFFIX }
317
+ "${LDC_EXE_FULL} " ${D_FLAGS} ${comp_args }
340
318
)
341
319
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
320
+ # We need to get the target triple but the compiler is not
321
+ # built yet. We can't depend on LDC_EXE since that would
322
+ # cause a cycle so pass-through the needed commands up to
323
+ # the root project and let it run them as POST_BUILD
346
324
# commands. This avoids adding the config_files as
347
325
# transitive dependencies to all compiled D files.
348
326
#
@@ -356,6 +334,22 @@ if(MULTILIB AND NOT "${TARGET_SYSTEM}" MATCHES "APPLE")
356
334
execute_process (COMMAND ${fill_cmd} )
357
335
endif ()
358
336
endforeach ()
337
+
338
+ set (_ALL_CONF_INSTALL_FILES "${_ALL_CONF_INSTALL_FILES} " PARENT_SCOPE )
339
+ set (_LDC_POST_BUILD_COMMANDS "${_LDC_POST_BUILD_COMMANDS} " PARENT_SCOPE )
340
+ set (_LDC_POST_BUILD_BYPRODUCTS "${_LDC_POST_BUILD_BYPRODUCTS} " PARENT_SCOPE )
341
+ endfunction ()
342
+
343
+ set (build_libdir "${CMAKE_BINARY_DIR} /lib${LIB_SUFFIX} " )
344
+ set (install_libdir "${CMAKE_INSTALL_LIBDIR} " )
345
+ makeTripleConfig ("" "${LIB_SUFFIX} " "${build_libdir} " "${install_libdir} " )
346
+
347
+ # macOS has fat libraries; otherwise, append a separate config file section for the
348
+ # multilib target and override the lib directory.
349
+ if (MULTILIB AND NOT "${TARGET_SYSTEM} " MATCHES "APPLE" )
350
+ set (build_libdir "${CMAKE_BINARY_DIR} /lib${MULTILIB_SUFFIX} " )
351
+ set (install_libdir "${CMAKE_INSTALL_PREFIX} /lib${MULTILIB_SUFFIX} " )
352
+ makeTripleConfig ("-m${MULTILIB_SUFFIX} " "${MULTILIB_SUFFIX} " "${build_libdir} " "${install_libdir} " )
359
353
endif ()
360
354
361
355
if (LDC_EXE )
0 commit comments