This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/packages/swig/java/CMakeLists.txt

78 lines
1.8 KiB
CMake
Raw Normal View History

2015-06-19 01:23:51 +01:00
2015-08-07 22:57:53 +01:00
2016-04-05 08:11:05 +01:00
if (JNI_FOUND)
2015-08-07 22:57:53 +01:00
2015-08-18 21:05:07 +01:00
include ( UseSWIG )
2015-08-07 22:57:53 +01:00
# SET(CMAKE_SWIG_FLAGS -package YAP)
2015-08-18 21:05:07 +01:00
set (CMAKE_SWIG_OUTDIR ${CMAKE_CURRENT_BINARY_DIR} )
SET(SWIG_SOURCES
2015-08-07 22:57:53 +01:00
../yap.i
)
2015-08-18 21:05:07 +01:00
#set (CMAKE_JAVA_CLASS_OUTPUT_PATH java)
2015-08-07 22:57:53 +01:00
SET_SOURCE_FILES_PROPERTIES(${SWIG_SOURCES} PROPERTIES CPLUSPLUS ON)
2015-08-18 21:05:07 +01:00
include_directories (
${CMAKE_SOURCE_DIR}/CXX
${JAVA_INCLUDE_DIRS}
${JNI_INCLUDE_DIRS}
)
if ( ${C_COMPILER} MATCHES "Clang")
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-missing-prototypes")
endif()
if ( ${C_COMPILER} MATCHES "GNU")
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-missing-declarations")
endif()
#SET(CMAKE_SWIG_FLAGS "${CMAKE_SWIG_FLAGS} ")
2017-09-06 01:09:46 +01:00
SWIG_ADD_LIBRARY(Native LANGUAGE java SOURCES ${SWIG_SOURCES}
2015-08-18 21:05:07 +01:00
)
2016-04-05 08:11:05 +01:00
set(CMAKE_JNI_TARGET 1
)
2015-08-18 21:05:07 +01:00
ADD_JAR( NativeJar
SOURCES "../../../docs/icons/yap_16x16x32.png"
2015-08-18 21:05:07 +01:00
DEPENDS Native
PROPERTIES OUTPUT_NAME Native
)
install_jar(NativeJar ${libpl})
add_dependencies(NativeJar Native )
#install_jni_symlink(NativeJar .)
2015-08-07 22:57:53 +01:00
2015-08-18 21:05:07 +01:00
ADD_CUSTOM_COMMAND(TARGET NativeJar
POST_BUILD
2015-08-07 22:57:53 +01:00
COMMAND cmake -E echo "Compiling Java files..."
2015-08-18 21:05:07 +01:00
COMMAND ${Java_JAVAC_EXECUTABLE} *.java -cp .
2015-08-07 22:57:53 +01:00
COMMAND cmake -E echo "Creating jar file..."
2015-08-18 21:05:07 +01:00
COMMAND ${Java_JAR_EXECUTABLE} -ufM Native.jar *.class
2015-08-07 22:57:53 +01:00
)
2015-08-18 21:05:07 +01:00
ADD_JAR( JavaYAP
SOURCES "JavaYAP.java"
ENTRY_POINT JavaYAP
INCLUDE_JARS NativeJar )
SET(CMAKE_JAVA_COMPILE_FLAGS "-source" "1.8" "-target" "1.8")
2016-04-05 08:11:05 +01:00
install( TARGETS Native
2017-12-05 15:14:57 +00:00
RUNTIME DESTINATION ${CMAKE_INSTALL_BIINDIR}
2015-08-18 21:05:07 +01:00
ARCHIVE DESTINATION ${libdir}
LIBRARY DESTINATION ${libdir}
)
2015-08-07 22:57:53 +01:00
2015-08-18 21:05:07 +01:00
install_jar(JavaYAP ${libpl})
#install_jni_symlink(JavaYAP ${libpl})
2015-08-07 22:57:53 +01:00
2015-06-19 01:23:51 +01:00
2015-08-18 21:05:07 +01:00
2016-04-05 08:11:05 +01:00
Endif ( JNI_FOUND)