Player: ndk-build is stupid and tries to compile any .cpp file in src

Created on 5 Oct 2015  路  7Comments  路  Source: EasyRPG/Player

Maybe ndk-build should depend on a list like all other sane build systems and stop compiling my non-clean upd conflict files player.BASE.cpp because they end on .cpp -.-

Android Building

All 7 comments

As a detail, the problem is at builds/android/jni/src/Android.mk which uses wildcards.
A possible solution without needing to maintain yet another makefile file list might be by using Androgenizer, which generates .mk files from autotools. CMake might help too. Or just a plain maintenance shell script to do the trick.

Is this one fixed with the updated build?

Nope

Does this bug still exist in 2019?

Yes, and this also affects most dedicated ports with Makefiles. Will vanish when this has been adapted to cmake.

ndk-build is very likely the last one which is going to be adopted to CMake because nobody wants to understand how the interaction between gradle and CMake works.

I started something:
asciicast

Needed changes so far:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2b7d4a31..47c0c212 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -389,6 +389,11 @@ if(MSVC)
    target_compile_options(${PROJECT_NAME} PRIVATE "/utf-8")
 endif()

+if(ANDROID)
+   target_compile_definitions(${PROJECT_NAME} PUBLIC SDL_MAIN_HANDLED=1)
+   target_link_libraries(${PROJECT_NAME} "GLESv1_CM" "log" "atomic")
+endif()
+
 # Executable
 # Windows: Only open console for Debug builds
 if(CMAKE_BUILD_TYPE MATCHES "Debug")
diff --git a/builds/cmake/Modules/FindSDL2.cmake b/builds/cmake/Modules/FindSDL2.cmake
index 4784a72a..55c77f41 100644
--- a/builds/cmake/Modules/FindSDL2.cmake
+++ b/builds/cmake/Modules/FindSDL2.cmake
@@ -125,7 +125,7 @@ if(WIN32 AND SDL2_LIBRARY)
 endif()


-if(WIN32 OR ANDROID OR IOS OR (APPLE AND NOT _sdl2_framework))
+if(WIN32 OR IOS OR (APPLE AND NOT _sdl2_framework))
    set(SDL2_EXTRA_REQUIRED SDL2_SDLMAIN_LIBRARY)
    find_library(SDL2_SDLMAIN_LIBRARY
        NAMES
@@ -256,6 +256,8 @@ if(SDL2_FOUND)
                    ${IOKIT} ${FORCEFEEDBACK} ${CARBON_LIBRARY}
                    ${COREAUDIO} ${AUDIOTOOLBOX} ${AUDIOUNIT} ${METAL}
                    ${ICONV_LIBRARY})
+       elseif(ANDROID)
+           # nothing to do?!
        else()
            # Remove -lSDL2 -lSDL2main from the pkg-config linker line,
            # to prevent linking against the system library
Was this page helpful?
0 / 5 - 0 ratings

Related issues

BuffMcBigHuge picture BuffMcBigHuge  路  4Comments

gadesx picture gadesx  路  5Comments

Ghabry picture Ghabry  路  4Comments

fdelapena picture fdelapena  路  3Comments

scoot404 picture scoot404  路  4Comments