Another twist to JNI autodetection. Let's *always* make sure the compiler can find jni.h, even if Meson thinks it has found it - following reports of JNI autodetect succeeding on macOS but thinking jni.h is in some absurd location
This commit is contained in:
16
meson.build
16
meson.build
@@ -143,19 +143,15 @@ have_sincos = cpp.has_function('sincos',
|
|||||||
# requires javac as a compiler). Now try adding Java as a complete
|
# requires javac as a compiler). Now try adding Java as a complete
|
||||||
# language pack, optionally, and only go on to JNI if that succeeds,
|
# language pack, optionally, and only go on to JNI if that succeeds,
|
||||||
# making sure that nothing "clever" happens if Java is not found.
|
# making sure that nothing "clever" happens if Java is not found.
|
||||||
|
# Note even if jni_dep is found, we still need to check that the
|
||||||
|
# compiler can find jni.h because the jni autodetection can't really
|
||||||
|
# be trusted, especially in a macOS frameworks environment.
|
||||||
#
|
#
|
||||||
|
have_jni = false
|
||||||
have_java = add_languages('java', required: get_option('jni'))
|
have_java = add_languages('java', required: get_option('jni'))
|
||||||
if have_java
|
if have_java
|
||||||
jni_dep = dependency('jni', version: '>= 7.0.0', required: false)
|
jni_dep = dependency('jni', version: '>= 7.0.0', required: false)
|
||||||
if not jni_dep.found()
|
have_jni = cpp.has_header('jni.h', dependencies: jni_dep, args: extra_include_args)
|
||||||
if cpp.has_header('jni.h', args: extra_include_args)
|
|
||||||
jni_dep = declare_dependency()
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
# Declare jni_dep so it isn't totally undefined - but it won't be
|
|
||||||
# used below because we are conditional on have_java as well
|
|
||||||
jni_dep = declare_dependency()
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
@@ -611,7 +607,7 @@ if get_option('default_library') != 'shared' and rubberband_additional_static_li
|
|||||||
)
|
)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if have_java and jni_dep.found()
|
if have_jni
|
||||||
target_summary += { 'JNI library': [ true, 'Name: ' + rubberband_jni_name ] }
|
target_summary += { 'JNI library': [ true, 'Name: ' + rubberband_jni_name ] }
|
||||||
message('Will build Java Native Interface')
|
message('Will build Java Native Interface')
|
||||||
rubberband_jni = shared_library(
|
rubberband_jni = shared_library(
|
||||||
|
|||||||
Reference in New Issue
Block a user