diff options
| author | Yukihiro Matsumoto <[email protected]> | 2012-05-23 02:20:13 +0900 |
|---|---|---|
| committer | Yukihiro Matsumoto <[email protected]> | 2012-05-23 02:20:13 +0900 |
| commit | df25301d8081b9351d8a2a9910c2f1d36de3f134 (patch) | |
| tree | 4f9cb83bab56b02a41a6139c8d23d7b071529845 /test/CMakeLists.txt | |
| parent | f44acf7bf87c8f4ad258a41bb7884c1f09a8aab9 (diff) | |
| parent | 0dc183b8f473e1398b1aeada9a39d96ad4d81518 (diff) | |
| download | mruby-df25301d8081b9351d8a2a9910c2f1d36de3f134.tar.gz mruby-df25301d8081b9351d8a2a9910c2f1d36de3f134.zip | |
Merge branch 'master' of github.com:mruby/mruby
Diffstat (limited to 'test/CMakeLists.txt')
| -rw-r--r-- | test/CMakeLists.txt | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 000000000..45031fc72 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,42 @@ +# build standalone mrbtest runner containing all *.rb tests + +if(NOT CMAKE_CROSSCOMPILING) + + file(GLOB MRBTEST_SRC_RB "assert.rb" "t/*.rb") + + # generate a single rb file from all existing test *.rb + add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/mrbtest.rbtmp" + DEPENDS xpcat + COMMAND xpcat -o "${CMAKE_CURRENT_BINARY_DIR}/mrbtest.rbtmp" ${MRBTEST_SRC_RB} + ) + + # mruby compile and generate C byte array representation + add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/mrbtest.ctmp" + DEPENDS mrbc "${CMAKE_CURRENT_BINARY_DIR}/mrbtest.rbtmp" + COMMAND mrbc -Bmrbtest_irep -o"${CMAKE_CURRENT_BINARY_DIR}/mrbtest.ctmp" + "${CMAKE_CURRENT_BINARY_DIR}/mrbtest.rbtmp" + ) + + # aggregate mruby's *.rb test files as a single C file + add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/mrbtest.c" + DEPENDS xpcat init_mrbtest.c "${CMAKE_CURRENT_BINARY_DIR}/mrbtest.ctmp" + COMMAND xpcat -o "${CMAKE_CURRENT_BINARY_DIR}/mrbtest.c" + "${CMAKE_CURRENT_SOURCE_DIR}/init_mrbtest.c" + "${CMAKE_CURRENT_BINARY_DIR}/mrbtest.ctmp" + ) + + add_executable(mrbtest + EXCLUDE_FROM_ALL + "${CMAKE_CURRENT_SOURCE_DIR}/driver.c" + "${CMAKE_CURRENT_BINARY_DIR}/mrbtest.c" + ) + target_link_libraries(mrbtest libmruby_static ${MRUBY_LIBS}) + + add_custom_target(test + DEPENDS mrbtest + COMMAND "${CMAKE_CURRENT_BINARY_DIR}/mrbtest" + ) + +endif() + +# vim: ts=2 sts=2 sw=2 et |
