Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ndk-build is stupid and tries to compile any .cpp file in src #621

Closed
Ghabry opened this issue Oct 5, 2015 · 7 comments · Fixed by #2475
Closed

ndk-build is stupid and tries to compile any .cpp file in src #621

Ghabry opened this issue Oct 5, 2015 · 7 comments · Fixed by #2475

Comments

@Ghabry
Copy link
Member

Ghabry commented Oct 5, 2015

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 -.-

@fdelapena
Copy link
Contributor

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.

@fdelapena
Copy link
Contributor

Is this one fixed with the updated build?

@Ghabry
Copy link
Member Author

Ghabry commented Jan 14, 2016

Nope

@carstene1ns carstene1ns added this to the 0.6.0 milestone Apr 17, 2017
@carstene1ns carstene1ns self-assigned this Apr 17, 2017
@fmatthew5876
Copy link
Contributor

Does this bug still exist in 2019?

@carstene1ns
Copy link
Member

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

@Ghabry
Copy link
Member Author

Ghabry commented Feb 1, 2019

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.

@carstene1ns
Copy link
Member

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

@Ghabry Ghabry modified the milestones: 0.6.1, 0.6.2 May 5, 2019
@Ghabry Ghabry modified the milestones: 0.6.2, 0.6.3 Apr 9, 2020
Ghabry added a commit to Ghabry/easyrpg-player that referenced this issue Mar 11, 2021
To build set EASYRPG_TOOLCHAIN_DIR and EASYRPG_LIBLCF_DIR to the paths that contain all the Android toolchains.
Then run "gradle assembleRelease" and the magic happens.

Fix EasyRPG#621
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

4 participants