3.6 add linux ci (#10636)

* 3.6 add linux ci
This commit is contained in:
江战
2022-04-01 18:53:52 +08:00
committed by GitHub
parent 8fd97d58e2
commit e02b03ac4c
8 changed files with 94 additions and 20 deletions
@@ -0,0 +1,48 @@
name: <Native> Linux
on: [pull_request]
jobs:
compile_linux:
name: "Linux-Ubuntu"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Download external libraries
shell: bash
run: |
EXT_VERSION=`grep version native/external-config.json |awk -F'"' '{print $4}'`
git clone --branch $EXT_VERSION --depth 1 https://github.com/cocos-creator/engine-native-external native/external
- name: Generate bindings
run: |
python3 -m pip install PyYAML==5.4.1 Cheetah3
python3 ./native/tools/tojs/genbindings.py
rm ./native/tools/tojs/userconf.ini
- name: Install dependencies
run: |
sudo apt install libx11-dev -y
sudo apt install libsndio-dev -y
sudo apt install ninja-build -y
- name: Compile
env:
COCOS_ENGINE_DEV: 1
run: |
COCOS2DX_ROOT=$GITHUB_WORKSPACE/native
echo "Compiling Linux ... "
cd $COCOS2DX_ROOT/templates/linux
mkdir -p build-linux/proj
touch build-linux/proj/cfg.cmake
echo "set(CC_USE_VULKAN OFF)" >> build-linux/proj/cfg.cmake
echo "set(CC_USE_GLES2 OFF)" >> build-linux/proj/cfg.cmake
echo "set(CC_USE_GLES3 ON)" >> build-linux/proj/cfg.cmake
echo "set(CC_USE_METAL OFF)" >> build-linux/proj/cfg.cmake
echo "set(USE_WEBSOCKET_SERVER OFF)" >> build-linux/proj/cfg.cmake
echo "set(CMAKE_CXX_STANDARD_REQUIRED ON)" >> build-linux/proj/cfg.cmake
echo "set(USE_PHYSICS_PHYSX OFF)" >> build-linux/proj/cfg.cmake
mkdir build-linux/assets
RES_DIR=$COCOS2DX_ROOT/templates/linux/build-linux
cd build-linux
cmake ../ -GNinja -DRES_DIR=$RES_DIR -DCOCOS_X_PATH=$COCOS2DX_ROOT
set +e
cmake --build .
+2 -2
View File
@@ -5,7 +5,7 @@ namespace geometry {
void Capsule::transform(const Mat4 &m, const Vec3 & /*pos*/, const Quaternion &rot, const Vec3 &scale, Capsule *out) const {
const auto maxComponent = mathutils::absMaxComponent(scale);
out->radius = this->radius * abs(maxComponent);
out->radius = this->radius * std::abs(maxComponent);
const auto halfTotalWorldHeight = (this->halfHeight + this->radius) * std::abs(scale.y);
auto halfWorldHeight = halfTotalWorldHeight - out->radius;
@@ -44,4 +44,4 @@ void Capsule::updateLocalCenter() {
}
}
} // namespace geometry
} // namespace cc
} // namespace cc
+10 -10
View File
@@ -3,15 +3,15 @@
namespace {
void transformExtentM3(cc::Vec3 *out, const cc::Vec3 &extent, const cc::Mat3 &m3) {
cc::Mat3 m3Tmp;
m3Tmp.m[0] = abs(m3.m[0]);
m3Tmp.m[1] = abs(m3.m[1]);
m3Tmp.m[2] = abs(m3.m[2]);
m3Tmp.m[3] = abs(m3.m[3]);
m3Tmp.m[4] = abs(m3.m[4]);
m3Tmp.m[5] = abs(m3.m[5]);
m3Tmp.m[6] = abs(m3.m[6]);
m3Tmp.m[7] = abs(m3.m[7]);
m3Tmp.m[8] = abs(m3.m[8]);
m3Tmp.m[0] = std::abs(m3.m[0]);
m3Tmp.m[1] = std::abs(m3.m[1]);
m3Tmp.m[2] = std::abs(m3.m[2]);
m3Tmp.m[3] = std::abs(m3.m[3]);
m3Tmp.m[4] = std::abs(m3.m[4]);
m3Tmp.m[5] = std::abs(m3.m[5]);
m3Tmp.m[6] = std::abs(m3.m[6]);
m3Tmp.m[7] = std::abs(m3.m[7]);
m3Tmp.m[8] = std::abs(m3.m[8]);
out->transformMat3(extent, m3Tmp);
};
} // namespace
@@ -101,4 +101,4 @@ void OBB::setScale(const Vec3 &scale, OBB *out) const {
}
} // namespace geometry
} // namespace cc
} // namespace cc
+2 -2
View File
@@ -218,7 +218,7 @@ auto repeat(T t, T length) {
template <typename T>
auto pingPong(T t, T length) {
t = repeat(t, length * 2);
t = length - abs(t - length);
t = length - std::abs(t - length);
return t;
}
@@ -252,7 +252,7 @@ Vec3ElementType maxComponent(const Vec3 &v);
*/
template <typename F>
auto absMax(F a, F b) {
return abs(a) > abs(b) ? a : b;
return std::abs(a) > std::abs(b) ? a : b;
}
} // namespace mathutils
+1 -1
View File
@@ -210,7 +210,7 @@ void Vec3::transformMat4Normal(const Vec3 &v, const Mat4 &m, Vec3 *dst) {
float y = v.y;
float z = v.z;
float rhw = m.m[3] * x + m.m[7] * y + m.m[11] * z;
rhw = rhw != 0.0F ? abs(1.0F / rhw) : 1.0F;
rhw = rhw != 0.0F ? std::abs(1.0F / rhw) : 1.0F;
dst->x = (m.m[0] * x + m.m[4] * y + m.m[8] * z) * rhw;
dst->y = (m.m[1] * x + m.m[5] * y + m.m[9] * z) * rhw;
dst->z = (m.m[2] * x + m.m[6] * y + m.m[10] * z) * rhw;
@@ -24,9 +24,12 @@
****************************************************************************/
#include "platform/linux/modules/Screen.h"
#include <X11/Xlib.h>
#include "base/Macros.h"
#include "cocos/bindings/jswrapper/SeApi.h"
// clang-format off
// Some macros in xlib.h conflict with v8 headers.
#include <X11/Xlib.h>
// clang-format on
namespace cc {
@@ -84,4 +87,4 @@ void Screen::setDisplayStats(bool isShow) {
se::ScriptEngine::getInstance()->evalString(commandBuf);
}
} // namespace cc
} // namespace cc
@@ -21,6 +21,8 @@
#pragma once
#include <algorithm>
#include "base/Macros.h"
#include "base/std/container/unordered_map.h"
#include "gfx-base/GFXDef-common.h"
@@ -29,7 +31,6 @@
#include "GLES3Std.h"
#include "GLES3Wrangler.h"
namespace cc {
namespace gfx {
@@ -157,7 +158,7 @@ using GLES3GPUTextureViewList = ccstd::vector<GLES3GPUTextureView *>;
struct GLES3GPUSwapchain {
#if CC_SWAPPY_ENABLED
bool swappyEnabled{false};
bool swappyEnabled{false};
#endif
EGLSurface eglSurface{EGL_NO_SURFACE};
EGLint eglSwapInterval{0};
@@ -670,4 +671,4 @@ private:
};
} // namespace gfx
} // namespace cc
} // namespace cc
@@ -0,0 +1,22 @@
#!/bin/bash
GENERATER="Ninja"
if [ -x "$(command -v ninja)" ]; then
MAKE_BIN=-DCMAKE_MAKE_PROGRAM="$(command -v ninja)"
else
echo "Ninja is not find, use 'make' instead."
GENERATER="Unix Makefiles"
MAKE_BIN=""
fi
mkdir -p build
cp ./utils/CMakeLists.header.txt build/CMakeLists.txt
set -x
cmake -Sbuild -Bbuild -DCC_USE_GLES2=ON -DCC_USE_VULKAN=ON -DCC_USE_GLES3=ON \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-G "$GENERATER" $MAKE_BIN
cp build/compile_commands.json .