<commit_before># Platform detection script for CMake

# Always use SDL2's enhanced assert facilities.
#
# See also: include/nomlib/config.hpp.in
set( NOM_USE_SDL2_ASSERT true )

if ( CMAKE_SYSTEM_NAME STREQUAL "Darwin" )
  # TODO: Rename to NOM_PLATFORM_OSX
  set( PLATFORM_OSX true )
  set( NOM_PLATFORM_POSIX true )

  option ( FRAMEWORK "Build OSX Framework instead of dylib" on )
  option ( UNIVERSAL "Build as an OSX Universal Library" off )

  # Setup the SDK selection for backwards compatibility
  set ( SDKVER "10.7" )
  set ( DEVROOT "/Applications/Developer/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer" )
  set ( SDKROOT "${DEVROOT}/SDKs/MacOSX${SDKVER}.sdk" )

  if( EXISTS ${SDKROOT} )
    set( CMAKE_OSX_SYSROOT "${SDKROOT}" )
    set( CMAKE_OSX_DEPLOYMENT_TARGET "${SDKVER}" )
    set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=${SDKVER}" )
  else( NOT EXISTS ${SDKROOT} ) # Mac OS X v10.7 SDK not found
    message ( WARNING "WARNING: Mac OS X ${SDKVER} SDK path not found: ${SDKROOT}" )
  endif( EXISTS ${SDKROOT} )

  # libc++ requires OSX v10.7+
  set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++" )

  if ( CMAKE_GENERATOR STREQUAL "Xcode" )
    set ( CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11" )
    set ( CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++" )
  endif ( CMAKE_GENERATOR STREQUAL "Xcode" )

  message ( STATUS "Platform: Darwin (Mac OS X)" )
elseif ( CMAKE_SYSTEM_NAME STREQUAL "Linux" ) # Tested on Ubuntu v12.04-LTS
  # TODO: Rename to NOM_PLATFORM_LINUX<commit_msg>platform.cmake: Use default installation path for OSX SDK<commit_after># Platform detection script for CMake

# Always use SDL2's enhanced assert facilities.
#
# See also: include/nomlib/config.hpp.in
set( NOM_USE_SDL2_ASSERT true )

if ( CMAKE_SYSTEM_NAME STREQUAL "Darwin" )
  # TODO: Rename to NOM_PLATFORM_OSX
  set( PLATFORM_OSX true )
  set( NOM_PLATFORM_POSIX true )

  option ( FRAMEWORK "Build OSX Framework instead of dylib" on )
  option ( UNIVERSAL "Build as an OSX Universal Library" off )

  # Setup the SDK selection for backwards compatibility
  set ( SDKVER "10.7" )

  set ( DEVROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer" )
  set ( SDKROOT "${DEVROOT}/SDKs/MacOSX${SDKVER}.sdk" )

  if( EXISTS ${SDKROOT} )
    set( CMAKE_OSX_SYSROOT "${SDKROOT}" )
    set( CMAKE_OSX_DEPLOYMENT_TARGET "${SDKVER}" )
    set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=${SDKVER}" )

    # This resolves the error in UnixFile.cpp I get when trying to compile with
    # Xcode generated project files -- it complains about not being able to find
    # the header file <MacTypes.h> in one of the system frameworks (CoreServices
    # or Carbon, I believe).
    #
    # This is due to the fact that it is referencing the MacOSX v10.9 SDK, when
    # it should be using v10.7 header files, like it appears to be for
    # everything else. This appears to have been working before, perhaps
    # my recent upgrade to CMake v3.0 had changed something related to all this?
    set( CMAKE_SYSTEM_FRAMEWORK_PATH "${SDKROOT}/System/Library/Frameworks" )
    message( STATUS "Using SDK: ${SDKROOT}" )

  else( NOT EXISTS ${SDKROOT} ) # Mac OS X v10.7 SDK not found
    message ( WARNING "WARNING: Mac OS X ${SDKVER} SDK path not found: ${SDKROOT}" )
  endif( EXISTS ${SDKROOT} )

  # libc++ requires OSX v10.7+
  set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++" )

  if ( CMAKE_GENERATOR STREQUAL "Xcode" )
    set ( CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11" )
    set ( CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++" )
  endif ( CMAKE_GENERATOR STREQUAL "Xcode" )

  message ( STATUS "Platform: Darwin (Mac OS X)" )
elseif ( CMAKE_SYSTEM_NAME STREQUAL "Linux" ) # Tested on Ubuntu v12.04-LTS
  # TODO: Rename to NOM_PLATFORM_LINUX
{'fraction_non_alphanumeric': 0.1045045045045045, 'fraction_numerical': 0.011840411840411841, 'mean_word_length': 4.153846153846154, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7350144', 'n_tokens_mistral': 1519, 'n_tokens_neox': 1348, 'n_words': 399}