Turns PokemonSpecies Construct C interface into Try function
This commit is contained in:
parent
91bd7f8670
commit
93983bdf5b
|
@ -2,13 +2,12 @@
|
||||||
#include "../Core.hpp"
|
#include "../Core.hpp"
|
||||||
using namespace PkmnLib::Library;
|
using namespace PkmnLib::Library;
|
||||||
|
|
||||||
export const PokemonSpecies* PkmnLib_PokemonSpecies_Construct(uint16_t id, const char* name,
|
export uint8_t PkmnLib_PokemonSpecies_Construct(const PokemonSpecies*& out, uint16_t id, const char* name,
|
||||||
const PokemonForme* defaultForme, float genderRatio,
|
const PokemonForme* defaultForme, float genderRatio,
|
||||||
const char* growthRate, uint8_t captureRate,
|
const char* growthRate, uint8_t captureRate, uint8_t baseHappiness) {
|
||||||
uint8_t baseHappiness) {
|
Try(auto cName = Arbutils::CaseInsensitiveConstString(name);
|
||||||
auto cName = Arbutils::CaseInsensitiveConstString(name);
|
|
||||||
auto cGrowthRate = Arbutils::CaseInsensitiveConstString(growthRate);
|
auto cGrowthRate = Arbutils::CaseInsensitiveConstString(growthRate);
|
||||||
return new PokemonSpecies(id, cName, defaultForme, genderRatio, cGrowthRate, captureRate, baseHappiness);
|
out = new PokemonSpecies(id, cName, defaultForme, genderRatio, cGrowthRate, captureRate, baseHappiness);)
|
||||||
}
|
}
|
||||||
|
|
||||||
export void PkmnLib_PokemonSpecies_Destruct(const PokemonSpecies* p) { delete p; }
|
export void PkmnLib_PokemonSpecies_Destruct(const PokemonSpecies* p) { delete p; }
|
||||||
|
|
|
@ -36,10 +36,10 @@ if (NOT EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
|
||||||
endif()
|
endif()
|
||||||
if (NOT WINDOWS)
|
if (NOT WINDOWS)
|
||||||
execute_process(COMMAND conan install ${CMAKE_SOURCE_DIR} --install-folder=${CMAKE_BINARY_DIR} --build outdated
|
execute_process(COMMAND conan install ${CMAKE_SOURCE_DIR} --install-folder=${CMAKE_BINARY_DIR} --build outdated
|
||||||
-s compiler=clang -s compiler.libcxx=libstdc++11 -s compiler.version=${VERSION})
|
-s compiler=clang -s compiler.libcxx=libstdc++11 -s compiler.version=${VERSION} -o *:staticC=True)
|
||||||
else()
|
else()
|
||||||
execute_process(COMMAND conan install ${CMAKE_SOURCE_DIR} --install-folder=${CMAKE_BINARY_DIR} --build outdated
|
execute_process(COMMAND conan install ${CMAKE_SOURCE_DIR} --install-folder=${CMAKE_BINARY_DIR} --build outdated
|
||||||
-s compiler=gcc -s compiler.libcxx=libstdc++11 -s compiler.version=${VERSION} -s os=Windows)
|
-s compiler=gcc -s compiler.libcxx=libstdc++11 -s compiler.version=${VERSION} -s os=Windows -o *:staticC=True)
|
||||||
endif()
|
endif()
|
||||||
endif ()
|
endif ()
|
||||||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
|
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
|
||||||
|
@ -97,13 +97,13 @@ if (WINDOWS)
|
||||||
endif (WINDOWS)
|
endif (WINDOWS)
|
||||||
|
|
||||||
if (STATICC)
|
if (STATICC)
|
||||||
|
message(STATUS "Linking C library statically")
|
||||||
SET(_LINKS ${_LINKS} -static-libgcc -static-libstdc++)
|
SET(_LINKS ${_LINKS} -static-libgcc -static-libstdc++)
|
||||||
if (NOT DEFINED CONAN_EXPORTED)
|
if (NOT DEFINED CONAN_EXPORTED)
|
||||||
SET(_TESTLINKS ${_TESTLINKS} -static-libgcc -static-libstdc++)
|
SET(_TESTLINKS ${_TESTLINKS} -static-libgcc -static-libstdc++)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
target_link_libraries(pkmnLib PUBLIC ${_LINKS})
|
target_link_libraries(pkmnLib PUBLIC ${_LINKS})
|
||||||
|
|
||||||
if (NOT DEFINED CONAN_EXPORTED)
|
if (NOT DEFINED CONAN_EXPORTED)
|
||||||
|
|
Loading…
Reference in New Issue