mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
fix single process build for Android
This commit is contained in:
@@ -188,8 +188,10 @@ void CVCMIServer::run()
|
||||
}
|
||||
|
||||
#if defined(VCMI_ANDROID)
|
||||
#ifndef SINGLE_PROCESS_APP
|
||||
CAndroidVMHelper vmHelper;
|
||||
vmHelper.callStaticVoidMethod(CAndroidVMHelper::NATIVE_METHODS_DEFAULT_CLASS, "onServerReady");
|
||||
#endif
|
||||
#elif !defined(VCMI_IOS)
|
||||
if(shm)
|
||||
{
|
||||
@@ -1024,7 +1026,7 @@ void handleLinuxSignal(int sig)
|
||||
}
|
||||
#endif
|
||||
|
||||
static void handleCommandOptions(int argc, char * argv[], boost::program_options::variables_map & options)
|
||||
static void handleCommandOptions(int argc, const char * argv[], boost::program_options::variables_map & options)
|
||||
{
|
||||
namespace po = boost::program_options;
|
||||
po::options_description opts("Allowed options");
|
||||
@@ -1084,13 +1086,14 @@ static void handleCommandOptions(int argc, char * argv[], boost::program_options
|
||||
#ifdef SINGLE_PROCESS_APP
|
||||
#define main server_main
|
||||
#endif
|
||||
#ifdef VCMI_ANDROID
|
||||
|
||||
#if VCMI_ANDROID_DUAL_PROCESS
|
||||
void CVCMIServer::create()
|
||||
{
|
||||
const int argc = 1;
|
||||
char * argv[argc] = { "android-server" };
|
||||
const char * argv[argc] = { "android-server" };
|
||||
#else
|
||||
int main(int argc, char * argv[])
|
||||
int main(int argc, const char * argv[])
|
||||
{
|
||||
#endif
|
||||
|
||||
@@ -1121,7 +1124,7 @@ int main(int argc, char * argv[])
|
||||
srand((ui32)time(nullptr));
|
||||
|
||||
#ifdef SINGLE_PROCESS_APP
|
||||
boost::condition_variable * cond = reinterpret_cast<boost::condition_variable *>(argv[0]);
|
||||
boost::condition_variable * cond = reinterpret_cast<boost::condition_variable *>(const_cast<char *>(argv[0]));
|
||||
cond->notify_one();
|
||||
#endif
|
||||
|
||||
@@ -1155,20 +1158,19 @@ int main(int argc, char * argv[])
|
||||
//and return non-zero status so client can detect error
|
||||
throw;
|
||||
}
|
||||
#ifdef VCMI_ANDROID
|
||||
#if VCMI_ANDROID_DUAL_PROCESS
|
||||
CAndroidVMHelper envHelper;
|
||||
envHelper.callStaticVoidMethod(CAndroidVMHelper::NATIVE_METHODS_DEFAULT_CLASS, "killServer");
|
||||
#endif
|
||||
logConfig.deconfigure();
|
||||
vstd::clear_pointer(VLC);
|
||||
|
||||
#ifndef VCMI_ANDROID
|
||||
#if !VCMI_ANDROID_DUAL_PROCESS
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef VCMI_ANDROID
|
||||
|
||||
#if VCMI_ANDROID_DUAL_PROCESS
|
||||
extern "C" JNIEXPORT void JNICALL Java_eu_vcmi_vcmi_NativeMethods_createServer(JNIEnv * env, jclass cls)
|
||||
{
|
||||
__android_log_write(ANDROID_LOG_INFO, "VCMI", "Got jni call to init server");
|
||||
@@ -1181,13 +1183,12 @@ extern "C" JNIEXPORT void JNICALL Java_eu_vcmi_vcmi_NativeMethods_initClassloade
|
||||
{
|
||||
CAndroidVMHelper::initClassloader(baseEnv);
|
||||
}
|
||||
|
||||
#elif defined(SINGLE_PROCESS_APP)
|
||||
void CVCMIServer::create(boost::condition_variable * cond, const std::vector<std::string> & args)
|
||||
{
|
||||
std::vector<const void *> argv = {cond};
|
||||
for(auto & a : args)
|
||||
argv.push_back(a.c_str());
|
||||
main(argv.size(), reinterpret_cast<char **>(const_cast<void **>(&*argv.begin())));
|
||||
main(argv.size(), reinterpret_cast<const char **>(&*argv.begin()));
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user