Skip to content

Commit

Permalink
android build fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nesbox committed Jun 1, 2024
1 parent 1970479 commit f4001ae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cmake/sokol.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if(BUILD_SOKOL)
target_link_libraries(sokol PRIVATE X11 Xcursor Xi GL m dl asound)
elseif(ANDROID)
target_compile_definitions(sokol PRIVATE SOKOL_GLES3)
target_link_libraries(sokol PUBLIC android log aaudio EGL GLESv2 GLESv3)
target_link_libraries(sokol PRIVATE android log aaudio EGL GLESv2 GLESv3)
elseif(EMSCRIPTEN)
target_compile_definitions(sokol PRIVATE SOKOL_WGPU)
endif()
Expand Down
11 changes: 5 additions & 6 deletions src/studio/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,18 +400,17 @@ struct tic_net
};

#if defined(__ANDROID__)
#include <jni.h>
JNIEnv *Android_JNI_GetEnv();
#include <native_activity.h>
const void* sapp_android_get_native_activity(void);
#endif

tic_net* tic_net_create(const char* host)
{
#if defined(__ANDROID__)
JNIEnv *env = Android_JNI_GetEnv();
JavaVM *vm = NULL;
(*env)->GetJavaVM(env, &vm);

naettInit(vm);
ANativeActivity *act = sapp_android_get_native_activity();
naettInit(act->vm);

#else
naettInit(NULL);
#endif
Expand Down

0 comments on commit f4001ae

Please sign in to comment.