Browse Source

Added mods folder to example and cmake config to install said mods folder to the exicutable directory.

master
DomtronVox 2 years ago
parent
commit
b8dad2c556
3 changed files with 10 additions and 2 deletions
  1. +4
    -0
      examples/1_minimal/CMakeLists.txt
  2. +1
    -0
      examples/1_minimal/mods/mod1/mod.ini
  3. +5
    -2
      examples/1_minimal/src/main.cpp

+ 4
- 0
examples/1_minimal/CMakeLists.txt View File

@ -1,3 +1,5 @@
set (SUB_PROJECT_PATH "examples/1_minimal")
# Collect source file paths into a var for later building
file(GLOB_RECURSE SUB_PROJECT_SOURCES "src/*.cpp")
file(GLOB_RECURSE SUB_PROJECT_HEADERS "src/*.h")
@ -5,6 +7,8 @@ file(GLOB_RECURSE SUB_PROJECT_HEADERS "src/*.h")
#pull in the project's headers
include_directories( ${PROJECT_HEADER_DIR} )
#put the mods directory next to the exicutable in the build folder
file(COPY mods DESTINATION ${CMAKE_BINARY_DIR}/${SUB_PROJECT_PATH})
# Build project and link it
add_executable( 1_Minimal_Example ${SUB_PROJECT_SOURCES} )


+ 1
- 0
examples/1_minimal/mods/mod1/mod.ini View File

@ -1,2 +1,3 @@
[mod]
name=mod 1
id=2dk53l89mn3n7JdY801264Kds0H

+ 5
- 2
examples/1_minimal/src/main.cpp View File

@ -13,8 +13,11 @@ int main (int argc, char* argv[]) {
std::unique_ptr<ModdingFrameworkCore> mod_framework;
mod_framework = std::make_unique<ModdingFrameworkCore>("mods");
std::shared_ptr<ConfigStore> data = mod_framework->mod_config[0];
std::shared_ptr<ConfigStore> data = mod_framework->mod_config[0]->getNested("mod");
if ( data->populated ) {
std::cout << data->getStr("name") << "; " << data->getStr("id") << std::endl;
} else { std::cout << "Error! Config empty" << std::endl; }
std::cout << data->getStr("name") << "; " << data->getStr("id") << std::endl;
return 0;
}

Loading…
Cancel
Save