<commit_before>CMAKE_MINIMUM_REQUIRED ( VERSION 2.8 )

PROJECT ( PBRT-V3 )

ENABLE_TESTING()

IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
ENDIF()

# src/core/*.cpp are handled differently due to
# the presence of yacc/lex generated files which
# may be optionally generated, especially on
# Windows which is a pain
IF (WIN32)
  SET ( PBRT_YACC_LEX_SOURCE
    src/core/pbrtlex.cpp
    src/core/pbrtparse.cpp
    )
ELSE()
  FIND_PACKAGE ( BISON REQUIRED )
  
  IF(BISON_FOUND)
    SET(BisonOutput ${CMAKE_BINARY_DIR}/pbrtparser.cpp)
    ADD_CUSTOM_COMMAND(
      OUTPUT ${BisonOutput}
      COMMAND ${BISON_EXECUTABLE} -d -v -t
              --output=${BisonOutput}
              ${CMAKE_SOURCE_DIR}/src/core/pbrtparse.yy
      COMMENT "Generating pbrtparser.cpp"
      )
  ENDIF()

  FIND_PACKAGE ( FLEX REQUIRED )
  IF(FLEX_FOUND)
    SET(FlexOutput ${CMAKE_BINARY_DIR}/pbrtlex.cpp)
    ADD_CUSTOM_COMMAND(
      OUTPUT ${FlexOutput}
      COMMAND ${FLEX_EXECUTABLE}
              --outfile=${FlexOutput}
              ${CMAKE_SOURCE_DIR}/src/core/pbrtlex.ll
      COMMENT "Generating pbrtlex.cpp"
      )
  ENDIF()

  SET ( PBRT_YACC_LEX_SOURCE
    ${BisonOutput}
    ${FlexOutput}
    )

ENDIF ()

SET ( PBRT_CORE_SOURCE
  src/core/api.cpp
  src/core/camera.cpp
  src/core/efloat.cpp
  src/core/error.cpp
  src/core/fileutil.cpp
  src/core/film.cpp
  src/core/filter.cpp
  src/core/floatfile.cpp
  src/core/geometry.cpp
  src/core/imageio.cpp
  src/core/integrator.cpp
  src/core/interaction.cpp<commit_msg>Use Bison/Flex on Windows if available, fall back otherwise<commit_after>CMAKE_MINIMUM_REQUIRED ( VERSION 2.8 )

PROJECT ( PBRT-V3 )

ENABLE_TESTING()

IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
ENDIF()

# Optionally use Bison and Flex to regenerate parser files
# Use pregenerated files otherwise (may be outdated)
FIND_PACKAGE ( BISON )
FIND_PACKAGE ( FLEX )
IF(BISON_FOUND AND FLEX_FOUND)
  SET(BisonOutput ${CMAKE_BINARY_DIR}/pbrtparser.cpp)
  ADD_CUSTOM_COMMAND(
    OUTPUT ${BisonOutput}
    COMMAND ${BISON_EXECUTABLE} -d -v -t
            --output=${BisonOutput}
            ${CMAKE_SOURCE_DIR}/src/core/pbrtparse.yy
    COMMENT "Generating pbrtparser.cpp"
  )

  SET(FlexOutput ${CMAKE_BINARY_DIR}/pbrtlex.cpp)
  ADD_CUSTOM_COMMAND(
    OUTPUT ${FlexOutput}
    COMMAND ${FLEX_EXECUTABLE}
            --outfile=${FlexOutput}
            ${CMAKE_SOURCE_DIR}/src/core/pbrtlex.ll
    COMMENT "Generating pbrtlex.cpp"
  )

  SET ( PBRT_YACC_LEX_SOURCE
    ${BisonOutput}
    ${FlexOutput}
    )
ELSE()
  SET ( PBRT_YACC_LEX_SOURCE
    src/core/pbrtlex.cpp
    src/core/pbrtparse.cpp
    )
ENDIF()

SET ( PBRT_CORE_SOURCE
  src/core/api.cpp
  src/core/camera.cpp
  src/core/efloat.cpp
  src/core/error.cpp
  src/core/fileutil.cpp
  src/core/film.cpp
  src/core/filter.cpp
  src/core/floatfile.cpp
  src/core/geometry.cpp
  src/core/imageio.cpp
  src/core/integrator.cpp
  src/core/interaction.cpp
{'fraction_non_alphanumeric': 0.10930383864671438, 'fraction_numerical': 0.0032530904359141183, 'mean_word_length': 3.30672268907563, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '6835512', 'n_tokens_mistral': 1289, 'n_tokens_neox': 1207, 'n_words': 198}