diff --git a/.gitignore b/.gitignore index 87f2f1646..9a40bcbe4 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,5 @@ backup CHANGES.md friction-distfiles svgo-linux +svgo-win.exe +skia-build diff --git a/src/cmake/friction-common.cmake b/src/cmake/friction-common.cmake index c5b68015b..8a33c66c0 100644 --- a/src/cmake/friction-common.cmake +++ b/src/cmake/friction-common.cmake @@ -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) @@ -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() diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 59122fdeb..97b0abed5 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -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}") diff --git a/src/scripts/build.sh b/src/scripts/build.sh index 0ddb7dc7a..08a8d205d 100755 --- a/src/scripts/build.sh +++ b/src/scripts/build.sh @@ -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 @@ -42,6 +45,13 @@ 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} @@ -49,4 +59,4 @@ 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 diff --git a/src/scripts/build_vfxplatform_friction.sh b/src/scripts/build_vfxplatform_friction.sh index 6c853ba64..85e2f3a01 100755 --- a/src/scripts/build_vfxplatform_friction.sh +++ b/src/scripts/build_vfxplatform_friction.sh @@ -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:-""} @@ -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` @@ -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 diff --git a/src/scripts/push_docker.sh b/src/scripts/push_docker.sh new file mode 100644 index 000000000..bb8420897 --- /dev/null +++ b/src/scripts/push_docker.sh @@ -0,0 +1,3 @@ +docker build -t frictiongraphics/friction-vfxplatform-sdk . -f Dockerfile.vfxplatform +docker push frictiongraphics/friction-vfxplatform-sdk + diff --git a/src/scripts/run_vfxplatform.sh b/src/scripts/run_vfxplatform.sh index 9ad4a9fe9..476dc1c03 100755 --- a/src/scripts/run_vfxplatform.sh +++ b/src/scripts/run_vfxplatform.sh @@ -21,6 +21,7 @@ set -e -x CWD=`pwd` +BUILD_ENGINE=${BUILD_ENGINE:-"ON"} REL=${REL:-0} BRANCH=${BRANCH:-""} COMMIT=${COMMIT:-""} @@ -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 @@ -51,5 +52,3 @@ else docker pull frictiongraphics/friction-vfxplatform-sdk ${DOCKER} frictiongraphics/friction-vfxplatform-sdk fi - - diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt index 07a57b103..76afd414e 100644 --- a/src/ui/CMakeLists.txt +++ b/src/ui/CMakeLists.txt @@ -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)