From e9203250739aa7f69d9befcf526c3d1472aebe98 Mon Sep 17 00:00:00 2001 From: Ole Volbracht Date: Thu, 5 Sep 2024 16:24:59 +0200 Subject: [PATCH] Build navmeshtool as a library --- apps/navmeshtool/CMakeLists.txt | 16 ++++++++++++++-- apps/navmeshtool/main.cpp | 4 ++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/apps/navmeshtool/CMakeLists.txt b/apps/navmeshtool/CMakeLists.txt index 58648a2f0a..090fc00f36 100644 --- a/apps/navmeshtool/CMakeLists.txt +++ b/apps/navmeshtool/CMakeLists.txt @@ -5,9 +5,21 @@ set(NAVMESHTOOL ) source_group(apps\\navmeshtool FILES ${NAVMESHTOOL}) -openmw_add_executable(openmw-navmeshtool ${NAVMESHTOOL}) +add_library(openmw-navmeshtool-lib STATIC + ${NAVMESHTOOL} +) + +if (ANDROID) + add_library(openmw-navmeshtool SHARED + main.cpp + ) +else() + openmw_add_executable(openmw-navmeshtool ${NAVMESHTOOL}) +endif() + +target_link_libraries(openmw-navmeshtool openmw-navmeshtool-lib) -target_link_libraries(openmw-navmeshtool +target_link_libraries(openmw-navmeshtool-lib Boost::program_options components ) diff --git a/apps/navmeshtool/main.cpp b/apps/navmeshtool/main.cpp index ed1ab57274..27f84104ac 100644 --- a/apps/navmeshtool/main.cpp +++ b/apps/navmeshtool/main.cpp @@ -258,7 +258,11 @@ namespace NavMeshTool } } +#ifdef ANDROID +extern "C" int SDL_main(int argc, char* argv[]) +#else int main(int argc, char* argv[]) +#endif { return Debug::wrapApplication(NavMeshTool::runNavMeshTool, argc, argv, NavMeshTool::applicationName); }