1+ project (' sleef' , version : ' 3.8' )
2+
3+ cmake = find_program (' cmake' )
4+ ninja = find_program (' ninja' , ' make' , required : false )
5+
6+ # Use relative paths from build directory
7+ sleef_build_dir = ' sleef_build'
8+ sleef_install_dir = ' sleef_install'
9+
10+ # Configure SLEEF at configuration time
11+ sleef_configure = run_command ([
12+ cmake,
13+ ' -S' , meson .current_source_dir(),
14+ ' -B' , meson .current_build_dir() / sleef_build_dir,
15+ ' -DCMAKE_BUILD_TYPE=Release' ,
16+ ' -DSLEEF_BUILD_QUAD=ON' ,
17+ ' -DSLEEF_BUILD_SHARED_LIBS=ON' ,
18+ ' -DSLEEF_BUILD_TESTS=OFF' ,
19+ ' -DSLEEF_BUILD_INLINE_HEADERS=OFF' ,
20+ ' -DCMAKE_POSITION_INDEPENDENT_CODE=ON' ,
21+ ' -DCMAKE_INSTALL_PREFIX=' + meson .current_build_dir() / sleef_install_dir
22+ ], check : false , capture : true )
23+
24+ if sleef_configure.returncode() != 0
25+ error (' SLEEF CMake configuration failed: ' + sleef_configure.stderr())
26+ endif
27+
28+ # Build target for SLEEF libraries - create a dummy output file
29+ sleef_build_target = custom_target (' sleef_build' ,
30+ command : [cmake, ' --build' , meson .current_build_dir() / sleef_build_dir, ' --target' , ' install' , ' --parallel' ],
31+ output : ' sleef_built.stamp' , # Dummy stamp file
32+ console : true ,
33+ build_always_stale : true ,
34+ build_by_default : true
35+ )
36+
37+ # Path variables
38+ sleef_include_path = meson .current_build_dir() / sleef_install_dir / ' include'
39+ sleef_lib_path = meson .current_build_dir() / sleef_install_dir / ' lib'
40+
41+ # Create a dependency that ensures the build happens but doesn't link the dummy file
42+ sleef_build_dep = declare_dependency (sources : [sleef_build_target])
43+
44+ # Create the actual linking dependencies
45+ sleef_dep = declare_dependency (
46+ dependencies : [sleef_build_dep], # Ensures build happens first
47+ compile_args : [' -I' + sleef_include_path],
48+ link_args : [' -L' + sleef_lib_path, ' -lsleef' , ' -Wl,-rpath,' + sleef_lib_path]
49+ )
50+
51+ sleefquad_dep = declare_dependency (
52+ dependencies : [sleef_build_dep], # Ensures build happens first
53+ compile_args : [' -I' + sleef_include_path],
54+ link_args : [' -L' + sleef_lib_path, ' -lsleefquad' , ' -Wl,-rpath,' + sleef_lib_path]
55+ )
0 commit comments