Skip to content

Commit

Permalink
fix: override default install directories for rpath consistency (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
c-dilks committed Nov 13, 2023
1 parent f62d332 commit 74f749a
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 12 deletions.
8 changes: 4 additions & 4 deletions install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def rmDir(dir,obj='files')
prefix = File.realpath options[:install]

# print and run a command
def exe(cmd)
def runCommand(cmd)
puts "[+++] #{cmd}"
system cmd or raise "FAILED: #{cmd}"
end
Expand Down Expand Up @@ -90,8 +90,8 @@ def buildOpt(key,val)

# run meson
if Dir.exists?(options[:build])
exe "#{meson[:config]} || #{meson[:setup]}"
runCommand "#{meson[:config]} || #{meson[:setup]}"
else
exe meson[:setup]
runCommand meson[:setup]
end
exe meson[:install]
runCommand meson[:install]
9 changes: 6 additions & 3 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ project(

project_inc = include_directories('src')

project_exe_rpath = ':'.join([
'$ORIGIN/../lib',
project_lib_install_dir = 'lib' # to keep it the same for different Linux distributions
project_bin_install_dir = 'bin'

project_lib_rpath = '$ORIGIN'
project_bin_rpath = ':'.join([
'$ORIGIN/../' + project_lib_install_dir,
get_option('hipo') + '/lib'
])
project_lib_rpath = '$ORIGIN'

fmt_dep = dependency('fmt')
hipo_dep = dependency('hipo4', method: 'cmake', cmake_args: '-DCMAKE_PREFIX_PATH=' + get_option('hipo'))
Expand Down
3 changes: 2 additions & 1 deletion src/algorithms/clas12/fiducial_cuts/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ algo_lib = shared_library(
include_directories: project_inc,
dependencies: services_dep,
link_with: services_lib,
install_rpath: project_lib_rpath,
install: true,
install_dir: project_lib_install_dir,
install_rpath: project_lib_rpath,
)

install_headers(algo_headers, subdir : meson.project_name())
3 changes: 2 additions & 1 deletion src/iguana/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ iguana_lib = shared_library(
iguana_sources,
include_directories: project_inc,
link_with: [ algo_lib, services_lib ],
install_rpath: project_lib_rpath,
install: true,
install_dir: project_lib_install_dir,
install_rpath: project_lib_rpath,
)

install_headers(iguana_headers, subdir : meson.project_name())
3 changes: 2 additions & 1 deletion src/services/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ services_lib = shared_library(
services_sources,
include_directories: project_inc,
dependencies: fmt_dep,
install_rpath: project_lib_rpath,
install: true,
install_dir: project_lib_install_dir,
install_rpath: project_lib_rpath,
)

services_dep = declare_dependency(
Expand Down
5 changes: 3 additions & 2 deletions src/tests/meson.build
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
test_exe = executable(
test_bin = executable(
'run',
'main.cc',
include_directories: project_inc,
dependencies: [ fmt_dep, hipo_dep ],
link_with: iguana_lib,
install_rpath: project_exe_rpath,
install: true,
install_dir: project_bin_install_dir,
install_rpath: project_bin_rpath,
)

0 comments on commit 74f749a

Please sign in to comment.