summaryrefslogtreecommitdiffhomepage
path: root/mrblib
diff options
context:
space:
mode:
authorBeoran <[email protected]>2012-05-01 20:13:09 +0200
committerJon <[email protected]>2012-05-22 09:11:13 -0400
commitb5dcb7128d7d235b66b4d9be879d26364dd1e3e9 (patch)
treec58c7ccfa87d4cdd9c9f8a503356f5e2d142ea16 /mrblib
parentabacbf667241ff4919b14007ef1a704f321de96d (diff)
downloadmruby-b5dcb7128d7d235b66b4d9be879d26364dd1e3e9.tar.gz
mruby-b5dcb7128d7d235b66b4d9be879d26364dd1e3e9.zip
First cmake build system. Works on Linux.
Diffstat (limited to 'mrblib')
-rw-r--r--mrblib/CMakeLists.txt35
-rw-r--r--mrblib/Makefile.orig (renamed from mrblib/Makefile)0
2 files changed, 35 insertions, 0 deletions
diff --git a/mrblib/CMakeLists.txt b/mrblib/CMakeLists.txt
new file mode 100644
index 000000000..30881c611
--- /dev/null
+++ b/mrblib/CMakeLists.txt
@@ -0,0 +1,35 @@
+# build mrblib
+# need custom commands
+# Compile C source from merged mruby source
+
+file(GLOB MRBLIB_SRC_RB "*.rb")
+
+# generate the a single rubu file from all the existing ones.
+add_custom_command(OUTPUT mrblib.rbtmp
+COMMAND cat ${MRBLIB_SRC_RB} > mrblib.rbtmp
+DEPENDS ${MRBLIB_SRC_RB}
+)
+
+# generate the intermediate representation in C
+add_custom_command(OUTPUT mrblib_irep.c
+COMMAND echo -B mrblib_irep -o mrblib_irep.c mrblib.rbtmp
+COMMAND mrbc -Bmrblib_irep -omrblib_irep.c mrblib.rbtmp
+DEPENDS mrblib.rbtmp
+)
+
+# finally generate the library's c file
+add_custom_command(OUTPUT mrblib.c
+COMMAND cat init_mrblib.c mrblib_irep.c > mrblib.c
+DEPENDS init_mrblib.c mrblib_irep.c
+)
+
+# only use this C file to generate mrblib.
+set(MRBLIB_SRC_C mrblib.c)
+# add_library(mrblib_static STATIC ${MRBLIB_SRC_C})
+add_library(mrblib_object OBJECT ${MRBLIB_SRC_C})
+# target_link_libraries(mrblib ritevm ${MRUBY_LIBS})
+# target_link_libraries(mrblib_static ritevm_static ${MRUBY_LIBS})
+# install(TARGETS mrblib mrblib_static
+# LIBRARY DESTINATION lib
+# ARCHIVE DESTINATION lib)
+
diff --git a/mrblib/Makefile b/mrblib/Makefile.orig
index d22c4509f..d22c4509f 100644
--- a/mrblib/Makefile
+++ b/mrblib/Makefile.orig