Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Flying-Tom committed Jan 25, 2022
0 parents commit 5628676
Show file tree
Hide file tree
Showing 121 changed files with 4,375 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/release-ubuntu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Ubuntu Release

on:
push:
branches:
- master

env:
BUILD_TYPE: Release

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Install Qt
uses: jurplel/install-qt-action@v2

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Pack Resources
if: startsWith(github.ref, 'refs/tags/v')
run: |
mkdir ${{github.workspace}}/release/
cp ${{github.workspace}}/build/TDGame ${{github.workspace}}/release/
cp -r ${{github.workspace}}/resource/maps/ ${{github.workspace}}/release/
- name: Archive Release
uses: thedoctor0/zip-release@master
if: startsWith(github.ref, 'refs/tags/v')
with:
type: "zip"
directory: ${{github.workspace}}/release/
filename: "TDGame-Ubuntu-${{github.ref_name}}.zip"

- name: Upload Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
files: "${{github.workspace}}/release/TDGame-Ubuntu-${{github.ref_name}}.zip"
54 changes: 54 additions & 0 deletions .github/workflows/release-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Windows Release

on:
push:
branches:
- master

env:
BUILD_TYPE: Release

jobs:
build:
runs-on: windows-latest

steps:
- uses: actions/checkout@v2

- name: Set up MinGW
uses: egor-tensin/setup-mingw@v2
with:
platform: x64

- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
arch: "win64_mingw81"

- name: Configure CMake
run: cmake -G "MinGW Makefiles" -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

- name: Pack Resources
if: startsWith(github.ref, 'refs/tags/v')
run: |
mkdir ${{github.workspace}}\release
Xcopy ${{github.workspace}}\build\TDGame.exe ${{github.workspace}}\release
Xcopy /E /I ${{github.workspace}}\resource\maps ${{github.workspace}}\release\maps
cd ${{env.Qt5_Dir}}/bin/
./windeployqt.exe ${{github.workspace}}\release\TDGame.exe
- name: Archive Release
uses: thedoctor0/zip-release@master
if: startsWith(github.ref, 'refs/tags/v')
with:
type: "zip"
directory: ${{github.workspace}}/release/
filename: "TDGame-Windows-${{github.ref_name}}.zip"

- name: Upload Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
files: "${{github.workspace}}/release/TDGame-Windows-${{github.ref_name}}.zip"
39 changes: 39 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

# Custom
**build*/**
**.vscode/
**.vs/
**_minted**/**
TDGame.pro.user**
33 changes: 33 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
cmake_minimum_required(VERSION 3.10.0)
project(TDGame LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

include_directories(include)
file(GLOB CMAKE_CXX_SOURCES src/*.cpp src/**/*.cpp)
file(GLOB CMAKE_CXX_HEADERS include/*.h include/**/*.h)
file(GLOB CMAKE_CXX_RESOURCES resource/*.qrc)

find_package(Qt5 COMPONENTS Widgets Core Gui Multimedia REQUIRED)

if(WIN32)
message(status "compiling for win32")
add_executable(TDGame WIN32
${CMAKE_CXX_HEADERS}
${CMAKE_CXX_SOURCES}
${CMAKE_CXX_RESOURCES}
)
else()
add_executable(TDGame
${CMAKE_CXX_HEADERS}
${CMAKE_CXX_SOURCES}
${CMAKE_CXX_RESOURCES}
)
endif()
target_link_libraries(TDGame Qt5::Widgets Qt5::Core Qt5::Gui Qt5::Multimedia)

Loading

0 comments on commit 5628676

Please sign in to comment.