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
Showing
with 777 additions and 21 deletions
......@@ -26,23 +26,23 @@
namespace fggl::scenes {
using callback = std::function<void(void)>;
using Callback = std::function<void(void)>;
class BasicMenu : public AppState {
public:
explicit BasicMenu(App &owner);
void update() override;
void update(float dt) override;
void render(gfx::Graphics &paint) override;
void activate() override;
void deactivate() override;
void add(const std::string &label, callback cb);
void add(const std::string &label, const Callback& /*cb*/);
private:
input::Input *m_inputs;
std::map<const std::string, callback> m_items;
std::map<const std::string, Callback> m_items;
// menu state
std::string m_active;
......
/*
* This file is part of FGGL.
*
* FGGL is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* FGGL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with FGGL.
* If not, see <https://www.gnu.org/licenses/>.
*/
//
// Created by webpigeon on 15/10/22.
//
#ifndef FGGL_SCRIPT_ENGINE_H
#define FGGL_SCRIPT_ENGINE_H
#include "fggl/modules/module.hpp"
namespace fggl::script {
class ScriptEngine {
public:
virtual ~ScriptEngine() = default;
// TODO use protected virtual pattern
// scene callbacks
virtual void onActivate() = 0;
virtual void onDeactivate() = 0;
virtual void onUpdate() = 0;
// trigger callback
virtual void onEvent(const std::string& name) = 0;
// run code in engine
virtual bool run(const char* script) = 0;
virtual bool load(const char* filename) = 0;
virtual void setGlobal(const char* name, void* ptr) = 0;
};
class ScriptProvider {
public:
constexpr static const modules::ServiceName service = modules::make_service("fggl::script::service");
virtual ScriptEngine* create() = 0;
};
}
#endif //FGGL_SCRIPT_ENGINE_H
......@@ -24,6 +24,7 @@
#include <cassert>
#include "fggl/util/safety.hpp"
#include "fggl/debug/logging.hpp"
namespace fggl::util {
......@@ -66,26 +67,68 @@ namespace fggl::util {
return hash;
}
template<unsigned N>
struct FString {
char c[N];
};
// https://stackoverflow.com/a/65440575
template<unsigned ...Len>
constexpr auto cat(const char (&...strings)[Len]) {
constexpr unsigned N = (... + Len) - sizeof...(Len);
FString<N + 1> result = {};
result.c[N] = '\0';
char* dst = result.c;
for (const char* src : {strings...}) {
for (; *src != '\0'; src++, dst++) {
*dst = *src;
}
}
return result;
}
// debug-only functions
#ifndef NDEBUG
GUID internString(const char *str);
std::string guidToString(GUID guid);
GUID intern_string(const char *str);
std::string guid_to_string(GUID guid);
#endif
constexpr GUID make_guid(const char *str) {
return GUID::make(hash_fnv1a_64(str));
return GUID(hash_fnv1a_64(str));
}
inline GUID make_guid_rt(const std::string &str) {
inline GUID make_guid_rt(const char* str) {
#ifndef NDEBUG
return internString(str.c_str());
return intern_string(str);
#else
return make_guid(str.c_str());
return make_guid(str);
#endif
}
inline GUID make_guid_rt(const std::string &str) {
return make_guid_rt(str.c_str());
}
} // namespace fggl::util
// formatter
template<> struct fmt::formatter<fggl::util::GUID> {
constexpr auto parse(format_parse_context& ctx) -> decltype(ctx.begin()) {
return ctx.begin();
}
template <typename FormatContext>
auto format(const fggl::util::GUID& guid, FormatContext& ctx) const -> decltype(ctx.out()) {
#ifndef NDEBUG
return fmt::format_to(ctx.out(), "GUID[{}]", guid_to_string(guid));
#else
return fmt::format_to(ctx.out(), "GUID[{}]", guid.get());
#endif
}
};
fggl::util::GUID operator "" _fid(const char *str);
fggl::util::GUID operator "" _fid(const char *str, std::size_t);
......
......@@ -47,8 +47,6 @@ namespace fggl::util {
return m_value;
}
constexpr explicit operator std::string_view() const { return m_value; }
/**
* Check for equality of two handles.
*
......
......@@ -63,7 +63,7 @@ namespace fggl::util {
}
StateType &active() const {
assertm(m_states.find(m_active) != m_states.end(), "active state does not exist!");
ASSERT_MSG(m_states.find(m_active) != m_states.end(), "active state does not exist!");
return *(m_states.at(m_active).get());
}
......
# Integration Modules
This adds support for 3rd party libraries to the engine. These can be included in projects
to expose modules which can then be used in your applications.
## Integrations Provided
The following integration modules are povided in this folder. For more information please see the readme for that module.
| Integration | Module Name | Description |
|-------------|-----------------------|----------------------------------------------------|
| Bullet | `fggl::phys::Bullet3` | Provides Bullet3 integration into the game engine. |
| Lua | `fggl::script::Lua` | Provides LUA scripting support for the engine |
Modules that cannot be included for legal reasons will be packaged independently of this repository.
\ No newline at end of file
target_include_directories( fggl
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>
$<INSTALL_INTERFACE:include>
)
add_library(fggl-lua)
find_package(Lua REQUIRED)
target_link_libraries(fggl-lua PUBLIC ${LUA_LIBRARIES})
target_include_directories(fggl-lua INTERFACE ${LUA_INCLUDE_DIR})
# Link to FGGL
target_link_libraries(fggl-lua PUBLIC fggl)
# sources and include directories
target_sources(fggl-lua
PRIVATE
src/engine.cpp
src/module.cpp
)
target_include_directories(fggl-lua
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>
$<INSTALL_INTERFACE:include>
)
/*
* This file is part of FGGL.
*
* FGGL is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* FGGL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with FGGL.
* If not, see <https://www.gnu.org/licenses/>.
*/
//
// Created by webpigeon on 15/10/22.
//
#ifndef FGGL_INTEGRATIONS_LUA_SCRIPT_LUA_ENGINE_HPP
#define FGGL_INTEGRATIONS_LUA_SCRIPT_LUA_ENGINE_HPP
#include "fggl/script/engine.hpp"
#include "fggl/data/storage.hpp"
extern "C" {
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
};
namespace fggl::script::lua {
class LuaScriptEngine : public ScriptEngine {
public:
LuaScriptEngine(data::Storage* storage);
virtual ~LuaScriptEngine();
void onActivate() override;
void onDeactivate() override;
void onUpdate() override;
void onEvent(const std::string& name) override;
// running scripts
bool run(const char* script) override;
bool load(const char* filename) override;
// variables
void setGlobal(const char* name, void* ptr) override;
private:
data::Storage* m_storage;
lua_State* m_state;
void release();
};
class LuaScriptProvider : public ScriptProvider {
public:
LuaScriptProvider(data::Storage* storage);
virtual ~LuaScriptProvider() = default;
LuaScriptEngine* create() override;
private:
data::Storage* m_storage;
};
}
#endif //FGGL_INTEGRATIONS_LUA_SCRIPT_LUA_ENGINE_HPP
/*
* This file is part of FGGL.
*
* FGGL is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* FGGL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with FGGL.
* If not, see <https://www.gnu.org/licenses/>.
*/
//
// Created by webpigeon on 15/10/22.
//
#ifndef FGGL_INTEGRATIONS_LUA_SCRIPT_LUA_MODULE_HPP
#define FGGL_INTEGRATIONS_LUA_SCRIPT_LUA_MODULE_HPP
#define FGGL_HAS_LUA
#include "fggl/modules/module.hpp"
#include "fggl/entity/module.hpp"
#include "fggl/script/engine.hpp"
#include "fggl/data/module.hpp"
#include "fggl/assets/packed/adapter.hpp"
namespace fggl::script::lua {
constexpr auto MIME_LUA = assets::from_mime("text/lua");
constexpr auto SCRIPT_LUA = assets::make_asset_type("script/lua");
struct Lua {
constexpr static const char* name = "fggl::script::lua";
constexpr static const std::array<modules::ServiceName, 1> provides = {
script::ScriptProvider::service
};
constexpr static const std::array<modules::ServiceName, 2> depends = {
data::SERVICE_STORAGE,
assets::CheckinAdapted::service
};
static bool factory(modules::ServiceName name, modules::Services& serviceManager);
};
} // namespace fggl::script::lua
namespace fggl::script {
using Lua = lua::Lua;
} // namespace fggl::script
#endif //FGGL_INTEGRATIONS_LUA_SCRIPT_LUA_MODULE_HPP
/*
* This file is part of FGGL.
*
* FGGL is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* FGGL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with FGGL.
* If not, see <https://www.gnu.org/licenses/>.
*/
//
// Created by webpigeon on 15/10/22.
//
#include "fggl/script/lua/engine.hpp"
#include "fggl/debug/logging.hpp"
#include "fggl/scenes/game.hpp"
#include "fggl/entity/loader/loader.hpp"
#include <cassert>
extern "C" {
int lua_switch_scene(lua_State *L) {
auto *scene = lua_tostring(L, -1);
auto *statePtr = (fggl::AppState *) (lua_topointer(L, -2));
statePtr->owner().change_state(scene);
return 0;
}
int lua_create_entity(lua_State *L) {
/*auto *prototype = lua_tostring(L, -1);
auto *statePtr = (fggl::scenes::Game*) (lua_topointer(L, -2));
auto *factory = statePtr->owner().service<fggl::entity::EntityFactory>();
//factory->create( statePtr->world(), , [](){} );
*/
return 0;
}
static void open_lua_fggl(lua_State *L) {
// switch scene
lua_pushcfunction(L, lua_switch_scene);
lua_setglobal(L, "switch_scene");
}
}
namespace fggl::script::lua {
LuaScriptProvider::LuaScriptProvider(data::Storage *storage) : m_storage(storage) {
}
LuaScriptEngine *LuaScriptProvider::create() {
return new LuaScriptEngine(m_storage);
}
LuaScriptEngine::LuaScriptEngine(data::Storage* storage) : m_state(luaL_newstate()), m_storage(storage) {
luaL_openlibs(m_state);
open_lua_fggl(m_state);
}
LuaScriptEngine::~LuaScriptEngine() {
release();
}
void LuaScriptEngine::release() {
if ( m_state != nullptr ) {
lua_close(m_state);
m_state = nullptr;
}
}
void LuaScriptEngine::onActivate() {
lua_getglobal(m_state, "print");
lua_pushstring(m_state, "LUA activate triggered");
lua_call(m_state, 1, 0);
}
void LuaScriptEngine::onDeactivate() {
lua_getglobal(m_state, "print");
lua_pushstring(m_state, "LUA deactivate triggered");
lua_call(m_state, 1, 0);
}
void LuaScriptEngine::onUpdate() {
lua_getglobal(m_state, "print");
lua_pushstring(m_state, "LUA update triggered");
lua_call(m_state, 1, 0);
}
void LuaScriptEngine::onEvent(const std::string &name) {
lua_getglobal(m_state, "print");
lua_pushstring(m_state, "LUA event triggered");
lua_call(m_state, 1, 0);
}
bool LuaScriptEngine::run(const char *script) {
auto result = luaL_dostring(m_state, script);
if ( !result ) {
fggl::debug::warning("lua error: {}", lua_tostring(m_state, -1));
}
return result;
}
bool LuaScriptEngine::load(const char *filename) {
assert( filename != nullptr);
auto path = m_storage->resolvePath(data::StorageType::Data, filename);
if ( !std::filesystem::exists(path) ) {
fggl::debug::warning("lua error: file does not exist: {}", path.c_str());
return false;
}
// load the file ( OK = 0 = false because reasons...)
auto result = !luaL_dofile(m_state, path.c_str());
if ( !result ) {
fggl::debug::warning("lua error: {}", lua_tostring(m_state, -1));
return false;
}
return true;
}
void LuaScriptEngine::setGlobal(const char *name, void *ptr) {
lua_pushlightuserdata(m_state, ptr);
lua_setglobal(m_state, name);
}
}
\ No newline at end of file
/*
* This file is part of FGGL.
*
* FGGL is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* FGGL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with FGGL.
* If not, see <https://www.gnu.org/licenses/>.
*/
//
// Created by webpigeon on 15/10/22.
//
#include "fggl/script/lua/module.hpp"
#include "fggl/script/lua/engine.hpp"
namespace fggl::script::lua {
static assets::AssetTypeID is_lua(std::filesystem::path path) {
if ( path.extension() == ".lua" ) {
return SCRIPT_LUA;
}
return assets::INVALID_ASSET_TYPE;
}
bool Lua::factory(modules::ServiceName service, modules::Services &serviceManager) {
if ( service == ScriptProvider::service ) {
auto *storageService = serviceManager.get<data::Storage>();
serviceManager.bind<ScriptProvider,LuaScriptProvider>(storageService);
auto *assetPacker = serviceManager.get<assets::CheckinAdapted>();
assetPacker->setLoader(MIME_LUA, assets::NEEDS_CHECKIN, is_lua);
return true;
}
return false;
}
}
\ No newline at end of file
add_executable(fgpak)
target_link_libraries(fgpak fggl)
target_sources(fgpak
PRIVATE
src/main.cpp
)
\ No newline at end of file
/*
* This file is part of FGGL.
*
* FGGL is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* FGGL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with FGGL.
* If not, see <https://www.gnu.org/licenses/>.
*/
/*
* This file is part of FGGL.
*
* FGGL is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* FGGL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with FGGL.
* If not, see <https://www.gnu.org/licenses/>.
*/
//
// Created by webpigeon on 11/09/22.
//
#ifndef FGGL_TOOLS_PACK_SRC_BINARY_HPP
#define FGGL_TOOLS_PACK_SRC_BINARY_HPP
#include <cstdint>
#include <iostream>
#include <cstdio>
#include "fggl/data/model.hpp"
namespace fggl::data {
enum class ModelType {
OPENGL
};
struct ModelHeader {
unsigned long guid;
std::size_t size;
ModelType type;
};
void write_mesh(FILE* file, const Mesh& mesh) {
static_assert( std::is_standard_layout_v<Vertex> );
static_assert( std::is_standard_layout_v<Mesh::IndexType> );
// write vertex data
std::size_t vertexCount = mesh.vertexCount();
fwrite( &vertexCount, sizeof(vertexCount), 1, file );
fwrite( mesh.vertexList().data(), sizeof(Vertex), vertexCount, file );
std::size_t indexCount = mesh.indexCount();
fwrite( &indexCount, sizeof(indexCount), 1, file);
fwrite( mesh.indexList().data(), sizeof(Mesh::IndexType), indexCount, file);
}
void write_model(FILE* file, const ModelHeader& header, const Mesh& mesh) {
assert( header.type == ModelType::OPENGL );
fwrite( &header , sizeof(ModelHeader), 1, file);
write_mesh(file, mesh);
}
void read_mesh(FILE* fin, data::Mesh& mesh) {
static_assert( std::is_standard_layout_v<Vertex> );
static_assert( std::is_standard_layout_v<Mesh::IndexType> );
std::size_t readCount;
// vertex data
std::size_t vertexCount = 0;
readCount = fread( &vertexCount, sizeof(vertexCount), 1, fin );
assert(ferror(fin) == 0);
if (readCount != 1) {
std::cerr << "failed to read vertex count" << std::endl;
return;
}
// push vertex data into mesh
auto* vertexData = new data::Vertex[vertexCount];
readCount = fread( vertexData, sizeof(Vertex), vertexCount, fin );
assert(ferror(fin) == 0);
if ( readCount != vertexCount ) {
std::cerr << "failed to read vertex data" << std::endl;
return;
}
for ( std::size_t i = 0; i < vertexCount; ++i) {
mesh.pushVertex(vertexData[i]);
}
delete[] vertexData;
// read index size
std::size_t indexCount = 0;
readCount = fread( &indexCount, sizeof(indexCount), 1, fin);
assert(ferror(fin) == 0);
if (readCount != 1 ) {
std::cerr << "failed to read index count" << std::endl;
return;
}
// read index data
auto* idxData = new Mesh::IndexType[indexCount];
readCount = fread( idxData, sizeof(Mesh::IndexType), indexCount, fin);
assert(ferror(fin) == 0);
if (readCount != indexCount) {
std::cerr << "failed to read index data, expected: " << indexCount << ", got: " << readCount << std::endl;
return;
}
for (int i=0; i < indexCount; ++i) {
mesh.pushIndex( idxData[i] );
}
delete[] idxData;
}
void read_model(FILE* file, ModelHeader& header, Mesh& mesh) {
fread( &header, sizeof(ModelHeader), 1, file);
if ( header.type == ModelType::OPENGL ) {
read_mesh(file, mesh);
}
}
}
#endif //FGGL_TOOLS_PACK_SRC_BINARY_HPP
/*
* This file is part of FGGL.
*
* FGGL is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* FGGL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with FGGL.
* If not, see <https://www.gnu.org/licenses/>.
*/
//
// Created by webpigeon on 11/09/22.
//
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <filesystem>
#include <map>
#include <yaml-cpp/yaml.h>
#include "fggl/data/model.hpp"
#include "fggl/data/procedural.hpp"
#include "fggl/entity/loader/loader.hpp"
#include "binary.hpp"
constexpr const char* YAML_PREFAB = "prefabs";
constexpr const char* YAML_COMPONENT = "components";
constexpr uint32_t DEFAULT_STACKS = 16;
constexpr uint32_t DEFAULT_SLICES = 16;
constexpr const char *SHAPE_SPHERE{"sphere"};
constexpr const char *SHAPE_BOX{"box"};
namespace fggl {
static void process_shape(const YAML::Node &node, data::Mesh &mesh) {
auto transform = data::OFFSET_NONE;
auto offset = node["offset"].as<math::vec3>(math::VEC3_ZERO);
transform = glm::translate(transform, offset);
auto scale = node["scale"].as<math::vec3>(math::VEC3_ONES);
transform = glm::scale(transform, scale);
debug::debug("scale: {}, {}, {}", scale.x, scale.y, scale.z);
// now the shape itself
auto type = node["type"].as<std::string>();
if (type == SHAPE_BOX) {
data::make_cube(mesh, transform);
} else if (type == SHAPE_SPHERE) {
auto stacks = node["stacks"].as<uint32_t>(DEFAULT_STACKS);
auto slices = node["slices"].as<uint32_t>(DEFAULT_SLICES);
data::make_sphere(mesh, transform, stacks, slices);
} else {
debug::log(debug::Level::warning, "unknown shape type requested: {}", type);
}
}
static void process_mesh(const YAML::Node& spec, fggl::data::Mesh& mesh) {
// process shape structure
if (spec["shape"].IsSequence()) {
for (const auto &node : spec["shape"]) {
process_shape(node, mesh);
}
} else {
process_shape(spec["shape"], mesh);
}
mesh.removeDups();
}
}
void write_comp_static_model(FILE* fout, const YAML::Node& config) {
// calculate mesh
fggl::data::Mesh mesh;
fggl::process_mesh( config, mesh);
// calculate correct name
auto meshName = config["shape_id"];
auto meshNameStr = meshName.as<std::string>();
auto meshGuid = fggl::util::make_guid_rt(meshNameStr);
// header data
fggl::data::ModelHeader header{
.guid = meshGuid.get(),
.type = fggl::data::ModelType::OPENGL,
};
// write the mesh to disk
fggl::data::write_model( fout, header, mesh );
}
int main(int argc, char* argv[]) {
auto* packName = argv[1];
std::cout << "generating " << packName << std::endl;
std::map< fggl::util::GUID, std::string > guids;
// rollball
auto rollPath = std::filesystem::current_path() / "rollball.yml";
std::cout << rollPath << std::endl;
YAML::Node root = YAML::LoadFile(rollPath);
if ( !root ){
return EXIT_FAILURE;
}
//std::cout << root[ YAML_PREFAB ] << std::endl;
std::map<std::string, std::function<void(FILE* fout, const YAML::Node&)>> converters;
converters["StaticMesh"] = write_comp_static_model;
std::string meshFile = "rollball_models.bin";
FILE* fout = fopen(meshFile.c_str(), "w");
// pack prefabs
for (const auto& prefab : root[YAML_PREFAB]) {
// name
auto name = prefab["name"].as<std::string>();
auto nameRef = fggl::util::make_guid(name.c_str());
guids[nameRef] = name;
std::cout << name << std::endl;
// parent
//auto parentName = prefab["parent"].as<std::string>();
//auto parentGuid = fggl::util::make_guid(parentName.c_str());
// components
for( const auto& key : prefab[YAML_COMPONENT] ) {
auto compStr = key.first.as<std::string>();
auto compGuid = fggl::util::make_guid_rt(compStr);
guids[compGuid] = compStr;
// figure out the type
auto compWrite = converters.find(compStr);
if ( compWrite != converters.end()) {
compWrite->second(fout, key.second);
}
}
}
fclose(fout);
// guid table
std::cerr << "GUID Table" << std::endl;
std::cerr << "guid,str" << std::endl;
for (auto& [guid,str] : guids) {
std::cerr << guid.get() << "," << str << std::endl;
}
return EXIT_SUCCESS;
}
\ No newline at end of file
# Vendor Libraries
This folder contains 3rd party code we need to ship with our build.
Compile-time only dependencies, or dependencies which can be included using cmake directly will not be included within this folder.
| Library | Purpose | Licence |
|------------|--------------------------------------------------|---------|
| GLAD | Allow loading of OpenGL libraries and extentions | MIT |
| Dear IMGUI | Debugging UI/Editor windows | MIT |
\ No newline at end of file
add_library( entt INTERFACE )
target_include_directories( entt
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>
$<INSTALL_INTERFACE:include>
)
install(
FILES
include/fggl/vendor/entt.hpp
DESTINATION
${CMAKE_INSTALL_INCLUDEDIR}/fggl/vendor/entt.hpp
)
install(TARGETS entt
EXPORT fgglTargets
DESTINATION
${CMAKE_INSTALL_LIBDIR}/fggl/entt
)
......@@ -12,11 +12,10 @@ target_sources( fggl-glad
debug/glad.c
)
# FIXME should be a cleaner way to do this...
install(
FILES
public/glad/glad.h
debug/include/glad/glad.h
DESTINATION
${CMAKE_INSTALL_INCLUDEDIR}/fggl/glad
)
......
......@@ -23,5 +23,5 @@ include(GNUInstallDirs)
install(TARGETS imgui
EXPORT fgglTargets
PUBLIC_HEADER
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/fggl/imgui
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/fggl/imgui
)
\ No newline at end of file