Skip to content

Commit 9a4018f

Browse files
committed
Build native extensions when installing
1 parent 3dc9223 commit 9a4018f

File tree

5 files changed

+12
-5
lines changed

5 files changed

+12
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ ext/symengine/extconf.h
88
notebooks/.ipynb_checkpoints/
99
notebooks/Gemfile.lock
1010
callgrind.out.*
11+
*~

CMakeLists.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,4 @@ include_directories(${SYMENGINE_INCLUDE_DIRS})
1212
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
1313
find_package(Ruby REQUIRED)
1414

15-
message("Copying source of ruby wrappers into: ${CMAKE_CURRENT_BINARY_DIR}")
16-
file(COPY ${ruby_wrapper_SOURCE_DIR}/ DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
17-
18-
add_subdirectory(ext/symengine)
15+
add_subdirectory(ext/symengine)

ext/symengine/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,10 @@ set_target_properties(symengine_ruby PROPERTIES
1616
OUTPUT_NAME "symengine"
1717
LIBRARY_OUTPUT_DIRECTORY "${ruby_wrapper_BINARY_DIR}/lib/symengine"
1818
)
19+
20+
# Ruby gems require a install target.
21+
install(TARGETS symengine_ruby
22+
RUNTIME DESTINATION lib/symengine
23+
ARCHIVE DESTINATION lib/symengine
24+
LIBRARY DESTINATION lib/symengine
25+
)

ext/symengine/extconf.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
exec 'cmake -DCMAKE_INSTALL_PREFIX=../../ %s ../../ ' % [ARGV.join(" ")]

symengine.gemspec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ Gem::Specification.new do |gem|
66
gem.authors = ['Abinash Meher']
77
gem.email = ["abinashdakshana999@gmail.com"]
88
gem.homepage = 'https://github.com/sympy/symengine'
9-
gem.files = Dir["lib/**/*", "bin/*", "LICENSE", "*.md"]
9+
gem.files = Dir["lib/**/*", "bin/*", "LICENSE", "*.md", "ext/**/*", "CMakeLists.txt"]
1010
gem.require_paths = ["lib"]
11+
gem.extensions = ["ext/symengine/extconf.rb"]
1112
gem.license = 'MIT'
1213

1314
gem.add_development_dependency 'bundler', '~> 1.7'

0 commit comments

Comments
 (0)