diff --git a/OsmAnd-java/CMakeLists.txt b/OsmAnd-java/CMakeLists.txt index 7369c2bca7..ca26407a6d 100644 --- a/OsmAnd-java/CMakeLists.txt +++ b/OsmAnd-java/CMakeLists.txt @@ -16,6 +16,20 @@ elseif(CMAKE_TARGET_OS STREQUAL "linux") ) endif() +if(CMAKE_HOST_WIN32 AND NOT CYGWIN) + add_custom_command(OUTPUT "${CMAKE_CURRENT_LIST_DIR}/c-src/swig.cpp" + COMMAND bash ARGS --login "${CMAKE_CURRENT_LIST_DIR}/generate-swig.sh" + COMMENT "Generating sources...") +else() + add_custom_command(OUTPUT "${CMAKE_CURRENT_LIST_DIR}/c-src/swig.cpp" + COMMAND "${CMAKE_CURRENT_LIST_DIR}/generate-swig.sh" + COMMENT "Generating sources...") +endif() +add_custom_target(OsmAndJNI_swig + DEPENDS "${CMAKE_CURRENT_LIST_DIR}/c-src/swig.cpp" +) +set_source_files_properties("${CMAKE_CURRENT_LIST_DIR}/c-src/swig.cpp" PROPERTIES GENERATED TRUE) + if(CMAKE_SHARED_LIBS_ALLOWED_ON_TARGET) add_library(OsmAndJNI SHARED "c-src/swig.cpp" @@ -29,6 +43,9 @@ if(CMAKE_SHARED_LIBS_ALLOWED_ON_TARGET) "$ENV{JAVA_HOME}/include" ${target_specific_private_includes} ) + add_dependencies(OsmAndJNI + OsmAndJNI_swig + ) if(CMAKE_STATIC_LIBS_ALLOWED_ON_TARGET) add_dependencies(OsmAndJNI diff --git a/OsmAnd-java/collect_libs.sh b/OsmAnd-java/collect_libs.sh index 210b8e1ae6..8caa2aac4f 100755 --- a/OsmAnd-java/collect_libs.sh +++ b/OsmAnd-java/collect_libs.sh @@ -28,7 +28,6 @@ function compile { "$ROOT_LOC/core/externals/configure.sh" ${OSMAND_ANDROID_EXTERNAL_DEPENDENCIES[*]} "$ROOT_LOC/core/externals/build.sh" ${OSMAND_ANDROID_EXTERNAL_DEPENDENCIES[*]} "$ROOT_LOC/tools/map-viewer/externals/configure.sh" - "$ROOT_LOC/android/OsmAnd-java/generate-swig.sh" if [ ! -d "$ROOT_LOC/amd64-linux-gcc-release.makefile" ]; then "$ROOT_LOC/build/amd64-linux-gcc.sh" release fi