Skip to content

Conversation

@killerdevildog
Copy link

  • Add pkg-config detection for Bullet Physics (libbullet-dev)
  • Add pkg-config detection for Lua 5.3 (liblua5.3-dev)
  • Generate lua/lua.hpp compatibility header for deprecated API calls
  • Add missing system libraries: GLEW, OpenAL, Vorbis to linking
  • Resolve CMake resource management conflicts between samples
  • Remove duplicate logo file references causing build failures

This fixes build issues on Linux where the system looks for local lua instead of system-level lua installation, and ensures proper integration with system-installed Bullet Physics and Lua libraries.

- Add pkg-config detection for Bullet Physics (libbullet-dev)
- Add pkg-config detection for Lua 5.3 (liblua5.3-dev)
- Generate lua/lua.hpp compatibility header for deprecated API calls
- Add missing system libraries: GLEW, OpenAL, Vorbis to linking
- Resolve CMake resource management conflicts between samples
- Remove duplicate logo file references causing build failures

This fixes build issues on Linux where the system looks for local lua
instead of system-level lua installation, and ensures proper integration
with system-installed Bullet Physics and Lua libraries.
- Implemented three-mode dependency system: AUTO (source→system fallback), SOURCE (force source build), SYSTEM (system libraries only)
- Added cmake/BuildDependenciesFromSource.cmake for Git-based dependency building
- Modified main CMakeLists.txt to support configurable DEPENDENCY_MODE
- Updated gameplay/CMakeLists.txt and samples/CMakeLists.txt for new system
- Removed /cmake from .gitignore to track CMake modules
- Fixed C++11 compatibility and disabled FluidSynth for OpenAL
- Tested with all samples: browser, character, racer, spaceship
@killerdevildog
Copy link
Author

@reven86 @rcmaniac25 @Benjamin-Dobell @timleader

When you have a moment, I'd appreciate your review on this PR.

I've implemented a feature that automatically builds dependencies from https://github.com/gameplay3d/gameplay-deps.git during the build process, with a fallback to system-installed dependencies if needed. This should streamline the setup and make the project more accessible for contributors.

I was inspired to tackle this as part of my interest in open-source contributions, aiming to improve the build experience on my own system—and hopefully others' as well. Looking forward to your feedback!

@killerdevildog
Copy link
Author

GamePlay Engine - Dependency Management System

Overview

This CMake system provides flexible dependency management for the GamePlay engine with three modes:

  1. SOURCE - Build dependencies from source (downloads gameplay-deps Git repository)
  2. SYSTEM - Use system-installed libraries
  3. AUTO - Automatic fallback: SOURCE → SYSTEM (default)

Usage

Quick Start (Default - AUTO mode)

mkdir build && cd build
cmake ..
cmake --build . --parallel 4

Specific Modes

# Build from source only
cmake -DDEPENDENCY_MODE=SOURCE ..

# Use system libraries only
cmake -DDEPENDENCY_MODE=SYSTEM ..

# Automatic mode (default)
cmake -DDEPENDENCY_MODE=AUTO ..

Dependency Management Modes

AUTO Mode (Recommended)

  • Default behavior - no flags needed
  • Automatically tries to build from source first
  • Falls back to system libraries if source build fails
  • Best for most users and CI systems

SOURCE Mode

  • Forces building all dependencies from source
  • Downloads gameplay-deps repository via Git
  • Builds libjson, tinyxml2, lua, openal, glew, zlib, png, ogg, vorbis, bullet physics
  • Uses C++11 standard and disables FluidSynth for compatibility
  • Best for: Development, ensuring consistent dependency versions

SYSTEM Mode

  • Uses system-installed libraries only
  • Requires system packages: gtk+-2.0, bullet, lua5.3, etc.
  • Best for: Linux distributions, package managers, minimal builds

Dependencies Built from Source

When using SOURCE or AUTO mode, the following libraries are built:

  • libjson 7.6.1 - JSON parsing
  • tinyxml2 2.1.0 - XML parsing
  • lua 5.2.3 - Scripting engine
  • OpenAL 1.16.0 - Audio (FluidSynth disabled for compatibility)
  • GLEW 1.10.0 - OpenGL extensions
  • zlib 1.2.8 - Compression
  • libpng 1.6.15 - PNG image support
  • ogg/vorbis 1.3.x - Audio codecs
  • Bullet Physics 2.82 - Physics engine
  • base64 1.0.0 - Base64 encoding

System Requirements

For SOURCE mode:

  • CMake 3.11+
  • Git
  • C++ compiler with C++11 support
  • OpenGL development libraries
  • GTK+ 2.0 development libraries

For SYSTEM mode:

  • Same as above plus system packages:
    • libgtk2.0-dev
    • libbullet-dev
    • liblua5.3-dev
    • libopenal-dev
    • libglew-dev
    • libpng-dev
    • libogg-dev
    • libvorbis-dev
    • zlib1g-dev

Build Output

Successful build produces:

  • libgameplay.a - Main GamePlay engine library
  • sample-browser - Interactive samples browser
  • sample-character - Character animation demo
  • sample-racer - Racing game demo
  • sample-spaceship - Spaceship game demo

Troubleshooting

Source Build Issues

  • Check internet connection (needs to download gameplay-deps)
  • Ensure C++11 compatible compiler
  • Check CMake version (3.11+ required)

System Library Issues

  • Install missing development packages
  • Check pkg-config can find libraries: pkg-config --list-all

FluidSynth Errors

  • Automatically disabled in this build system
  • If still encountering issues, ensure ALSOFT_MIDI_FLUIDSYNTH=OFF

Implementation Details

The system uses modular CMake files:

  • cmake/BuildDependenciesFromSource.cmake - Source building logic
  • Main CMakeLists.txt - Mode selection and orchestration

External dependencies are built in external-deps/ directory and libraries are output to external-deps/out/external-deps/lib/linux/x86_64/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant