Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

CPP project using engine as a library

Alan edited this page Aug 3, 2017 · 2 revisions

You may like to not use Atomic Editor and use engine as a c++ library for your project. First you will need to get engine code into your project source tree. One way to do it is add a git submodule:

git submodule add https://github.com/AtomicGameEngine/AtomicGameEngine.git

Then use this minimal cmake script example to consume engine as a library:

# Legacy CMake version is still supported.
cmake_minimum_required(VERSION 2.8.12.1)
project(YourProjectName)

# Disable various Atomic features. 'CACHE BOOL "" FORCE' is required for options declared with cmake `option()` call.
set(ATOMIC_CPLUSPLUS_EXAMPLES 0 CACHE BOOL "" FORCE)
set(ATOMIC_WEBVIEW 0 CACHE BOOL "" FORCE)
set(ATOMIC_JAVASCRIPT 0 CACHE BOOL "" FORCE)
set(ATOMIC_DOTNET 0 CACHE BOOL "" FORCE)
set(ATOMIC_EDITOR 0 CACHE BOOL "" FORCE)
# Add game engine to the project build.
add_subdirectory(AtomicGameEngine)

# Define our own project
set(SOURCE_FILES main.cpp)
add_executable(MyGame ${SOURCE_FILES})
# Link engine to our project. It pulls in engine defines and include directories automatically.
target_link_libraries (MyGame Atomic)

Note that disabling editor, javascript or .NET bindings are not required. You leave them enabled and use these features.

You may experience issues with Editor in such builds as this is not a supported configuration. Please use Build_AtomicEditor.sh or Build_AtomicEditor.bat for supported editor builds.

Links

https://github.com/rokups/AtomicAsLibraryExample - Example on how to use Atomic as a Library https://github.com/rokups/ShaderSketch - Minimal application that uses Atomic as a Library

Clone this wiki locally