Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
Chukobyte committed Nov 10, 2023
0 parents commit 2812cfc
Show file tree
Hide file tree
Showing 244 changed files with 200,586 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/macosx-clang-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: macosx-clang-build

on:
push:
branches: [ main ]

env:
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8

jobs:
build:
runs-on: macOS-latest

steps:
- uses: actions/checkout@v1

- name: install dependencies
run: |
brew install pkg-config
- name: get cmake
uses: lukka/get-cmake@latest
with:
useLocalCache: true
useCloudCache: false
cmakeVersion: "3.25.0"

- name: run-vcpkg
uses: lukka/[email protected]
with:
vcpkgDirectory: '${{ github.workspace }}/vcpkg'
vcpkgGitCommitId: 'b619a233fbf7b2c9765fb4458f3ecb05bd3166e3'

- name: run build
uses: lukka/[email protected]
with:
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
configurePreset: 'ninja-multi-vcpkg'
configurePresetAdditionalArgs: "['-DIS_CI_BUILD=true']"
buildPreset: 'ninja-multi-vcpkg'

- name: run unit tests
run: |
echo "Running seika tests!"
${{ github.workspace }}/builds/Debug/seika_test
43 changes: 43 additions & 0 deletions .github/workflows/ubuntu-gcc-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: ubuntu-gcc-build

on:
push:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1

- name: install updates
run: |
sudo apt install gcc-11
sudo apt install g++-11
- name: get cmake
uses: lukka/get-cmake@latest
with:
useLocalCache: true
useCloudCache: false
cmakeVersion: "3.25.0"

- name: run-vcpkg
uses: lukka/[email protected]
with:
vcpkgDirectory: '${{ github.workspace }}/vcpkg'
vcpkgGitCommitId: 'b619a233fbf7b2c9765fb4458f3ecb05bd3166e3'

- name: run build
uses: lukka/[email protected]
with:
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
configurePreset: 'ninja-multi-vcpkg'
configurePresetAdditionalArgs: "['-DIS_CI_BUILD=true']"
buildPreset: 'ninja-multi-vcpkg'

- name: run unit tests
run: |
echo "Running seika tests!"
${{ github.workspace }}/builds/Debug/seika_test
25 changes: 25 additions & 0 deletions .github/workflows/windows-mingw-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: windows-mingw-build

on:
push:
branches: [ main ]

jobs:
build:
runs-on: windows-latest

steps:
- uses: actions/checkout@v1
- uses: msys2/setup-msys2@v2
with:
install: gcc make

- name: run build
shell: msys2 {0}
run: |
(echo ""; echo "y") | pacman -S mingw-w64-x86_64-toolchain
echo "y" | pacman -S mingw-w64-x86_64-cmake
echo "y" | pacman -S mingw-w64-x86_64-SDL2
echo "y" | pacman -S mingw-w64-x86_64-freetype
cmake -G "MinGW Makefiles" . -DIS_CI_BUILD="true"
cmake --build .
38 changes: 38 additions & 0 deletions .github/workflows/windows-msvc-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: windows-msvc-build

on:
push:
branches: [ main ]

jobs:
build:
runs-on: windows-latest

steps:
- uses: actions/checkout@v1

- name: get cmake
uses: lukka/get-cmake@latest
with:
useLocalCache: true
useCloudCache: false
cmakeVersion: "3.25.0"

- name: run-vcpkg
uses: lukka/[email protected]
with:
vcpkgDirectory: '${{ github.workspace }}/vcpkg'
vcpkgGitCommitId: 'b619a233fbf7b2c9765fb4458f3ecb05bd3166e3'

- name: run build
uses: lukka/[email protected]
with:
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
configurePreset: 'ninja-multi-vcpkg'
configurePresetAdditionalArgs: "['-DIS_CI_BUILD=true']"
buildPreset: 'ninja-multi-vcpkg'

- name: run unit tests
run: |
echo "Running seika tests!"
${{ github.workspace }}\builds\Debug\seika_test.exe
31 changes: 31 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
*.o
*.exe
*.dll
*.zip

__pycache__
.idea
temp
venv
site
engine/build

valgrind.xml

# Project
bin
export

# CMake
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps

cmake-build-*
129 changes: 129 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
cmake_minimum_required(VERSION 3.25.0)

set(CMAKE_C_STANDARD 11)

project(seika C)

if (CMAKE_C_COMPILER_ID STREQUAL "MSVC")
# list(APPEND flags "/std:c11" "/W3" "/Zc:preprocessor") # TODO: Adding "/std:c11" breaks editor, fix later...
list(APPEND flags "/W3" "/Zc:preprocessor")
elseif (APPLE)
list(APPEND flags "-Wfatal-errors" "-Wall" "-Wextra" "-Wno-write-strings" "-Wno-deprecated-declarations"
"-Wno-unused-variable" "-Wno-bad-function-cast" "-Wno-unused-parameter" "-Wno-missing-field-initializers")
else ()
list(APPEND flags "-std=c11" "-Wfatal-errors" "-Wall" "-Wextra" "-Wno-write-strings" "-Wno-deprecated-declarations"
"-Wno-unused-variable" "-Wno-cast-function-type" "-Wno-unused-parameter" "-Wno-missing-field-initializers")
endif ()

find_package(SDL2 CONFIG REQUIRED)

find_package(freetype CONFIG)
set(freetype_from_find_package TRUE)
if (NOT freetype_FOUND)
find_package(PkgConfig REQUIRED)
pkg_check_modules(freetype REQUIRED freetype2)
set(freetype_from_find_package FALSE)
endif()

add_library(${PROJECT_NAME} STATIC
seika/seika.c
seika/asset/asset_manager.c
seika/asset/asset_file_loader.c
seika/memory/se_mem.c
seika/math/se_curve_float.c
seika/math/se_math.c
seika/input/input.c
seika/input/input_action.c
seika/input/mouse.c
seika/networking/se_network.c
seika/networking/se_network_socket.c
seika/rendering/font.c
seika/rendering/frame_buffer.c
seika/rendering/renderer.c
seika/rendering/render_context.c
seika/rendering/shader/shader.c
seika/rendering/shader/shader_cache.c
seika/rendering/shader/shader_file_parser.c
seika/rendering/shader/shader_instance.c
seika/rendering/texture.c
seika/audio/audio_manager.c
seika/audio/audio.c
seika/thread/se_pthread.c
seika/thread/se_thread_pool.c
seika/utils/logger.c
seika/utils/se_file_system_utils.c
seika/utils/se_platform.c
seika/utils/se_string_util.c
seika/utils/observer.c
seika/data_structures/se_array_utils.c
seika/data_structures/se_array_list.c
seika/data_structures/se_queue.c
seika/data_structures/se_hash_map.c
seika/data_structures/se_hash_map_string.c
seika/data_structures/se_spatial_hash_map.c
seika/data_structures/se_tile_map.c
)

add_library(glad include/glad/glad.c)
add_library(stb_image include/stb_image/stb_image.c)
add_library(kuba_zip include/kuba_zip/zip.c)
add_library(unity include/unity.c)

target_include_directories(${PROJECT_NAME} PUBLIC
"${PROJECT_BINARY_DIR}"
"include"
)
target_include_directories(glad PUBLIC
"${PROJECT_BINARY_DIR}"
"include"
)
target_include_directories(stb_image PUBLIC
"${PROJECT_BINARY_DIR}"
"include"
)

target_include_directories(unity PUBLIC
"${PROJECT_BINARY_DIR}"
"include"
)

if (NOT freetype_from_find_package)
target_include_directories(${PROJECT_NAME} PUBLIC ${freetype_INCLUDE_DIRS})
endif()

if (CMAKE_C_COMPILER_ID STREQUAL "MSVC")
target_link_libraries(${PROJECT_NAME} PUBLIC glad stb_image kuba_zip SDL2::SDL2main SDL2::SDL2 freetype Ws2_32)
elseif (WIN32)
target_link_libraries(${PROJECT_NAME} PUBLIC glad stb_image kuba_zip -lmingw32 -static-libgcc SDL2::SDL2main SDL2::SDL2 freetype -lws2_32)
elseif (APPLE)
target_link_libraries(${PROJECT_NAME} PUBLIC glad stb_image kuba_zip -Xlinker SDL2::SDL2main SDL2::SDL2 freetype m)
else ()
target_link_libraries(${PROJECT_NAME} PUBLIC glad stb_image kuba_zip -static-libgcc -Xlinker -export-dynamic SDL2::SDL2main SDL2::SDL2 freetype m)
endif ()

target_compile_options(${PROJECT_NAME} PUBLIC ${flags})

# Copy directories over that are needed to test
if (NOT DEFINED IS_CI_BUILD)
set(IS_CI_BUILD "false")
endif()
if (IS_CI_BUILD STREQUAL "false")
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${PROJECT_SOURCE_DIR}/test
$<TARGET_FILE_DIR:${PROJECT_NAME}>/test
)
endif()

if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
set(SK_IS_MAIN TRUE)
else()
set(SK_IS_MAIN FALSE)
endif()

if (SK_IS_MAIN)
# Create seika test exe
add_executable(${PROJECT_NAME}_test test/main.c)
target_link_libraries(${PROJECT_NAME}_test ${PROJECT_NAME} unity)
target_include_directories(${PROJECT_NAME}_test PUBLIC ${PROJECT_SOURCE_DIR})
endif()
41 changes: 41 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"version": 6,
"cmakeMinimumRequired": {
"major": 3,
"minor": 25,
"patch": 0
},
"configurePresets": [
{
"name": "ninja-multi-vcpkg",
"displayName": "Ninja Multi-Config",
"description": "Configure with vcpkg toolchain and generate Ninja project files for all configurations",
"binaryDir": "${sourceDir}/builds",
"generator": "Ninja Multi-Config",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": {
"type": "FILEPATH",
"value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
}
},
"environment": {
"VCPKG_ROOT": "./vcpkg"
}
}
],
"buildPresets": [
{
"name": "ninja-multi-vcpkg",
"configurePreset": "ninja-multi-vcpkg",
"displayName": "Build ninja-multi-vcpkg",
"description": "Build with Ninja the configuration specified with --config"
}
],
"testPresets": [
{
"name": "ninja-multi-vcpkg",
"configurePreset": "ninja-multi-vcpkg",
"description": "Test with Ninja the provided configuration with --config"
}
]
}
21 changes: 21 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Michael Smith

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Seika Framework

A framework that can be used to make 2D games.
Loading

0 comments on commit 2812cfc

Please sign in to comment.