diff --git a/README.md b/README.md index 254b52c..6726ffe 100644 --- a/README.md +++ b/README.md @@ -1 +1,3 @@ -# openim-sdk-cpp \ No newline at end of file +# openim-sdk-cpp + +openim-sdk-core \ No newline at end of file diff --git a/gen/gen_android_so.bat b/gen/gen_android_so.bat index 22f3c4f..e4825e5 100644 --- a/gen/gen_android_so.bat +++ b/gen/gen_android_so.bat @@ -4,26 +4,26 @@ set OUT_PATH=android\ set CGO_ENABLED=1 -REM 生成 armeabi-v7a +REM armeabi-v7a set GOOS=android set GOARCH=arm set CC=%NDK_PATH%\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi16-clang.cmd go build -buildmode=c-shared -trimpath -ldflags="-s -w" -o %OUT_PATH%armeabi-v7a\%SO_NAME%.so export.go protocol.go message.go -REM 生成 arm64-v8a +REM arm64-v8a set GOARCH=arm64 set CC=%NDK_PATH%\toolchains\llvm\prebuilt\windows-x86_64\bin\aarch64-linux-android21-clang.cmd go build -buildmode=c-shared -trimpath -ldflags="-s -w" -o %OUT_PATH%arm64-v8a\%SO_NAME%.so export.go protocol.go message.go -REM 生成 x86 +REM x86 set GOARCH=386 set CC=%NDK_PATH%\toolchains\llvm\prebuilt\windows-x86_64\bin\i686-linux-android16-clang.cmd go build -buildmode=c-shared -trimpath -ldflags="-s -w" -o %OUT_PATH%x86\%SO_NAME%.so export.go protocol.go message.go -REM 生成 x86_64 +REM x86_64 set GOARCH=amd64 set CC=%NDK_PATH%\toolchains\llvm\prebuilt\windows-x86_64\bin\x86_64-linux-android21-clang.cmd diff --git a/gen/gen_ios_dylib.sh b/gen/gen_ios_dylib.sh index dc3e7e8..b659a89 100644 --- a/gen/gen_ios_dylib.sh +++ b/gen/gen_ios_dylib.sh @@ -1,8 +1,21 @@ -export GOOS=darwin -export GOARCH=arm64 -export CGO_ENABLED=1 -export CC=clang - -go build -buildmode=c-shared -o libopenimsdk.dylib export.go protocol.go message.go - - +#!/bin/sh +export LANG=en_US.UTF-8 +# ios device +export CFLAGS="-arch arm64 -miphoneos-version-min=9.0 -isysroot "$(xcrun -sdk iphoneos --show-sdk-path) +export CGO_LDFLAGS="-arch arm64 -miphoneos-version-min=9.0 -isysroot "$(xcrun -sdk iphoneos --show-sdk-path) +export CGO_ENABLED=1 +export GOARCH=arm64 +export GOOS=ios +export CC="clang $CFLAGS $CGO_LDFLAGS" +go build -tags ios -ldflags=-w -trimpath -v -o libopenimsdk.a -buildmode c-archive export.go protocol.go message.go +# go build -tags ios -ldflags=-w -trimpath -v -o libopenimsdk_ios.a -buildmode c-archive export.go protocol.go message.go +# ios simulator +# export CFLAGS="-arch x86_64 -miphoneos-version-min=9.0 -isysroot "$(xcrun -sdk iphonesimulator --show-sdk-path) +# export CGO_LDFLAGS="-arch x86_64 -miphoneos-version-min=9.0 -isysroot "$(xcrun -sdk iphonesimulator --show-sdk-path) +# CGO_ENABLED=1 +# GOARCH=amd64 +# GOOS=darwin +# CC="clang $CFLAGS $CGO_LDFLAGS" +# go build -tags ios -ldflags=-w -trimpath -v -o libopenimsdk_iossimulator.a -buildmode c-archive + +# lipo -create libopenimsdk_ios.a libopenimsdk_iossimulator.a -output libopenimsdk.a diff --git a/gen/build_so.sh b/gen/gen_linux_so.sh similarity index 100% rename from gen/build_so.sh rename to gen/gen_linux_so.sh diff --git a/gen/gen_mac_dylib.sh b/gen/gen_mac_dylib.sh new file mode 100644 index 0000000..da5947b --- /dev/null +++ b/gen/gen_mac_dylib.sh @@ -0,0 +1,9 @@ +export GOOS=darwin +export CGO_ENABLED=1 +export CC=clang +export GOARCH=arm64 +go build -buildmode=c-shared -o libopenimsdk_arm64.dylib export.go protocol.go message.go + +export GOARCH=amd64 +go build -buildmode=c-shared -o libopenimsdk_amd64.dylib export.go protocol.go message.go +lipo -create -output libopenimsdk.dylib libopenimsdk_arm64.dylib libopenimsdk_amd64.dylib \ No newline at end of file diff --git a/gen/build_dll.bat b/gen/gen_win_dll.bat similarity index 100% rename from gen/build_dll.bat rename to gen/gen_win_dll.bat diff --git a/include/IMSDK.h b/include/imsdk.h similarity index 100% rename from include/IMSDK.h rename to include/imsdk.h diff --git a/src/IMSDK.cpp b/src/imsdk.cpp similarity index 93% rename from src/IMSDK.cpp rename to src/imsdk.cpp index 2911ac2..5727da9 100644 --- a/src/IMSDK.cpp +++ b/src/imsdk.cpp @@ -1,9 +1,10 @@ -#include "IMSDK.h" +#include "imsdk.h" #include #include #include "json.hpp" using json = nlohmann::json; + char *GetOperationId(const char *prefix) { static int operationIndex = 0; @@ -15,6 +16,5 @@ char *GetOperationId(const char *prefix) void OpenIM::InitSDK() { - init_sdk(GetOperationId("init_sdk"), ""); } \ No newline at end of file