<commit_before>set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

IF(WIN32)
    CMAKE_MINIMUM_REQUIRED(VERSION 2.4.6 FATAL_ERROR)
ELSE(WIN32)
    IF(APPLE)
        CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 FATAL_ERROR)
    ELSE(APPLE)
        CMAKE_MINIMUM_REQUIRED(VERSION 2.4.4 FATAL_ERROR)
    ENDIF(APPLE)
ENDIF(WIN32)

if(COMMAND cmake_policy)
    # Works around warnings libraries linked against that don't
    # have absolute paths (e.g. -lpthreads)
    cmake_policy(SET CMP0003 NEW)

    # Works around warnings about escaped quotes in ADD_DEFINITIONS
    # statements.
    cmake_policy(SET CMP0005 NEW)

    # tell CMake to prefer CMake's own CMake modules when available
    # only available from cmake-2.8.4
    if(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 8 AND ${CMAKE_PATCH_VERSION} GREATER 3)
        cmake_policy(SET CMP0017 NEW)
    endif()

    # cmake-2.6.1 introduces policy cmp0008 decide how to treat full path libraries that do not appear to be valid library file names
    # quote from cvslog "Such libraries worked by accident in the VS IDE and Xcode generators in CMake 2.4 and below."
    if(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4 AND ${CMAKE_PATCH_VERSION} GREATER 0)
        cmake_policy(SET CMP0008 OLD)
    endif()
endif()

PROJECT(OpenSceneGraph)

SET(OPENSCENEGRAPH_MAJOR_VERSION 3)
SET(OPENSCENEGRAPH_MINOR_VERSION 1)
SET(OPENSCENEGRAPH_PATCH_VERSION 6)
SET(OPENSCENEGRAPH_SOVERSION 97)

# set to 0 when not a release candidate, non zero means that any generated
# svn tags will be treated as release candidates of given number
SET(OPENSCENEGRAPH_RELEASE_CANDIDATE 0)

SET(OPENSCENEGRAPH_VERSION ${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION}.${OPENSCENEGRAPH_PATCH_VERSION})

SET(OSG_PLUGINS osgPlugins-${OPENSCENEGRAPH_VERSION})

SET(OSG_PLUGIN_PREFIX "")

IF (CYGWIN)
    SET(OSG_PLUGIN_PREFIX "cygwin_")
ENDIF()

IF(MINGW)
    SET(OSG_PLUGIN_PREFIX "mingw_")
ENDIF()


# We want to build SONAMES shared librariess
SET(OPENSCENEGRAPH_SONAMES TRUE)
SET(OPENTHREADS_SONAMES TRUE)

SET(OpenThreads_SOURCE_DIR ${OpenSceneGraph_SOURCE_DIR})

# We have some custom .cmake scripts not in the official distribution.
# Maybe this can be used override existing behavior if needed?
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)

    CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0 FATAL_ERROR)

    INCLUDE(OsgAndroidMacroUtils)
    SET(ANDROID TRUE)
    IF(NOT ANDROID_PLATFORM)
        MESSAGE("Warning Android Platform version NOT defined, Default selected version: 5")
        SET(ANDROID_PLATFORM 5)
    ENDIF()
    IF(NOT ANDROID_ABI)
        MESSAGE("Warning Android ABI version NOT defined, Default selection: armeabi armeabi-v7a")
        SET(ANDROID_ABI "armeabi armeabi-v7a")
    ENDIF()
    IF(NOT ANDROID_STL)
        MESSAGE("Warning Android STL NOT defined, Default selection: gnustl_static")
        SET(ANDROID_STL "gnustl_static")
    ENDIF()
    IF(ANDROID_DEBUG)
        MESSAGE("Warning Android Build is in debug mode")
        SET(ANDROID_RELEASE_OPTIM "debug")
    ELSE()
        MESSAGE("Warning Android Build is in release mode")
        SET(ANDROID_RELEASE_OPTIM "release")
    ENDIF()
    IF(ANDROID_NEON)
        MESSAGE("Warning Android NEON optimizations enabled, this will not be available on all armeabi-v7a devices ie. Tegra2")
        SET(ANDROID_OPTIM_NEON true)
    ELSE()
        SET(ANDROID_OPTIM_NEON false)
    ENDIF()
    IF(ANDROID_ARM32)
        MESSAGE("Warning ARM 32bit instruction set will be used")
        SET(ANDROID_OPTIM_ARM32 true)
    ELSE()
        SET(ANDROID_OPTIM_ARM32 false)
    ENDIF()

    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
    )
    install(DIRECTORY include/ DESTINATION include/
        PATTERN ".svn" EXCLUDE
    )
    install(DIRECTORY ${CMAKE_BINARY_DIR}/include/ DESTINATION include/
    )
    install(DIRECTORY ${CMAKE_BINARY_DIR}/obj/ DESTINATION obj/
        PATTERN ".svn" EXCLUDE
        PATTERN "objs" EXCLUDE
    )

    ADD_DEFINITIONS(-DANDROID)

ENDIF()



# Okay, here's the problem: On some platforms, linking against OpenThreads
# is not enough and explicit linking to the underlying thread library
# is also required (e.g. FreeBSD). But OpenThreads may be built with different
# backends (Pthreads, Sproc, Windows) so we don't know what the underlying
# thread library is because some platforms support multiple backends (e.g.
# IRIX supports Sproc and Pthreads). Linking all libraries won't work
# because the libraries may be incompatible.
# So the current solution is to attempt best guess linking and exempt certain
# 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
# which might be an issue on things like Cygwin. This may need to be fixed.
IF(NOT ANDROID)
    FIND_PACKAGE(Threads)
ENDIF()
IF(CMAKE_SYSTEM MATCHES IRIX)
    # Erase CMAKE_THREAD_LIBS_INIT and hope it works
    SET(CMAKE_THREAD_LIBS_INIT "" CACHE INTERNAL "")
ENDIF()

OPTION(OSG_MAINTAINER "Enable OpenSceneGraph maintainer build methods, such as making svn branches, tags, updating ChangeLog." OFF)
IF (OSG_MAINTAINER)

    SET(OPENSCENEGRAPH_SVN "trunk")
    #SET(OPENSCENEGRAPH_SVN "branches")
    SET(OPENSCENEGRAPH_BRANCH OpenSceneGraph-${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION})

    #
    # Provide target for tagging a release
    #
    SET(SVNCOMMAND svn)
    SET(SVNTRUNKDIR     http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk)
    SET(SVNTAGDIR       http://www.openscenegraph.org/svn/osg/OpenSceneGraph/tags)
    SET(SVNBRANCHDIR    http://www.openscenegraph.org/svn/osg/OpenSceneGraph/branches)

    IF   (OPENSCENEGRAPH_SVN STREQUAL "trunk")
        SET(SVNSOURCEDIR ${SVNTRUNKDIR})
    ELSE()
        SET(SVNSOURCEDIR ${SVNBRANCHDIR}/${OPENSCENEGRAPH_BRANCH})
    ENDIF()


    IF   (OPENSCENEGRAPH_RELEASE_CANDIDATE EQUAL 0)
        SET(RELEASE_NAME OpenSceneGraph-${OPENSCENEGRAPH_VERSION})
    ELSE()
        SET(RELEASE_NAME OpenSceneGraph-${OPENSCENEGRAPH_VERSION}-rc${OPENSCENEGRAPH_RELEASE_CANDIDATE})<commit_msg>Updated links to svn repository<commit_after>set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

IF(WIN32)
    CMAKE_MINIMUM_REQUIRED(VERSION 2.4.6 FATAL_ERROR)
ELSE(WIN32)
    IF(APPLE)
        CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 FATAL_ERROR)
    ELSE(APPLE)
        CMAKE_MINIMUM_REQUIRED(VERSION 2.4.4 FATAL_ERROR)
    ENDIF(APPLE)
ENDIF(WIN32)

if(COMMAND cmake_policy)
    # Works around warnings libraries linked against that don't
    # have absolute paths (e.g. -lpthreads)
    cmake_policy(SET CMP0003 NEW)

    # Works around warnings about escaped quotes in ADD_DEFINITIONS
    # statements.
    cmake_policy(SET CMP0005 NEW)

    # tell CMake to prefer CMake's own CMake modules when available
    # only available from cmake-2.8.4
    if(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 8 AND ${CMAKE_PATCH_VERSION} GREATER 3)
        cmake_policy(SET CMP0017 NEW)
    endif()

    # cmake-2.6.1 introduces policy cmp0008 decide how to treat full path libraries that do not appear to be valid library file names
    # quote from cvslog "Such libraries worked by accident in the VS IDE and Xcode generators in CMake 2.4 and below."
    if(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4 AND ${CMAKE_PATCH_VERSION} GREATER 0)
        cmake_policy(SET CMP0008 OLD)
    endif()
endif()

PROJECT(OpenSceneGraph)

SET(OPENSCENEGRAPH_MAJOR_VERSION 3)
SET(OPENSCENEGRAPH_MINOR_VERSION 1)
SET(OPENSCENEGRAPH_PATCH_VERSION 6)
SET(OPENSCENEGRAPH_SOVERSION 97)

# set to 0 when not a release candidate, non zero means that any generated
# svn tags will be treated as release candidates of given number
SET(OPENSCENEGRAPH_RELEASE_CANDIDATE 0)

SET(OPENSCENEGRAPH_VERSION ${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION}.${OPENSCENEGRAPH_PATCH_VERSION})

SET(OSG_PLUGINS osgPlugins-${OPENSCENEGRAPH_VERSION})

SET(OSG_PLUGIN_PREFIX "")

IF (CYGWIN)
    SET(OSG_PLUGIN_PREFIX "cygwin_")
ENDIF()

IF(MINGW)
    SET(OSG_PLUGIN_PREFIX "mingw_")
ENDIF()


# We want to build SONAMES shared librariess
SET(OPENSCENEGRAPH_SONAMES TRUE)
SET(OPENTHREADS_SONAMES TRUE)

SET(OpenThreads_SOURCE_DIR ${OpenSceneGraph_SOURCE_DIR})

# We have some custom .cmake scripts not in the official distribution.
# Maybe this can be used override existing behavior if needed?
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)

    CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0 FATAL_ERROR)

    INCLUDE(OsgAndroidMacroUtils)
    SET(ANDROID TRUE)
    IF(NOT ANDROID_PLATFORM)
        MESSAGE("Warning Android Platform version NOT defined, Default selected version: 5")
        SET(ANDROID_PLATFORM 5)
    ENDIF()
    IF(NOT ANDROID_ABI)
        MESSAGE("Warning Android ABI version NOT defined, Default selection: armeabi armeabi-v7a")
        SET(ANDROID_ABI "armeabi armeabi-v7a")
    ENDIF()
    IF(NOT ANDROID_STL)
        MESSAGE("Warning Android STL NOT defined, Default selection: gnustl_static")
        SET(ANDROID_STL "gnustl_static")
    ENDIF()
    IF(ANDROID_DEBUG)
        MESSAGE("Warning Android Build is in debug mode")
        SET(ANDROID_RELEASE_OPTIM "debug")
    ELSE()
        MESSAGE("Warning Android Build is in release mode")
        SET(ANDROID_RELEASE_OPTIM "release")
    ENDIF()
    IF(ANDROID_NEON)
        MESSAGE("Warning Android NEON optimizations enabled, this will not be available on all armeabi-v7a devices ie. Tegra2")
        SET(ANDROID_OPTIM_NEON true)
    ELSE()
        SET(ANDROID_OPTIM_NEON false)
    ENDIF()
    IF(ANDROID_ARM32)
        MESSAGE("Warning ARM 32bit instruction set will be used")
        SET(ANDROID_OPTIM_ARM32 true)
    ELSE()
        SET(ANDROID_OPTIM_ARM32 false)
    ENDIF()

    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
    )
    install(DIRECTORY include/ DESTINATION include/
        PATTERN ".svn" EXCLUDE
    )
    install(DIRECTORY ${CMAKE_BINARY_DIR}/include/ DESTINATION include/
    )
    install(DIRECTORY ${CMAKE_BINARY_DIR}/obj/ DESTINATION obj/
        PATTERN ".svn" EXCLUDE
        PATTERN "objs" EXCLUDE
    )

    ADD_DEFINITIONS(-DANDROID)

ENDIF()



# Okay, here's the problem: On some platforms, linking against OpenThreads
# is not enough and explicit linking to the underlying thread library
# is also required (e.g. FreeBSD). But OpenThreads may be built with different
# backends (Pthreads, Sproc, Windows) so we don't know what the underlying
# thread library is because some platforms support multiple backends (e.g.
# IRIX supports Sproc and Pthreads). Linking all libraries won't work
# because the libraries may be incompatible.
# So the current solution is to attempt best guess linking and exempt certain
# 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
# which might be an issue on things like Cygwin. This may need to be fixed.
IF(NOT ANDROID)
    FIND_PACKAGE(Threads)
ENDIF()
IF(CMAKE_SYSTEM MATCHES IRIX)
    # Erase CMAKE_THREAD_LIBS_INIT and hope it works
    SET(CMAKE_THREAD_LIBS_INIT "" CACHE INTERNAL "")
ENDIF()

OPTION(OSG_MAINTAINER "Enable OpenSceneGraph maintainer build methods, such as making svn branches, tags, updating ChangeLog." OFF)
IF (OSG_MAINTAINER)

    SET(OPENSCENEGRAPH_SVN "trunk")
    #SET(OPENSCENEGRAPH_SVN "branches")
    SET(OPENSCENEGRAPH_BRANCH OpenSceneGraph-${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION})

    #
    # Provide target for tagging a release
    #
    SET(SVNCOMMAND svn)
    SET(SVNTRUNKDIR     http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk)
    SET(SVNTAGDIR       http://svn.openscenegraph.org/osg/OpenSceneGraph/tags)
    SET(SVNBRANCHDIR    http://svn.openscenegraph.org/osg/OpenSceneGraph/branches)

    IF   (OPENSCENEGRAPH_SVN STREQUAL "trunk")
        SET(SVNSOURCEDIR ${SVNTRUNKDIR})
    ELSE()
        SET(SVNSOURCEDIR ${SVNBRANCHDIR}/${OPENSCENEGRAPH_BRANCH})
    ENDIF()


    IF   (OPENSCENEGRAPH_RELEASE_CANDIDATE EQUAL 0)
        SET(RELEASE_NAME OpenSceneGraph-${OPENSCENEGRAPH_VERSION})
    ELSE()
        SET(RELEASE_NAME OpenSceneGraph-${OPENSCENEGRAPH_VERSION}-rc${OPENSCENEGRAPH_RELEASE_CANDIDATE})
{'fraction_non_alphanumeric': 0.07832034122665098, 'fraction_numerical': 0.01117811442859244, 'mean_word_length': 4.116252821670429, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 3, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5471980', 'n_tokens_mistral': 5058, 'n_tokens_neox': 4637, 'n_words': 1187}