diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml new file mode 100644 index 000000000..3db43529c --- /dev/null +++ b/.github/workflows/windows.yml @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index 84a30da44..05d6cd95b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) @@ -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) @@ -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() diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt index 2754f0524..3bf3e6d0f 100644 --- a/src/app/CMakeLists.txt +++ b/src/app/CMakeLists.txt @@ -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") @@ -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) diff --git a/src/cmake/friction-common.cmake b/src/cmake/friction-common.cmake index 0566f5a68..47b8a56f6 100644 --- a/src/cmake/friction-common.cmake +++ b/src/cmake/friction-common.cmake @@ -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) @@ -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() diff --git a/src/cmake/friction-ffmpeg.cmake b/src/cmake/friction-ffmpeg.cmake index b98eca3b3..0fbeae99c 100644 --- a/src/cmake/friction-ffmpeg.cmake +++ b/src/cmake/friction-ffmpeg.cmake @@ -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) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index b06143979..59122fdeb 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -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} ) diff --git a/src/scripts/build_ci.bat b/src/scripts/build_ci.bat new file mode 100644 index 000000000..5899fe334 --- /dev/null +++ b/src/scripts/build_ci.bat @@ -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=