@@ -269,48 +269,31 @@ elseif(${BUILD_SHARED_LIBS} STREQUAL "OFF")
269
269
list (APPEND switches "-link-defaultlib-shared=false" )
270
270
endif ()
271
271
272
- set (build_libdir "${CMAKE_BINARY_DIR} /lib${LIB_SUFFIX} " )
273
- set (install_libdir "${CMAKE_INSTALL_LIBDIR} " )
274
-
275
- # Default -rpath linker option when linking against shared libraries.
276
- if (SHARED_LIBS_SUPPORTED )
277
- set (build_rpath "${build_libdir} " )
278
- set (install_rpath "${install_libdir} " )
279
- endif ()
272
+ # For windows, to call fill-multilib-section.sh we need an explicit bash.exe call
273
+ find_program (BASH bash REQUIRED )
280
274
281
- makeConfSection (NAME "30-ldc-runtime-lib${LIB_SUFFIX} "
282
- SECTION "default"
283
-
284
- BUILD
285
- SWITCHES ${switches}
286
- LIB_DIRS OVERRIDE ${build_libdir}
287
- RPATH ${build_rpath}
288
-
289
- INSTALL
290
- SWITCHES ${switches}
291
- LIB_DIRS OVERRIDE ${install_libdir}
292
- RPATH ${install_rpath}
293
- )
275
+ # comp_args are arguments passed to ldc2 to change the triple
276
+ function (makeTripleConfig comp_args suffix build_libdir install_libdir )
277
+ set (name "30-ldc-runtime-lib${suffix} " )
278
+ set (sectionPlaceholder "LDC_CONF_MULTILIB_TRIPLE_REGEX" )
294
279
295
- # macOS has fat libraries; otherwise, append a separate config file section for the
296
- # multilib target and override the lib directory.
297
- if (MULTILIB AND NOT "${TARGET_SYSTEM} " MATCHES "APPLE" )
298
- set (build_libdir "${CMAKE_BINARY_DIR} /lib${MULTILIB_SUFFIX} " )
299
- set (install_libdir "${CMAKE_INSTALL_PREFIX} /lib${MULTILIB_SUFFIX} " )
280
+ # Default -rpath linker option when linking against shared libraries.
300
281
if (SHARED_LIBS_SUPPORTED )
301
282
set (build_rpath "${build_libdir} " )
302
283
set (install_rpath "${install_libdir} " )
303
284
endif ()
304
285
305
- set (name "31-ldc-runtime-lib${MULTILIB_SUFFIX} " )
306
- set (sectionPlaceholder "LDC_CONF_MULTILIB_TRIPLE_REGEX" )
307
286
makeConfSection (NAME "${name} "
308
287
SECTION "${sectionPlaceholder} "
288
+
309
289
BUILD
290
+ SWITCHES ${switches}
310
291
LIB_DIRS OVERRIDE ${build_libdir}
311
292
RPATH ${build_rpath}
293
+
312
294
INSTALL
313
- LIB_DIRS OVERRIDE ${install_libdir}
295
+ SWITCHES ${switches}
296
+ LIB_DIRS ${install_libdir}
314
297
RPATH ${install_rpath}
315
298
)
316
299
@@ -321,18 +304,19 @@ if(MULTILIB AND NOT "${TARGET_SYSTEM}" MATCHES "APPLE")
321
304
# Rename the just-generated config files in order to replace sectionPlaceholder
322
305
file (RENAME "${conf} " "${conf} .in" )
323
306
set (fill_cmd
307
+ "${BASH} "
324
308
"${PROJECT_PARENT_DIR} /tools/fill-multilib-triple.sh"
325
309
"${conf} .in"
326
310
"${conf} "
327
311
"${sectionPlaceholder} "
328
312
# Next arguments are a compiler invocation for the desired triple
329
- "${LDC_EXE_FULL} " -m${MULTILIB_SUFFIX }
313
+ "${LDC_EXE_FULL} " ${D_FLAGS} ${comp_args }
330
314
)
331
315
if (LDC_EXE )
332
- # We need to get the -m32 target triple but the compiler
333
- # is not built yet. We can't depend on LDC_EXE since that
334
- # would cause a cycle so pass-through the needed commands
335
- # up to the root project and let it run them as POST_BUILD
316
+ # We need to get the target triple but the compiler is not
317
+ # built yet. We can't depend on LDC_EXE since that would
318
+ # cause a cycle so pass-through the needed commands up to
319
+ # the root project and let it run them as POST_BUILD
336
320
# commands. This avoids adding the config_files as
337
321
# transitive dependencies to all compiled D files.
338
322
#
@@ -346,6 +330,22 @@ if(MULTILIB AND NOT "${TARGET_SYSTEM}" MATCHES "APPLE")
346
330
execute_process (COMMAND ${fill_cmd} )
347
331
endif ()
348
332
endforeach ()
333
+
334
+ set (_ALL_CONF_INSTALL_FILES "${_ALL_CONF_INSTALL_FILES} " PARENT_SCOPE )
335
+ set (_LDC_POST_BUILD_COMMANDS "${_LDC_POST_BUILD_COMMANDS} " PARENT_SCOPE )
336
+ set (_LDC_POST_BUILD_BYPRODUCTS "${_LDC_POST_BUILD_BYPRODUCTS} " PARENT_SCOPE )
337
+ endfunction ()
338
+
339
+ set (build_libdir "${CMAKE_BINARY_DIR} /lib${LIB_SUFFIX} " )
340
+ set (install_libdir "${CMAKE_INSTALL_LIBDIR} " )
341
+ makeTripleConfig ("" "${LIB_SUFFIX} " "${build_libdir} " "${install_libdir} " )
342
+
343
+ # macOS has fat libraries; otherwise, append a separate config file section for the
344
+ # multilib target and override the lib directory.
345
+ if (MULTILIB AND NOT "${TARGET_SYSTEM} " MATCHES "APPLE" )
346
+ set (build_libdir "${CMAKE_BINARY_DIR} /lib${MULTILIB_SUFFIX} " )
347
+ set (install_libdir "${CMAKE_INSTALL_PREFIX} /lib${MULTILIB_SUFFIX} " )
348
+ makeTripleConfig ("-m${MULTILIB_SUFFIX} " "${MULTILIB_SUFFIX} " "${build_libdir} " "${install_libdir} " )
349
349
endif ()
350
350
351
351
if (LDC_EXE )
0 commit comments