Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • gamedev/fggl
  • onuralpsezer/fggl
2 results
Show changes
Commits on Source (180)
Showing
with 251 additions and 147 deletions
*,ogg filter=lfs diff=lfs merge=lfs -text
*.mtl filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
*.obj filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
......@@ -5,6 +5,9 @@ imgui.ini
.flatpak-builder/
compile_commands.json
# Engine data
demo/data/*.bin
# dotfiles (IDE)
.idea/
.cache/
......
......@@ -15,22 +15,28 @@
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/alpine:latest
stages: # List of stages for jobs, and their order of execution
stages:
- build
- test
- deploy
variables:
GIT_SUBMODULE_STRATEGY: recursive
.f34-ogl:
image: git.fossgalaxy.com:8042/gamedev/containers/fedora:36-opengl
before_script:
- dnf install -y pkgconfig\(dri\) pkgconfig\(glu\) pkgconfig\(x11\) pkgconfig\(xcursor\) pkgconfig\(xi\) pkgconfig\(xinerama\) pkgconfig\(xrandr\) doxygen
- dnf install -y glm-devel glfw-devel openal-soft-devel spdlog-devel freetype-devel yaml-cpp-devel assimp-devel bullet-devel
- dnf install -y pkgconfig\(dri\) pkgconfig\(glu\) pkgconfig\(x11\) pkgconfig\(xcursor\) pkgconfig\(xi\) pkgconfig\(xinerama\) pkgconfig\(xrandr\) pkgconfig\(lua\) doxygen
- dnf install -y glm-devel glfw-devel openal-soft-devel spdlog-devel freetype-devel yaml-cpp-devel assimp-devel gtest-devel gmock-devel
##
# Build Targets check it builds on popular Linux Distributions
##
build:fedora:
extends: .f34-ogl
stage: build
script:
- cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug
- cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DFGGL_EXT_BULLET=OFF
- cmake --build build
artifacts:
paths:
......@@ -41,11 +47,41 @@ build:ubuntu:
stage: build
before_script:
- apt update && apt install -y build-essential cmake
- apt install -y libglm-dev libglfw3-dev libopenal-dev libspdlog-dev libfreetype-dev libyaml-cpp-dev libassimp-dev libbullet-dev libbullet-extras-dev
- apt install -y libglm-dev libglfw3-dev libopenal-dev libspdlog-dev libfreetype-dev libyaml-cpp-dev libassimp-dev libbullet-extras-dev libgtest-dev libgmock-dev liblua5.2-dev
script:
- cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug
- cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DFGGL_EXT_BULLET=OFF -DFGGL_EXT_LUA=OFF
- cmake --build build
# Based on Bruce Cowan's wordsearch package:
flatpak:
image: alpine:latest
stage: deploy
when: manual
only:
- develop
variables:
MANIFEST_PATH: "build-aux/com.fossgalaxy.fggl.demo.yml"
RUNTIME_REPO: "https://flathub.org/repo/flathub.flatpakrepo"
FLATPAK_MODULE: "fggl"
BUNDLE: "fggl-demo.flatpak"
APP_ID: "com.fossgalaxy.fggl.demo"
script:
- apk update && apk add flatpak-builder
- flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
- flatpak install -y flathub org.freedesktop.Platform 21.08
- flatpak install -y flathub org.freedesktop.Sdk 21.08
- flatpak-builder _repo ${MANIFEST_PATH}
- flatpak build-bundle _repo ${BUNDLE} --runtime-repo=${RUNTIME_REPO} ${APP_ID}
artifacts:
paths:
- ${BUNDLE}
- _build/meson-logs/meson-log.txt
cache:
paths:
- .flatpak-builder/cache
- .flatpak-builder/downloads
# Deploy doxygen pages
pages:
extends: .f34-ogl
......
......@@ -4,92 +4,92 @@ set(namespace "fggl")
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED YES)
option(FGGL_CONAN "Should we use conan to find missing dependencies?" OFF)
option(FGGL_EXAMPLES "Should we build examples or just the library" ON)
option(FGGL_TESTS "Should we enable the testing suite?" ON)
option(FGGL_DOCS "Should we build documentation?" ON)
set(CONAN_BUILD_TYPE "Debug")
option(FGGL_EXT_BULLET "Should we build the bullet module?" OFF)
option(FGGL_EXT_LUA "Should we build the lua module?" ON)
##
# Windows
# When on windows, integrate vcpkg
##
if(DEFINED ENV{VCPKG_ROOT} AND NOT DEFINED CMAKE_TOOLCHAIN_FILE)
set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
CACHE STRING "")
endif()
##
# /windows
##
# Define the project
project(fggl
VERSION 0.1
DESCRIPTION ""
HOMEPAGE_URL ""
DESCRIPTION "FOSS Galaxy Game Library, for use in Education, and Games"
HOMEPAGE_URL "https://git.fossgalaxy.com/gamedev/fggl"
LANGUAGES C CXX)
include(GNUInstallDirs)
# export compile commands for vim/neovim users
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
# vendor dependencies
add_subdirectory( vendor/entt )
add_subdirectory( vendor/imgui )
add_subdirectory( vendor/glad )
# engine headers
file(GLOB_RECURSE public_headers
${PROJECT_SOURCE_DIR}/include/fggl/*.hpp
)
# slightly cleaner conan support
include(cmake/conan-wrangler.cmake)
# engine sources, enable strict compiler warnings
add_subdirectory( fggl )
target_compile_options( fggl PRIVATE -Wall -Wpedantic -Wextra -Wodr -fno-strict-aliasing -fno-strict-overflow )
set_property(TARGET fggl PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
# testing support
# Unit Tests
if (FGGL_TESTS)
include(CTest)
add_subdirectory(tests)
endif()
# Documentation support
if (FGGL_DOCS)
find_package(Doxygen)
if (Doxygen_FOUND)
add_subdirectory( docs )
else()
message(STATUS "Doxygen not found, not building docs")
endif()
# Documentation support
if (FGGL_DOCS)
find_package(Doxygen)
if (Doxygen_FOUND)
add_subdirectory( docs )
else()
message(STATUS "Doxygen not found, not building docs")
endif()
endif()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
##
# end windows support
# Optional/Extra modules
##
# vendor dependencies
add_subdirectory( vendor/imgui )
# engine
add_subdirectory( fggl )
add_subdirectory( vendor/header_only )
# 3rd party integrations
add_subdirectory( integrations/bullet )
## G++ enable insane checks
target_compile_options( ${PROJECT_NAME} PRIVATE -Wall -Wpedantic -Wextra -Wodr -fno-strict-aliasing -fno-strict-overflow )
set_property(TARGET fggl PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
if ( FGGL_EXT_BULLET )
add_subdirectory( integrations/bullet )
endif()
# extras
if (FGGL_TESTS)
add_subdirectory(tests)
if ( FGGL_EXT_LUA )
add_subdirectory( integrations/lua )
endif()
# Tools
# add_subdirectory( tools/pack )
# Demo project
if (FGGL_EXAMPLES)
add_subdirectory(demo)
target_compile_options( demo PRIVATE -Wall -Wextra -Wodr -Wdouble-promotion -fno-strict-aliasing -fno-strict-overflow )
set_property(TARGET demo PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
add_subdirectory(demo EXCLUDE_FROM_ALL)
endif()
##
# INSTALL PHASE
# see https://decovar.dev/blog/2021/03/08/cmake-cpp-library/
##
file(GLOB_RECURSE public_headers
${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/*.hpp
${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/*.h
)
#include(CMakePrintHelpers)
include(GNUInstallDirs)
# Structure preserving header macro
foreach(header ${public_headers})
......@@ -103,15 +103,16 @@ endforeach()
set_target_properties(${PROJECT_NAME} PROPERTIES DEBUG_POSTFIX "d")
include(CMakePackageConfigHelpers)
set(FGGL_CONFIG_PATH "${CMAKE_INSTALL_LIBDIR}/cmake/fggl")
# generate and install export file
install(EXPORT "${PROJECT_NAME}Targets"
FILE "${PROJECT_NAME}Targets.cmake"
NAMESPACE ${namespace}::
DESTINATION cmake
DESTINATION "${FGGL_CONFIG_PATH}"
)
include(CMakePackageConfigHelpers)
# generate the version file for the config file
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
......@@ -120,22 +121,24 @@ write_basic_package_version_file(
)
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION cmake
INSTALL_DESTINATION "${FGGL_CONFIG_PATH}"
)
# install config files
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION cmake
DESTINATION "${FGGL_CONFIG_PATH}"
)
# generate the export targets for the build tree
install(TARGETS ${PROJECT_NAME}
EXPORT fgglTargets
DESTINATION "${CMAKE_INSTALL_LIBDIR}"
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
export(EXPORT "${PROJECT_NAME}Targets"
FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake"
NAMESPACE ${namespace}::
)
install(TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}Targets
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
......@@ -3,6 +3,7 @@
include(CMakeFindDependencyMacro)
find_dependency(glm)
find_dependency(fmt)
find_dependency(Lua)
find_dependency(spdlog)
find_dependency(Freetype)
find_dependency(OpenAL CONFIG)
......
......@@ -12,6 +12,10 @@ On Ubuntu:
sudo apt install build-essential cmake
sudo apt install -y libglm-dev libglfw3-dev libopenal-dev libspdlog-dev libfreetype-dev libyaml-cpp-dev libassimp-dev libbullet-dev
```
On Fedora:
```bash
sudo dnf install -y glm-devel glfw-devel openal-soft-devel spdlog-devel freetype-devel yaml-cpp-devel assimp-devel bullet-devel gcc gcc-c++ cmake gtest-devel doxygen lua lua-devel gmock gmock-devel
```
### Building
It's designed to be a fairly standard cmake project, so the standard cmake steps should work:
......
......@@ -9,23 +9,11 @@ finish-args:
- "--socket=fallback-x11"
- "--socket=wayland"
modules:
- name: glfw
buildsystem: cmake-ninja
builddir: true
sources:
- type: archive
url: https://github.com/glfw/glfw/releases/download/3.3.4/glfw-3.3.4.zip
sha256: bbd2c42c660b725e9755eb417e40b373f0d4c03138c9b2e210d02cd308bd99cd
cleanup:
- /include
- /lib/cmake
- /lib/pkgconfig
- '*.a'
- modules/glfw.yml
- modules/glm-0.9.9.8.json
- modules/fmt.yml
- modules/spdlog.json
# - shared-modules/glew/glew.json
# - modules/googletest.yml
- modules/googletest.yml
- shared-modules/glu/glu-9.json
- modules/yaml-cpp.yml
- modules/assimp.yml
......
Name: fggl
Version: 0.1.0
Release: 1%{?dist}
Summary: FOSS Galaxy game library
License: LGPLv3
# The source was pulled from github
source0: https://git.fossgalaxy.com/gamedev/fggl/-/archive/develop/fggl-develop.zip
BuildRequires: g++
BuildRequires: cmake
BuildRequires: glfw-devel
BuildRequires: openal-devel
BuildRequires: glm-devel
BuildRequires: glfw-devel
BuildRequires: openal-soft-devel
BuildRequires: spdlog-devel
BuildRequires: freetype-devel
BuildRequires: yaml-cpp-devel
BuildRequires: assimp-devel
BuildRequires: bullet-devel
BuildRequires: gtest-devel
BuildRequires: gmock-devel
# demo desktop stuff
BuildRequires: libappstream-glib
BuildRequires: desktop-file-utils
%description
%{summary}.
%prep
%setup -q -n %{name}-develop
%build
%cmake
%cmake_build
%install
%cmake_install
%check
%ctest
appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/*.metainfo.xml
desktop-file-validate %{buildroot}/%{_datadir}/applications/com.fossgalaxy.fggl.Demo.desktop
%package demos
Summary: Demos for fggl
Group: System Environment/Libraries
Requires: %{name} = %{version}-%{release}
%description demos
FGGL example binaries
%package devel
Summary: FGGL development libraries and header files
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
%description devel
fggl dynamic libraries and header files.
%files
%{_libdir}/libfggl.so
%files devel
%{_includedir}/fggl/*
%{_libdir}/cmake/%{name}
# this feels like a packaging bug...
%{_libdir}/libimgui.a
%files demos
%{_bindir}/demo
%{_datadir}/fggl-demo/*
%{_datadir}/applications/com.fossgalaxy.fggl.Demo.desktop
%{_metainfodir}/com.fossgalaxy.fggl.Demo.metainfo.xml
name: glfw
buildsystem: cmake-ninja
builddir: true
sources:
- type: archive
url: https://github.com/glfw/glfw/releases/download/3.3.4/glfw-3.3.4.zip
sha256: bbd2c42c660b725e9755eb417e40b373f0d4c03138c9b2e210d02cd308bd99cd
cleanup:
- /include
- /lib/cmake
- /lib/pkgconfig
- '*.a'
##
# Conan Wranger
# Integrate Conan when needed, don't bother when it's not
##
if ( FGGL_CONAN )
if ( CONAN_EXPORTED )
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
else()
list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR})
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR})
# download conan if not available
if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan")
file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/master/conan.cmake"
"${CMAKE_BINARY_DIR}/conan.cmake")
endif()
# download and enable dependencies
include(${CMAKE_BINARY_DIR}/conan.cmake)
conan_cmake_configure(
REQUIRES
opengl/system
openal/1.21.1
assimp/5.2.2
glfw/3.3.7
glad/0.1.35
glm/0.9.9.8
spdlog/1.10.0
freetype/2.11.1
bullet3/3.22a
yaml-cpp/0.7.0
GENERATORS
cmake_find_package
cmake_find_package_multi
OPTIONS
glfw:shared=True
glad:gl_profile=core
glad:gl_version=4.5
glad:extensions="GL_ARB_get_program_binary,GL_ARB_shading_language_include"
BASIC_SETUP
)
if ( CMAKE_CONFIGURATION_TYPES )
foreach(TYPE ${CMAKE_CONFIGURATION_TYPES})
conan_cmake_autodetect( settings BUILD_TYPE ${TYPE} )
conan_cmake_install(
PATH_OR_REFERENCE .
BUILD missing
SETTINGS ${settings}
)
endforeach()
else()
conan_cmake_autodetect( settings BUILD_TYPE ${TYPE} )
conan_cmake_install(
PATH_OR_REFERENCE .
BUILD missing
SETTINGS ${settings}
)
endif()
endif()
endif()
\ No newline at end of file
......@@ -7,24 +7,40 @@ add_executable(demo
demo/GameScene.cpp
demo/rollball.cpp
demo/topdown.cpp
)
demo/grid.cpp
demo/robot/programmer.cpp
demo/models/viewer.cpp
demo/hexboard/board.cpp
demo/hexboard/camera.cpp
)
# set build flags
target_compile_options( demo PRIVATE -Wall -Wextra -Wodr -Wdouble-promotion -fno-strict-aliasing -fno-strict-overflow )
set_property(TARGET demo PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
target_include_directories(demo
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/include
)
target_link_libraries(demo fggl)
target_link_libraries( demo fggl )
#target_link_libraries(demo fggl fgglbt)
if ( FGGL_EXT_LUA )
target_link_libraries( demo fggl-lua )
endif()
find_package(spdlog)
target_link_libraries(demo spdlog::spdlog)
#target_include_directories(FgglDemo PUBLIC ${PROJECT_BINARY_DIR})
# rssources
#find_package(Lua)
#target_link_libraries(demo ${LUA_LIBRARIES})
# resources
file(GLOB_RECURSE data data/*)
file(COPY ${data} DESTINATION data )
include(GNUInstallDirs)
install(
TARGETS demo
RUNTIME
......
packs/
demo/data/backpack/ao.jpg

132 B

source diff could not be displayed: it is stored in LFS. Options to address this: view the blob.
source diff could not be displayed: it is stored in LFS. Options to address this: view the blob.
demo/data/backpack/diffuse.jpg

132 B

image diff could not be displayed: it is too large. Options to address this: view the blob.
demo/data/backpack/roughness.jpg

132 B

Model by Berk Gedik, from: https://sketchfab.com/3d-models/survival-guitar-backpack-low-poly-799f8c4511f84fab8c3f12887f7e6b36
Modified material assignment (Joey de Vries) for easier load in OpenGL model loading chapter, and renamed albedo to diffuse and metallic to specular to match non-PBR lighting setup.
\ No newline at end of file
demo/data/backpack/specular.jpg

132 B