JNI should be in core

This commit is contained in:
Alexey Pelykh 2014-03-04 19:32:34 +02:00
parent 5a32f6c24d
commit 7f66caede9
6 changed files with 5 additions and 136 deletions

View file

@ -1,28 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
ifneq ($(OSMAND_BUILDING_NEON_LIBRARY),true)
LOCAL_MODULE := OsmAndJNI
else
LOCAL_MODULE := OsmAndJNI_neon
LOCAL_ARM_NEON := true
endif
ifeq ($(LOCAL_ARM_NEON),true)
OSMAND_BINARY_SUFFIX := _neon
else
OSMAND_BINARY_SUFFIX :=
endif
LOCAL_STATIC_LIBRARIES := OsmAndCore$(OSMAND_BINARY_SUFFIX)
ifneq ($(OSMAND_USE_PREBUILT),true)
LOCAL_SRC_FILES := c-src/swig.cpp
include $(BUILD_SHARED_LIBRARY)
else
LOCAL_SRC_FILES := \
$(OSMAND_ANDROID_PREBUILT_ROOT)/$(TARGET_ARCH_ABI)/lib$(LOCAL_MODULE).so
include $(PREBUILT_SHARED_LIBRARY)
endif

View file

@ -1,89 +0,0 @@
project(OsmAndJNI)
find_package(Java REQUIRED)
find_package(JNI REQUIRED)
set(target_specific_private_includes "")
set(target_specific_public_libraries "")
file(GLOB_RECURSE core_includes "${OSMAND_ROOT}/core/include/*.h*")
file(GLOB_RECURSE core_headers "${OSMAND_ROOT}/core/src/*.h*")
file(GLOB_RECURSE core_sources "${OSMAND_ROOT}/core/src/*.c*")
file(GLOB_RECURSE core_headers_client "${OSMAND_ROOT}/core/client/*.h*")
file(GLOB_RECURSE core_sources_client "${OSMAND_ROOT}/core/client/*.c*")
file(GLOB core_swig "${OSMAND_ROOT}/core.swig")
file(GLOB_RECURSE core_swig_subfiles "${OSMAND_ROOT}/swig/*")
set(OsmAndJNI_generated_cpp
"${CMAKE_CURRENT_LIST_DIR}/c-src/swig.cpp"
)
if(CMAKE_HOST_WIN32 AND NOT CYGWIN)
add_custom_command(OUTPUT ${OsmAndJNI_generated_cpp}
COMMAND bash ARGS --login "${CMAKE_CURRENT_LIST_DIR}/generate-swig.sh"
DEPENDS
"${CMAKE_CURRENT_LIST_DIR}/generate-swig.sh"
${core_includes}
${core_headers}
${core_sources}
${core_headers_client}
${core_sources_client}
${core_swig}
${core_swig_subfiles}
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
COMMENT "Generating sources...")
else()
add_custom_command(OUTPUT ${OsmAndJNI_generated_cpp}
COMMAND "${CMAKE_CURRENT_LIST_DIR}/generate-swig.sh"
DEPENDS
"${CMAKE_CURRENT_LIST_DIR}/generate-swig.sh"
${core_includes}
${core_headers}
${core_sources}
${core_headers_client}
${core_sources_client}
${core_swig}
${core_swig_subfiles}
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
COMMENT "Generating sources...")
endif()
if(CMAKE_SHARED_LIBS_ALLOWED_ON_TARGET)
add_library(OsmAndJNI SHARED
${OsmAndJNI_generated_cpp}
)
target_compile_definitions(OsmAndJNI
PRIVATE
-DOSMAND_JNI_EXPORTS
-DOSMAND_SWIG
)
target_include_directories(OsmAndJNI
PRIVATE
${JNI_INCLUDE_DIRS}
${JAVA_INCLUDE_PATH}
${target_specific_private_includes}
)
if(CMAKE_STATIC_LIBS_ALLOWED_ON_TARGET)
add_dependencies(OsmAndJNI
OsmAndCore_static
OsmAndCoreUtils_static
)
target_link_libraries(OsmAndJNI
LINK_PUBLIC
OsmAndCore_static
OsmAndCoreUtils_static
${target_specific_public_libraries}
)
else()
add_dependencies(OsmAndJNI
OsmAndCore_shared
OsmAndCoreUtils_shared
)
target_link_libraries(OsmAndJNI
LINK_PUBLIC
OsmAndCore_shared
OsmAndCoreUtils_shared
${target_specific_public_libraries}
)
endif()
endif()

View file

@ -1,11 +0,0 @@
#!/bin/bash
SRCLOC="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
rm -rf "$SRCLOC/src/net/osmand/core/jni"
mkdir -p "$SRCLOC/src/net/osmand/core/jni"
rm -rf "$SRCLOC/c-src"
mkdir -p "$SRCLOC/c-src"
swig -java -package net.osmand.core.jni -outdir "$SRCLOC/src/net/osmand/core/jni" -o "$SRCLOC/c-src/swig.cpp" -I"$SRCLOC/../../core/include" -c++ -v "$SRCLOC/../../core/core.swig"

View file

@ -1,3 +0,0 @@
# OsmAnd JNI
add_subdirectory("${OSMAND_ROOT}/android/OsmAnd-java" "android/OsmAnd-java")
add_dependencies(OsmAndJNI OsmAndCore)

View file

@ -2,17 +2,19 @@ LOCAL_PATH := $(call my-dir)
ROOT_PATH := $(LOCAL_PATH)/../../..
$(info OsmAnd root: $(ROOT_PATH))
# LEGACY {
ifdef BUILD_ONLY_OLD_LIB
OSMAND_MAKEFILES := \
$(all-subdir-makefiles) \
$(call all-makefiles-under,$(ROOT_PATH)/core/targets/android)
else
# } LEGACY
OSMAND_MAKEFILES := \
$(call all-makefiles-under,$(ROOT_PATH)/core/externals) \
$(ROOT_PATH)/core/Android.mk \
$(all-subdir-makefiles) \
$(ROOT_PATH)/android/OsmAnd-java/Android.mk
$(call all-makefiles-under,$(ROOT_PATH)/core/wrappers/android)
# LEGACY {
endif
# } LEGACY
$(info OsmAnd makefiles: $(OSMAND_MAKEFILES))
# Protect from previous builds

View file

@ -7,8 +7,6 @@ else
NDK_TOOLCHAIN_VERSION := 4.7
endif
APP_ABI :=
ifneq ($(filter x86,$(OSMAND_ARCHITECTURES_SET)),)
APP_ABI += x86