Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add csharp_modular and java_modular examples support
- Loading branch information
Showing
5 changed files
with
60 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
FILE(GLOB TARGETS_SRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cs) | ||
LIST(REMOVE_ITEM TARGETS_SRC Load.cs) | ||
|
||
SET(CSHARP_FLAGS "${CMAKE_CURRENT_SOURCE_DIR}/Load.cs;/lib:${CSHARP_MODULAR_BUILD_DIR};/r:modshogun") | ||
|
||
FOREACH(EXAMPLE_SRC ${TARGETS_SRC}) | ||
STRING(REGEX REPLACE "(.*).cs" "\\1" EXAMPLE_NAME ${EXAMPLE_SRC}) | ||
|
||
ADD_CUSTOM_COMMAND(OUTPUT ${EXAMPLE_NAME} | ||
COMMAND ${CSHARP_COMPILER} ${CMAKE_CURRENT_SOURCE_DIR}/${EXAMPLE_SRC} ${CSHARP_FLAGS} | ||
DEPENDS csharp_modular) | ||
LIST(APPEND CSHARP_EXAMPLES ${EXAMPLE_NAME}) | ||
|
||
add_test(NAME csharp_modular-${EXAMPLE_NAME} | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
COMMAND ${CSHARP_INTERPRETER} ${CMAKE_CURRENT_SOURCE_DIR}/${EXAMPLE_NAME}.exe) | ||
set_property(TEST csharp_modular-${EXAMPLE_NAME} PROPERTY | ||
ENVIRONMENT "MONO_PATH=${CSHARP_MODULAR_BUILD_DIR}") | ||
ENDFOREACH() | ||
|
||
add_custom_target(build_csharp_examples ALL | ||
DEPENDS ${CSHARP_EXAMPLES} | ||
COMMENT "C# examples") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
FILE(GLOB EXAMPLES_SRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.java) | ||
LIST(REMOVE_ITEM EXAMPLES_SRC Load.java) | ||
|
||
SET(CLASSPATH "${JBLAS}:${SHOGUN_JAR}:${CMAKE_CURRENT_BINARY_DIR}") | ||
SET(JAVAOPTS "-Xmx1024m") | ||
SET(JAVA_LIB_PATH "${JAVA_MODULAR_BUILD_DIR}") | ||
|
||
ADD_CUSTOM_COMMAND(OUTPUT Load.class | ||
COMMAND ${Java_JAVAC_EXECUTABLE} -cp ${CLASSPATH} | ||
-d ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/Load.java | ||
DEPENDS shogun_jar) | ||
|
||
FOREACH(EXAMPLE_SRC ${EXAMPLES_SRC}) | ||
STRING(REGEX REPLACE "(.*).java" "\\1" EXAMPLE_NAME ${EXAMPLE_SRC}) | ||
|
||
ADD_CUSTOM_COMMAND(OUTPUT ${EXAMPLE_NAME}.class | ||
COMMAND ${Java_JAVAC_EXECUTABLE} -cp ${CLASSPATH} | ||
-d ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${EXAMPLE_SRC} | ||
DEPENDS shogun_jar) | ||
LIST(APPEND JAVA_EXAMPLES ${EXAMPLE_NAME}.class) | ||
|
||
add_test(NAME java_modular-${EXAMPLE_NAME} | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
COMMAND ${Java_JAVA_EXECUTABLE} ${JAVAOPTS} | ||
-cp ${CLASSPATH} | ||
-Djava.library.path=${JAVA_LIB_PATH} ${EXAMPLE_NAME}) | ||
ENDFOREACH() | ||
|
||
add_custom_target(build_java_examples ALL | ||
DEPENDS Load.class ${JAVA_EXAMPLES} | ||
COMMENT "Java examples") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters