From dfbe64c88b9e264044ff68a9f1833935ceacbba8 Mon Sep 17 00:00:00 2001 From: Kangping Dong Date: Mon, 15 Apr 2024 22:39:31 +0800 Subject: [PATCH] [build] update cmake to 3.20.1 Updates cmake to 3.20.1 which adds support for USE_SWIG_DEPENDENCIES USE_SWIG_DEPENDENCIES is needed to tell SWIG compiler to rebuild the java library when the dependencies are changed. For example, we currently have a problem that the java library is not updated even a new API is added to commissioner.hpp --- .github/workflows/build.yml | 8 ++++---- CMakeLists.txt | 2 +- script/bootstrap.sh | 2 +- src/java/CMakeLists.txt | 3 +++ 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b1c7e900e..4a5532efb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -60,11 +60,11 @@ jobs: gcc_ver: [5, 6, 7, 8, 9, 10] steps: - uses: actions/checkout@v3 - - name: Install CMake 3.10.1 + - name: Install CMake 3.20.1 run: | - wget https://cmake.org/files/v3.10/cmake-3.10.1.zip - unzip cmake-3.10.1 - cd cmake-3.10.1 + wget https://cmake.org/files/v3.20/cmake-3.20.1.zip + unzip cmake-3.20.1 + cd cmake-3.20.1 cmake . make -j4 sudo make install diff --git a/CMakeLists.txt b/CMakeLists.txt index 0efc6f2ae..ade3f02f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,7 @@ # POSSIBILITY OF SUCH DAMAGE. # -cmake_minimum_required(VERSION 3.10.1) +cmake_minimum_required(VERSION 3.20.1) project(ot-commissioner VERSION 0.2.0) option(OT_COMM_ANDROID "Build with Android NDK" OFF) diff --git a/script/bootstrap.sh b/script/bootstrap.sh index c0209d05a..c44c919b6 100755 --- a/script/bootstrap.sh +++ b/script/bootstrap.sh @@ -31,7 +31,7 @@ set -e # Bootstrap with CCM dependencies. readonly WITH_CCM="${WITH_CCM:-1}" -readonly MIN_CMAKE_VERSION="3.10.1" +readonly MIN_CMAKE_VERSION="3.20.1" ## Match the version to see if current version is greater than or euqal to required version. ## Args: $1 current version diff --git a/src/java/CMakeLists.txt b/src/java/CMakeLists.txt index 57c9edf39..9c54ec77d 100644 --- a/src/java/CMakeLists.txt +++ b/src/java/CMakeLists.txt @@ -48,6 +48,9 @@ include_directories(${PROJECT_SOURCE_DIR}/include) set_property(SOURCE commissioner.i PROPERTY CPLUSPLUS ON) +# Tells SWIG compiler to rebuild the java library when any of the dependencies are updated +set_property(SOURCE commissioner.i PROPERTY USE_SWIG_DEPENDENCIES ON) + set(UseSWIG_TARGET_NAME_PREFERENCE LEGACY) swig_add_library(commissioner-java