|
31 | 31 |
|
32 | 32 | class Gem::Ext::CmakeBuilder |
33 | 33 | attr_accessor :runner, :profile |
34 | | - |
35 | 34 | def initialize |
36 | 35 | @runner = self.class.method(:run) |
37 | 36 | @profile = :release |
38 | 37 | end |
39 | 38 |
|
40 | | - def build(extension, dest_path, results, args = [], lib_dir = nil, cmake_dir = Dir.pwd, target_rbconfig = Gem.target_rbconfig) |
| 39 | + def build(extension, dest_path, results, args = [], lib_dir = nil, cmake_dir = Dir.pwd, |
| 40 | + target_rbconfig = Gem.target_rbconfig) |
41 | 41 | if target_rbconfig.path |
42 | 42 | warn "--target-rbconfig is not yet supported for CMake extensions. Ignoring" |
43 | 43 | end |
44 | 44 |
|
45 | | - # Make sure lib dir is set |
46 | | - unless lib_dir |
47 | | - lib_dir ||= File.join(dest_path, "lib") |
48 | | - end |
49 | | - |
50 | 45 | # Figure the build dir |
51 | 46 | build_dir = File.join(cmake_dir, "build") |
52 | 47 |
|
53 | 48 | # Check if the gem defined presets |
54 | 49 | check_presets(cmake_dir, args, results) |
55 | 50 |
|
56 | 51 | # Configure |
57 | | - configure(cmake_dir, build_dir, lib_dir, args, results) |
| 52 | + configure(cmake_dir, build_dir, dest_path, args, results) |
58 | 53 |
|
59 | 54 | # Compile |
60 | 55 | compile(cmake_dir, build_dir, args, results) |
61 | 56 |
|
62 | 57 | results |
63 | 58 | end |
64 | 59 |
|
65 | | - def configure(cmake_dir, build_dir, lib_dir, args, results) |
| 60 | + def configure(cmake_dir, build_dir, install_dir, args, results) |
66 | 61 | cmd = ["cmake", |
67 | 62 | cmake_dir, |
68 | 63 | "-B", |
69 | 64 | build_dir, |
70 | | - "-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=#{lib_dir}", # Windows |
71 | | - "-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=#{lib_dir}", # Not Windows |
| 65 | + "-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=#{install_dir}", # Windows |
| 66 | + "-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=#{install_dir}", # Not Windows |
72 | 67 | *Gem::Command.build_args, |
73 | 68 | *args] |
74 | 69 |
|
|
0 commit comments