Initial work on creating C interface.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
5a05a2f4d3
commit
0a109e37bc
|
@ -0,0 +1,23 @@
|
||||||
|
#include "../../src/Library/DataLibrary.hpp"
|
||||||
|
#define export extern "C"
|
||||||
|
|
||||||
|
export const CreatureLib::Library::DataLibrary* CreatureLib_DataLibrary_Construct(
|
||||||
|
CreatureLib::Library::LibrarySettings* settings, CreatureLib::Library::SpeciesLibrary* species,
|
||||||
|
CreatureLib::Library::AttackLibrary* attacks, CreatureLib::Library::ItemLibrary* items,
|
||||||
|
CreatureLib::Library::GrowthRateLibrary* growthRates, CreatureLib::Library::TypeLibrary* typeLibrary) {
|
||||||
|
return new CreatureLib::Library::DataLibrary(settings, species, attacks, items, growthRates, typeLibrary);
|
||||||
|
}
|
||||||
|
|
||||||
|
export void CreatureLib_DataLibrary_Destruct(const CreatureLib::Library::DataLibrary* p) { delete p; }
|
||||||
|
|
||||||
|
#define SIMPLE_GET_FUNC(type, name, returnType) \
|
||||||
|
export returnType CreatureLib_##type##_##name(const CreatureLib::Library::type* p) { return p->name(); }
|
||||||
|
|
||||||
|
SIMPLE_GET_FUNC(DataLibrary, GetSettings, const CreatureLib::Library::LibrarySettings*);
|
||||||
|
SIMPLE_GET_FUNC(DataLibrary, GetSpeciesLibrary, const CreatureLib::Library::SpeciesLibrary*);
|
||||||
|
SIMPLE_GET_FUNC(DataLibrary, GetAttackLibrary, const CreatureLib::Library::AttackLibrary*);
|
||||||
|
SIMPLE_GET_FUNC(DataLibrary, GetItemLibrary, const CreatureLib::Library::ItemLibrary*);
|
||||||
|
SIMPLE_GET_FUNC(DataLibrary, GetGrowthRates, const CreatureLib::Library::GrowthRateLibrary*);
|
||||||
|
SIMPLE_GET_FUNC(DataLibrary, GetTypeLibrary, const CreatureLib::Library::TypeLibrary*);
|
||||||
|
|
||||||
|
#undef SIMPLE_GET_FUNC
|
|
@ -0,0 +1,17 @@
|
||||||
|
#include "../../src/Library/LibrarySettings.hpp"
|
||||||
|
#define export extern "C"
|
||||||
|
|
||||||
|
export const CreatureLib::Library::LibrarySettings* CreatureLib_LibrarySettings_Construct(uint8_t maximalLevel,
|
||||||
|
uint8_t maximalMoves) {
|
||||||
|
return new CreatureLib::Library::LibrarySettings(maximalLevel, maximalMoves);
|
||||||
|
}
|
||||||
|
|
||||||
|
export void CreatureLib_LibrarySettings_Destruct(const CreatureLib::Library::LibrarySettings* p) { delete p; }
|
||||||
|
|
||||||
|
#define SIMPLE_GET_FUNC(type, name, returnType) \
|
||||||
|
export returnType CreatureLib_##type##_##name(const CreatureLib::Library::type* p) { return p->name(); }
|
||||||
|
|
||||||
|
SIMPLE_GET_FUNC(LibrarySettings, GetMaximalLevel, uint8_t);
|
||||||
|
SIMPLE_GET_FUNC(LibrarySettings, GetMaximalMoves, uint8_t);
|
||||||
|
|
||||||
|
#undef SIMPLE_GET_FUNC
|
|
@ -0,0 +1,13 @@
|
||||||
|
#include "../../src/Library/SpeciesLibrary.hpp"
|
||||||
|
#define export extern "C"
|
||||||
|
|
||||||
|
export const CreatureLib::Library::SpeciesLibrary* CreatureLib_SpeciesLibrary_Construct(size_t initialCapacity = 32) {
|
||||||
|
return new CreatureLib::Library::SpeciesLibrary(initialCapacity);
|
||||||
|
};
|
||||||
|
|
||||||
|
export void CreatureLib_SpeciesLibrary_Destruct(const CreatureLib::Library::SpeciesLibrary* p) { delete p; }
|
||||||
|
|
||||||
|
void CreatureLib_SpeciesLibrary_Insert(CreatureLib::Library::SpeciesLibrary* p, const char* name,
|
||||||
|
CreatureLib::Library::CreatureSpecies* species) {
|
||||||
|
p->Insert(Arbutils::CaseInsensitiveConstString(name), species);
|
||||||
|
}
|
|
@ -32,16 +32,16 @@ if (WINDOWS)
|
||||||
endif (WINDOWS)
|
endif (WINDOWS)
|
||||||
|
|
||||||
# Create Core library with files in src/Core
|
# Create Core library with files in src/Core
|
||||||
file(GLOB_RECURSE CORE_SRC_FILES "src/Core/*.cpp" "src/Core/*.hpp")
|
file(GLOB_RECURSE CORE_SRC_FILES "src/Core/*.cpp" "src/Core/*.hpp" "CInterface/Core/*.hpp")
|
||||||
add_library(CreatureLibCore SHARED ${CORE_SRC_FILES})
|
add_library(CreatureLibCore SHARED ${CORE_SRC_FILES})
|
||||||
set_target_properties(CreatureLibCore PROPERTIES LINKER_LANGUAGE CXX)
|
set_target_properties(CreatureLibCore PROPERTIES LINKER_LANGUAGE CXX)
|
||||||
|
|
||||||
# Create main Library library with files in src/Library
|
# Create main Library library with files in src/Library
|
||||||
file(GLOB_RECURSE LIBRARY_SRC_FILES "src/Library/*.cpp" "src/Library/*.hpp")
|
file(GLOB_RECURSE LIBRARY_SRC_FILES "src/Library/*.cpp" "src/Library/*.hpp" "CInterface/Library/*.cpp")
|
||||||
add_library(CreatureLibLibrary SHARED ${LIBRARY_SRC_FILES})
|
add_library(CreatureLibLibrary SHARED ${LIBRARY_SRC_FILES})
|
||||||
|
|
||||||
# Create Battling library with files in src/Battling
|
# Create Battling library with files in src/Battling
|
||||||
file(GLOB_RECURSE BATTLING_SRC_FILES "src/Battling/*.cpp" "src/Battling/*.hpp")
|
file(GLOB_RECURSE BATTLING_SRC_FILES "src/Battling/*.cpp" "src/Battling/*.hpp" "CInterface/Battling/*.hpp")
|
||||||
add_library(CreatureLibBattling SHARED ${BATTLING_SRC_FILES})
|
add_library(CreatureLibBattling SHARED ${BATTLING_SRC_FILES})
|
||||||
|
|
||||||
if (NOT DEFINED CONAN_EXPORTED)
|
if (NOT DEFINED CONAN_EXPORTED)
|
||||||
|
|
Loading…
Reference in New Issue