set(release_version "${SIMGRID_VERSION_MAJOR}.${SIMGRID_VERSION_MINOR}.${SIMGRID_VERSION_PATCH}")
endif()
set(libsimgrid_version "${release_version}")
-set(libSG_java_version "${release_version}")
+set(libsimgrid-java_version "${release_version}")
set(GCC_NEED_VERSION "4.0")
set(APPLE_NEED_GCC_VERSION "4.6")
endif()
if(enable_java)
- install(TARGETS SG_java
+ install(TARGETS simgrid-java
DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/)
install(FILES ${SIMGRID_JAR}
DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/java/)
include(UseJava)
-# Rules to build libSG_java
+# Rules to build libsimgrid-java
#
-add_library(SG_java SHARED ${JMSG_C_SRC})
-set_target_properties(SG_java PROPERTIES VERSION ${libSG_java_version})
+add_library(simgrid-java SHARED ${JMSG_C_SRC})
+set_target_properties(simgrid-java PROPERTIES VERSION ${libsimgrid-java_version})
if (CMAKE_VERSION VERSION_LESS "2.8.8")
include_directories(${JNI_INCLUDE_DIRS})
message(WARNING "[Java] Try to workaround missing feature in older CMake. You should better update CMake to version 2.8.8 or above.")
get_directory_property(CHECK_INCLUDES INCLUDE_DIRECTORIES)
else()
- get_target_property(COMMON_INCLUDES SG_java INCLUDE_DIRECTORIES)
+ get_target_property(COMMON_INCLUDES simgrid-java INCLUDE_DIRECTORIES)
if (COMMON_INCLUDES)
- set_target_properties(SG_java PROPERTIES
+ set_target_properties(simgrid-java PROPERTIES
INCLUDE_DIRECTORIES "${COMMON_INCLUDES};${JNI_INCLUDE_DIRS}")
else()
- set_target_properties(SG_java PROPERTIES
+ set_target_properties(simgrid-java PROPERTIES
INCLUDE_DIRECTORIES "${JNI_INCLUDE_DIRS}")
endif()
- add_dependencies(SG_java simgrid)
+ add_dependencies(simgrid-java simgrid)
- get_target_property(CHECK_INCLUDES SG_java INCLUDE_DIRECTORIES)
+ get_target_property(CHECK_INCLUDES simgrid-java INCLUDE_DIRECTORIES)
endif()
-message("-- [Java] SG_java includes: ${CHECK_INCLUDES}")
+message("-- [Java] simgrid-java includes: ${CHECK_INCLUDES}")
-target_link_libraries(SG_java simgrid)
+target_link_libraries(simgrid-java simgrid)
message(FATAL_ERROR "Java JVM needs to be 32 bits to be able to run with Simgrid on Windows for now")
endif()
- set_target_properties(SG_java PROPERTIES
+ set_target_properties(simgrid-java PROPERTIES
LINK_FLAGS "-Wl,--subsystem,windows,--kill-at"
PREFIX "")
find_path(PEXPORTS_PATH NAMES pexports.exe PATHS NO_DEFAULT_PATHS)
message(STATUS "pexports: ${PEXPORTS_PATH}")
if(PEXPORTS_PATH)
- add_custom_command(TARGET SG_java POST_BUILD
- COMMAND ${PEXPORTS_PATH}/pexports.exe ${CMAKE_BINARY_DIR}/lib/SG_java.dll > ${CMAKE_BINARY_DIR}/lib/SG_java.def)
+ add_custom_command(TARGET simgrid-java POST_BUILD
+ COMMAND ${PEXPORTS_PATH}/pexports.exe ${CMAKE_BINARY_DIR}/lib/simgrid-java.dll > ${CMAKE_BINARY_DIR}/lib/simgrid-java.def)
endif(PEXPORTS_PATH)
endif()
set(LIBSIMGRID_SO
libsimgrid${CMAKE_SHARED_LIBRARY_SUFFIX})
set(LIBSG_JAVA_SO
- ${CMAKE_SHARED_LIBRARY_PREFIX}SG_java${CMAKE_SHARED_LIBRARY_SUFFIX})
+ ${CMAKE_SHARED_LIBRARY_PREFIX}simgrid-java${CMAKE_SHARED_LIBRARY_SUFFIX})
## Name of the "NATIVE" folder in simgrid.jar
##
## Here is how to build simgrid.jar
##
set(CMAKE_JAVA_TARGET_OUTPUT_NAME simgrid)
-add_jar(SG_java_pre_jar ${JMSG_JAVA_SRC})
+add_jar(simgrid-java_pre_jar ${JMSG_JAVA_SRC})
add_custom_command(
COMMENT "Finalize simgrid.jar..."
OUTPUT ${SIMGRID_JAR}_finalized
- DEPENDS simgrid SG_java SG_java_pre_jar
+ DEPENDS simgrid simgrid-java simgrid-java_pre_jar
${SIMGRID_JAR} ${MANIFEST_FILE}
${CMAKE_BINARY_DIR}/lib/${LIBSIMGRID_SO}
${CMAKE_BINARY_DIR}/lib/${LIBSG_JAVA_SO}
COMMAND ${CMAKE_COMMAND} -E remove ${SIMGRID_JAR}_finalized
COMMAND ${CMAKE_COMMAND} -E touch ${SIMGRID_JAR}_finalized
)
-add_custom_target(SG_java_jar ALL DEPENDS ${SIMGRID_JAR}_finalized)
+add_custom_target(simgrid-java_jar ALL DEPENDS ${SIMGRID_JAR}_finalized)
# install java library and examples\r
CreateDirectory $INSTDIR\examples\simgrid-java\r
setOutPath $INSTDIR\lib\r
- file /nonfatal "lib\SG_java.dll"\r
- file /nonfatal "lib\SG_java.def"\r
+ file /nonfatal "lib\simgrid-java.dll"\r
+ file /nonfatal "lib\simgrid-java.def"\r
file /nonfatal "simgrid.jar"\r
setOutPath $INSTDIR\examples\simgrid-java\r
file /nonfatal /r ".\examples\"\r
\subsubsection bindings_binding_java_use How to use Simgrid-java
To execute the examples you need to add the path where you installed
-the generated `libSG_java` and `libsimgrid` libraries
+the generated `libsimgrid-java` and `libsimgrid` libraries
into the `LD_LIBRARY_PATH`.
Be careful on Mac, this variable is called `DYLD_LIBRARY_PATH` and not
simulation with the correct JVM. The selected context factory gets
displayed automatically.
~~~~{.sh}
-export LD_LIBRARY_PATH=/path/to/simgrid.so:/path/to/libSG_java.so
+export LD_LIBRARY_PATH=/path/to/simgrid.so:/path/to/libsimgrid-java.so
cd examples
$PATH_TO_COROUTINE_JVM/java -cp .:../simgrid.jar masterslave.Masterslave masterslave/ masterslaveDeployment.xml platform.xml
~~~~
add_custom_command(
COMMENT "Building ${example}..."
OUTPUT ${example}_compiled
- DEPENDS ${sources} SG_java_jar ${SIMGRID_JAR}
+ DEPENDS ${sources} simgrid-java_jar ${SIMGRID_JAR}
COMMAND ${JAVA_COMPILE} -cp ${SIMGRID_JAR}
-d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
COMMAND ${CMAKE_COMMAND} -E remove ${example}_compiled
add_custom_command(
COMMENT "Building ${example}..."
OUTPUT ${example}_compiled
- DEPENDS ${sources} SG_java_jar ${SIMGRID_JAR}
+ DEPENDS ${sources} simgrid-java_jar ${SIMGRID_JAR}
COMMAND ${JAVA_COMPILE} -cp ${SIMGRID_JAR}
-d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
COMMAND ${CMAKE_COMMAND} -E remove ${example}_compiled
add_custom_command(
COMMENT "Building ${example}..."
OUTPUT ${example}_compiled
- DEPENDS ${sources} SG_java_jar ${SIMGRID_JAR}
+ DEPENDS ${sources} simgrid-java_jar ${SIMGRID_JAR}
COMMAND ${JAVA_COMPILE} -cp ${SIMGRID_JAR}
-d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
COMMAND ${CMAKE_COMMAND} -E remove ${example}_compiled
add_custom_command(
COMMENT "Building ${example}..."
OUTPUT ${example}_compiled
- DEPENDS ${sources} SG_java_jar ${SIMGRID_JAR}
+ DEPENDS ${sources} simgrid-java_jar ${SIMGRID_JAR}
COMMAND ${JAVA_COMPILE} -cp ${SIMGRID_JAR}
-d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
COMMAND ${CMAKE_COMMAND} -E remove ${example}_compiled
add_custom_command(
COMMENT "Building ${example}..."
OUTPUT ${example}_compiled
- DEPENDS ${sources} SG_java_jar ${SIMGRID_JAR}
+ DEPENDS ${sources} simgrid-java_jar ${SIMGRID_JAR}
COMMAND ${JAVA_COMPILE} -cp ${SIMGRID_JAR}
-d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
COMMAND ${CMAKE_COMMAND} -E remove ${example}_compiled
add_custom_command(
COMMENT "Building ${example}..."
OUTPUT ${example}_compiled
- DEPENDS ${sources} SG_java_jar ${SIMGRID_JAR}
+ DEPENDS ${sources} simgrid-java_jar ${SIMGRID_JAR}
COMMAND ${JAVA_COMPILE} -cp ${SIMGRID_JAR}
-d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
COMMAND ${CMAKE_COMMAND} -E remove ${example}_compiled
add_custom_command(
COMMENT "Building ${example}..."
OUTPUT ${example}_compiled
- DEPENDS ${sources} SG_java_jar ${SIMGRID_JAR}
+ DEPENDS ${sources} simgrid-java_jar ${SIMGRID_JAR}
COMMAND ${JAVA_COMPILE} -cp ${SIMGRID_JAR}
-d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
COMMAND ${CMAKE_COMMAND} -E remove ${example}_compiled
add_custom_command(
COMMENT "Building ${example}..."
OUTPUT ${example}_compiled
- DEPENDS ${sources} SG_java_jar ${SIMGRID_JAR}
+ DEPENDS ${sources} simgrid-java_jar ${SIMGRID_JAR}
COMMAND ${JAVA_COMPILE} -cp ${SIMGRID_JAR}
-d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
COMMAND ${CMAKE_COMMAND} -E remove ${example}_compiled
add_custom_command(
COMMENT "Building ${example}..."
OUTPUT ${example}_compiled
- DEPENDS ${sources} SG_java_jar ${SIMGRID_JAR}
+ DEPENDS ${sources} simgrid-java_jar ${SIMGRID_JAR}
COMMAND ${JAVA_COMPILE} -cp ${SIMGRID_JAR}
-d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
COMMAND ${CMAKE_COMMAND} -E remove ${example}_compiled
add_custom_command(
COMMENT "Building ${example}..."
OUTPUT ${example}_compiled
- DEPENDS ${sources} SG_java_jar ${SIMGRID_JAR}
+ DEPENDS ${sources} simgrid-java_jar ${SIMGRID_JAR}
COMMAND ${JAVA_COMPILE} -cp ${SIMGRID_JAR}
-d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
COMMAND ${CMAKE_COMMAND} -E remove ${example}_compiled
add_custom_command(
COMMENT "Building ${example}..."
OUTPUT ${example}_compiled
- DEPENDS ${sources} SG_java_jar ${SIMGRID_JAR}
+ DEPENDS ${sources} simgrid-java_jar ${SIMGRID_JAR}
COMMAND ${JAVA_COMPILE} -cp ${SIMGRID_JAR}
-d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
COMMAND ${CMAKE_COMMAND} -E remove ${example}_compiled
add_custom_command(
COMMENT "Building ${example}..."
OUTPUT ${example}_compiled
- DEPENDS ${sources} SG_java_jar ${SIMGRID_JAR}
+ DEPENDS ${sources} simgrid-java_jar ${SIMGRID_JAR}
COMMAND ${JAVA_COMPILE} -cp ${SIMGRID_JAR}
-d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
COMMAND ${CMAKE_COMMAND} -E remove ${example}_compiled
add_custom_command(
COMMENT "Building ${example}..."
OUTPUT ${example}_compiled
- DEPENDS ${sources} SG_java_jar ${SIMGRID_JAR}
+ DEPENDS ${sources} simgrid-java_jar ${SIMGRID_JAR}
COMMAND ${JAVA_COMPILE} -cp ${SIMGRID_JAR}
-d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
COMMAND ${CMAKE_COMMAND} -E remove ${example}_compiled
add_custom_command(
COMMENT "Building ${example}..."
OUTPUT ${example}_compiled
- DEPENDS ${sources} SG_java_jar ${SIMGRID_JAR}
+ DEPENDS ${sources} simgrid-java_jar ${SIMGRID_JAR}
COMMAND ${JAVA_COMPILE} -cp ${SIMGRID_JAR}
-d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
COMMAND ${CMAKE_COMMAND} -E remove ${example}_compiled
add_custom_command(
COMMENT "Building ${example}..."
OUTPUT ${example}_compiled
- DEPENDS ${sources} SG_java_jar ${SIMGRID_JAR}
+ DEPENDS ${sources} simgrid-java_jar ${SIMGRID_JAR}
COMMAND ${JAVA_COMPILE} -cp ${SIMGRID_JAR}
-d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
COMMAND ${CMAKE_COMMAND} -E remove ${example}_compiled
add_custom_command(
COMMENT "Building ${example}..."
OUTPUT ${example}_compiled
- DEPENDS ${sources} SG_java_jar ${SIMGRID_JAR}
+ DEPENDS ${sources} simgrid-java_jar ${SIMGRID_JAR}
COMMAND ${JAVA_COMPILE} -cp ${SIMGRID_JAR}
-d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
COMMAND ${CMAKE_COMMAND} -E remove ${example}_compiled
add_custom_command(
COMMENT "Building ${example}..."
OUTPUT ${example}_compiled
- DEPENDS ${sources} SG_java_jar ${SIMGRID_JAR}
+ DEPENDS ${sources} simgrid-java_jar ${SIMGRID_JAR}
COMMAND ${JAVA_COMPILE} -cp ${SIMGRID_JAR}
-d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
COMMAND ${CMAKE_COMMAND} -E remove ${example}_compiled
add_custom_command(
COMMENT "Building ${example}..."
OUTPUT ${example}_compiled
- DEPENDS ${sources} SG_java_jar ${SIMGRID_JAR}
+ DEPENDS ${sources} simgrid-java_jar ${SIMGRID_JAR}
COMMAND ${SCALA_COMPILE} -cp ${SIMGRID_JAR}
-d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
COMMAND ${CMAKE_COMMAND} -E remove ${example}_compiled
add_custom_command(
COMMENT "Building ${example}..."
OUTPUT ${example}_compiled
- DEPENDS ${sources} SG_java_jar ${SIMGRID_JAR}
+ DEPENDS ${sources} simgrid-java_jar ${SIMGRID_JAR}
COMMAND ${SCALA_COMPILE} -cp ${SIMGRID_JAR}
-d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
COMMAND ${CMAKE_COMMAND} -E remove ${example}_compiled
add_custom_command(
COMMENT "Building ${example}..."
OUTPUT ${example}_compiled
- DEPENDS ${sources} SG_java_jar ${SIMGRID_JAR}
+ DEPENDS ${sources} simgrid-java_jar ${SIMGRID_JAR}
COMMAND ${SCALA_COMPILE} -cp ${SIMGRID_JAR}
-d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
COMMAND ${CMAKE_COMMAND} -E remove ${example}_compiled
return;
try {
/* prefer the version on disk, if existing */
- System.loadLibrary("SG_java");
+ System.loadLibrary("simgrid-java");
} catch (UnsatisfiedLinkError e) {
/* If not found, unpack the one bundled into the jar file and use it */
loadLib("simgrid");
- loadLib("SG_java");
+ loadLib("simgrid-java");
}
isNativeInited = true;
}