diff options
author | Sven Gothel <[email protected]> | 2021-01-25 23:56:30 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2021-01-25 23:56:30 +0100 |
commit | 959c604af7c100d7d06b51d92d16aed64fac286f (patch) | |
tree | 014cebb20f5aa73d6ee67d93aaa55e618c48a3c9 /test/java/CMakeLists.txt | |
parent | 7054cd13119c6dc5e113dc5436e226ad70b380fc (diff) |
Complete build change: Using jaulib[_fat] if available (for Java) incl. native lib loading. Added junit test facility (Java).
Diffstat (limited to 'test/java/CMakeLists.txt')
-rw-r--r-- | test/java/CMakeLists.txt | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/java/CMakeLists.txt b/test/java/CMakeLists.txt new file mode 100644 index 00000000..9ef771d3 --- /dev/null +++ b/test/java/CMakeLists.txt @@ -0,0 +1,38 @@ +# java/CMakeLists.txt + +find_jar(JUNIT_JAR + NAMES junit4 junit + PATHS "/usr/share/java") + +set(direct_bt_test_jar_file ${CMAKE_CURRENT_BINARY_DIR}/direct_bt_test.jar CACHE FILEPATH "direct_bt test jar file" FORCE) + +file(GLOB_RECURSE TEST_JAVA_SOURCES "*.java") + +file(GLOB_RECURSE TEST_JAVA_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "Test*.java") + +add_jar(direct_bt_test + ${TEST_JAVA_SOURCES} + INCLUDE_JARS ${jaulib_fat_jar_file} ${direct_bt_fat_jar_file} ${jaulib_test_jar_file} ${JUNIT_JAR} + MANIFEST ${CMAKE_CURRENT_BINARY_DIR}/manifest.txt + OUTPUT_NAME direct_bt_test +) +add_dependencies(direct_bt_test jaulib_fat_jar direct_bt_fat_jar jaulib_test) + +install (FILES ${direct_bt_test_jar_file} DESTINATION ${CMAKE_INSTALL_LIBDIR}/../lib/java) + +string( REPLACE ".java" "" TEST_JAVA_FILES2 "${TEST_JAVA_FILES}" ) +string( REPLACE "/" "." BASENAMES_IDIOMATIC_EXAMPLES "${TEST_JAVA_FILES2}" ) +set( TARGETS_IDIOMATIC_EXAMPLES ${BASENAMES_IDIOMATIC_EXAMPLES} ) + +set(ALL_EXAMPLE_TARGETS + ${TARGETS_IDIOMATIC_EXAMPLES} +) + +foreach(name ${ALL_EXAMPLE_TARGETS}) + add_test (NAME ${name} COMMAND ${JAVA_RUNTIME} + -cp ${JUNIT_JAR}:${jaulib_fat_jar_file}:${direct_bt_fat_jar_file}:${jaulib_test_jar_file}:${direct_bt_test_jar_file} + org.junit.runner.JUnitCore ${name}) +endforeach() + + + |