Skip to content

Commit

Permalink
CI Stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
rodlie committed Aug 25, 2024
1 parent 7e480cd commit e0521f6
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ backup
CHANGES.md
friction-distfiles
svgo-linux
svgo-win.exe
skia-build
8 changes: 7 additions & 1 deletion src/cmake/friction-common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)

option(LINUX_DEPLOY "Linux Deploy" OFF)
option(WIN_DEPLOY "Windows Deploy" OFF)
option(BUILD_ENGINE "Build Engine" ON)
set(ENGINE_LIB_PATH "/mnt/skia-build" CACHE STRING "Path to prebuilt skia library")

if(${LINUX_DEPLOY})
add_definitions(-DLINUX_DEPLOY)
Expand Down Expand Up @@ -120,5 +122,9 @@ else()
set(GPERF_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/../gperftools ${UNWIND_INCLUDE_DIRS})
set(GPERF_LIBRARIES tcmalloc_static ${UNWIND_LIBRARIES})
endif()
set(SKIA_LIBRARIES_DIRS ${CMAKE_CURRENT_BINARY_DIR}/../engine/skia)
if(${BUILD_ENGINE})
set(SKIA_LIBRARIES_DIRS ${CMAKE_CURRENT_BINARY_DIR}/../engine/skia)
else()
set(SKIA_LIBRARIES_DIRS ${ENGINE_LIB_PATH})
endif()
endif()
2 changes: 1 addition & 1 deletion src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ include(friction-ffmpeg)

message("-- ffmpeg include: ${FFMPEG_INCLUDE_DIRS}")
message("-- ffmpeg libraries: ${FFMPEG_LIBRARIES_DIRS} ${FFMPEG_LIBRARIES}")
message("-- skia libraries: ${SKIA_LIBRARIES}")
message("-- skia libraries: ${SKIA_LIBRARIES_DIRS} ${SKIA_LIBRARIES}")

add_definitions(-DPROJECT_VERSION="${PROJECT_VERSION}")
add_definitions(-DPROJECT_COMMIT="${GIT_COMMIT}")
Expand Down
18 changes: 14 additions & 4 deletions src/scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,17 @@ MKJOBS=${MKJOBS:-2}
COMMIT=`git rev-parse --short=8 HEAD`
BRANCH=`git rev-parse --abbrev-ref HEAD`

BUILD_ENGINE=${BUILD_ENGINE:-"OFF"}
REL=${REL:-0}
ASDK=20240401
APPIMG=20240401
SDK=20240609
SKIA=7e480cd3
URL=https://github.com/friction2d/friction-sdk/releases/download/${SDK}
APPIMAGE_TAR=friction-appimage-tools-${ASDK}.tar.xz
APPIMAGE_TAR=friction-appimage-tools-${APPIMG}.tar.xz
SDK_TAR=friction-vfxplatform-CY2021-sdk-${SDK}.tar.bz2
SKIA_TAR=skia-build-${SKIA}.tar.xz

mkdir -p distfiles/sdk
mkdir -p distfiles/sdk || true

cd distfiles
if [ ! -d "linux" ]; then
Expand All @@ -42,11 +45,18 @@ if [ ! -d "linux" ]; then
tar xvf ${APPIMAGE_TAR}
fi

if [ ! -d "skia" ]; then
if [ ! -f "${SKIA_TAR}" ]; then
wget ${URL}/${SKIA_TAR}
fi
tar xvf ${SKIA_TAR}
fi

cd sdk
if [ ! -f "${SDK_TAR}" ]; then
wget ${URL}/${SDK_TAR}
fi

cd ${CWD}

LOCAL_BUILD=0 MKJOBS=${MKJOBS} REL=${REL} BRANCH=${BRANCH} COMMIT=${COMMIT} ./src/scripts/run_vfxplatform.sh
BUILD_ENGINE=${BUILD_ENGINE} LOCAL_BUILD=0 MKJOBS=${MKJOBS} REL=${REL} BRANCH=${BRANCH} COMMIT=${COMMIT} ./src/scripts/run_vfxplatform.sh
11 changes: 11 additions & 0 deletions src/scripts/build_vfxplatform_friction.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ clang -v
SDK=${SDK:-"/opt/friction"}
BUILD=${BUILD:-"${HOME}"}

BUILD_ENGINE=${BUILD_ENGINE:-"ON"}
REL=${REL:-1}
BRANCH=${BRANCH:-""}
COMMIT=${COMMIT:-""}
Expand Down Expand Up @@ -98,6 +99,7 @@ cmake -GNinja \
-DGIT_COMMIT=${GIT_COMMIT} \
-DGIT_BRANCH=${GIT_BRANCH} \
-DCUSTOM_BUILD=${CUSTOM} \
-DBUILD_ENGINE=${BUILD_ENGINE} \
..

VERSION=`cat version.txt`
Expand All @@ -107,6 +109,15 @@ fi

cmake --build .

# TODO: add option to keep skia build for reuse
#if [ "${BUILD_ENGINE}" = "ON" ]; then
# (cd src/engine ;
# tar cvvf skia-build-${GIT_COMMIT}.tar skia
# mkdir -p /mnt/builds/${VERSION} || true
# mv skia-build-${GIT_COMMIT}.tar /mnt/builds/${VERSION}
# )
#fi

FRICTION_INSTALL_DIR=friction-${VERSION}
mkdir -p ${BUILD}/${FRICTION_INSTALL_DIR}/opt/friction/{bin,lib,share} || true
mkdir -p ${BUILD}/${FRICTION_INSTALL_DIR}/opt/friction/plugins/{audio,generic,platforminputcontexts,platforms,xcbglintegrations} || true
Expand Down
3 changes: 3 additions & 0 deletions src/scripts/push_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
docker build -t frictiongraphics/friction-vfxplatform-sdk . -f Dockerfile.vfxplatform
docker push frictiongraphics/friction-vfxplatform-sdk

5 changes: 2 additions & 3 deletions src/scripts/run_vfxplatform.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
set -e -x

CWD=`pwd`
BUILD_ENGINE=${BUILD_ENGINE:-"ON"}
REL=${REL:-0}
BRANCH=${BRANCH:-""}
COMMIT=${COMMIT:-""}
Expand All @@ -34,7 +35,7 @@ SDK_VERSION="20240609"
TAR_VERSION=${TAR_VERSION:-""}

DOCKER="docker run"
DOCKER="${DOCKER} -e REL=${REL} -e MKJOBS=${MKJOBS} -e TAR_VERSION=${TAR_VERSION} -e SDK_VERSION=${SDK_VERSION} -e ONLY_SDK=${ONLY_SDK} -e DOWNLOAD_SDK=${DOWNLOAD_SDK} -e BRANCH=${BRANCH} -e COMMIT=${COMMIT} -e TAG=${TAG} -e CUSTOM=${CUSTOM}"
DOCKER="${DOCKER} -e BUILD_ENGINE=${BUILD_ENGINE} -e REL=${REL} -e MKJOBS=${MKJOBS} -e TAR_VERSION=${TAR_VERSION} -e SDK_VERSION=${SDK_VERSION} -e ONLY_SDK=${ONLY_SDK} -e DOWNLOAD_SDK=${DOWNLOAD_SDK} -e BRANCH=${BRANCH} -e COMMIT=${COMMIT} -e TAG=${TAG} -e CUSTOM=${CUSTOM}"
DOCKER="${DOCKER} -t --mount type=bind,source=${CWD}/distfiles,target=/mnt"

if [ ! -d "${CWD}/distfiles" ]; then
Expand All @@ -51,5 +52,3 @@ else
docker pull frictiongraphics/friction-vfxplatform-sdk
${DOCKER} frictiongraphics/friction-vfxplatform-sdk
fi


2 changes: 1 addition & 1 deletion src/ui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ include(friction-ffmpeg)

message("-- ffmpeg include: ${FFMPEG_INCLUDE_DIRS}")
message("-- ffmpeg libraries: ${FFMPEG_LIBRARIES_DIRS} ${FFMPEG_LIBRARIES}")
message("-- skia libraries: ${SKIA_LIBRARIES}")
message("-- skia libraries: ${SKIA_LIBRARIES_DIRS} ${SKIA_LIBRARIES}")

add_definitions(-DUI_LIBRARY)

Expand Down

0 comments on commit e0521f6

Please sign in to comment.