Ruby C-Extensions: Compile files in subdirectory?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJPNEGDAAoJELh1XLHFkqha0/kH/2b5BCo1qIjYS6af3L9Zj+EA
K6836EYnrZNvyvmWTOKms4PkRGfucWQNygS0xm/HtC8CqkIL8Co+J85fi9+9g137
O5VTgypLwjCogFr1UMqv4+bJlxaO3EAgDWoJOArRj9esYOHa+o6hTsLl7npM1Who
fOuH8J8MUTv3G6ic1TVffxlAWMMdD/FMGvn0AmWjCZbrAws57HyMHnWNx4tvBUIu
nWp7nJ0usl4M9gtGPk+D2A8BMe9ufnci5eBQ2QyZN28FGT4dW8ufoXSxzPBuZhKh
4BkVAi9WjRFxLUYD7LIs6nEjdQkYwjLtaSLl4grUCE1JCglts0ixb5ywpTp9qWA=
=8zss
-----END PGP SIGNATURE-----

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 L.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am 13.02.2012 22:10, schrieb Luis L.:

https://github.com/ruby/ruby/blob/trunk/lib/mkmf.rb#L1880-1932

But only works with one directory.

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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJPOYELAAoJELh1XLHFkqharpcIAIFdtRoGCAidoHDWoPG/FM05
ZtcFWIJTV5uxg806mHxIiGQ1g7DyFL+5c2vXFonJs7n31knCyzXEeKREuxLqqXCa
2hMcINZphZFKUJVOREPhsb7vuelWduBkea1y2OQAb3lxqJZq+9dbmYKhvj8Tsq/s
7QxQPN5UM7LKOqfwKbHhUD6J85VsCX1xoRLey7jbAuea/+VAJZ+9ZBVJwKRQ1bM+
v5JQj+PMPeR2eUtHIr+fgh6TtfHJIaZyQxsGL1wH6Tf/DUmR5G5FZegWK8qgL78Y
sF8/zee1l0xlOznhrSGKux6D4nokPR6IkZWCHGTdC/UO3tU1uAmeiUfVI2c+T+I=
=MBNT
-----END PGP SIGNATURE-----

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs