Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Axanery authored Jul 6, 2024
2 parents a76f16b + 5cc3f3b commit 1ef6172
Show file tree
Hide file tree
Showing 249 changed files with 32,024 additions and 11,597 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/cmake-multi-platform.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: CMake (Linux and Windows)

on:
push:
branches: [ "master", "dev", "workflow-test" ]
pull_request:
branches: [ "master", "dev" ]

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false

matrix:
os: [ubuntu-latest, windows-latest]
build_type: [Release, Debug]
c_compiler: [gcc, clang, cl]
include:
- os: windows-latest
c_compiler: cl
cpp_compiler: cl
- os: ubuntu-latest
c_compiler: gcc
cpp_compiler: g++
- os: ubuntu-latest
c_compiler: clang
cpp_compiler: clang++
exclude:
- os: windows-latest
c_compiler: gcc
- os: windows-latest
c_compiler: clang
- os: ubuntu-latest
c_compiler: cl

steps:
- uses: actions/checkout@v3

- name: Set reusable strings
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
- name: Setup libraries
if: startsWith(matrix.os, 'ubuntu')
run: sudo apt-get install libsdl2-dev libassimp5 libglew2.2 libglew-dev

- name: Configure CMake
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ github.workspace }}
- name: Build
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}

- name: Upload Linux build
if: startsWith(matrix.os, 'ubuntu')
uses: actions/upload-artifact@v3
with:
name: HatchGameEngine-Linux-${{ matrix.build_type }}-${{ github.sha }}-${{ matrix.c_compiler }}
path: build/HatchGameEngine-${{ matrix.build_type }}
retention-days: 7

- name: Upload Windows build
if: startsWith(matrix.os, 'windows')
uses: actions/upload-artifact@v3
with:
name: HatchGameEngine-Windows-${{ matrix.build_type }}-${{ github.sha }}
path: build/${{ matrix.build_type }}/HatchGameEngine-${{ matrix.build_type }}.exe
retention-days: 7
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ mono_crash.*
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
Expand Down
75 changes: 54 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
cmake_minimum_required(VERSION 3.10)

# set the project name and version
project(HatchGameEngine VERSION 1.1.0)
project(HatchGameEngine VERSION 1.2.2)

# specify the C++ standard
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_CXX_FLAGS_RELEASE "-Ofast -march=nocona")

if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
set(CMAKE_CXX_FLAGS "/wd4244 /wd4267 /wd4305 /wd4717 /EHsc")
else()
set(CMAKE_CXX_FLAGS_RELEASE "-Ofast -march=nocona")
endif()

# Set up CMake modules path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
Expand Down Expand Up @@ -44,16 +49,16 @@ endif()
option(USE_OPEN_ASSET_IMPORT_LIBRARY "Use Open Asset Import Library" ON)
option(USE_FREETYPE_LIBRARY "Use FreeType" OFF)

if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
set(USE_OPEN_ASSET_IMPORT_LIBRARY OFF)
endif()

# Renderers
option(USING_OPENGL "Use OpenGL" ON)
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
option(USING_DIRECT3D "Use Direct3D" OFF)
endif()

if(USE_OPEN_ASSET_IMPORT_LIBRARY)
add_definitions(-DUSING_ASSIMP)
endif()

if(USE_FREETYPE_LIBRARY)
add_definitions(-DUSING_FREETYPE)
endif()
Expand All @@ -70,6 +75,8 @@ if(NOT ENABLE_SCRIPT_COMPILING)
add_definitions(-DNO_SCRIPT_COMPILING)
endif()

add_definitions(-DMINIZ_NO_ARCHIVE_APIS -DMINIZ_NO_ARCHIVE_WRITING_APIS -DMINIZ_NO_TIME )

if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(MAKEHEADERS_BINARY makeheaders.exe)
else()
Expand All @@ -82,6 +89,18 @@ add_custom_target(makeheaders ALL
BYPRODUCTS "${CMAKE_SOURCE_DIR}/include/makeheaders.bin" "${CMAKE_SOURCE_DIR}/include/Engine"
COMMENT "Generating header files")

find_file(REPO_DIR NAMES .git PATHS ${CMAKE_SOURCE_DIR} NO_DEFAULT_PATH)

if (REPO_DIR)
execute_process(
COMMAND git log -1 --format=%H
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE)

add_definitions("-DGIT_COMMIT_HASH=\"${GIT_COMMIT_HASH}\"")
endif()

add_executable(${PROJECT_NAME} ${HATCH_SOURCES})
add_dependencies(${PROJECT_NAME} makeheaders)

Expand Down Expand Up @@ -112,21 +131,30 @@ if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows")
add_definitions(-DUSING_LIBPNG)
endif()
if(USE_OPEN_ASSET_IMPORT_LIBRARY)
find_package(assimp REQUIRED)
set(ASSIMP_INCLUDE_DIRS assimp_INCLUDE_DIRS)
set(ASSIMP_LIBRARIES assimp)
find_package(assimp)
if(assimp_FOUND)
add_definitions(-DUSING_ASSIMP)
set(ASSIMP_INCLUDE_DIRS assimp_INCLUDE_DIRS)
set(ASSIMP_LIBRARIES assimp)
endif()
endif()
if(USING_OPENGL)
set(OPENGL_LIBRARIES "-lGL -lGLEW")
endif()
else()
set(SDL2_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/meta/win/include/SDL2/")
if(USE_OPEN_ASSET_IMPORT_LIBRARY)
set(ASSIMP_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/meta/win/include/assimp/")
set(ASSIMP_LIBRARIES "${CMAKE_CURRENT_LIST_DIR}/meta/win/lib/mingw/${TOOLCHAIN_PREFIX}/libassimp.a;${CMAKE_CURRENT_LIST_DIR}/meta/win/lib/mingw/${TOOLCHAIN_PREFIX}/libzlibstatic.a")
endif()
if(USING_OPENGL)
set(OPENGL_LIBRARIES "${CMAKE_CURRENT_LIST_DIR}/meta/win/lib/mingw/${TOOLCHAIN_PREFIX}/libglew32.a;-lgdi32;-lopengl32")
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
if(USING_OPENGL)
set(OPENGL_LIBRARIES "${CMAKE_CURRENT_LIST_DIR}/meta/win/lib/msvc/x64/glew32s.lib")
endif()
else()
if(USE_OPEN_ASSET_IMPORT_LIBRARY)
set(ASSIMP_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/meta/win/include/assimp/")
set(ASSIMP_LIBRARIES "${CMAKE_CURRENT_LIST_DIR}/meta/win/lib/mingw/${TOOLCHAIN_PREFIX}/libassimp.a;${CMAKE_CURRENT_LIST_DIR}/meta/win/lib/mingw/${TOOLCHAIN_PREFIX}/libzlibstatic.a")
endif()
if(USING_OPENGL)
set(OPENGL_LIBRARIES "${CMAKE_CURRENT_LIST_DIR}/meta/win/lib/mingw/${TOOLCHAIN_PREFIX}/libglew32.a;-lgdi32;-lopengl32")
endif()
endif()
endif()

Expand Down Expand Up @@ -161,11 +189,16 @@ endif()

# Add libraries
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
target_link_libraries(${PROJECT_NAME}
"${CMAKE_CURRENT_LIST_DIR}/meta/win/lib/mingw/${TOOLCHAIN_PREFIX}/libSDL2.a"
-static -mwindows -lmingw32 -lm -ldinput8 -ldxguid -ldxerr8
-luser32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32
-lversion -luuid -lhid -lsetupapi -lws2_32)
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
target_link_libraries(${PROJECT_NAME} "${CMAKE_CURRENT_LIST_DIR}/meta/win/lib/msvc/x64/SDL2.lib"
Ws2_32.lib opengl32.lib)
else()
target_link_libraries(${PROJECT_NAME}
"${CMAKE_CURRENT_LIST_DIR}/meta/win/lib/mingw/${TOOLCHAIN_PREFIX}/libSDL2.a"
-static -mwindows -lmingw32 -lm -ldinput8 -ldxguid -ldxerr8
-luser32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32
-lversion -luuid -lhid -lsetupapi -lws2_32)
endif()
add_definitions(-DSDL_MAIN_HANDLED)
else()
target_link_libraries(${PROJECT_NAME} ${SDL2_LIBRARIES})
Expand Down
31 changes: 26 additions & 5 deletions VisualC/HatchGameEngine.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -66,23 +66,24 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(SolutionDir)..\meta\win\include;$(SolutionDir)..\include;$(SolutionDir)..\source;$(IncludePath)</IncludePath>
<LibraryPath>$(SolutionDir)..\meta\win\lib;$(LibraryPath)</LibraryPath>
<LibraryPath>$(SolutionDir)..\meta\win\lib\msvc\x86;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(SolutionDir)..\meta\win\include;$(SolutionDir)..\include;$(SolutionDir)..\source;$(IncludePath)</IncludePath>
<LibraryPath>$(SolutionDir)..\meta\win\lib;$(LibraryPath)</LibraryPath>
<LibraryPath>$(SolutionDir)..\meta\win\lib\msvc\x86;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<IncludePath>$(SolutionDir)..\meta\win\include;$(SolutionDir)..\include;$(SolutionDir)..\source;$(IncludePath)</IncludePath>
<LibraryPath>$(SolutionDir)..\meta\win\lib;$(LibraryPath)</LibraryPath>
<LibraryPath>$(SolutionDir)..\meta\win\lib\msvc\x64;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IncludePath>$(SolutionDir)..\meta\win\include;$(SolutionDir)..\include;$(SolutionDir)..\source;$(IncludePath)</IncludePath>
<LibraryPath>$(SolutionDir)..\meta\win\lib;$(LibraryPath)</LibraryPath>
<LibraryPath>$(SolutionDir)..\meta\win\lib\msvc\x64;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<LanguageStandard>stdcpp17</LanguageStandard>
<PreprocessorDefinitions>WIN32;TARGET_NAME="$(ProjectName)";GLEW_STATIC;USING_OPENGL;USING_FREETYPE;_DEBUG;_WINDOWS;DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
Expand All @@ -104,6 +105,7 @@ CD ..</Command>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<LanguageStandard>stdcpp17</LanguageStandard>
<PreprocessorDefinitions>WIN32;TARGET_NAME="$(ProjectName)";GLEW_STATIC;USING_OPENGL;USING_FREETYPE;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
Expand All @@ -126,7 +128,9 @@ CD ..</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile />
<ClCompile>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<PreBuildEvent>
<Command>CD "..\tools"
"makeheaders.exe" ../source
Expand All @@ -137,6 +141,9 @@ CD ..</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<PreBuildEvent>
<Command>CD "..\tools"
"makeheaders.exe" ../source
Expand All @@ -153,6 +160,7 @@ CD ..</Command>
<ClCompile Include="..\source\engine\bytecode\TypeImpl\ArrayImpl.cpp" />
<ClCompile Include="..\source\engine\bytecode\TypeImpl\FunctionImpl.cpp" />
<ClCompile Include="..\source\engine\bytecode\TypeImpl\MapImpl.cpp" />
<ClCompile Include="..\source\engine\bytecode\TypeImpl\StringImpl.cpp" />
<ClCompile Include="..\source\engine\bytecode\Bytecode.cpp" />
<ClCompile Include="..\source\engine\bytecode\Compiler.cpp" />
<ClCompile Include="..\source\engine\bytecode\GarbageCollector.cpp" />
Expand Down Expand Up @@ -195,6 +203,7 @@ CD ..</Command>
<ClCompile Include="..\source\engine\io\Stream.cpp" />
<ClCompile Include="..\source\engine\Main.cpp" />
<ClCompile Include="..\source\engine\math\Ease.cpp" />
<ClCompile Include="..\source\engine\math\Geometry.cpp" />
<ClCompile Include="..\source\engine\math\Math.cpp" />
<ClCompile Include="..\source\engine\math\Matrix4x4.cpp" />
<ClCompile Include="..\source\engine\math\Vector.cpp" />
Expand Down Expand Up @@ -236,7 +245,10 @@ CD ..</Command>
<ClCompile Include="..\source\engine\resourcetypes\IModel.cpp" />
<ClCompile Include="..\source\engine\resourcetypes\ISound.cpp" />
<ClCompile Include="..\source\engine\resourcetypes\ISprite.cpp" />
<ClCompile Include="..\source\engine\resourcetypes\modelformats\HatchModel.cpp" />
<ClCompile Include="..\source\engine\resourcetypes\modelformats\Importer.cpp" />
<ClCompile Include="..\source\engine\resourcetypes\modelformats\MD3Model.cpp" />
<ClCompile Include="..\source\engine\resourcetypes\modelformats\RSDKModel.cpp" />
<ClCompile Include="..\source\engine\resourcetypes\ResourceManager.cpp" />
<ClCompile Include="..\source\Engine\ResourceTypes\SceneFormats\HatchSceneReader.cpp" />
<ClCompile Include="..\source\engine\resourcetypes\sceneformats\RSDKSceneReader.cpp" />
Expand All @@ -245,6 +257,7 @@ CD ..</Command>
<ClCompile Include="..\source\engine\resourcetypes\soundformats\SoundFormat.cpp" />
<ClCompile Include="..\source\engine\resourcetypes\soundformats\WAV.cpp" />
<ClCompile Include="..\source\engine\Scene.cpp" />
<ClCompile Include="..\source\engine\scene\SceneInfo.cpp" />
<ClCompile Include="..\source\engine\scene\SceneLayer.cpp" />
<ClCompile Include="..\source\engine\scene\ScrollingIndex.cpp" />
<ClCompile Include="..\source\engine\scene\ScrollingInfo.cpp" />
Expand All @@ -263,6 +276,14 @@ CD ..</Command>
<ClCompile Include="..\source\Libraries\miniz.c" />
<ClCompile Include="..\source\Libraries\stb_vorbis.c" />
<ClCompile Include="..\source\Libraries\spng.c" />
<ClCompile Include="..\source\Libraries\poly2tri\common\shapes.cpp" />
<ClCompile Include="..\source\Libraries\poly2tri\sweep\advancing_front.cpp" />
<ClCompile Include="..\source\Libraries\poly2tri\sweep\cdt.cpp" />
<ClCompile Include="..\source\Libraries\poly2tri\sweep\sweep_context.cpp" />
<ClCompile Include="..\source\Libraries\poly2tri\sweep\sweep.cpp" />
<ClCompile Include="..\source\Libraries\clipper2\clipper.engine.cpp" />
<ClCompile Include="..\source\Libraries\clipper2\clipper.offset.cpp" />
<ClCompile Include="..\source\Libraries\clipper2\clipper.rectclip.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\include\engine\audio\AudioChannel.h" />
Expand Down
18 changes: 18 additions & 0 deletions VisualC/HatchGameEngine.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
<ClCompile Include="..\source\engine\bytecode\TypeImpl\MapImpl.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\source\engine\bytecode\TypeImpl\StringImpl.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\source\engine\bytecode\Bytecode.cpp">
<Filter>Source Files</Filter>
</ClCompile>
Expand Down Expand Up @@ -156,6 +159,9 @@
<ClCompile Include="..\source\engine\math\Ease.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\source\engine\math\Geometry.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\source\engine\math\Math.cpp">
<Filter>Source Files</Filter>
</ClCompile>
Expand Down Expand Up @@ -279,9 +285,18 @@
<ClCompile Include="..\source\engine\resourcetypes\ISprite.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\source\engine\resourcetypes\modelformats\HatchModel.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\source\engine\resourcetypes\modelformats\Importer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\source\engine\resourcetypes\modelformats\MD3Model.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\source\engine\resourcetypes\modelformats\RSDKModel.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\source\engine\resourcetypes\ResourceManager.cpp">
<Filter>Source Files</Filter>
</ClCompile>
Expand All @@ -306,6 +321,9 @@
<ClCompile Include="..\source\engine\Scene.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\source\engine\scene\SceneInfo.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\source\engine\scene\SceneLayer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
Expand Down
Loading

0 comments on commit 1ef6172

Please sign in to comment.