1
# cmake/modules/java.cmake
3
# Java binding configuration
5
# Copyright (C) 2006 Andrew Ross
7
# This file is part of PLplot.
9
# PLplot is free software; you can redistribute it and/or modify
10
# it under the terms of the GNU Library General Public License as published
11
# by the Free Software Foundation; version 2 of the License.
13
# PLplot is distributed in the hope that it will be useful,
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
# GNU Library General Public License for more details.
18
# You should have received a copy of the GNU Library General Public License
19
# along with the file PLplot; if not, write to the Free Software
20
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22
# Module for determining Java bindings configuration options
24
# Options to enable Java bindings
25
if(DEFAULT_NO_BINDINGS)
26
option(ENABLE_java "Enable Java bindings" OFF)
27
else(DEFAULT_NO_BINDINGS)
28
option(ENABLE_java "Enable Java bindings" ON)
29
endif(DEFAULT_NO_BINDINGS)
31
if(ENABLE_java AND NOT BUILD_SHARED_LIBS)
32
message(STATUS "WARNING: "
33
"Java requires shared libraries. Disabling java bindings")
34
set(ENABLE_java OFF CACHE BOOL "Enable Java bindings" FORCE)
35
endif(ENABLE_java AND NOT BUILD_SHARED_LIBS)
37
if(ENABLE_java AND NOT SWIG_FOUND)
38
message(STATUS "WARNING: "
39
"swig not found. Disabling java bindings")
40
set(ENABLE_java OFF CACHE BOOL "Enable Java bindings" FORCE)
41
endif(ENABLE_java AND NOT SWIG_FOUND)
43
if(ENABLE_java AND NOT PLPLOT_Java_COMPILER_WORKS)
44
workaround_9220(Java PLPLOT_Java_COMPILER_WORKS)
45
if(NOT PLPLOT_Java_COMPILER_WORKS)
46
message(STATUS "WARNING: no working Java compiler so disabling Java bindings and examples.")
47
set(ENABLE_java OFF CACHE BOOL "Enable Java bindings" FORCE)
48
endif(NOT PLPLOT_Java_COMPILER_WORKS)
49
endif(ENABLE_java AND NOT PLPLOT_Java_COMPILER_WORKS)
52
# Find and check Java compiler.
53
enable_language(Java OPTIONAL)
54
if(NOT CMAKE_Java_COMPILER_WORKS)
55
message(STATUS "WARNING: no working Java compiler so disabling Java bindings and examples.")
56
set(ENABLE_java OFF CACHE BOOL "Enable java bindings" FORCE)
57
endif(NOT CMAKE_Java_COMPILER_WORKS)
61
if(NOT CMAKE_Java_ARCHIVE)
62
message(STATUS "WARNING: java archiver (jar) not found. Disabling java bindings")
63
set(ENABLE_java OFF CACHE BOOL "Enable Java bindings" FORCE)
64
endif(NOT CMAKE_Java_ARCHIVE)
68
# Check for java environment
70
# If CMake doesn't find jni.h you need set CMAKE_INCLUDE_PATH
71
if(NOT JAVA_INCLUDE_PATH)
73
"WARNING: jni.h header not found. Disabling Java bindings.\n"
74
" Please install that header and/or set the environment variable\n"
75
" CMAKE_INCLUDE_PATH appropriately."
77
set(ENABLE_java OFF CACHE BOOL "Enable Java bindings" FORCE)
78
endif(NOT JAVA_INCLUDE_PATH)
82
# Set up installation locations for java specific files.
84
set(JAR_DIR ${CMAKE_INSTALL_DATADIR}/java
85
CACHE PATH "PLplot jar file install location"
87
get_filename_component(JAVADATA_HARDDIR ${JAR_DIR} ABSOLUTE)
89
set(JAVAWRAPPER_DIR ${LIB_DIR}/jni
90
CACHE PATH "PLplot java plugin install location"
92
get_filename_component(JAVAWRAPPER_HARDDIR ${JAVAWRAPPER_DIR} ABSOLUTE)
93
# Library name suffix is system dependent. Tests have shown
94
# that ${CMAKE_SHARED_LIBRARY_SUFFIX} gives the correct suffix on both
95
# Linux and windows, and from CMAKEPREFIX/share/cmake-2.4/Modules/Platform
96
# it appears this CMake variable is defined on Mac OS X and other platforms.
97
set(PLPLOTJAVAC_WRAP_DLL plplotjavac_wrap${CMAKE_SHARED_LIBRARY_SUFFIX})