cmake_minimum_required(VERSION 3.18.1)
project("testndk")
add_library( # Sets the name of the library.
testndk
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
native-lib.cpp
)
find_library( # Sets the name of the path variable.
log-lib
# Specifies the name of the NDK library that
# you want CMake to locate.
log)
target_link_libraries( # Specifies the target library.
testndk
# Links the target library to the log library
# included in the NDK.
${log-lib})
5.增加OpenGL相关的库依赖。在CMakeList.txt中的target_link_libraries模块中加入: EGL,GLESv3,android。或者直接粘下面的。
cmake_minimum_required(VERSION 3.18.1)
project("testndk")
add_library( # Sets the name of the library.
testndk
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
native-lib.cpp//默认生成的cpp
)
find_library( # Sets the name of the path variable.
log-lib
# Specifies the name of the NDK library that
# you want CMake to locate.
log)
target_link_libraries( # Specifies the target library.
testndk //你自己起的名字
EGL
GLESv3
android
# Links the target library to the log library
# included in the NDK.
${log-lib})
6.编译项目,编译完后在默认的cpp里尝试引入openGL相关的库,如果有提示的话,那就证明成功喽。
#include
#include
#include
如果一切顺利的话,你就可以开始android - openGL之路啦。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)