Open
Description
Was looking into creating GDExtension bindings with the Godot engine using this library
Reference (https://github.com/godotengine/godot-cpp)
Different platforms that should be supported (https://github.com/godotengine/godot-cpp/blob/master/test/project/example.gdextension)
When trying to compile with emsdk (https://emscripten.org/index.html) for a Web release I get compile errors.
By looking at the CMake scripts have removed the shared_library_*
files from compilation as well as removed the SharedLibrary
usage from the BehaviorTreeFactory::registerFromPlugin
API.
According to me this was the only OS specific dependency of this project.
Questions
- Are there any other change required to make WebAssembly builds compile?
- Apart from Windows and Unix are other platforms supported? (Android, iOS, MacOS)
Additional Context
Current scons script
Import("env")
BEHAVIORTREE_FOLDER = "BehaviorTree.CPP"
env.Append(CPPPATH=[
f"{BEHAVIORTREE_FOLDER}/include/",
f"{BEHAVIORTREE_FOLDER}/3rdparty/",
f"{BEHAVIORTREE_FOLDER}/3rdparty/lexy/include/"
])
localenv = env.Clone()
localenv.Append(CPPDEFINES=[
"BTCPP_LIBRARY_VERSION=\\\"4.4.0\\\"",
"LEXY_HAS_UNICODE_DATABASE=1"
])
# localenv.Append(CXXFLAGS=["-s ASYNCIFY"])
sources = [
f"{BEHAVIORTREE_FOLDER}/src/action_node.cpp",
f"{BEHAVIORTREE_FOLDER}/src/basic_types.cpp",
f"{BEHAVIORTREE_FOLDER}/src/behavior_tree.cpp",
f"{BEHAVIORTREE_FOLDER}/src/blackboard.cpp",
f"{BEHAVIORTREE_FOLDER}/src/bt_factory.cpp",
f"{BEHAVIORTREE_FOLDER}/src/decorator_node.cpp",
f"{BEHAVIORTREE_FOLDER}/src/condition_node.cpp",
f"{BEHAVIORTREE_FOLDER}/src/control_node.cpp",
# f"{BEHAVIORTREE_FOLDER}/src/shared_library.cpp",
f"{BEHAVIORTREE_FOLDER}/src/tree_node.cpp",
f"{BEHAVIORTREE_FOLDER}/src/script_parser.cpp",
f"{BEHAVIORTREE_FOLDER}/src/json_export.cpp",
f"{BEHAVIORTREE_FOLDER}/src/xml_parsing.cpp",
f"{BEHAVIORTREE_FOLDER}/src/actions/test_node.cpp",
f"{BEHAVIORTREE_FOLDER}/src/actions/sleep_node.cpp",
f"{BEHAVIORTREE_FOLDER}/src/decorators/delay_node.cpp",
f"{BEHAVIORTREE_FOLDER}/src/decorators/inverter_node.cpp",
f"{BEHAVIORTREE_FOLDER}/src/decorators/repeat_node.cpp",
f"{BEHAVIORTREE_FOLDER}/src/decorators/retry_node.cpp",
f"{BEHAVIORTREE_FOLDER}/src/decorators/timeout_node.cpp",
f"{BEHAVIORTREE_FOLDER}/src/decorators/subtree_node.cpp",
f"{BEHAVIORTREE_FOLDER}/src/controls/if_then_else_node.cpp",
f"{BEHAVIORTREE_FOLDER}/src/controls/fallback_node.cpp",
f"{BEHAVIORTREE_FOLDER}/src/controls/parallel_node.cpp",
f"{BEHAVIORTREE_FOLDER}/src/controls/parallel_all_node.cpp",
f"{BEHAVIORTREE_FOLDER}/src/controls/reactive_sequence.cpp",
f"{BEHAVIORTREE_FOLDER}/src/controls/reactive_fallback.cpp",
f"{BEHAVIORTREE_FOLDER}/src/controls/sequence_node.cpp",
f"{BEHAVIORTREE_FOLDER}/src/controls/sequence_star_node.cpp",
f"{BEHAVIORTREE_FOLDER}/src/controls/switch_node.cpp",
f"{BEHAVIORTREE_FOLDER}/src/controls/while_do_else_node.cpp",
f"{BEHAVIORTREE_FOLDER}/src/loggers/bt_cout_logger.cpp",
f"{BEHAVIORTREE_FOLDER}/src/loggers/bt_file_logger_v2.cpp",
f"{BEHAVIORTREE_FOLDER}/src/loggers/bt_minitrace_logger.cpp",
f"{BEHAVIORTREE_FOLDER}/src/loggers/bt_observer.cpp",
f"{BEHAVIORTREE_FOLDER}/3rdparty/tinyxml2/tinyxml2.cpp",
f"{BEHAVIORTREE_FOLDER}/3rdparty/minitrace/minitrace.cpp",
]
# # TODO, Might need to check for WASM applications
# if env['PLATFORM'] == 'windows':
# sources.append(f"{BEHAVIORTREE_FOLDER}/src/shared_library_WIN.cpp")
# else:
# sources.append(f"{BEHAVIORTREE_FOLDER}/src/shared_library_UNIX.cpp")
libpath = localenv.File(
f"bin/{localenv['platform']}/libbehaviortree_cpp{localenv['suffix']}{localenv['LIBSUFFIX']}")
library = localenv.StaticLibrary(
target=libpath, source=sources)
print(library)
localenv.Default(library)
env.AppendUnique(LIBS=[libpath])