From 0adccd72de6d7883e3a8378c62a3458ff183850b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grisez?= Date: Fri, 18 May 2018 15:48:22 +0200 Subject: [PATCH] [Build] Fix race condition between linphonej and linphone-coreapi targets --- coreapi/CMakeLists.txt | 6 ++++++ src/CMakeLists.txt | 3 --- wrappers/cpp/CMakeLists.txt | 1 - wrappers/csharp/CMakeLists.txt | 1 - wrappers/java/CMakeLists.txt | 10 ++++++---- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/coreapi/CMakeLists.txt b/coreapi/CMakeLists.txt index fb380c2a5..7e46275bf 100644 --- a/coreapi/CMakeLists.txt +++ b/coreapi/CMakeLists.txt @@ -156,6 +156,9 @@ if (ENABLE_STATIC) ) target_include_directories(linphone-coreapi-static SYSTEM PRIVATE ${LINPHONE_INCLUDE_DIRS}) add_dependencies(linphone-coreapi-static liblinphone-git-version) + if (ENABLE_JAVA_WRAPPER) + add_dependencies(linphone-coreapi-static linphonej) + endif() endif () if (ENABLE_SHARED) @@ -165,6 +168,9 @@ if (ENABLE_SHARED) target_include_directories(linphone-coreapi SYSTEM PRIVATE ${LINPHONE_INCLUDE_DIRS}) target_compile_options(linphone-coreapi PRIVATE "-fPIC") add_dependencies(linphone-coreapi liblinphone-git-version) + if (ENABLE_JAVA_WRAPPER) + add_dependencies(linphone-coreapi linphonej) + endif() endif () diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 990974b2c..9540befa4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -441,9 +441,6 @@ if(ENABLE_SHARED) set_target_properties(linphone PROPERTIES PREFIX "lib") elseif(ANDROID) target_link_libraries(linphone PUBLIC "log" ${SUPPORT_LIBRARIES} ${CPUFEATURES_LIBRARIES}) - if(ENABLE_JAVA_WRAPPER) - add_dependencies(linphone linphonej) - endif() endif() if(MSVC) if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") diff --git a/wrappers/cpp/CMakeLists.txt b/wrappers/cpp/CMakeLists.txt index 1042d749d..1e2e25a10 100644 --- a/wrappers/cpp/CMakeLists.txt +++ b/wrappers/cpp/CMakeLists.txt @@ -34,7 +34,6 @@ add_custom_command(OUTPUT include/linphone++/linphone.hh src/linphone++.cc enums_header.mustache main_header.mustache linphone-doc - "${PROJECT_BINARY_DIR}/coreapi/help/doc/doxygen/xml/index.xml" ) add_library(linphone++ SHARED diff --git a/wrappers/csharp/CMakeLists.txt b/wrappers/csharp/CMakeLists.txt index 0be827872..00c4b4cb0 100644 --- a/wrappers/csharp/CMakeLists.txt +++ b/wrappers/csharp/CMakeLists.txt @@ -28,7 +28,6 @@ add_custom_command(OUTPUT LinphoneWrapper.cs genwrapper.py wrapper_impl.mustache linphone-doc - "${PROJECT_BINARY_DIR}/coreapi/help/doc/doxygen/xml/index.xml" ) add_custom_target(linphonecs ALL DEPENDS LinphoneWrapper.cs) diff --git a/wrappers/java/CMakeLists.txt b/wrappers/java/CMakeLists.txt index 6f6cda660..a6fb895d2 100644 --- a/wrappers/java/CMakeLists.txt +++ b/wrappers/java/CMakeLists.txt @@ -20,10 +20,13 @@ # ############################################################################ -add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/src/linphone_jni.cc" +set(jni_sources "${CMAKE_CURRENT_BINARY_DIR}/src/linphone_jni.cc") + +add_custom_command(OUTPUT "${jni_sources}" COMMAND ${CMAKE_COMMAND} -E remove -f java/org/linphone/core/* src/* COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/genwrapper.py" "${PROJECT_BINARY_DIR}/coreapi/help/doc/doxygen/xml" "-o" "${CMAKE_CURRENT_BINARY_DIR}" DEPENDS ${PROJECT_SOURCE_DIR}/tools/genapixml.py ${LINPHONE_HEADER_FILES} + ${PROJECT_SOURCE_DIR}/tools/metaname.py ${PROJECT_SOURCE_DIR}/tools/metadoc.py ${PROJECT_SOURCE_DIR}/tools/abstractapi.py genwrapper.py @@ -33,13 +36,12 @@ add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/src/linphone_jni.cc" java_interface.mustache jni.mustache linphone-doc - "${PROJECT_BINARY_DIR}/coreapi/help/doc/doxygen/xml/index.xml" COMMENT "Generating java wrapper" ) -add_custom_target(linphonej ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/src/linphone_jni.cc") +add_custom_target(linphonej ALL DEPENDS "${jni_sources}") -set(LINPHONE_JNI_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/src/linphone_jni.cc" PARENT_SCOPE) +set(LINPHONE_JNI_SOURCES "${jni_sources}" PARENT_SCOPE) install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/java" DESTINATION "${CMAKE_INSTALL_DATADIR}/linphonej/") install(DIRECTORY classes/ DESTINATION "${CMAKE_INSTALL_DATADIR}/linphonej/java/org/linphone/core/")