IF(ANDROID)
# Not in CMake toolchain file, because the toolchain
# file is called several times and generally doesn't
- # seem to be meant for it:
+ # seem to be meant for modifying CFLAGS:
# '-mandroid' is not mandatory but doesn't hurt
# '-O0 -gstabs+' helps the currently buggy GDB port
- # '-DANDROID' is the Android build system convention
# Too late to manipulate ENV: SET(ENV{CFLAGS} "$ENV{CFLAGS} -mandroid")
# Not using _INIT variables, they seem to be used internally only
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mandroid")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -gstabs+")
- ADD_DEFINITIONS(-DANDROID)
ENDIF()
ENDIF()
IF(BUILD_SHARED_LIBS)
${DEMO_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}
)
ENDIF()
+
+# pkg-config support, to install at $(libdir)/pkgconfig
+# Define static build dependencies
+IF(WIN32)
+ SET(LIBS_PRIVATE "-lopengl32 -lwinmm -lgdi32")
+ELSEIF(ANDROID)
+ SET(LIBS_PRIVATE "-llog -landroid -lGLESv2 -lEGL")
+ELSE()
+ SET(LIBS_PRIVATE "-lX11 -lXxf86vm -lXrandr -lGLESv2 -lEGL")
+ENDIF()
+CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/freeglut.pc.in ${CMAKE_BINARY_DIR}/freeglut.pc @ONLY)
+INSTALL(FILES ${CMAKE_BINARY_DIR}/freeglut.pc DESTINATION share/pkgconfig)
make -j4
make install
-- Compile your own project, for instance if you use the autotools:
+- Compile your own project.
+
+For instance if you use the autotools:
PATH=/usr/src/ndk-standalone-9/bin:$PATH
./configure --host=arm-linux-androideabi --prefix=/somewhere
make
make install
+
+If you use CMake, you may want to copy our Android toolchain
+'android_toolchain.cmake':
+
+ cp .../android_toolchain.cmake .
+ cmake \
+ -D CMAKE_TOOLCHAIN_FILE=android_toolchain.cmake
+ -D CMAKE_INSTALL_PREFIX=/somewhere \
+ -D MY_PROG_OPTION=something ... \
+ .
+ make -j4
+ make install
include(CMakeForceCompiler)
# Prefix detection only works with compiler id "GNU"
CMAKE_FORCE_C_COMPILER(arm-linux-androideabi-gcc GNU)
+# '-DANDROID' is the Android build system convention
+ADD_DEFINITIONS(-DANDROID)
SET(ANDROID TRUE)