From 4dc61b0dd980b16f8e30e164fbfc2ea6c57135f6 Mon Sep 17 00:00:00 2001 From: johnche Date: Wed, 28 Jul 2021 16:45:17 +0800 Subject: [PATCH] =?UTF-8?q?[unity]=E6=B7=BB=E5=8A=A0unity=20linux64?= =?UTF-8?q?=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build_unity_plugins.yml | 23 +++++++++++++++++++++++ unity/native_src/CMakeLists.txt | 5 +++++ unity/native_src/Inc/JSEngine.h | 2 ++ unity/native_src/make_linux64.sh | 7 +++++++ 4 files changed, 37 insertions(+) create mode 100644 unity/native_src/make_linux64.sh diff --git a/.github/workflows/build_unity_plugins.yml b/.github/workflows/build_unity_plugins.yml index 28cbe7bf67..7f6a028259 100644 --- a/.github/workflows/build_unity_plugins.yml +++ b/.github/workflows/build_unity_plugins.yml @@ -300,3 +300,26 @@ jobs: with: path: ./unity/Assets/Plugins/**/* name: Unity_Plugins_Quickjs + + linux64: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Download artifact + uses: dawidd6/action-download-artifact@v2 + with: + workflow: build_v8.yml + name: v8_bin + path: unity/native_src/ + - name: Build + run: | + cd unity/native_src + chmod 777 make_linux64.sh + ./make_linux64.sh + - name: Upload + uses: actions/upload-artifact@v2 + with: + path: ./unity/Assets/Plugins/**/* + name: Unity_Plugins_V8 + \ No newline at end of file diff --git a/unity/native_src/CMakeLists.txt b/unity/native_src/CMakeLists.txt index a2b7d7a736..7bcebd66c0 100644 --- a/unity/native_src/CMakeLists.txt +++ b/unity/native_src/CMakeLists.txt @@ -208,6 +208,11 @@ elseif ( APPLE ) ) target_compile_definitions (puerts PRIVATE PLATFORM_MAC) endif () +elseif (UNIX) + target_link_libraries(puerts + ${V8_ENGINE}/Lib/Linux/${LIB_FILE_NAME} + ) + target_compile_definitions (puerts PRIVATE PLATFORM_LINUX) endif () if ( WIN32 AND NOT CYGWIN AND NOT ( CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" ) AND NOT ANDROID AND NOT MSYS) diff --git a/unity/native_src/Inc/JSEngine.h b/unity/native_src/Inc/JSEngine.h index d9461701d5..e897cbb334 100644 --- a/unity/native_src/Inc/JSEngine.h +++ b/unity/native_src/Inc/JSEngine.h @@ -40,6 +40,8 @@ #include "Blob/iOS/arm64/SnapshotBlob.h" #elif defined(PLATFORM_IOS_SIMULATOR) #include "Blob/iOS/x64/SnapshotBlob.h" +#elif defined(PLATFORM_LINUX) +#include "Blob/Linux/SnapshotBlob.h" #endif typedef void(*CSharpFunctionCallback)(v8::Isolate* Isolate, const v8::FunctionCallbackInfo& Info, void* Self, int ParamLen, int64_t UserData); diff --git a/unity/native_src/make_linux64.sh b/unity/native_src/make_linux64.sh new file mode 100644 index 0000000000..c03dd01661 --- /dev/null +++ b/unity/native_src/make_linux64.sh @@ -0,0 +1,7 @@ +mkdir -p build_linux64 && cd build_linux64 +cmake ../ +cd .. +cmake --build build_linux64 --config Release +mkdir -p ../Assets/Plugins/x86_64/ +cp build_linux64/libpuerts.so ../Assets/Plugins/x86_64/libpuerts.so +