From Rafa Gaitan and Jorge Izquierdo, build support for Android NDK.
"- In order to build against GLES1 we execute: $ mkdir build_android_gles1 $ cd build_android_gles1 $ cmake .. -DOSG_BUILD_PLATFORM_ANDROID=ON -DDYNAMIC_OPENTHREADS=OFF -DDYNAMIC_OPENSCENEGRAPH=OFF -DANDROID_NDK=<path_to_android_ndk>/ -DOSG_GLES1_AVAILABLE=ON -DOSG_GL1_AVAILABLE=OFF -DOSG_GL2_AVAILABLE=OFF -DOSG_GL_DISPLAYLISTS_AVAILABLE=OFF -DJ=2 -DOSG_CPP_EXCEPTIONS_AVAILABLE=OFF $ make If all is correct you will have and static OSG inside: build_android_gles1/bin/ndk/local/armeabi. - GLES2 is not tested/proved, but I think it could be possible build it with the correct cmake flags. - The flag -DJ=2 is used to pass to the ndk-build the number of processors to speed up the building. - make install is not yet supported."
This commit is contained in:
parent
99aeca003b
commit
b24353b12c
127
CMakeLists.txt
127
CMakeLists.txt
@ -62,6 +62,34 @@ SET(OpenThreads_SOURCE_DIR ${OpenSceneGraph_SOURCE_DIR})
|
|||||||
# Maybe this can be used override existing behavior if needed?
|
# Maybe this can be used override existing behavior if needed?
|
||||||
SET(CMAKE_MODULE_PATH "${OpenSceneGraph_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}")
|
SET(CMAKE_MODULE_PATH "${OpenSceneGraph_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}")
|
||||||
|
|
||||||
|
## Option to enable Android build using AndroidNDK
|
||||||
|
OPTION(OSG_BUILD_PLATFORM_ANDROID OFF)
|
||||||
|
IF(OSG_BUILD_PLATFORM_ANDROID)
|
||||||
|
INCLUDE(OsgAndroidMacroUtils)
|
||||||
|
SET(ANDROID TRUE)
|
||||||
|
SET(ANDROID_PLATFORM 5)
|
||||||
|
FIND_PACKAGE(AndroidNDK REQUIRED)
|
||||||
|
|
||||||
|
SET(OSG_ANDROID_TEMPLATES "${CMAKE_SOURCE_DIR}/PlatformSpecifics/Android")
|
||||||
|
|
||||||
|
SET(J "4" CACHE STRING "how many processes for make -j <J>")
|
||||||
|
|
||||||
|
ADD_CUSTOM_COMMAND(
|
||||||
|
OUTPUT Android-OpenSceneGraph
|
||||||
|
DEPENDS ${CMAKE_BINARY_DIR}/Android.mk
|
||||||
|
COMMAND "${ANDROID_NDK}/ndk-build"
|
||||||
|
ARGS --directory=${CMAKE_BINARY_DIR} NDK_APPLICATION_MK=Application.mk -j${J} NDK_LOG=1
|
||||||
|
)
|
||||||
|
|
||||||
|
ADD_CUSTOM_TARGET(ndk ALL echo
|
||||||
|
DEPENDS Android-OpenSceneGraph
|
||||||
|
)
|
||||||
|
|
||||||
|
ADD_DEFINITIONS(-DANDROID)
|
||||||
|
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Okay, here's the problem: On some platforms, linking against OpenThreads
|
# Okay, here's the problem: On some platforms, linking against OpenThreads
|
||||||
# is not enough and explicit linking to the underlying thread library
|
# is not enough and explicit linking to the underlying thread library
|
||||||
@ -74,7 +102,9 @@ SET(CMAKE_MODULE_PATH "${OpenSceneGraph_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_
|
|||||||
# cases. With IRIX, we're going to hope explicit linking to the underlying
|
# cases. With IRIX, we're going to hope explicit linking to the underlying
|
||||||
# library is not necessary. We currently don't case for pthreads on Windows
|
# library is not necessary. We currently don't case for pthreads on Windows
|
||||||
# which might be an issue on things like Cygwin. This may need to be fixed.
|
# which might be an issue on things like Cygwin. This may need to be fixed.
|
||||||
FIND_PACKAGE(Threads)
|
IF(NOT ANDROID)
|
||||||
|
FIND_PACKAGE(Threads)
|
||||||
|
ENDIF()
|
||||||
IF(CMAKE_SYSTEM MATCHES IRIX)
|
IF(CMAKE_SYSTEM MATCHES IRIX)
|
||||||
# Erase CMAKE_THREAD_LIBS_INIT and hope it works
|
# Erase CMAKE_THREAD_LIBS_INIT and hope it works
|
||||||
SET(CMAKE_THREAD_LIBS_INIT "" CACHE INTERNAL "")
|
SET(CMAKE_THREAD_LIBS_INIT "" CACHE INTERNAL "")
|
||||||
@ -137,7 +167,7 @@ IF (OSG_MAINTAINER)
|
|||||||
|
|
||||||
ENDIF(OSG_MAINTAINER)
|
ENDIF(OSG_MAINTAINER)
|
||||||
|
|
||||||
|
IF(NOT ANDROID)
|
||||||
IF(APPLE)
|
IF(APPLE)
|
||||||
# Trying to get CMake to generate an XCode IPhone project, current efforts are to get iphoneos sdk 3.1 working
|
# Trying to get CMake to generate an XCode IPhone project, current efforts are to get iphoneos sdk 3.1 working
|
||||||
# Added option which needs manually setting to select the IPhone SDK for building. We can only have one of the below
|
# Added option which needs manually setting to select the IPhone SDK for building. We can only have one of the below
|
||||||
@ -182,8 +212,9 @@ ELSE()
|
|||||||
# Non-Apple: Find OpenGL
|
# Non-Apple: Find OpenGL
|
||||||
FIND_PACKAGE(OpenGL)
|
FIND_PACKAGE(OpenGL)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
IF(UNIX)
|
IF(UNIX AND NOT ANDROID)
|
||||||
# Not sure what this will do on Cygwin and Msys
|
# Not sure what this will do on Cygwin and Msys
|
||||||
# Also, remember OS X X11 is a user installed option so it may not exist.
|
# Also, remember OS X X11 is a user installed option so it may not exist.
|
||||||
FIND_PACKAGE(X11)
|
FIND_PACKAGE(X11)
|
||||||
@ -216,7 +247,7 @@ ENDIF()
|
|||||||
# Platform specific definitions
|
# Platform specific definitions
|
||||||
|
|
||||||
|
|
||||||
IF(WIN32)
|
IF(WIN32 AND NOT ANDROID)
|
||||||
|
|
||||||
IF(MSVC)
|
IF(MSVC)
|
||||||
# This option is to enable the /MP switch for Visual Studio 2005 and above compilers
|
# This option is to enable the /MP switch for Visual Studio 2005 and above compilers
|
||||||
@ -295,7 +326,7 @@ IF(WIN32)
|
|||||||
ENDIF(NOT OSG_MSVC_DEBUG_INCREMENTAL_LINK)
|
ENDIF(NOT OSG_MSVC_DEBUG_INCREMENTAL_LINK)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF(MSVC)
|
ENDIF(MSVC)
|
||||||
ENDIF(WIN32)
|
ENDIF(WIN32 AND NOT ANDROID)
|
||||||
|
|
||||||
########################################################################################################
|
########################################################################################################
|
||||||
##### these were settings located in SetupCommon.cmake used in Luigi builds.... find out what are useful
|
##### these were settings located in SetupCommon.cmake used in Luigi builds.... find out what are useful
|
||||||
@ -395,42 +426,47 @@ OPTION(BUILD_OSG_EXAMPLES "Enable to build OSG Examples" OFF)
|
|||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# 3rd Party Dependency Stuff
|
# 3rd Party Dependency Stuff
|
||||||
IF(WIN32)
|
IF(WIN32 AND NOT ANDROID)
|
||||||
INCLUDE(Find3rdPartyDependencies)
|
INCLUDE(Find3rdPartyDependencies)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
# Common to all platforms:
|
IF(ANDROID)
|
||||||
FIND_PACKAGE(FreeType)
|
# FIXME: add here any platform find
|
||||||
FIND_PACKAGE(Inventor)
|
ELSE()
|
||||||
FIND_PACKAGE(Jasper)
|
# Common to all platforms except android:
|
||||||
FIND_PACKAGE(OpenEXR)
|
FIND_PACKAGE(FreeType)
|
||||||
FIND_PACKAGE(COLLADA)
|
FIND_PACKAGE(Inventor)
|
||||||
FIND_PACKAGE(FBX)
|
FIND_PACKAGE(Jasper)
|
||||||
FIND_PACKAGE(ZLIB)
|
FIND_PACKAGE(OpenEXR)
|
||||||
FIND_PACKAGE(Xine)
|
FIND_PACKAGE(COLLADA)
|
||||||
FIND_PACKAGE(OpenVRML)
|
FIND_PACKAGE(FBX)
|
||||||
FIND_PACKAGE(Performer)
|
FIND_PACKAGE(ZLIB)
|
||||||
FIND_PACKAGE(GDAL)
|
FIND_PACKAGE(Xine)
|
||||||
FIND_PACKAGE(CURL)
|
FIND_PACKAGE(OpenVRML)
|
||||||
FIND_PACKAGE(ITK)
|
FIND_PACKAGE(Performer)
|
||||||
FIND_PACKAGE(LibVNCServer)
|
FIND_PACKAGE(GDAL)
|
||||||
FIND_PACKAGE(OurDCMTK)
|
FIND_PACKAGE(CURL)
|
||||||
FIND_PACKAGE(OpenAL)
|
FIND_PACKAGE(ITK)
|
||||||
FIND_PACKAGE(FFmpeg)
|
FIND_PACKAGE(LibVNCServer)
|
||||||
FIND_PACKAGE(DirectShow)
|
FIND_PACKAGE(OurDCMTK)
|
||||||
FIND_PACKAGE(SDL)
|
FIND_PACKAGE(OpenAL)
|
||||||
FIND_PACKAGE(Poppler-glib)
|
FIND_PACKAGE(FFmpeg)
|
||||||
FIND_PACKAGE(RSVG)
|
FIND_PACKAGE(DirectShow)
|
||||||
FIND_PACKAGE(GtkGl)
|
FIND_PACKAGE(SDL)
|
||||||
FIND_PACKAGE(DirectInput)
|
FIND_PACKAGE(Poppler-glib)
|
||||||
FIND_PACKAGE(NVTT)
|
FIND_PACKAGE(RSVG)
|
||||||
|
FIND_PACKAGE(GtkGl)
|
||||||
|
FIND_PACKAGE(DirectInput)
|
||||||
|
FIND_PACKAGE(NVTT)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
# Include macro utilities here
|
# Include macro utilities here
|
||||||
INCLUDE(OsgMacroUtils)
|
INCLUDE(OsgMacroUtils)
|
||||||
|
|
||||||
|
IF(NOT ANDROID)
|
||||||
# To select a specific version of QT define DESIRED_QT_VERSION
|
# To select a specific version of QT define DESIRED_QT_VERSION
|
||||||
# via cmake -DDESIRED_QT_VERSION=4
|
# via cmake -DDESIRED_QT_VERSION=4
|
||||||
IF (DESIRED_QT_VERSION)
|
IF (DESIRED_QT_VERSION)
|
||||||
|
|
||||||
IF (DESIRED_QT_VERSION MATCHES 4)
|
IF (DESIRED_QT_VERSION MATCHES 4)
|
||||||
FIND_PACKAGE(Qt4)
|
FIND_PACKAGE(Qt4)
|
||||||
@ -438,7 +474,7 @@ IF (DESIRED_QT_VERSION)
|
|||||||
FIND_PACKAGE(Qt3)
|
FIND_PACKAGE(Qt3)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
ELSE()
|
ELSE()
|
||||||
|
|
||||||
FIND_PACKAGE(Qt4)
|
FIND_PACKAGE(Qt4)
|
||||||
|
|
||||||
@ -446,10 +482,10 @@ ELSE()
|
|||||||
FIND_PACKAGE(Qt3)
|
FIND_PACKAGE(Qt3)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
ENDIF(NOT ANDROID)
|
||||||
#optional example related dependencies
|
#optional example related dependencies
|
||||||
IF (BUILD_OSG_EXAMPLES)
|
IF (BUILD_OSG_EXAMPLES AND NOT ANDROID)
|
||||||
|
|
||||||
|
|
||||||
FIND_PACKAGE(FLTK)
|
FIND_PACKAGE(FLTK)
|
||||||
@ -459,7 +495,7 @@ IF (BUILD_OSG_EXAMPLES)
|
|||||||
SET(wxWidgets_USE_LIBS base core gl net)
|
SET(wxWidgets_USE_LIBS base core gl net)
|
||||||
FIND_PACKAGE(wxWidgets)
|
FIND_PACKAGE(wxWidgets)
|
||||||
|
|
||||||
ENDIF(BUILD_OSG_EXAMPLES)
|
ENDIF(BUILD_OSG_EXAMPLES AND NOT ANDROID)
|
||||||
|
|
||||||
|
|
||||||
# Platform specific:
|
# Platform specific:
|
||||||
@ -476,7 +512,8 @@ ENDIF(BUILD_OSG_EXAMPLES)
|
|||||||
|
|
||||||
# Image readers/writers depend on 3rd party libraries except for OS X which
|
# Image readers/writers depend on 3rd party libraries except for OS X which
|
||||||
# can use Quicktime.
|
# can use Quicktime.
|
||||||
IF(NOT APPLE)
|
IF(NOT ANDROID)
|
||||||
|
IF(NOT APPLE)
|
||||||
FIND_PACKAGE(GIFLIB)
|
FIND_PACKAGE(GIFLIB)
|
||||||
FIND_PACKAGE(JPEG)
|
FIND_PACKAGE(JPEG)
|
||||||
FIND_PACKAGE(PNG)
|
FIND_PACKAGE(PNG)
|
||||||
@ -487,10 +524,11 @@ IF(NOT APPLE)
|
|||||||
FIND_PACKAGE(QuickTime)
|
FIND_PACKAGE(QuickTime)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
ELSE()
|
ELSE()
|
||||||
FIND_PACKAGE(QuickTime)
|
FIND_PACKAGE(QuickTime)
|
||||||
FIND_PACKAGE(QTKit)
|
FIND_PACKAGE(QTKit)
|
||||||
FIND_PACKAGE(CoreVideo)
|
FIND_PACKAGE(CoreVideo)
|
||||||
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
@ -690,7 +728,7 @@ ENDIF()
|
|||||||
# OSG Core
|
# OSG Core
|
||||||
ADD_SUBDIRECTORY(src)
|
ADD_SUBDIRECTORY(src)
|
||||||
|
|
||||||
IF (BUILD_OSG_APPLICATIONS)
|
IF (BUILD_OSG_APPLICATIONS AND NOT ANDROID)
|
||||||
ADD_SUBDIRECTORY(applications)
|
ADD_SUBDIRECTORY(applications)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
@ -966,3 +1004,12 @@ CONFIGURE_FILE(
|
|||||||
IMMEDIATE @ONLY)
|
IMMEDIATE @ONLY)
|
||||||
ADD_CUSTOM_TARGET(uninstall
|
ADD_CUSTOM_TARGET(uninstall
|
||||||
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
|
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
|
||||||
|
|
||||||
|
#
|
||||||
|
IF(ANDROID)
|
||||||
|
message(STATUS "Creating Android Makefile Master files" )
|
||||||
|
configure_file("${OSG_ANDROID_TEMPLATES}/Android.mk.master.in" "${CMAKE_BINARY_DIR}/Android.mk")
|
||||||
|
configure_file("${OSG_ANDROID_TEMPLATES}/Application.mk.master.in" "${CMAKE_BINARY_DIR}/Application.mk")
|
||||||
|
configure_file("${OSG_ANDROID_TEMPLATES}/AndroidManifest.xml.master.in" "${CMAKE_BINARY_DIR}/AndroidManifest.xml")
|
||||||
|
ENDIF(ANDROID)
|
||||||
|
|
||||||
|
45
CMakeModules/FindAndroidNDK.cmake
Normal file
45
CMakeModules/FindAndroidNDK.cmake
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
# Locate AndroidNDK
|
||||||
|
# This module defines
|
||||||
|
# ANDROID_NDK
|
||||||
|
# ANDROID_FOUND, if false, do not try to use AndroidNDK
|
||||||
|
#
|
||||||
|
|
||||||
|
FIND_PATH(ANDROID_NDK ndk-build
|
||||||
|
${ANDROID_NDK}
|
||||||
|
NO_DEFAULT_PATH
|
||||||
|
)
|
||||||
|
|
||||||
|
IF(NOT ANDROID_NDK)
|
||||||
|
FIND_PATH(ANDROID_NDK ndk-build
|
||||||
|
$ENV{ANDROID_NDK}
|
||||||
|
$ENV{ANDROID_ROOT}
|
||||||
|
NO_DEFAULT_PATH
|
||||||
|
)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
IF(NOT ANDROID_NDK)
|
||||||
|
FIND_PATH(ANDROID_NDK ndk-build
|
||||||
|
# search for r5b
|
||||||
|
~/android-ndk-r5b
|
||||||
|
~/android_develop/android-ndk-r5b
|
||||||
|
~/ndk-r5b
|
||||||
|
~/android_develop/ndk-r5b
|
||||||
|
# search for r5
|
||||||
|
~/android-ndk-r5
|
||||||
|
~/android_develop/android-ndk-r5
|
||||||
|
~/ndk-r5
|
||||||
|
~/android_develop/ndk-r5
|
||||||
|
# search for r4-crystax
|
||||||
|
~/android-ndk-r4-crystax
|
||||||
|
~/android_develop/android-ndk-r4-crystax
|
||||||
|
~/ndk-r4
|
||||||
|
~/android_develop/ndk-r4
|
||||||
|
)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
SET(ANDROID_FOUND "NO")
|
||||||
|
IF(ANDROID_NDK)
|
||||||
|
SET(ANDROID_FOUND "YES")
|
||||||
|
MESSAGE(STATUS "Android NDK found in: ${ANDROID_NDK}")
|
||||||
|
ENDIF(ANDROID_NDK)
|
||||||
|
|
55
CMakeModules/OsgAndroidMacroUtils.cmake
Normal file
55
CMakeModules/OsgAndroidMacroUtils.cmake
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
MACRO(SETUP_ANDROID_LIBRARY LIB_NAME)
|
||||||
|
|
||||||
|
foreach(arg ${TARGET_LIBRARIES})
|
||||||
|
set(MODULE_LIBS "${MODULE_LIBS} -l${arg}")
|
||||||
|
endforeach(arg ${TARGET_LIBRARIES})
|
||||||
|
|
||||||
|
foreach(arg ${TARGET_SRC})
|
||||||
|
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" n_f ${arg})
|
||||||
|
set(MODULE_SOURCES "${MODULE_SOURCES} ${n_f}")
|
||||||
|
endforeach(arg ${TARGET_SRC})
|
||||||
|
|
||||||
|
#SET(MODULE_INCLUDES "${CMAKE_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/include")
|
||||||
|
GET_DIRECTORY_PROPERTY(loc_includes INCLUDE_DIRECTORIES)
|
||||||
|
foreach(arg ${loc_includes})
|
||||||
|
IF(NOT "${arg}" MATCHES "/usr/include" AND NOT "${arg}" MATCHES "/usr/local/include")
|
||||||
|
set(MODULE_INCLUDES "${MODULE_INCLUDES} ${arg}")
|
||||||
|
ENDIF()
|
||||||
|
endforeach(arg ${loc_includes})
|
||||||
|
|
||||||
|
GET_DIRECTORY_PROPERTY(loc_definitions COMPILE_DEFINITIONS)
|
||||||
|
foreach(arg ${loc_definitions})
|
||||||
|
set(DEFINITIONS "${DEFINITIONS} -D${arg}")
|
||||||
|
endforeach(arg ${loc_definitions})
|
||||||
|
|
||||||
|
message(STATUS "##############Creating Android Makefile#################")
|
||||||
|
message(STATUS "name: ${LIB_NAME}")
|
||||||
|
|
||||||
|
set(MODULE_NAME ${LIB_NAME})
|
||||||
|
set(MODULE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
set(MODULE_FLAGS_C ${DEFINITIONS})
|
||||||
|
set(MODULE_FLAGS_CPP ${DEFINITIONS})
|
||||||
|
#TODO: determine if GLES2 or GLES
|
||||||
|
IF(OSG_GLES1_AVAILABLE)
|
||||||
|
SET(OPENGLES_LIBRARY -lGLESv1_CM)
|
||||||
|
ELSEIF(OSG_GLES2_AVAILABLE)
|
||||||
|
SET(OPENGLES_LIBRARY -lGLESv2)
|
||||||
|
ENDIF()
|
||||||
|
set(MODULE_LIBS "${MODULE_LIBS} ${OPENGLES_LIBRARY} -ldl")
|
||||||
|
if(NOT CPP_EXTENSION)
|
||||||
|
set(CPP_EXTENSION "cpp")
|
||||||
|
endif()
|
||||||
|
IF(NOT MODULE_USER_STATIC_OR_DYNAMIC)
|
||||||
|
MESSAGE(FATAL_ERROR "Not defined MODULE_USER_STATIC_OR_DYNAMIC")
|
||||||
|
ENDIF()
|
||||||
|
IF("MODULE_USER_STATIC_OR_DYNAMIC" MATCHES "STATIC")
|
||||||
|
SET(MODULE_BUILD_TYPE "\$\(BUILD_STATIC_LIBRARY\)")
|
||||||
|
ELSE()
|
||||||
|
SET(MODULE_BUILD_TYPE "\$\(BUILD_DYNAMIC_LIBRARY\)")
|
||||||
|
ENDIF()
|
||||||
|
set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} ${LIB_NAME}")
|
||||||
|
set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${CMAKE_CURRENT_BINARY_DIR}/Android.mk \n")
|
||||||
|
|
||||||
|
configure_file("${OSG_ANDROID_TEMPLATES}/Android.mk.modules.in" "${CMAKE_CURRENT_BINARY_DIR}/Android.mk")
|
||||||
|
|
||||||
|
ENDMACRO()
|
@ -210,7 +210,9 @@ ENDMACRO(SET_OUTPUT_DIR_PROPERTY_260 TARGET_TARGETNAME RELATIVE_OUTDIR)
|
|||||||
##########################################################################################################
|
##########################################################################################################
|
||||||
|
|
||||||
MACRO(SETUP_LIBRARY LIB_NAME)
|
MACRO(SETUP_LIBRARY LIB_NAME)
|
||||||
|
IF(ANDROID)
|
||||||
|
SETUP_ANDROID_LIBRARY(${LIB_NAME})
|
||||||
|
ELSE()
|
||||||
SET(TARGET_NAME ${LIB_NAME} )
|
SET(TARGET_NAME ${LIB_NAME} )
|
||||||
SET(TARGET_TARGETNAME ${LIB_NAME} )
|
SET(TARGET_TARGETNAME ${LIB_NAME} )
|
||||||
|
|
||||||
@ -236,10 +238,13 @@ MACRO(SETUP_LIBRARY LIB_NAME)
|
|||||||
LINK_CORELIB_DEFAULT(${LIB_NAME})
|
LINK_CORELIB_DEFAULT(${LIB_NAME})
|
||||||
|
|
||||||
INCLUDE(ModuleInstall OPTIONAL)
|
INCLUDE(ModuleInstall OPTIONAL)
|
||||||
|
ENDIF()
|
||||||
ENDMACRO(SETUP_LIBRARY LIB_NAME)
|
ENDMACRO(SETUP_LIBRARY LIB_NAME)
|
||||||
|
|
||||||
MACRO(SETUP_PLUGIN PLUGIN_NAME)
|
MACRO(SETUP_PLUGIN PLUGIN_NAME)
|
||||||
|
IF(ANDROID)
|
||||||
|
SETUP_ANDROID_LIBRARY(${TARGET_DEFAULT_PREFIX}${PLUGIN_NAME})
|
||||||
|
ELSE()
|
||||||
|
|
||||||
SET(TARGET_NAME ${PLUGIN_NAME} )
|
SET(TARGET_NAME ${PLUGIN_NAME} )
|
||||||
|
|
||||||
@ -324,6 +329,7 @@ MACRO(SETUP_PLUGIN PLUGIN_NAME)
|
|||||||
ARCHIVE DESTINATION lib${LIB_POSTFIX}/${OSG_PLUGINS} COMPONENT libopenscenegraph-dev
|
ARCHIVE DESTINATION lib${LIB_POSTFIX}/${OSG_PLUGINS} COMPONENT libopenscenegraph-dev
|
||||||
LIBRARY DESTINATION lib${LIB_POSTFIX}/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT})
|
LIBRARY DESTINATION lib${LIB_POSTFIX}/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT})
|
||||||
ENDIF(WIN32)
|
ENDIF(WIN32)
|
||||||
|
ENDIF()
|
||||||
ENDMACRO(SETUP_PLUGIN)
|
ENDMACRO(SETUP_PLUGIN)
|
||||||
|
|
||||||
|
|
||||||
|
7
PlatformSpecifics/Android/Android.mk.master.in
Normal file
7
PlatformSpecifics/Android/Android.mk.master.in
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#ANDROID ROOT MAKEFILE
|
||||||
|
OSG_ROOT := $(call my-dir)
|
||||||
|
LOCAL_PATH := $(call my-dir)
|
||||||
|
OSG_ROOT := $(LOCAL_PATH)
|
||||||
|
OSGInclude := $(OSG_ROOT)/include/OpenThreads \
|
||||||
|
$(OSG_ROOT)/include/osg
|
||||||
|
include src/Android.mk
|
23
PlatformSpecifics/Android/Android.mk.modules.in
Normal file
23
PlatformSpecifics/Android/Android.mk.modules.in
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#ANDROID makefile ${MODULE_NAME}
|
||||||
|
|
||||||
|
LOCAL_PATH := ${MODULE_DIR}
|
||||||
|
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
|
LOCAL_CPP_EXTENSION := ${CPP_EXTENSION}
|
||||||
|
|
||||||
|
LOCAL_LDLIBS := ${MODULE_LIBS}
|
||||||
|
|
||||||
|
LOCAL_MODULE := ${MODULE_NAME}
|
||||||
|
|
||||||
|
LOCAL_SRC_FILES := ${MODULE_SOURCES}
|
||||||
|
|
||||||
|
LOCAL_C_INCLUDES := ${MODULE_INCLUDES}
|
||||||
|
|
||||||
|
LOCAL_CFLAGS := ${MODULE_FLAGS_C}
|
||||||
|
|
||||||
|
LOCAL_CPPFLAGS := ${MODULE_FLAGS_CPP}
|
||||||
|
|
||||||
|
#include $(BUILD_STATIC_LIBRARY)
|
||||||
|
include ${MODULE_BUILD_TYPE}
|
||||||
|
|
17
PlatformSpecifics/Android/Android.mk.serializers.in
Normal file
17
PlatformSpecifics/Android/Android.mk.serializers.in
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#ANDROID makefile in src
|
||||||
|
|
||||||
|
SERIALIZER_ROOT := $(call my-dir)
|
||||||
|
LOCAL_PATH := $(call my-dir)
|
||||||
|
SERIALIZER_ROOT := $(LOCAL_PATH)
|
||||||
|
|
||||||
|
#include $(call all-subdir-makefiles)
|
||||||
|
include $(SERIALIZER_ROOT)/osg/Android.mk
|
||||||
|
include $(SERIALIZER_ROOT)/osgAnimation/Android.mk
|
||||||
|
include $(SERIALIZER_ROOT)/osgFX/Android.mk
|
||||||
|
include $(SERIALIZER_ROOT)/osgManipulator/Android.mk
|
||||||
|
include $(SERIALIZER_ROOT)/osgParticle/Android.mk
|
||||||
|
include $(SERIALIZER_ROOT)/osgShadow/Android.mk
|
||||||
|
include $(SERIALIZER_ROOT)/osgSim/Android.mk
|
||||||
|
include $(SERIALIZER_ROOT)/osgTerrain/Android.mk
|
||||||
|
include $(SERIALIZER_ROOT)/osgText/Android.mk
|
||||||
|
include $(SERIALIZER_ROOT)/osgVolume/Android.mk
|
8
PlatformSpecifics/Android/Android.mk.src.in
Normal file
8
PlatformSpecifics/Android/Android.mk.src.in
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#ANDROID makefile in src
|
||||||
|
|
||||||
|
SRC_ROOT := $(call my-dir)
|
||||||
|
LOCAL_PATH := $(call my-dir)
|
||||||
|
SRC_ROOT := $(LOCAL_PATH)
|
||||||
|
|
||||||
|
$ENV{AND_OSG_LIB_PATHS}
|
||||||
|
|
7
PlatformSpecifics/Android/AndroidManifest.xml.master.in
Normal file
7
PlatformSpecifics/Android/AndroidManifest.xml.master.in
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.openscenegraph"
|
||||||
|
android:versionCode="1"
|
||||||
|
android:versionName="1.0">
|
||||||
|
|
||||||
|
</manifest>
|
15
PlatformSpecifics/Android/Application.mk.master.in
Normal file
15
PlatformSpecifics/Android/Application.mk.master.in
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#ANDROID APPLICATION MAKEFILE
|
||||||
|
APP_BUILD_SCRIPT := $(call my-dir)/Android.mk
|
||||||
|
APP_PROJECT_PATH := $(call my-dir)
|
||||||
|
|
||||||
|
APP_OPTIM := release
|
||||||
|
|
||||||
|
APP_PLATFORM := android-5
|
||||||
|
APP_STL := gnustl_static
|
||||||
|
APP_CPPFLAGS := -fexceptions -frtti
|
||||||
|
#APP_CPPFLAGS := -Os -mthumb-interwork -fno-short-enums
|
||||||
|
#APP_CPPFLAGS := -Wl,--no-undefined
|
||||||
|
|
||||||
|
APP_ABI := armeabi
|
||||||
|
#armeabi-v7a
|
||||||
|
APP_MODULES := $ENV{AND_OSG_LIB_NAMES}
|
@ -14,6 +14,9 @@ SET(TARGET_COMMON_LIBRARIES
|
|||||||
osgText
|
osgText
|
||||||
)
|
)
|
||||||
|
|
||||||
|
IF(ANDROID)
|
||||||
|
# ADD_SUBDIRECTORY(osgandroidsimple)
|
||||||
|
ELSE(ANDROID)
|
||||||
|
|
||||||
IF(DYNAMIC_OPENSCENEGRAPH)
|
IF(DYNAMIC_OPENSCENEGRAPH)
|
||||||
|
|
||||||
@ -246,3 +249,5 @@ ELSE(DYNAMIC_OPENSCENEGRAPH)
|
|||||||
|
|
||||||
ENDIF(DYNAMIC_OPENSCENEGRAPH)
|
ENDIF(DYNAMIC_OPENSCENEGRAPH)
|
||||||
|
|
||||||
|
ENDIF(ANDROID)
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@
|
|||||||
#if defined(_WIN64)
|
#if defined(_WIN64)
|
||||||
typedef __int64 GLintptr;
|
typedef __int64 GLintptr;
|
||||||
typedef __int64 GLsizeiptr;
|
typedef __int64 GLsizeiptr;
|
||||||
#elif defined(__ia64__) || defined(__x86_64__)
|
#elif defined(__ia64__) || defined(__x86_64__) || defined(ANDROID)
|
||||||
typedef long int GLintptr;
|
typedef long int GLintptr;
|
||||||
typedef long int GLsizeiptr;
|
typedef long int GLsizeiptr;
|
||||||
#else
|
#else
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#ifdef __CYGWIN__
|
#if defined(__CYGWIN__) || defined(ANDROID)
|
||||||
namespace std
|
namespace std
|
||||||
{
|
{
|
||||||
typedef basic_string<wchar_t> wstring;
|
typedef basic_string<wchar_t> wstring;
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
IF(ANDROID)
|
||||||
|
SET(MODULE_USER_STATIC_OR_DYNAMIC ${OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC})
|
||||||
|
ENDIF(ANDROID)
|
||||||
|
|
||||||
#the old construct SUBDIRS( was substituded by ADD_SUBDIRECTORY that is to be preferred according on CMake docs.
|
#the old construct SUBDIRS( was substituded by ADD_SUBDIRECTORY that is to be preferred according on CMake docs.
|
||||||
FOREACH( mylibfolder
|
FOREACH( mylibfolder
|
||||||
OpenThreads
|
OpenThreads
|
||||||
@ -26,7 +30,7 @@ FOREACH( mylibfolder
|
|||||||
|
|
||||||
ENDFOREACH()
|
ENDFOREACH()
|
||||||
|
|
||||||
IF (QT4_FOUND)
|
IF (QT4_FOUND AND NOT ANDROID)
|
||||||
ADD_SUBDIRECTORY(osgQt)
|
ADD_SUBDIRECTORY(osgQt)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
@ -34,3 +38,7 @@ IF(MSVC80 OR MSVC90)
|
|||||||
OPTION(OSG_MSVC_GENERATE_PLUGINS_AND_WRAPPERS_MANIFESTS "Generate or not manifests files under VS8 for dynamically loaded dlls" ON)
|
OPTION(OSG_MSVC_GENERATE_PLUGINS_AND_WRAPPERS_MANIFESTS "Generate or not manifests files under VS8 for dynamically loaded dlls" ON)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
IF(ANDROID)
|
||||||
|
configure_file("${OSG_ANDROID_TEMPLATES}/Android.mk.src.in" "${CMAKE_CURRENT_BINARY_DIR}/Android.mk")
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
@ -9,7 +9,9 @@ SET(OPENTHREADS_SOVERSION 12)
|
|||||||
|
|
||||||
SET(OPENTHREADS_VERSION ${OPENTHREADS_MAJOR_VERSION}.${OPENTHREADS_MINOR_VERSION}.${OPENTHREADS_PATCH_VERSION})
|
SET(OPENTHREADS_VERSION ${OPENTHREADS_MAJOR_VERSION}.${OPENTHREADS_MINOR_VERSION}.${OPENTHREADS_PATCH_VERSION})
|
||||||
|
|
||||||
INCLUDE(CheckAtomicOps)
|
IF(NOT ANDROID)
|
||||||
|
INCLUDE(CheckAtomicOps)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
# User Options
|
# User Options
|
||||||
OPTION(DYNAMIC_OPENTHREADS "Set to ON to build OpenThreads for dynamic linking. Use OFF for static." ON)
|
OPTION(DYNAMIC_OPENTHREADS "Set to ON to build OpenThreads for dynamic linking. Use OFF for static." ON)
|
||||||
@ -62,9 +64,10 @@ SET(OpenThreads_PUBLIC_HEADERS
|
|||||||
${OPENTHREADS_CONFIG_HEADER}
|
${OPENTHREADS_CONFIG_HEADER}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
IF(NOT ANDROID)
|
||||||
# Use our modified version of FindThreads.cmake which has Sproc hacks.
|
# Use our modified version of FindThreads.cmake which has Sproc hacks.
|
||||||
FIND_PACKAGE(Threads)
|
FIND_PACKAGE(Threads)
|
||||||
|
ENDIF()
|
||||||
# Do we have sproc?
|
# Do we have sproc?
|
||||||
IF(CMAKE_SYSTEM MATCHES IRIX)
|
IF(CMAKE_SYSTEM MATCHES IRIX)
|
||||||
IF(CMAKE_USE_SPROC_INIT)
|
IF(CMAKE_USE_SPROC_INIT)
|
||||||
@ -83,7 +86,9 @@ IF(QT4_FOUND)
|
|||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
# Maybe we should be using the FindThreads.cmake module?
|
# Maybe we should be using the FindThreads.cmake module?
|
||||||
IF(QT4_FOUND AND BUILD_OPENTHREADS_WITH_QT)
|
IF(ANDROID)
|
||||||
|
SUBDIRS(pthreads)
|
||||||
|
ELSEIF(QT4_FOUND AND BUILD_OPENTHREADS_WITH_QT)
|
||||||
SUBDIRS(qt)
|
SUBDIRS(qt)
|
||||||
ELSEIF(WIN32)
|
ELSEIF(WIN32)
|
||||||
# So I think Cygwin wants to use pthreads
|
# So I think Cygwin wants to use pthreads
|
||||||
|
@ -6,11 +6,9 @@ INCLUDE (CheckSymbolExists)
|
|||||||
INCLUDE (CheckCXXSourceCompiles)
|
INCLUDE (CheckCXXSourceCompiles)
|
||||||
|
|
||||||
SET(LIB_NAME OpenThreads)
|
SET(LIB_NAME OpenThreads)
|
||||||
SET(LIB_PUBLIC_HEADERS ${OpenThreads_PUBLIC_HEADERS})
|
SET(TARGET_H ${OpenThreads_PUBLIC_HEADERS})
|
||||||
|
|
||||||
ADD_LIBRARY(${LIB_NAME}
|
SET(TARGET_SRC
|
||||||
${OPENTHREADS_USER_DEFINED_DYNAMIC_OR_STATIC}
|
|
||||||
${LIB_PUBLIC_HEADERS}
|
|
||||||
PThread.cpp
|
PThread.cpp
|
||||||
PThreadBarrier.cpp
|
PThreadBarrier.cpp
|
||||||
PThreadBarrierPrivateData.h
|
PThreadBarrierPrivateData.h
|
||||||
@ -22,19 +20,23 @@ ADD_LIBRARY(${LIB_NAME}
|
|||||||
../common/Version.cpp
|
../common/Version.cpp
|
||||||
../common/Atomic.cpp
|
../common/Atomic.cpp
|
||||||
)
|
)
|
||||||
|
IF(ANDROID)
|
||||||
IF(OPENTHREADS_SONAMES)
|
ADD_DEFINITIONS(-D_GNU_SOURCE)
|
||||||
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES VERSION ${OPENTHREADS_VERSION} SOVERSION ${OPENTHREADS_SOVERSION})
|
SET(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_GNU_SOURCE")
|
||||||
ENDIF()
|
SET(MODULE_USER_STATIC_OR_DYNAMIC ${OPENTHREADS_USER_DEFINED_DYNAMIC_OR_STATIC})
|
||||||
|
#SET(CPP_EXTENSION "c++")
|
||||||
SET(CMAKE_REQUIRED_LIBRARIES_SAFE "${CMAKE_REQUIRED_LIBRARIES}")
|
SETUP_ANDROID_LIBRARY(${LIB_NAME})
|
||||||
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
|
|
||||||
|
|
||||||
|
|
||||||
CHECK_FUNCTION_EXISTS(pthread_yield HAVE_PTHREAD_YIELD)
|
|
||||||
IF(HAVE_PTHREAD_YIELD)
|
|
||||||
ADD_DEFINITIONS(-DHAVE_PTHREAD_YIELD)
|
|
||||||
ELSE()
|
ELSE()
|
||||||
|
|
||||||
|
# should check?
|
||||||
|
ADD_DEFINITIONS(-DHAVE_PTHREAD_TESTCANCEL)
|
||||||
|
ADD_DEFINITIONS(-DHAVE_PTHREAD_CANCEL)
|
||||||
|
ADD_DEFINITIONS(-DHAVE_PTHREAD_SETCANCELSTATE)
|
||||||
|
|
||||||
|
CHECK_FUNCTION_EXISTS(pthread_yield HAVE_PTHREAD_YIELD)
|
||||||
|
IF(HAVE_PTHREAD_YIELD)
|
||||||
|
ADD_DEFINITIONS(-DHAVE_PTHREAD_YIELD)
|
||||||
|
ELSE()
|
||||||
# sched_yield appears not in libc, pthreads or whatever on some systems
|
# sched_yield appears not in libc, pthreads or whatever on some systems
|
||||||
CHECK_FUNCTION_EXISTS(sched_yield HAVE_SCHED_YIELD)
|
CHECK_FUNCTION_EXISTS(sched_yield HAVE_SCHED_YIELD)
|
||||||
IF(NOT HAVE_SCHED_YIELD)
|
IF(NOT HAVE_SCHED_YIELD)
|
||||||
@ -46,26 +48,26 @@ ELSE()
|
|||||||
IF(HAVE_SCHED_YIELD)
|
IF(HAVE_SCHED_YIELD)
|
||||||
ADD_DEFINITIONS(-DHAVE_SCHED_YIELD)
|
ADD_DEFINITIONS(-DHAVE_SCHED_YIELD)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||||
# need to have that for pthread_setaffinity_np on linux
|
# need to have that for pthread_setaffinity_np on linux
|
||||||
ADD_DEFINITIONS(-D_GNU_SOURCE)
|
ADD_DEFINITIONS(-D_GNU_SOURCE)
|
||||||
SET(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_GNU_SOURCE")
|
SET(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_GNU_SOURCE")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
CHECK_FUNCTION_EXISTS(pthread_setconcurrency HAVE_PTHREAD_SETCONCURRENCY)
|
CHECK_FUNCTION_EXISTS(pthread_setconcurrency HAVE_PTHREAD_SETCONCURRENCY)
|
||||||
IF(HAVE_PTHREAD_SETCONCURRENCY)
|
IF(HAVE_PTHREAD_SETCONCURRENCY)
|
||||||
ADD_DEFINITIONS(-DHAVE_PTHREAD_SETCONCURRENCY)
|
ADD_DEFINITIONS(-DHAVE_PTHREAD_SETCONCURRENCY)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
CHECK_FUNCTION_EXISTS(pthread_getconcurrency HAVE_PTHREAD_GETCONCURRENCY)
|
CHECK_FUNCTION_EXISTS(pthread_getconcurrency HAVE_PTHREAD_GETCONCURRENCY)
|
||||||
IF(HAVE_PTHREAD_GETCONCURRENCY)
|
IF(HAVE_PTHREAD_GETCONCURRENCY)
|
||||||
ADD_DEFINITIONS(-DHAVE_PTHREAD_GETCONCURRENCY)
|
ADD_DEFINITIONS(-DHAVE_PTHREAD_GETCONCURRENCY)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
CHECK_FUNCTION_EXISTS(pthread_setaffinity_np HAVE_PTHREAD_SETAFFINITY_NP)
|
CHECK_FUNCTION_EXISTS(pthread_setaffinity_np HAVE_PTHREAD_SETAFFINITY_NP)
|
||||||
IF(HAVE_PTHREAD_SETAFFINITY_NP)
|
IF(HAVE_PTHREAD_SETAFFINITY_NP)
|
||||||
# double check that pthread_setaffinity_np is available as FreeBSD header doesn't contain required function
|
# double check that pthread_setaffinity_np is available as FreeBSD header doesn't contain required function
|
||||||
CHECK_CXX_SOURCE_COMPILES("
|
CHECK_CXX_SOURCE_COMPILES("
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
@ -80,11 +82,11 @@ IF(HAVE_PTHREAD_SETAFFINITY_NP)
|
|||||||
IF (NOT COMPILES_PTHREAD_SETAFFINITY_NP)
|
IF (NOT COMPILES_PTHREAD_SETAFFINITY_NP)
|
||||||
SET(HAVE_PTHREAD_SETAFFINITY_NP OFF)
|
SET(HAVE_PTHREAD_SETAFFINITY_NP OFF)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF(HAVE_PTHREAD_SETAFFINITY_NP)
|
IF(HAVE_PTHREAD_SETAFFINITY_NP)
|
||||||
ADD_DEFINITIONS(-DHAVE_PTHREAD_SETAFFINITY_NP)
|
ADD_DEFINITIONS(-DHAVE_PTHREAD_SETAFFINITY_NP)
|
||||||
ELSE()
|
ELSE()
|
||||||
CHECK_CXX_SOURCE_COMPILES("
|
CHECK_CXX_SOURCE_COMPILES("
|
||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
int main() {
|
int main() {
|
||||||
@ -96,46 +98,60 @@ ELSE()
|
|||||||
ADD_DEFINITIONS(-DHAVE_THREE_PARAM_SCHED_SETAFFINITY)
|
ADD_DEFINITIONS(-DHAVE_THREE_PARAM_SCHED_SETAFFINITY)
|
||||||
ELSE()
|
ELSE()
|
||||||
CHECK_CXX_SOURCE_COMPILES("
|
CHECK_CXX_SOURCE_COMPILES("
|
||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
int main() {
|
int main() {
|
||||||
cpu_set_t cpumask;
|
cpu_set_t cpumask;
|
||||||
sched_setaffinity( 0, &cpumask );
|
sched_setaffinity( 0, &cpumask );
|
||||||
return 0;
|
return 0;
|
||||||
}" HAVE_TWO_PARAM_SCHED_SETAFFINITY)
|
}" HAVE_TWO_PARAM_SCHED_SETAFFINITY)
|
||||||
IF(HAVE_TWO_PARAM_SCHED_SETAFFINITY)
|
IF(HAVE_TWO_PARAM_SCHED_SETAFFINITY)
|
||||||
ADD_DEFINITIONS(-DHAVE_TWO_PARAM_SCHED_SETAFFINITY)
|
ADD_DEFINITIONS(-DHAVE_TWO_PARAM_SCHED_SETAFFINITY)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
SET(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES_SAFE}")
|
SET(CMAKE_REQUIRED_LIBRARIES_SAFE "${CMAKE_REQUIRED_LIBRARIES}")
|
||||||
|
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(${LIB_NAME}
|
ADD_LIBRARY(${LIB_NAME}
|
||||||
|
${OPENTHREADS_USER_DEFINED_DYNAMIC_OR_STATIC}
|
||||||
|
${TARGET_H}
|
||||||
|
${TARGET_SRC}
|
||||||
|
)
|
||||||
|
|
||||||
|
IF(OPENTHREADS_SONAMES)
|
||||||
|
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES VERSION ${OPENTHREADS_VERSION} SOVERSION ${OPENTHREADS_SOVERSION})
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
|
||||||
|
SET(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES_SAFE}")
|
||||||
|
|
||||||
|
TARGET_LINK_LIBRARIES(${LIB_NAME}
|
||||||
${CMAKE_THREAD_LIBS_INIT}
|
${CMAKE_THREAD_LIBS_INIT}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Since we're building different platforms binaries in
|
# Since we're building different platforms binaries in
|
||||||
# their respective directories, we need to set the
|
# their respective directories, we need to set the
|
||||||
# link directory so it can find this location.
|
# link directory so it can find this location.
|
||||||
LINK_DIRECTORIES(
|
LINK_DIRECTORIES(
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
INSTALL(
|
INSTALL(
|
||||||
TARGETS OpenThreads
|
TARGETS OpenThreads
|
||||||
ARCHIVE DESTINATION lib${LIB_POSTFIX} COMPONENT libopenthreads-dev
|
ARCHIVE DESTINATION lib${LIB_POSTFIX} COMPONENT libopenthreads-dev
|
||||||
LIBRARY DESTINATION lib${LIB_POSTFIX} COMPONENT libopenthreads
|
LIBRARY DESTINATION lib${LIB_POSTFIX} COMPONENT libopenthreads
|
||||||
RUNTIME DESTINATION bin COMPONENT libopenthreads
|
RUNTIME DESTINATION bin COMPONENT libopenthreads
|
||||||
)
|
)
|
||||||
|
|
||||||
IF(NOT OSG_COMPILE_FRAMEWORKS)
|
IF(NOT OSG_COMPILE_FRAMEWORKS)
|
||||||
INSTALL(
|
INSTALL(
|
||||||
FILES ${OpenThreads_PUBLIC_HEADERS}
|
FILES ${OpenThreads_PUBLIC_HEADERS}
|
||||||
DESTINATION include/OpenThreads
|
DESTINATION include/OpenThreads
|
||||||
COMPONENT libopenthreads-dev
|
COMPONENT libopenthreads-dev
|
||||||
)
|
)
|
||||||
|
|
||||||
ELSE()
|
ELSE()
|
||||||
MESSAGE("Will compile OpenThreads.framework!")
|
MESSAGE("Will compile OpenThreads.framework!")
|
||||||
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES
|
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES
|
||||||
FRAMEWORK TRUE
|
FRAMEWORK TRUE
|
||||||
@ -143,5 +159,6 @@ ELSE()
|
|||||||
PUBLIC_HEADER "${OpenThreads_PUBLIC_HEADERS}"
|
PUBLIC_HEADER "${OpenThreads_PUBLIC_HEADERS}"
|
||||||
INSTALL_NAME_DIR "${OSG_COMPILE_FRAMEWORKS_INSTALL_NAME_DIR}"
|
INSTALL_NAME_DIR "${OSG_COMPILE_FRAMEWORKS_INSTALL_NAME_DIR}"
|
||||||
)
|
)
|
||||||
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
#commented out# INCLUDE(ModuleInstall OPTIONAL)
|
#commented out# INCLUDE(ModuleInstall OPTIONAL)
|
||||||
|
@ -23,11 +23,13 @@
|
|||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
#if defined __linux || defined __sun || defined __APPLE__
|
#if defined __linux || defined __sun || defined __APPLE__ || ANDROID
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#include <sys/unistd.h>
|
#if !defined ANDROID
|
||||||
|
#include <sys/unistd.h>
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if defined(__sgi)
|
#if defined(__sgi)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -44,6 +46,12 @@
|
|||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(ANDROID)
|
||||||
|
#ifndef PAGE_SIZE
|
||||||
|
#define PAGE_SIZE 0x400
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <OpenThreads/Thread>
|
#include <OpenThreads/Thread>
|
||||||
#include "PThreadPrivateData.h"
|
#include "PThreadPrivateData.h"
|
||||||
|
|
||||||
@ -723,7 +731,7 @@ int Thread::join()
|
|||||||
//
|
//
|
||||||
int Thread::testCancel()
|
int Thread::testCancel()
|
||||||
{
|
{
|
||||||
|
#if defined(HAVE_PTHREAD_TESTCANCEL)
|
||||||
PThreadPrivateData *pd = static_cast<PThreadPrivateData *> (_prvData);
|
PThreadPrivateData *pd = static_cast<PThreadPrivateData *> (_prvData);
|
||||||
|
|
||||||
if(pthread_self() != pd->tid)
|
if(pthread_self() != pd->tid)
|
||||||
@ -732,7 +740,9 @@ int Thread::testCancel()
|
|||||||
pthread_testcancel();
|
pthread_testcancel();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -744,7 +754,7 @@ int Thread::testCancel()
|
|||||||
//
|
//
|
||||||
int Thread::cancel()
|
int Thread::cancel()
|
||||||
{
|
{
|
||||||
|
#if defined(HAVE_PTHREAD_CANCEL)
|
||||||
PThreadPrivateData *pd = static_cast<PThreadPrivateData *> (_prvData);
|
PThreadPrivateData *pd = static_cast<PThreadPrivateData *> (_prvData);
|
||||||
if (pd->isRunning)
|
if (pd->isRunning)
|
||||||
{
|
{
|
||||||
@ -753,6 +763,9 @@ int Thread::cancel()
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -763,9 +776,11 @@ int Thread::cancel()
|
|||||||
//
|
//
|
||||||
int Thread::setCancelModeDisable()
|
int Thread::setCancelModeDisable()
|
||||||
{
|
{
|
||||||
|
#if defined(HAVE_PTHREAD_SETCANCELSTATE)
|
||||||
return pthread_setcancelstate( PTHREAD_CANCEL_DISABLE, 0 );
|
return pthread_setcancelstate( PTHREAD_CANCEL_DISABLE, 0 );
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -776,10 +791,14 @@ int Thread::setCancelModeDisable()
|
|||||||
//
|
//
|
||||||
int Thread::setCancelModeAsynchronous() {
|
int Thread::setCancelModeAsynchronous() {
|
||||||
|
|
||||||
|
#if defined(HAVE_PTHREAD_SETCANCELSTATE)
|
||||||
int status = pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, 0);
|
int status = pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, 0);
|
||||||
if(status != 0) return status;
|
if(status != 0) return status;
|
||||||
|
|
||||||
return pthread_setcancelstate( PTHREAD_CANCEL_ENABLE, 0);
|
return pthread_setcancelstate( PTHREAD_CANCEL_ENABLE, 0);
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -790,11 +809,14 @@ int Thread::setCancelModeAsynchronous() {
|
|||||||
//
|
//
|
||||||
int Thread::setCancelModeDeferred() {
|
int Thread::setCancelModeDeferred() {
|
||||||
|
|
||||||
|
#if defined(HAVE_PTHREAD_SETCANCELSTATE)
|
||||||
int status = pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, 0);
|
int status = pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, 0);
|
||||||
if(status != 0) return status;
|
if(status != 0) return status;
|
||||||
|
|
||||||
return pthread_setcancelstate( PTHREAD_CANCEL_ENABLE, 0);
|
return pthread_setcancelstate( PTHREAD_CANCEL_ENABLE, 0);
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -947,7 +969,12 @@ int Thread::YieldCurrentThread()
|
|||||||
//
|
//
|
||||||
int Thread::microSleep(unsigned int microsec)
|
int Thread::microSleep(unsigned int microsec)
|
||||||
{
|
{
|
||||||
|
#if !defined(ANDROID)
|
||||||
return ::usleep(microsec);
|
return ::usleep(microsec);
|
||||||
|
#else
|
||||||
|
::usleep(microsec);
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -166,7 +166,9 @@ ADD_SUBDIRECTORY(obj)
|
|||||||
|
|
||||||
ADD_SUBDIRECTORY(pic)
|
ADD_SUBDIRECTORY(pic)
|
||||||
ADD_SUBDIRECTORY(stl)
|
ADD_SUBDIRECTORY(stl)
|
||||||
ADD_SUBDIRECTORY(3ds)
|
IF(NOT ANDROID)
|
||||||
|
ADD_SUBDIRECTORY(3ds)
|
||||||
|
ENDIF()
|
||||||
ADD_SUBDIRECTORY(ac)
|
ADD_SUBDIRECTORY(ac)
|
||||||
ADD_SUBDIRECTORY(pov)
|
ADD_SUBDIRECTORY(pov)
|
||||||
|
|
||||||
@ -203,7 +205,7 @@ ENDIF()
|
|||||||
# ADD_SUBDIRECTORY(OpenAL)
|
# ADD_SUBDIRECTORY(OpenAL)
|
||||||
# ENDIF()
|
# ENDIF()
|
||||||
|
|
||||||
IF(APPLE)
|
IF(APPLE AND NOT ANDROID)
|
||||||
ADD_SUBDIRECTORY(imageio)
|
ADD_SUBDIRECTORY(imageio)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "BITSET.h"
|
#include "BITSET.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
bool BITSET::Init(int numberOfBits)
|
bool BITSET::Init(int numberOfBits)
|
||||||
{
|
{
|
||||||
|
@ -47,11 +47,19 @@ IF(CMAKE_COMPILER_IS_GNUCXX)
|
|||||||
STRING(REGEX REPLACE "-pedantic" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
STRING(REGEX REPLACE "-pedantic" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
SET(TARGET_LIBRARIES_VARS
|
SET(TARGET_LIBRARIES
|
||||||
QT_QTCORE_LIBRARY
|
${TARGET_LIBRARIES}
|
||||||
QT_QTGUI_LIBRARY
|
${QT_QTCORE_LIBRARY}
|
||||||
QT_QTOPENGL_LIBRARY
|
${QT_QTGUI_LIBRARY}
|
||||||
|
${QT_QTOPENGL_LIBRARY}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# FIXME: This should work but something with the LINK_WITH_VARIABLES macro is not working
|
||||||
|
#SET(TARGET_LIBRARIES_VARS
|
||||||
|
# QT_QTCORE_LIBRARY
|
||||||
|
# QT_QTGUI_LIBRARY
|
||||||
|
# QT_QTOPENGL_LIBRARY
|
||||||
|
#)
|
||||||
INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR})
|
INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR})
|
||||||
|
|
||||||
SETUP_LIBRARY(${LIB_NAME})
|
SETUP_LIBRARY(${LIB_NAME})
|
||||||
|
@ -70,9 +70,13 @@ ELSE()
|
|||||||
SET(OSG_WINDOWING_SYSTEM "Carbon" CACHE STRING "Windowing system type for graphics window creation, options Carbon, Cocoa or X11.")
|
SET(OSG_WINDOWING_SYSTEM "Carbon" CACHE STRING "Windowing system type for graphics window creation, options Carbon, Cocoa or X11.")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
ELSE()
|
||||||
|
IF(ANDROID)
|
||||||
|
SET(OSG_WINDOWING_SYSTEM "None" CACHE STRING "None Windowing system type for graphics window creation.")
|
||||||
ELSE()
|
ELSE()
|
||||||
SET(OSG_WINDOWING_SYSTEM "X11" CACHE STRING "Windowing system type for graphics window creation. options only X11")
|
SET(OSG_WINDOWING_SYSTEM "X11" CACHE STRING "Windowing system type for graphics window creation. options only X11")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
IF(${OSG_WINDOWING_SYSTEM} STREQUAL "Cocoa")
|
IF(${OSG_WINDOWING_SYSTEM} STREQUAL "Cocoa")
|
||||||
ADD_DEFINITIONS(-DUSE_DARWIN_COCOA_IMPLEMENTATION)
|
ADD_DEFINITIONS(-DUSE_DARWIN_COCOA_IMPLEMENTATION)
|
||||||
@ -156,7 +160,7 @@ ELSE()
|
|||||||
|
|
||||||
SET(LIB_EXTRA_LIBS ${COCOA_LIBRARY} ${LIB_EXTRA_LIBS})
|
SET(LIB_EXTRA_LIBS ${COCOA_LIBRARY} ${LIB_EXTRA_LIBS})
|
||||||
|
|
||||||
ELSE()
|
ELSEIF(${OSG_WINDOWING_SYSTEM} STREQUAL "x11")
|
||||||
# X11 for everybody else
|
# X11 for everybody else
|
||||||
INCLUDE(FindPkgConfig OPTIONAL)
|
INCLUDE(FindPkgConfig OPTIONAL)
|
||||||
IF(PKG_CONFIG_FOUND)
|
IF(PKG_CONFIG_FOUND)
|
||||||
@ -217,6 +221,8 @@ ELSE()
|
|||||||
|
|
||||||
SET(LIB_EXTRA_LIBS ${X11_X11_LIB} ${LIB_EXTRA_LIBS})
|
SET(LIB_EXTRA_LIBS ${X11_X11_LIB} ${LIB_EXTRA_LIBS})
|
||||||
ENDIF(APPLE)
|
ENDIF(APPLE)
|
||||||
|
ELSE()
|
||||||
|
MESSAGE(STATUS "Windowing system not supported")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user