-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
61 lines (41 loc) · 2.37 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
cmake_minimum_required(VERSION 2.8)
find_package(SWIG REQUIRED)
find_package(JNI REQUIRED)
find_package(Java REQUIRED)
include(${SWIG_USE_FILE})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-strict-aliasing")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -fno-strict-aliasing")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall -fno-strict-aliasing")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Wall -fno-strict-aliasing")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG -Wall -g -fno-strict-aliasing")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG -Wall -g -fno-strict-aliasing")
include_directories(${JAVA_INCLUDE_PATH})
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/package)
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(CMAKE_INSTALL_RPATH \$ORIGIN)
include_directories(${JAVA_INCLUDE_PATH}/linux)
endif()
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_JAVA_INCLUDE_PATH /Users/marc/.m2/repository/log4j/log4j/1.2.16/log4j-1.2.16.jar)
#set(CMAKE_JAVA_INCLUDE_PATH /home/clean/.m2/repository/log4j/log4j/1.2.16/log4j-1.2.16.jar)
set(CMAKE_SWIG_OUTDIR ${CMAKE_CURRENT_BINARY_DIR}/com/animetrics/utils)
set(CMAKE_SWIG_FLAGS "-package" "com.animetrics.utils")
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${ADDITIONAL_MAKE_CLEAN_FILES};${CMAKE_SWIG_OUTDIR}")
set_source_files_properties(SR.i PROPERTIES CPLUSPLUS ON)
swig_add_module(SR Java SR.i STDIORedirectNative.cpp)
add_custom_command(
OUTPUT ${CMAKE_SWIG_OUTDIR}/STDIORedirectToLog4j.java
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/STDIORedirectToLog4j.java ${CMAKE_CURRENT_BINARY_DIR}/com/animetrics/utils/
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/STDIORedirectToLog4j.java)
add_custom_target(copy_java
DEPENDS ${CMAKE_SWIG_OUTDIR}/STDIORedirectToLog4j.java)
set_source_files_properties( ${CMAKE_SWIG_OUTDIR}/STDIORedirectToLog4j.java PROPERTIES GENERATED TRUE )
include(UseJava)
add_jar(com.animetrics.utils ${CMAKE_SWIG_OUTDIR}/*.java)
add_dependencies(com.animetrics.utils copy_java)
install(TARGETS SR DESTINATION lib)
install_jar(com.animetrics.utils jar/)
# add a test client
set(CMAKE_JAVA_INCLUDE_PATH com.animetrics.utils.jar /Users/marc/.m2/repository/log4j/log4j/1.2.16/log4j-1.2.16.jar)
#set(CMAKE_JAVA_INCLUDE_PATH com.animetrics.utils.jar /home/clean/.m2/repository/log4j/log4j/1.2.16/log4j-1.2.16.jar)
add_jar(testSTDIO testSTDIO.java)