diff --git a/CMakeLists.txt b/CMakeLists.txt index d03bcaec1..6fe754291 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,16 +31,16 @@ project(ot-commissioner VERSION 0.2.0) option(OT_COMM_ANDROID "Build with Android NDK" OFF) option(OT_COMM_APP "Build the CLI App" ON) -option(OT_COMM_CCM "Build with Commercial Commissioning Mode" ON) +option(OT_COMM_CCM "Build with Commercial Commissioning Mode" OFF) option(OT_COMM_REFERENCE_DEVICE "Enable features for being a Thread Group reference device" OFF) option(OT_COMM_COVERAGE "Enable coverage reporting" OFF) option(OT_COMM_JAVA_BINDING "Build Java binding" OFF) set(OT_COMM_JAVA_BINDING_OUTDIR "" CACHE STRING "Specify output directory of generated Java source files") -option(OT_COMM_TEST "Build tests" ON) +option(OT_COMM_TEST "Build tests" OFF) option(OT_COMM_WARNING_AS_ERROR "Treat warning as error" OFF) if (NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Debug) + set(CMAKE_BUILD_TYPE Release) endif() if(NOT "${CMAKE_CXX_STANDARD}") diff --git a/android/build-commissioner-libs.sh b/android/build-commissioner-libs.sh index 1054904d8..804a0d16a 100755 --- a/android/build-commissioner-libs.sh +++ b/android/build-commissioner-libs.sh @@ -54,12 +54,14 @@ cmake -GNinja \ -DBUILD_SHARED_LIBS=OFF \ -DCMAKE_CXX_STANDARD=11 \ -DCMAKE_CXX_STANDARD_REQUIRED=ON \ - -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_BUILD_TYPE=MinSizeRel \ -DOT_COMM_ANDROID=ON \ -DOT_COMM_JAVA_BINDING=ON \ -DOT_COMM_APP=OFF \ -DOT_COMM_TEST=OFF \ -DOT_COMM_CCM=OFF \ + -DCMAKE_C_FLAGS="-Os -g0 -DNDEBUG" \ + -DCMAKE_CXX_FLAGS="-Os -g0 -DNDEBUG" \ ../.. ninja commissioner-java @@ -75,9 +77,9 @@ find ./io/openthread/commissioner -name "*.class" | xargs jar cvf ../../libs/lib cd ../../../ ## Copy shared native libraries -cp "$BUILD_DIR"/src/java/libcommissioner-java.so "$BUILD_DIR"/libs +cp "$BUILD_DIR"/src/java/libcommissioner-java.a "$BUILD_DIR"/libs mkdir -p openthread_commissioner/service/libs mkdir -p openthread_commissioner/service/src/main/jniLibs/"${ANDROID_ABI}" cp "$BUILD_DIR"/libs/libotcommissioner.jar openthread_commissioner/service/libs -cp "$BUILD_DIR"/libs/*.so openthread_commissioner/service/src/main/jniLibs/"${ANDROID_ABI}" +cp "$BUILD_DIR"/libs/libcommissioner-java.a openthread_commissioner/service/src/main/jniLibs/"${ANDROID_ABI}" diff --git a/src/common/error_macros.hpp b/src/common/error_macros.hpp index d04dc81c0..f742b6ed3 100644 --- a/src/common/error_macros.hpp +++ b/src/common/error_macros.hpp @@ -41,42 +41,42 @@ #define ERROR_NONE \ Error {} #define ERROR_CANCELLED(aFormat, ...) \ - Error { ErrorCode::kCancelled, fmt::format(FMT_STRING((aFormat)), ##__VA_ARGS__) } + Error { ErrorCode::kCancelled, "" } #define ERROR_INVALID_ARGS(aFormat, ...) \ - Error { ErrorCode::kInvalidArgs, fmt::format(FMT_STRING((aFormat)), ##__VA_ARGS__) } + Error { ErrorCode::kInvalidArgs, "" } #define ERROR_INVALID_COMMAND(aFormat, ...) \ - Error { ErrorCode::kInvalidCommand, fmt::format(FMT_STRING((aFormat)), ##__VA_ARGS__) } + Error { ErrorCode::kInvalidCommand, "" } #define ERROR_TIMEOUT(aFormat, ...) \ - Error { ErrorCode::kTimeout, fmt::format(FMT_STRING((aFormat)), ##__VA_ARGS__) } + Error { ErrorCode::kTimeout, "" } #define ERROR_NOT_FOUND(aFormat, ...) \ - Error { ErrorCode::kNotFound, fmt::format(FMT_STRING((aFormat)), ##__VA_ARGS__) } + Error { ErrorCode::kNotFound, "" } #define ERROR_SECURITY(aFormat, ...) \ - Error { ErrorCode::kSecurity, fmt::format(FMT_STRING((aFormat)), ##__VA_ARGS__) } + Error { ErrorCode::kSecurity, "" } #define ERROR_UNIMPLEMENTED(aFormat, ...) \ - Error { ErrorCode::kUnimplemented, fmt::format(FMT_STRING((aFormat)), ##__VA_ARGS__) } + Error { ErrorCode::kUnimplemented, "" } #define ERROR_BAD_FORMAT(aFormat, ...) \ - Error { ErrorCode::kBadFormat, fmt::format(FMT_STRING((aFormat)), ##__VA_ARGS__) } + Error { ErrorCode::kBadFormat, "" } #define ERROR_BUSY(aFormat, ...) \ - Error { ErrorCode::kBusy, fmt::format(FMT_STRING((aFormat)), ##__VA_ARGS__) } + Error { ErrorCode::kBusy, "" } #define ERROR_OUT_OF_MEMORY(aFormat, ...) \ - Error { ErrorCode::kOutOfMemory, fmt::format(FMT_STRING((aFormat)), ##__VA_ARGS__) } + Error { ErrorCode::kOutOfMemory, "" } #define ERROR_IO_ERROR(aFormat, ...) \ - Error { ErrorCode::kIOError, fmt::format(FMT_STRING((aFormat)), ##__VA_ARGS__) } + Error { ErrorCode::kIOError, "" } #define ERROR_IO_BUSY(aFormat, ...) \ - Error { ErrorCode::kIOBusy, fmt::format(FMT_STRING((aFormat)), ##__VA_ARGS__) } + Error { ErrorCode::kIOBusy, "" } #define ERROR_ALREADY_EXISTS(aFormat, ...) \ - Error { ErrorCode::kAlreadyExists, fmt::format(FMT_STRING((aFormat)), ##__VA_ARGS__) } + Error { ErrorCode::kAlreadyExists, "" } #define ERROR_ABORTED(aFormat, ...) \ - Error { ErrorCode::kAborted, fmt::format(FMT_STRING((aFormat)), ##__VA_ARGS__) } + Error { ErrorCode::kAborted, "" } #define ERROR_INVALID_STATE(aFormat, ...) \ - Error { ErrorCode::kInvalidState, fmt::format(FMT_STRING((aFormat)), ##__VA_ARGS__) } + Error { ErrorCode::kInvalidState, "" } #define ERROR_REJECTED(aFormat, ...) \ - Error { ErrorCode::kRejected, fmt::format(FMT_STRING((aFormat)), ##__VA_ARGS__) } + Error { ErrorCode::kRejected, "" } #define ERROR_COAP_ERROR(aFormat, ...) \ - Error { ErrorCode::kCoapError, fmt::format(FMT_STRING((aFormat)), ##__VA_ARGS__) } + Error { ErrorCode::kCoapError, "" } #define ERROR_REGISTRY_ERROR(aFormat, ...) \ - Error { ErrorCode::kRegistryError, fmt::format(FMT_STRING((aFormat)), ##__VA_ARGS__) } + Error { ErrorCode::kRegistryError, "" } #define ERROR_UNKNOWN(aFormat, ...) \ - Error { ErrorCode::kUnknown, fmt::format(FMT_STRING((aFormat)), ##__VA_ARGS__) } + Error { ErrorCode::kUnknown, "" } #endif // ERROR_MACROS_HPP_ diff --git a/src/common/logging.hpp b/src/common/logging.hpp index 4d6592677..38c486bba 100644 --- a/src/common/logging.hpp +++ b/src/common/logging.hpp @@ -55,7 +55,6 @@ #define LOG(aLevel, aRegion, aFmt, ...) \ do \ { \ - Log(aLevel, aRegion, fmt::format(FMT_STRING(aFmt), ##__VA_ARGS__)); \ } while (false) #define LOG_DEBUG(aRegion, aFmt, ...) LOG(LogLevel::kDebug, aRegion, aFmt, ##__VA_ARGS__) diff --git a/src/java/CMakeLists.txt b/src/java/CMakeLists.txt index 57c9edf39..24f3f6781 100644 --- a/src/java/CMakeLists.txt +++ b/src/java/CMakeLists.txt @@ -51,7 +51,7 @@ set_property(SOURCE commissioner.i PROPERTY CPLUSPLUS ON) set(UseSWIG_TARGET_NAME_PREFERENCE LEGACY) swig_add_library(commissioner-java - TYPE SHARED + TYPE STATIC LANGUAGE java SOURCES commissioner.i)