File tree Expand file tree Collapse file tree 1 file changed +9
-14
lines changed Expand file tree Collapse file tree 1 file changed +9
-14
lines changed Original file line number Diff line number Diff line change 13
13
lib_dirs = lib . split ( ':' )
14
14
rpath = lib_dirs . join ( ':' )
15
15
16
- $INCFLAGS << " -I#{ inc } "
17
-
18
- lib_dirs . each do |lib_dir |
19
- $LDFLAGS. prepend ( "-L#{ lib_dir } " )
20
- end
21
-
22
- # Add rpath for all lib directories
23
- $LDFLAGS. prepend ( "-Wl,-rpath,#{ rpath } " )
16
+ # Find the first lib directory containing libprotobuf.a
17
+ libprotobuf_dir = lib_dirs . find { |dir | File . exist? ( "#{ dir } /libprotobuf.a" ) }
18
+ raise "libprotobuf.a not found" unless libprotobuf_dir
24
19
25
- # Check for libprotobuf.a in any of the lib directories
26
- libprotobuf_found = lib_dirs . any? { |dir | File . exist? ( "#{ dir } /libprotobuf.a" ) }
27
- raise "libprotobuf.a not found" unless libprotobuf_found
20
+ raise "OR-Tools not found" unless have_library ( "ortools" )
28
21
29
- # Add libprotobuf.a to LDFLAGS
30
- $LDFLAGS << " #{ lib_dirs . find { |dir | File . exist? ( " #{ dir } /libprotobuf.a" ) } } /libprotobuf.a"
22
+ # -L flags for each lib directory
23
+ lib_dirs_flags = lib_dirs . map { |lib_dir | "-L #{ lib_dir } " } . join
31
24
32
- raise "OR-Tools not found" unless have_library ( "ortools" )
25
+ $INCFLAGS << " -I#{ inc } "
26
+ ld_flags = "-Wl,-rpath,#{ rpath } #{ lib_dirs_flags } #{ libprotobuf_dir } /libprotobuf.a "
27
+ $LDFLAGS. prepend ( ld_flags )
33
28
else
34
29
# download
35
30
require_relative "vendor"
You can’t perform that action at this time.
0 commit comments