Skip to content

Commit

Permalink
[unity]添加unity linux64支持
Browse files Browse the repository at this point in the history
  • Loading branch information
chexiongsheng committed Jul 28, 2021
1 parent ee6a01f commit 4dc61b0
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/build_unity_plugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

5 changes: 5 additions & 0 deletions unity/native_src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions unity/native_src/Inc/JSEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<v8::Value>& Info, void* Self, int ParamLen, int64_t UserData);
Expand Down
7 changes: 7 additions & 0 deletions unity/native_src/make_linux64.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 4dc61b0

Please sign in to comment.