Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a CI build for Windows #603

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions .github/workflows/build-windows_fmod_steam.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# This is a basic workflow to help you get started with Actions

name: Windows-CI_fmod_steam

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master, develop ]
pull_request:
branches: [ master, develop ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: windows-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

# Install the dependencies
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1.0.2

# Fetch the dependencies
- name: Fetch encrypted dependencies zip
env:
DEPENDENCIES_ZIP_KEY: ${{ secrets.DEPENDENCIES_ZIP_KEY }}
DEPENDENCIES_ZIP_IV: ${{ secrets.DEPENDENCIES_ZIP_IV }}
run: |
echo "Downloading dependencies!"
curl -L https://github.com/TurningWheel/Barony/releases/download/ci_deps_1.2/dependencies_windows_x64.zip.enc --output dependencies_windows_x64.zip.enc
openssl aes-256-ctr -d -in dependencies_windows_x64.zip.enc -out dependencies_windows_x64.zip -K $DEPENDENCIES_ZIP_KEY -iv $DEPENDENCIES_ZIP_IV
unzip dependencies_windows_x64.zip -d dependencies
shell: bash

# Actually does the build...
- name: Generate Visual Studio project via CMake
run: |
echo "Generating Visual Studio project"
mkdir build
cd build
cmake .. -DSTEAMWORKS_ENABLED=1 -DEOS_ENABLED=0 -DFMOD_ENABLED=ON -DBARONY_WIN32_LIBRARIES="$(pwd)/../dependencies/gamelibs/"
shell: bash

- name: Compile
# Add additional options to the MSBuild command line here (like platform or verbosity level).
# See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
run: msbuild /m build/Barony.sln /property:Configuration=Release

- name: Upload Game Build Artifact
uses: actions/upload-artifact@v2
with:
# Artifact name
name: barony.exe # optional
# A file, directory or wildcard pattern that describes what to upload
path: build/Release/barony.exe

- name: Upload Editor Build Artifact
uses: actions/upload-artifact@v2
with:
# Artifact name
name: editor.exe # optional
# A file, directory or wildcard pattern that describes what to upload
path: build/Release/editor.exe
30 changes: 30 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,36 @@ endif()

if (NOT "${BARONY_WIN32_LIBRARIES}" STREQUAL "")
list(APPEND CMAKE_PREFIX_PATH $ENV{BARONY_WIN32_LIBRARIES})

# If not specified, set library search paths to look here.
if ("${SDL2DIR}" STREQUAL "")
set (SDL2DIR "${BARONY_WIN32_LIBRARIES}")
message("SETTING SDL2 DIRECTORY! SET to: ${SDL2DIR}")
endif()
if ("${PHYSFSDIR}" STREQUAL "")
set (PHYSFSDIR "${BARONY_WIN32_LIBRARIES}")
message("SETTING PHYSFSDIR DIRECTORY! SET to: ${PHYSFSDIR}")
endif()
if ("${RAPID_JSONROOT}" STREQUAL "" AND "${RAPID_JSON_ROOT}" STREQUAL "" AND "${RAPID_JSON_DIR}" STREQUAL "")
set (RAPID_JSON_DIR "${BARONY_WIN32_LIBRARIES}")
message("SETTING RAPID_JSON_DIR DIRECTORY! SET to: ${RAPID_JSON_DIR}")
endif()
if ("${FMOD_DIR}" STREQUAL "")
set (FMOD_DIR "${BARONY_WIN32_LIBRARIES}")
message("SETTING FMOD_DIR DIRECTORY! SET to: ${FMOD_DIR}")
endif()
if ("${ZLIB_DIR}" STREQUAL "")
set (ZLIB_DIR "${BARONY_WIN32_LIBRARIES}")
message("SETTING ZLIB_DIR DIRECTORY! SET to: ${ZLIB_DIR}")
endif()
if ("${PNG_DIR}" STREQUAL "")
set (PNG_DIR "${BARONY_WIN32_LIBRARIES}")
message("SETTING PNG_DIR DIRECTORY! SET to: ${PNG_DIR}")
endif()
if ("${STEAMWORKS_ROOT}" STREQUAL "")
set (STEAMWORKS_ROOT "${BARONY_WIN32_LIBRARIES}")
message("SETTING STEAMWORKS_ROOT DIRECTORY! SET to: ${STEAMWORKS_ROOT}")
endif()
endif(NOT "${BARONY_WIN32_LIBRARIES}" STREQUAL "")

if (DEFINED ENV{BARONY_DATADIR}) # Used by visual studio to set the current working directory when debugging the barony executables.
Expand Down
8 changes: 8 additions & 0 deletions cmake/Modules/FindFMOD.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ FIND_PATH(FMOD_INCLUDE_DIR
fmod.hpp
PATHS
$ENV{FMOD_DIR}/api/core/inc/
${FMOD_DIR}/api/core/inc/
IF (WIN32)
${FMOD_DIR}/include/
ENDIF (WIN32)
/usr/local/include/
/usr/local/include/fmodstudio/
/usr/include/
Expand All @@ -32,7 +36,11 @@ FIND_LIBRARY(FMOD_LIBRARY
$ENV{FMOD_DIR}/api/core/lib/
ELSE (APPLE)
$ENV{FMOD_DIR}/api/core/lib/x86_64/
${FMOD_DIR}/api/core/lib/x86_64/
ENDIF (APPLE)
IF (WIN32)
${FMOD_DIR}/lib/
ENDIF (WIN32)
/usr/local/lib64
/usr/local/lib
/usr/lib64
Expand Down
42 changes: 33 additions & 9 deletions cmake/Modules/FindPNG.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,40 @@
INCLUDE(FindZLIB)

IF(ZLIB_FOUND)
FIND_PATH(PNG_PNG_INCLUDE_DIR png.h
/usr/local/include/libpng # OpenBSD
)

find_path(PNG_INCLUDE_DIR zlib.h
HINTS
ENV PNG_DIR
${PNG_DIR}
PATH_SUFFIXES include
PATHS
~/Library/Frameworks
/Library/Frameworks
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
)

SET(PNG_NAMES ${PNG_NAMES} png libpng libpng16)
FIND_LIBRARY(PNG_LIBRARY NAMES ${PNG_NAMES} )
find_library(PNG_LIBRARY
NAMES ${PNG_NAMES}
HINTS
ENV PNG_DIR
${PNG_DIR}
PATH_SUFFIXES lib
PATHS
~/Library/Frameworks
/Library/Frameworks
/sw
/opt/local
/opt/csw
/opt
)

IF (PNG_LIBRARY AND PNG_PNG_INCLUDE_DIR)
IF (PNG_LIBRARY AND PNG_INCLUDE_DIR)
# png.h includes zlib.h. Sigh.
SET(PNG_INCLUDE_DIR ${PNG_PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} )
SET(PNG_INCLUDE_DIR ${PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} )
SET(PNG_LIBRARIES ${PNG_LIBRARY} ${ZLIB_LIBRARY})

IF (CYGWIN)
Expand All @@ -32,13 +56,13 @@ IF(ZLIB_FOUND)
ENDIF(BUILD_SHARED_LIBS)
ENDIF (CYGWIN)

ENDIF (PNG_LIBRARY AND PNG_PNG_INCLUDE_DIR)
ENDIF (PNG_LIBRARY AND PNG_INCLUDE_DIR)

ENDIF(ZLIB_FOUND)

# handle the QUIETLY and REQUIRED arguments and set PNG_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PNG DEFAULT_MSG PNG_LIBRARY PNG_PNG_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PNG DEFAULT_MSG PNG_LIBRARY PNG_INCLUDE_DIR)

MARK_AS_ADVANCED(PNG_PNG_INCLUDE_DIR PNG_LIBRARY )
MARK_AS_ADVANCED(PNG_INCLUDE_DIR PNG_LIBRARY )
2 changes: 2 additions & 0 deletions cmake/Modules/FindPhysFS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
find_path(PHYSFS_INCLUDE_DIR physfs.h
HINTS
ENV PHYSFSDIR
${PHYSFSDIR}
PATH_SUFFIXES include/physfs include
PATHS
~/Library/Frameworks
Expand All @@ -33,6 +34,7 @@ find_library(PHYSFS_LIBRARY
NAMES physfs
HINTS
ENV PHYSFSDIR
${PHYSFSDIR}
PATH_SUFFIXES lib
PATHS
~/Library/Frameworks
Expand Down
3 changes: 3 additions & 0 deletions cmake/Modules/FindRapidJson.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
if (NOT RAPID_JSON_INCLUDE_DIR OR NOT RAPID_JSON_LIBRARIES)
set(LIB_SEARCH_PATHS
$ENV{RAPID_JSONROOT}/
${RAPID_JSONROOT}/
$ENV{RAPID_JSON_ROOT}/
${RAPID_JSON_ROOT}/
$ENV{RAPID_JSON_DIR}/
${RAPID_JSON_DIR}/
~/Library/Frameworks
/Library/Frameworks
/usr/lib
Expand Down
10 changes: 7 additions & 3 deletions cmake/Modules/FindSDL2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@

SET(SDL2_SEARCH_PATHS
${SDL2_SEARCH_PATHS}
${SDL2DIR}
~/Library/Frameworks
/Library/Frameworks
/usr/local
Expand All @@ -79,15 +80,18 @@ SET(SDL2_SEARCH_PATHS

FIND_PATH(SDL2_INCLUDE_DIR SDL.h
HINTS
$ENV{SDL2DIR}
${SDL2DIR}
PATH_SUFFIXES include/SDL2 include SDL2
PATHS ${SDL2_SEARCH_PATHS}
)

message("searchdir for sdl SET to: ${SDL2DIR}")
message("search paths for sdl SET to: ${SDL2_SEARCH_PATHS}")

FIND_LIBRARY(SDL2_LIBRARY_TEMP
NAMES SDL2
HINTS
$ENV{SDL2DIR}
${SDL2DIR}
PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
PATHS ${SDL2_SEARCH_PATHS}
)
Expand All @@ -101,7 +105,7 @@ IF(NOT SDL2_BUILDING_LIBRARY)
FIND_LIBRARY(SDL2MAIN_LIBRARY
NAMES SDL2main
HINTS
$ENV{SDL2DIR}
${SDL2DIR}
PATH_SUFFIXES lib64 lib
PATHS ${SDL2_SEARCH_PATHS}
)
Expand Down
4 changes: 2 additions & 2 deletions cmake/Modules/FindSDL2_image.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
find_path(SDL2_IMAGE_INCLUDE_DIR SDL_image.h
HINTS
ENV SDL2IMAGEDIR
ENV SDL2DIR
${SDL2DIR}
PATH_SUFFIXES SDL2
# path suffixes to search inside ENV{SDLDIR}
include/SDL2 include
Expand All @@ -61,7 +61,7 @@ find_library(SDL2_IMAGE_LIBRARY
NAMES SDL2_image
HINTS
ENV SDL2IMAGEDIR
ENV SDL2DIR
${SDL2DIR}
PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX}
)

Expand Down
6 changes: 4 additions & 2 deletions cmake/Modules/FindSDL2_net.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,17 @@ find_path(SDL2_NET_INCLUDE_DIR
HINTS
${PC_SDL2_NET_INCLUDEDIR}
${PC_SDL2_NET_INCLUDE_DIRS}
PATH_SUFFIXES SDL2
${SDL2DIR}
PATH_SUFFIXES SDL2 include
)

find_library(SDL2_NET_LIBRARY
NAMES SDL2_net
HINTS
${PC_SDL2_NET_LIBDIR}
${PC_SDL2_NET_LIBRARY_DIRS}
PATH_SUFFIXES x64 x86
${SDL2DIR}
PATH_SUFFIXES lib x64 x86
)

if(SDL2_NET_INCLUDE_DIR AND EXISTS "${SDL2_NET_INCLUDE_DIR}/SDL_net.h")
Expand Down
2 changes: 2 additions & 0 deletions cmake/Modules/FindSDL2_ttf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ find_path(SDL2_TTF_INCLUDE_DIR SDL_ttf.h
HINTS
ENV SDLTTFDIR
ENV SDLDIR
${SDL2DIR}
Copy link
Collaborator Author

@addictgamer addictgamer Dec 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Oof, indentation mismatch that wasn't visible in my editor. :|

PATH_SUFFIXES include/SDL2 include SDL2
)

Expand All @@ -45,6 +46,7 @@ find_library(SDL2_TTF_LIBRARY
HINTS
ENV SDLTTFDIR
ENV SDLDIR
${SDL2DIR}
PATH_SUFFIXES lib
)

Expand Down
4 changes: 4 additions & 0 deletions cmake/Modules/FindSTEAMWORKS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ if (NOT STEAMWORKS_INCLUDE_DIR OR NOT STEAMWORKS_LIBRARIES)
/usr/local/lib64
$ENV{STEAMWORKSROOT}/sdk/redistributable_bin/linux64 #I don't like this. TODO: Make it determine 64/32 bit automatically.
$ENV{STEAMWORKS_ROOT}/sdk/redistributable_bin/linux64
${STEAMWORKS_ROOT}
$ENV{STEAMWORKS_DIR}/sdk/redistributable_bin/linux64
#$ENV{STEAMWORKSROOT}/sdk/redistributable_bin/linux32
#$ENV{STEAMWORKS_ROOT}/sdk/redistributable_bin/linux32
Expand All @@ -25,6 +26,7 @@ if (NOT STEAMWORKS_INCLUDE_DIR OR NOT STEAMWORKS_LIBRARIES)
/usr/local/include
$ENV{STEAMWORKSROOT}/sdk/public/
$ENV{STEAMWORKS_ROOT}/sdk/public/
${STEAMWORKS_ROOT}/include/
$ENV{STEAMWORKS_DIR}/sdk/public/
DOC "Include path for Steamworks"
)
Expand All @@ -34,13 +36,15 @@ if (NOT STEAMWORKS_INCLUDE_DIR OR NOT STEAMWORKS_LIBRARIES)
FIND_LIBRARY(STEAMWORKS_LIBRARY NAMES steam_api
PATHS
$ENV{STEAMWORKS_ROOT}/sdk/redistributable_bin
${STEAMWORKS_ROOT}/lib/
DOC "Steamworks library name"
)
MESSAGE("32 bit steam")
else ()
FIND_LIBRARY(STEAMWORKS_LIBRARY NAMES steam_api64
PATHS
$ENV{STEAMWORKS_ROOT}/sdk/redistributable_bin/win64
${STEAMWORKS_ROOT}/lib/
DOC "Steamworks library name"
)
MESSAGE("64 bit steam")
Expand Down
Loading