Hi folks,
I’m writing a C extension (it’s actually C++ but that doesn’t matter
for this problem) for Ruby that consists of many files that
are intended to be compiled into a _single_ C extension, not a dozen
ones. To structure the code, I’ve got some subdirectories under the ext/
directory, i.e. my directory structure looks something like this:
/
ext/
- extconf.rb
- my_ext.c
- my_ext.h
thing1/
- thing1.c
- thing1.h
- thing1_2.c
- thing1_2.h
thing2/
- thing2.c
- thing2.h
thing2_1/
- something.c
- something.h
Now, as I said before I want a single C extension "my_ext.so", but I
just can't find out how to instruct mkmf to recognise subdiretories.
It just compiles the files residing in the toplevel directory into
object files, completely ignoring all the subdirectories. So, my
question is: How to tell mkmf about the subdirectories?
Valete,
Marvin
Marvin Gülker wrote in post #1045032:
Hi folks,
I’m writing a C extension (it’s actually C++ but that doesn’t matter
for this problem) for Ruby that consists of many files that
are intended to be compiled into a _single_ C extension, not a dozen
ones. To structure the code, I’ve got some subdirectories under the ext/
directory, i.e. my directory structure looks something like this:
/
ext/
- extconf.rb
- my_ext.c
- my_ext.h
thing1/
- thing1.c
- thing1.h
- thing1_2.c
- thing1_2.h
thing2/
- thing2.c
- thing2.h
thing2_1/
- something.c
- something.h
https://github.com/ruby/ruby/blob/trunk/lib/mkmf.rb#L1880-1932
But only works with one directory.
···
--
Luis Lavena
--
Posted via http://www.ruby-forum.com/\.
Thanks Luis, but I already knew this option and the limitation to one
directory was what made me ask here, actually the extension consists
of many quite small parts grouped into bigger ones that I don’t wanted
to put all into one directory. However, if there isn’t another way I’m
going to create multiple C extensions, one per subdirectory. This
shouldn’t hurt I guess.
Thank you anyway!
Marvin
···
Am 13.02.2012 22:10, schrieb Luis Lavena:
https://github.com/ruby/ruby/blob/trunk/lib/mkmf.rb#L1880-1932
But only works with one directory.