상세 컨텐츠

본문 제목

안드로이드 android NDK jni 폴더안에 폴더를 만들어 빌드해보기 관련

스마트기기개발관련/OpenGL (그래픽, 게임)

by AlrepondTech 2020. 9. 18. 05:44

본문

반응형

 

 

=================================

=================================

=================================

 

 

 

출처: http://202psj.tistory.com/

 

JNI 을 할떄 코드들이 jni 한 폴더에 만 있어 정리하기 곤란할때가 있다.

그러면 아래 그림처럼 처리 해주면 도움이 된다.

 

 

 

LOCAL_PATH := $(call my-dir)

 

include $(CLEAR_VARS)

 

LS_CPP=$(subst $(1)/,,$(wildcard $(1)/*.cpp))

LOCAL_MODULE    := droidblaster

LOCAL_SRC_FILES := $(call LS_CPP,$(LOCAL_PATH)) \

 ./basea/TimeService.h \

 ./basea/TimeService.cpp \

 

LOCAL_LDLIBS    := -landroid -llog -lEGL -lGLESv1_CM

 

LOCAL_STATIC_LIBRARIES := android_native_app_glue png

 

include $(BUILD_SHARED_LIBRARY)

 

$(call import-module,android/native_app_glue)

$(call import-module,libpng)

#-----------------------------------------------------------------------------------

 

LOCAL_SRC_FILES := $(call LS_CPP,$(LOCAL_PATH)) \

이부분은 기본 jni 폴더 기본 부분이고

 ./basea/TimeService.h \

 ./basea/TimeService.cpp \

이부분은 폴더 생성뒤 정리한 추가 부분이다.

 

더 효율적인 방법이 있는 것 같은데 자꾸 에러가 나서 

더 연구해보구 더 올려야 겠다 ㅋㅋ 

더 좋은 방법 아시는분 리플 부탁 드립니다~!

 

추가

-------------------------------------------------------------

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

 

LS_CPP=$(subst $(1)/,,$(wildcard $(1)/*.cpp))

LS_CPP2=$(subst $(1)/,,$(wildcard $(1)/basea/*.cpp))

 

LOCAL_MODULE    := droidblaster

LOCAL_SRC_FILES := $(call LS_CPP,$(LOCAL_PATH)) \

 $(call LS_CPP2,$(LOCAL_PATH)) \

 

LOCAL_LDLIBS    := -landroid -llog -lEGL -lGLESv1_CM

LOCAL_STATIC_LIBRARIES := android_native_app_glue png

include $(BUILD_SHARED_LIBRARY)

$(call import-module,android/native_app_glue)

$(call import-module,libpng)

----------------------------

 ./basea/TimeService.h \

 ./basea/TimeService.cpp 

대신

LS_CPP2=$(subst $(1)/,,$(wildcard $(1)/basea/*.cpp))

여기에 폴더를 지정해주고

LOCAL_SRC_FILES := $(call LS_CPP,$(LOCAL_PATH)) \

 $(call LS_CPP2,$(LOCAL_PATH)) \

이런식으로 불러오는 것도 됩니다 ^^

 

 

 

 

반응형

 

728x90

 

 

=================================

=================================

=================================

 

 

 

출처: http://www.cocos2d-x.org/boards/6/topics/5321

edisun dongis there are way to create android.mk automaticallyMinggo ZhangRE: is there are way to create android.mk automaticallyedisun dongRE: is there are way to create android.mk automaticallyVictor LavrentyevRE: is there are way to create android.mk automatically小 苏RE: is there are way to create android.mk automaticallyVictor LavrentyevRE: is there are way to create android.mk automaticallyFoXx WeLlRE: is there are way to create android.mk automaticallyaries sulitRE: is there are way to create android.mk automaticallyPipero ManRE: is there are way to create android.mk automaticallyVictor LavrentyevRE: is there are way to create android.mk automaticallyaries sulitRE: is there are way to create android.mk automatically

 
edisun dong이(가) 약 일년 전에 추가함
the file is look like :
LOCAL_SRC_FILES := main.cpp \
../../../Classes/AppDelegate.cpp \
../../../Classes/GameMenu/GameMainMenu.cpp \

LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../../cocos2dx \
$(LOCAL_PATH)/../../../../cocos2dx/platform \
$(LOCAL_PATH)/../../../../cocos2dx/include \
$(LOCAL_PATH)/../../../../CocosDenshion/include \
$(LOCAL_PATH)/../../../Classes \
$(LOCAL_PATH)/../../../Classes/GameMenu

so any class i add ,i must modify the android.mk file,is any tool can fix that??
 
Minggo Zhang이(가) 약 일년 전에 추가함
No now, may be you can write a script to do it and share with the community.
 
edisun dong이(가) 약 일년 전에 추가함
OK,i will ,but not today,and i am not so good at shell,may be i will use .exe(windows) or .app(mac os),sorry linux guys 
 
Victor Lavrentyev이(가) 11달 전에 추가함
Include all *.cpp files automatically in Android.mk:
  • For Android.mk in "/Classes" folder (or you must correct the script)
  • If I want to rebuild project I resave Android.mk (this maybe dummy way) or you need to use the "always_rebuild" key (I don't know it)
Maybe I should share this in other place?
 
小 苏이(가) 11달 전에 추가함
it's good..
 
Victor Lavrentyev이(가) 11달 전에 추가함
O!
I found "../HelloWorld/android/jni/list.sh" with function list_alldir().
It look like useful for this issue, but don't used by default... strange.
 
FoXx WeLl이(가) 11달 전에 추가함
OK~ I fix android.mk to create android.mk automatically~
It can find any subdirs and *.cpp that u add in "Classes"

It's for cocos2d-1.0.1-x-0.10.0 !!!
or u can download file and cover it
Android.mk (994 Bytes)
 
aries sulit이(가) 9일 전에 추가함
Hi!
Is it okay for .mm classes? cause i have .mm classes on my iphone cocos2d-x project,
and after i modified Android.mk file. I got this error.

Compile++ thumb : game <= ClassicGameplay.mm
fatal error: directory compilation terminated.
make: *** [obj/local/armeabi/objs-debug/game/__/__/__/__/source/states/ClassicGameplay.o] Error 1
ERROR: NDK build failed.
 
Pipero Man이(가) 9일 전에 추가함
My Android.mk looks like this:
Compile all cpp in each folder. It is helpful if you add new cpps and don't want to add manually (but folders must be). All headers are relatives.
 
Victor Lavrentyev이(가) 9일 전에 추가함
hm...
1. Android don't understands Obj C language
2. "-name *.cpp" - it takes cpp files only
 
aries sulit이(가) 8일 전에 추가함
Hi! so.. I badly need to convert obj-c codes to c++ D:
Thanks BTW! 

 

 

=================================

=================================

=================================

 

 

반응형


관련글 더보기

댓글 영역