OsmAnd/OsmAnd-java/CMakeLists.txt

102 lines
2.5 KiB
Text
Raw Normal View History

2013-08-07 21:34:30 +02:00
project(OsmAndJNI)
2013-09-27 09:58:16 +02:00
find_package(Java REQUIRED)
find_package(JNI REQUIRED)
2013-08-07 21:34:30 +02:00
set(target_specific_private_includes "")
2013-08-08 07:09:04 +02:00
set(target_specific_public_libraries "")
2013-08-07 21:34:30 +02:00
2013-08-18 21:43:29 +02:00
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*")
2013-08-19 07:13:57 +02:00
file(GLOB core_swig "${OSMAND_ROOT}/core.swig")
file(GLOB_RECURSE core_swig_subfiles "${OSMAND_ROOT}/swig/*")
2013-08-19 10:15:19 +02:00
set(OsmAndJNI_generated_cpp
"${CMAKE_CURRENT_LIST_DIR}/c-src/swig.cpp"
)
2013-08-18 20:55:32 +02:00
if(CMAKE_HOST_WIN32 AND NOT CYGWIN)
2013-08-19 10:15:19 +02:00
add_custom_command(OUTPUT ${OsmAndJNI_generated_cpp}
COMMAND bash ARGS --login "${CMAKE_CURRENT_LIST_DIR}/generate-swig.sh"
2013-08-18 21:43:29 +02:00
DEPENDS
${core_includes}
${core_headers}
${core_sources}
${core_headers_client}
${core_sources_client}
2013-08-19 06:51:24 +02:00
${core_swig}
2013-08-19 07:13:57 +02:00
${core_swig_subfiles}
2013-08-19 10:15:19 +02:00
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
2013-08-18 20:55:32 +02:00
COMMENT "Generating sources...")
else()
2013-08-19 10:15:19 +02:00
add_custom_command(OUTPUT ${OsmAndJNI_generated_cpp}
COMMAND "${CMAKE_CURRENT_LIST_DIR}/generate-swig.sh"
2013-08-18 21:43:29 +02:00
DEPENDS
${core_includes}
${core_headers}
${core_sources}
${core_headers_client}
${core_sources_client}
2013-08-19 06:51:24 +02:00
${core_swig}
2013-08-19 07:13:57 +02:00
${core_swig_subfiles}
2013-08-19 10:15:19 +02:00
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
2013-08-18 20:55:32 +02:00
COMMENT "Generating sources...")
endif()
add_custom_target(OsmAndJNI_generate_swig
ALL
2013-08-19 10:15:19 +02:00
DEPENDS
${OsmAndJNI_generated_cpp}
SOURCES
${OsmAndJNI_generated_cpp}
)
set_source_files_properties(${OsmAndJNI_generated_cpp}
PROPERTIES
GENERATED TRUE
2013-08-18 21:43:29 +02:00
)
2013-08-18 20:55:32 +02:00
2013-08-07 21:34:30 +02:00
if(CMAKE_SHARED_LIBS_ALLOWED_ON_TARGET)
add_library(OsmAndJNI SHARED
2013-08-19 10:15:19 +02:00
${OsmAndJNI_generated_cpp}
2013-08-07 21:34:30 +02:00
)
target_compile_definitions(OsmAndJNI
PRIVATE
2013-11-13 17:37:36 +01:00
-DOSMAND_JNI_EXPORTS
2014-02-22 23:10:44 +01:00
-DOSMAND_SWIG
2013-08-07 21:34:30 +02:00
)
target_include_directories(OsmAndJNI
PRIVATE
2013-09-27 09:58:16 +02:00
${JNI_INCLUDE_DIRS}
${JAVA_INCLUDE_PATH}
2013-08-07 21:34:30 +02:00
${target_specific_private_includes}
)
2013-08-18 20:55:32 +02:00
add_dependencies(OsmAndJNI
2013-08-18 21:43:29 +02:00
OsmAndJNI_generate_swig
2013-08-18 20:55:32 +02:00
)
2013-08-07 21:34:30 +02:00
if(CMAKE_STATIC_LIBS_ALLOWED_ON_TARGET)
add_dependencies(OsmAndJNI
OsmAndCore_static
OsmAndCoreUtils_static
)
target_link_libraries(OsmAndJNI
LINK_PUBLIC
OsmAndCore_static
OsmAndCoreUtils_static
2013-08-08 07:11:00 +02:00
${target_specific_public_libraries}
2013-08-07 21:34:30 +02:00
)
else()
add_dependencies(OsmAndJNI
OsmAndCore_shared
OsmAndCoreUtils_shared
)
target_link_libraries(OsmAndJNI
LINK_PUBLIC
OsmAndCore_shared
OsmAndCoreUtils_shared
2013-08-08 07:09:04 +02:00
${target_specific_public_libraries}
2013-08-07 21:34:30 +02:00
)
endif()
2013-08-08 07:09:04 +02:00
endif()