Skip to content

Commit 7c15c98

Browse files
committed
workflow: windows dlink fix
1 parent 797fd82 commit 7c15c98

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

quaddtype/subprojects/packagefiles/sleef/meson.build

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@ project('sleef', version: '3.8')
33
cmake = find_program('cmake')
44
ninja = find_program('ninja', 'make', required: false)
55

6+
# Use relative paths from build directory
67
sleef_build_dir = 'sleef_build'
78
sleef_install_dir = 'sleef_install'
89

9-
# This can be done manually from user side, but lets handle it here as well
10+
# Dynamically set libdir based on platform conventions
1011
libdir = 'lib'
1112
if host_machine.system() == 'linux' and host_machine.cpu_family() == 'x86_64'
1213
libdir = 'lib64'
1314
endif
1415

16+
# Configure SLEEF at configuration time
1517
sleef_configure = run_command([
1618
cmake,
1719
'-S', meson.current_source_dir(),
@@ -29,6 +31,7 @@ if sleef_configure.returncode() != 0
2931
error('SLEEF CMake configuration failed: ' + sleef_configure.stderr())
3032
endif
3133

34+
# Build target for SLEEF libraries - create a dummy output file
3235
sleef_build_target = custom_target('sleef_build',
3336
command: [cmake, '--build', meson.current_build_dir() / sleef_build_dir, '--target', 'install', '--parallel'],
3437
output: 'sleef_built.stamp', # Dummy stamp file
@@ -37,17 +40,28 @@ sleef_build_target = custom_target('sleef_build',
3740
build_by_default: true
3841
)
3942

43+
# Path variables
4044
sleef_include_path = meson.current_build_dir() / sleef_install_dir / 'include'
4145
sleef_lib_path = meson.current_build_dir() / sleef_install_dir / libdir
4246

47+
# Create a dependency that ensures the build happens but doesn't link the dummy file
4348
sleef_build_dep = declare_dependency(sources: [sleef_build_target])
49+
50+
# Platform-specific define for static linking on Windows
51+
sleef_static_define = ''
52+
if host_machine.system() == 'windows'
53+
sleef_static_define = '-DSLEEF_STATIC_LIBS'
54+
endif
55+
56+
# Create the actual linking dependencies
4457
sleef_dep = declare_dependency(
45-
dependencies: [sleef_build_dep],
46-
compile_args: ['-I' + sleef_include_path],
58+
dependencies: [sleef_build_dep], # Ensures build happens first
59+
compile_args: ['-I' + sleef_include_path, sleef_static_define],
4760
link_args: ['-L' + sleef_lib_path, '-lsleef']
4861
)
62+
4963
sleefquad_dep = declare_dependency(
50-
dependencies: [sleef_build_dep],
51-
compile_args: ['-I' + sleef_include_path],
64+
dependencies: [sleef_build_dep], # Ensures build happens first
65+
compile_args: ['-I' + sleef_include_path, sleef_static_define],
5266
link_args: ['-L' + sleef_lib_path, '-lsleefquad']
5367
)

0 commit comments

Comments
 (0)