Skip to content

Commit

Permalink
Windows CI (first try)
Browse files Browse the repository at this point in the history
  • Loading branch information
rodlie committed Aug 5, 2024
1 parent 99a4cdf commit 89ee5de
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 9 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Windows

on: [push, pull_request]

jobs:
build:

runs-on: windows-2019

steps:
- uses: actions/checkout@v3
- name: Build
shell: cmd
run: \src\scripts\build_ci.bat
10 changes: 8 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
cmake_minimum_required(VERSION 3.12)
project(friction.graphics)

option(BUILD_ENGINE "Build Engine" ON)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/src/cmake")
include(friction-version)
include(friction-meta)
Expand Down Expand Up @@ -55,7 +57,9 @@ if(UNIX AND NOT APPLE)
include(CPack)
endif()

add_subdirectory(src/engine)
if(${BUILD_ENGINE})
add_subdirectory(src/engine)
endif()
if(UNIX)
option(BUILD_TESTING "Don't build gperftools tests" OFF)
add_subdirectory(src/gperftools)
Expand All @@ -64,4 +68,6 @@ add_subdirectory(src/core)
add_subdirectory(src/ui)
add_subdirectory(src/app)

add_dependencies(frictioncore Engine)
if(${BUILD_ENGINE})
add_dependencies(frictioncore Engine)
endif()
6 changes: 3 additions & 3 deletions src/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ if(APPLE)
endif()

if(WIN32)
set(QSCINTILLA_LIBRARIES_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla/src/release)
set(QSCINTILLA_LIBRARIES_DIRS ${CMAKE_SOURCE_DIR}/sdk/bin)
set(QSCINTILLA_LIBRARIES qscintilla2_qt5)
set(QSCINTILLA_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla/src)
set(QSCINTILLA_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/sdk/include)
add_definitions(-DQSCINTILLA_DLL)
else()
set(QSCINTILLA_LIBRARIES_DIRS "/usr/lib" CACHE STRING "qscintilla library path")
Expand Down Expand Up @@ -289,7 +289,7 @@ target_link_directories(
${FFMPEG_LIBRARIES_DIRS}
${QSCINTILLA_LIBRARIES_DIRS}
#${QUAZIP_LIBRARIES_DIRS}
${CMAKE_CURRENT_BINARY_DIR}/../engine/skia
${SKIA_LIBRARIES_DIRS}
)

if(${USE_SKIA_SYSTEM_LIBS} AND UNIX)
Expand Down
2 changes: 2 additions & 0 deletions src/cmake/friction-common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ if(WIN32)
user32
opengl32)
add_definitions(-DSKIA_DLL)
set(SKIA_LIBRARIES_DIRS ${CMAKE_SOURCE_DIR}/sdk/bin)
else()
if(APPLE)
set(SKIA_LIBRARIES skia)
Expand All @@ -117,4 +118,5 @@ 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)
endif()
4 changes: 2 additions & 2 deletions src/cmake/friction-ffmpeg.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
#

if(WIN32)
set(FFMPEG_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/src/ffmpeg/include)
set(FFMPEG_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/sdk/include)
set(FFMPEG_LIBRARIES
avformat
avcodec
avutil
swscale
swresample)
set(FFMPEG_LIBRARIES_DIRS ${CMAKE_SOURCE_DIR}/src/ffmpeg/bin)
set(FFMPEG_LIBRARIES_DIRS ${CMAKE_SOURCE_DIR}/sdk/bin)
else()
pkg_check_modules(AVFORMAT REQUIRED libavformat)
pkg_check_modules(AVCODEC REQUIRED libavcodec)
Expand Down
2 changes: 1 addition & 1 deletion src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ target_link_directories(
${PROJECT_NAME}
PRIVATE
${FFMPEG_LIBRARIES_DIRS}
${CMAKE_CURRENT_BINARY_DIR}/../engine/skia
${SKIA_LIBRARIES_DIRS}
#${QUAZIP_LIBRARIES_DIRS}
)

Expand Down
77 changes: 77 additions & 0 deletions src/scripts/build_ci.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
@echo off

REM ### BUILD FRICTION ON WINDOWS
REM # Copyright (c) Friction contributors
REM # GPLv3+

set OPT=%1
set REL=OFF
if "%OPT%" == "release" (
set REL=ON
)

set CWD=%cd%
set SDK_DIR=%CWD%\sdk
set SDK_VERSION=20240805

set PATH=%SDK_DIR%\bin;%PATH%

set BRANCH=
for /f %%I in ('git rev-parse --abbrev-ref HEAD 2^> NUL') do set BRANCH=%%I

set COMMIT=
for /f %%i in ('git rev-parse --short^=8 HEAD') do set COMMIT=%%i

if not exist "sdk\" (
curl -OL "https://github.com/friction2d/friction-sdk/releases/download/%SDK_VERSION%/friction-sdk-%SDK_VERSION%-windows-x64.7z"
7z x friction-sdk-%SDK_VERSION%-windows-x64.7z
)

if exist "build\" (
@RD /S /Q build
)
mkdir build

cd "%CWD%\build"
mkdir output

cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=%SDK_DIR% -DBUILD_ENGINE=OFF -DFRICTION_OFFICIAL_RELEASE=%REL% -DWIN_DEPLOY=ON -DGIT_COMMIT=%COMMIT% -DGIT_BRANCH=%BRANCH% ..
set /p VERSION=<version.txt
cmake --build . --config Release

if "%REL%" == "OFF" (
set VERSION="%VERSION%-%COMMIT%"
)

set OUTPUT_DIR="%CWD%\build\output\friction-%VERSION%"
mkdir "%OUTPUT_DIR%"
mkdir "%OUTPUT_DIR%\audio"
mkdir "%OUTPUT_DIR%\platforms"

copy "%CWD%\build\src\core\release\frictioncore.dll" "%OUTPUT_DIR%\"
copy "%CWD%\build\src\ui\release\frictionui.dll" "%OUTPUT_DIR%\"
copy "%CWD%\build\src\app\release\friction.exe" "%OUTPUT_DIR%\"
copy "%SDK_DIR%\bin\svgo-win.exe" "%OUTPUT_DIR%\"
copy "%SDK_DIR%\bin\skia.dll" "%OUTPUT_DIR%\"
copy "%SDK_DIR%\bin\Qt5Core.dll" "%OUTPUT_DIR%\"
copy "%SDK_DIR%\bin\Qt5Gui.dll" "%OUTPUT_DIR%\"
copy "%SDK_DIR%\bin\Qt5Multimedia.dll" "%OUTPUT_DIR%\"
copy "%SDK_DIR%\bin\Qt5Network.dll" "%OUTPUT_DIR%\"
copy "%SDK_DIR%\bin\Qt5OpenGL.dll" "%OUTPUT_DIR%\"
copy "%SDK_DIR%\bin\Qt5PrintSupport.dll" "%OUTPUT_DIR%\"
copy "%SDK_DIR%\bin\Qt5Qml.dll" "%OUTPUT_DIR%\"
copy "%SDK_DIR%\bin\Qt5Widgets.dll" "%OUTPUT_DIR%\"
copy "%SDK_DIR%\bin\Qt5Xml.dll" "%OUTPUT_DIR%\"
copy "%SDK_DIR%\bin\qscintilla2_qt5.dll" "%OUTPUT_DIR%\"
copy "%SDK_DIR%\plugins\audio\qtaudio_wasapi.dll" "%OUTPUT_DIR%\audio\"
copy "%SDK_DIR%\plugins\platforms\qwindows.dll" "%OUTPUT_DIR%\platforms\"
copy "%SDK_DIR%\bin\avcodec-58.dll" "%OUTPUT_DIR%\"
copy "%SDK_DIR%\bin\avdevice-58.dll" "%OUTPUT_DIR%\"
copy "%SDK_DIR%\bin\avformat-58.dll" "%OUTPUT_DIR%\"
copy "%SDK_DIR%\bin\avutil-56.dll" "%OUTPUT_DIR%\"
copy "%SDK_DIR%\bin\swresample-3.dll" "%OUTPUT_DIR%\"
copy "%SDK_DIR%\bin\swscale-5.dll" "%OUTPUT_DIR%\"

cd "%CWD%\build\output"

7z a -mx9 friction-%VERSION%-windows-x64.7z friction-%VERSION%
2 changes: 1 addition & 1 deletion src/ui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ target_link_directories(
${PROJECT_NAME}
PRIVATE
${FFMPEG_LIBRARIES_DIRS}
${CMAKE_CURRENT_BINARY_DIR}/../engine/skia
${SKIA_LIBRARIES_DIRS}
)

target_link_libraries(
Expand Down

0 comments on commit 89ee5de

Please sign in to comment.