<commit_before>cmake_minimum_required(VERSION 3.8)
project("GT_RoboJackets_RoboCup")


# include cmake files in the 'cmake folder'
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")

# put executables in the 'run' folder
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/run)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/run/lib)

# Google test
enable_testing()
include(SetupGTest)

message("${TARGET}")

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) # Don't fall back to older versions

add_subdirectory(external/grSim)

install(TARGETS grSim DESTINATION run)

# Because we use ninja, we have to explicitly turn on color output for the compiler
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcolor-diagnostics -Werror=return-stack-address")
else()
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=return-local-addr")

endif()

# Use compiler optimization if we are making a release build.
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -march=native")

# Build in debug mode
# TODO: make this easier to specify when running `make` on the command-line
# try using cmake's debug flag support? 'set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g")'
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -Og")

# Turn some compiler warnings into errors
# TODO determine if we want these flags in the release build
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Werror=return-type -Werror=delete-non-virtual-dtor")


# Qt5
if(APPLE)
    # look for the homebrew-installed version of Qt5
    find_package(Qt5Widgets
        REQUIRED
        PATHS /usr/local/Cellar/qt5/*)

    # this directory is included by default, but we mark it as SYSTEM so
    # warnings in external headers don't show up every time we build
    include_directories(SYSTEM /usr/local/include/)

else()
    find_package(Qt5Widgets REQUIRED)
endif()
message(STATUS "Found Qt5: ${Qt5Widgets_DIR}")

# Google Protobuf
find_package(Protobuf REQUIRED)
include_directories(SYSTEM ${PROTOBUF_INCLUDE_DIR})

# Remove QT slots/signals/emit keywords
add_definitions(-DQT_NO_KEYWORDS)
# Python
if(APPLE)
    # Finding homebrew-installed python3 on OS X doesn't work with the standard
    # FindPythonLibs.cmake file, so we do a custom search for it here.

    # This block will either fail or set these three variables:
    # * PYTHON_INCLUDE_DIRS
    # * PYTHON_LINK_DIRS
    # * PYTHON_LIBRARIES

    # try to find python3-config
    find_program(PYTHON3_CONFIG
        NAMES python3-config)
    if(NOT PYTHON3_CONFIG)
        message(FATAL_ERROR "Could not find python3-config")
    endif()

    # use python3-config to find where python stuff is stored
    execute_process(COMMAND "${PYTHON3_CONFIG}" --prefix
                    OUTPUT_VARIABLE PYTHON3_PREFIX
                    OUTPUT_STRIP_TRAILING_WHITESPACE
                    ERROR_QUIET)
    set(PYTHON_INCLUDE_DIRS "${PYTHON3_PREFIX}/Headers")
    set(PYTHON_LINK_DIRS "${PYTHON3_PREFIX}/lib")

    # search for the python library
    find_library(PYTHON_LIBRARIES
        NAMES python3.5 python3.4 python3.3 python3.2 python3
        PATHS ${PYTHON_LINK_DIRS})
    if(NOT PYTHON_LIBRARIES)
        message(FATAL_ERROR "Unable to find python 3 library")
    endif()
else()
    find_package(PythonInterp 3.2 REQUIRED)
    find_package(PythonLibs 3.2 REQUIRED)
endif()


# Eigen - used for linear algebra
find_package(Eigen3 REQUIRED)

# libusb
find_package(libusb-1.0 REQUIRED)

# SDL2
include(FindPkgConfig)
pkg_search_module(SDL2 REQUIRED sdl2)

# Several things depend on the headers in the 'common' directory
include_directories("${PROJECT_SOURCE_DIR}/common") # for headers in common/
include_directories("${PROJECT_BINARY_DIR}/common") # for generated protobuf headers
include_directories("${CMAKE_BINARY_DIR}/common") # for generated protobuf headers


# setup ccache to speed up recompiles.  It's especially useful when switching back and forth
# between branches where you'd normally have to recompile things many times.
# see http://stackoverflow.com/questions/1815688/how-to-use-ccache-with-cmake
if(NOT STATIC_ANALYSIS)
    set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
    set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif()

# run all the other CMakeLists files
add_subdirectory(external)
add_subdirectory(common)
add_subdirectory(soccer)
add_subdirectory(logging)
<commit_msg>Let grSim location be determined automatically<commit_after>cmake_minimum_required(VERSION 3.8)
project("GT_RoboJackets_RoboCup")


# include cmake files in the 'cmake folder'
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")

# put executables in the 'run' folder
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/run)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/run/lib)

# Google test
enable_testing()
include(SetupGTest)

message("${TARGET}")

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) # Don't fall back to older versions

add_subdirectory(external/grSim)

# Because we use ninja, we have to explicitly turn on color output for the compiler
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcolor-diagnostics -Werror=return-stack-address")
else()
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=return-local-addr")

endif()

# Use compiler optimization if we are making a release build.
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -march=native")

# Build in debug mode
# TODO: make this easier to specify when running `make` on the command-line
# try using cmake's debug flag support? 'set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g")'
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -Og")

# Turn some compiler warnings into errors
# TODO determine if we want these flags in the release build
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Werror=return-type -Werror=delete-non-virtual-dtor")


# Qt5
if(APPLE)
    # look for the homebrew-installed version of Qt5
    find_package(Qt5Widgets
        REQUIRED
        PATHS /usr/local/Cellar/qt5/*)

    # this directory is included by default, but we mark it as SYSTEM so
    # warnings in external headers don't show up every time we build
    include_directories(SYSTEM /usr/local/include/)

else()
    find_package(Qt5Widgets REQUIRED)
endif()
message(STATUS "Found Qt5: ${Qt5Widgets_DIR}")

# Google Protobuf
find_package(Protobuf REQUIRED)
include_directories(SYSTEM ${PROTOBUF_INCLUDE_DIR})

# Remove QT slots/signals/emit keywords
add_definitions(-DQT_NO_KEYWORDS)
# Python
if(APPLE)
    # Finding homebrew-installed python3 on OS X doesn't work with the standard
    # FindPythonLibs.cmake file, so we do a custom search for it here.

    # This block will either fail or set these three variables:
    # * PYTHON_INCLUDE_DIRS
    # * PYTHON_LINK_DIRS
    # * PYTHON_LIBRARIES

    # try to find python3-config
    find_program(PYTHON3_CONFIG
        NAMES python3-config)
    if(NOT PYTHON3_CONFIG)
        message(FATAL_ERROR "Could not find python3-config")
    endif()

    # use python3-config to find where python stuff is stored
    execute_process(COMMAND "${PYTHON3_CONFIG}" --prefix
                    OUTPUT_VARIABLE PYTHON3_PREFIX
                    OUTPUT_STRIP_TRAILING_WHITESPACE
                    ERROR_QUIET)
    set(PYTHON_INCLUDE_DIRS "${PYTHON3_PREFIX}/Headers")
    set(PYTHON_LINK_DIRS "${PYTHON3_PREFIX}/lib")

    # search for the python library
    find_library(PYTHON_LIBRARIES
        NAMES python3.5 python3.4 python3.3 python3.2 python3
        PATHS ${PYTHON_LINK_DIRS})
    if(NOT PYTHON_LIBRARIES)
        message(FATAL_ERROR "Unable to find python 3 library")
    endif()
else()
    find_package(PythonInterp 3.2 REQUIRED)
    find_package(PythonLibs 3.2 REQUIRED)
endif()


# Eigen - used for linear algebra
find_package(Eigen3 REQUIRED)

# libusb
find_package(libusb-1.0 REQUIRED)

# SDL2
include(FindPkgConfig)
pkg_search_module(SDL2 REQUIRED sdl2)

# Several things depend on the headers in the 'common' directory
include_directories("${PROJECT_SOURCE_DIR}/common") # for headers in common/
include_directories("${PROJECT_BINARY_DIR}/common") # for generated protobuf headers
include_directories("${CMAKE_BINARY_DIR}/common") # for generated protobuf headers


# setup ccache to speed up recompiles.  It's especially useful when switching back and forth
# between branches where you'd normally have to recompile things many times.
# see http://stackoverflow.com/questions/1815688/how-to-use-ccache-with-cmake
if(NOT STATIC_ANALYSIS)
    set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
    set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif()

# run all the other CMakeLists files
add_subdirectory(external)
add_subdirectory(common)
add_subdirectory(soccer)
add_subdirectory(logging)

{'fraction_non_alphanumeric': 0.08465252048950264, 'fraction_numerical': 0.011227124733355787, 'mean_word_length': 4.765695792880259, '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': '1622627', 'n_tokens_mistral': 3151, 'n_tokens_neox': 2932, 'n_words': 771}