Skip to content

Commit

Permalink
Link with libdl when we compile shared libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
amontoison committed Jul 27, 2024
1 parent 773437a commit df5360c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
13 changes: 10 additions & 3 deletions .github/julia/build_tarballs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ cd ${WORKSPACE}/srcdir/CUTEst
meson setup builddir --cross-file=${MESON_TARGET_TOOLCHAIN%.*}_gcc.meson --prefix=$prefix -Dquadruple=true
meson compile -C builddir
meson install -C builddir
meson setup builddir_shared --cross-file=${MESON_TARGET_TOOLCHAIN%.*}_gcc.meson --prefix=$prefix -Dquadruple=true -Ddefault_library=shared
meson compile -C builddir_shared
meson install -C builddir_shared
"""

# These are the platforms we will build for by default, unless further
Expand All @@ -29,9 +33,12 @@ platforms = expand_gfortran_versions(platforms)

# The products that we will ensure are always built
products = [
FileProduct("lib/libcutest_single.a", :libcutest_single)
FileProduct("lib/libcutest_double.a", :libcutest_double)
FileProduct("lib/libcutest_quadruple.a", :libcutest_quadruple)
FileProduct("lib/libcutest_single.a", :libcutest_single_a),
FileProduct("lib/libcutest_double.a", :libcutest_double_a),
FileProduct("lib/libcutest_quadruple.a", :libcutest_quadruple_a),
LibraryProduct("libcutest_single", :libcutest_single),
LibraryProduct("libcutest_double", :libcutest_double),
LibraryProduct("libcutest_quadruple", :libcutest_quadruple),
]

# Dependencies that must be installed before this package can be built
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/meson.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ jobs:
python-version: '3.11'

- name: Install Meson and Ninja
run: pip install meson ninja
shell: bash
run: |
pip install meson==1.4.1
pip install ninja
- name: Set the environment variables CUTEST
shell: bash
Expand Down
8 changes: 7 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ project(
'CUTEst',
'fortran', 'c',
version: '2.2.0',
meson_version: '>= 0.61.0',
meson_version: '>= 0.62.0',
default_options: [
'buildtype=release',
'libdir=lib',
Expand Down Expand Up @@ -36,6 +36,9 @@ cutest_headers = []
libcutest_include = []
libcutest_include += include_directories('include')

# Dependency
libdl = fc.find_library('dl', required : false)

# Sources
subdir('include')
# subdir('src/algencan') # needs algencan_
Expand Down Expand Up @@ -139,6 +142,7 @@ gen_single = generator(fc_compiler,
pp_sources_single = [gen_single.process(libcutest_src)]

libcutest_single = library(libcutest_single_name,
dependencies : libdl,
sources : pp_sources_single + libcutest_c_src,
include_directories : libcutest_include,
install : true)
Expand All @@ -158,6 +162,7 @@ gen_double = generator(fc_compiler,
pp_sources_double = [gen_double.process(libcutest_src)]

libcutest_double = library(libcutest_double_name,
dependencies : libdl,
sources : pp_sources_double + libcutest_c_src,
include_directories : libcutest_include,
install : true)
Expand All @@ -178,6 +183,7 @@ if build_quadruple
pp_sources_quadruple = [gen_quadruple.process(libcutest_src)]

libcutest_quadruple = library(libcutest_quadruple_name,
dependencies : libdl,
sources : pp_sources_quadruple + libcutest_c_src,
include_directories : libcutest_include,
install : true)
Expand Down

0 comments on commit df5360c

Please sign in to comment.