<commit_before>
# 
# External dependencies
# 

# find_package(THIRDPARTY REQUIRED)
find_package(Boost REQUIRED COMPONENTS filesystem system)

# 
# Library name and options
# 

# Target name
set(target engine)

# Exit here if required dependencies are not met
message(STATUS "Lib ${target}")

# Set API export file and macro
string(TOUPPER ${target} target_upper)
set(feature_file "include/${target}/${target}_features.h")
set(export_file  "include/${target}/${target}_api.h")
set(export_macro "${target_upper}_API")


# 
# Sources
# 

set(include_path "${CMAKE_CURRENT_SOURCE_DIR}/include/${target}")
set(source_path  "${CMAKE_CURRENT_SOURCE_DIR}/source")

set(headers
    ${include_path}/Utils/Json.hpp
    ${include_path}/Utils/Perlin.hpp
    ${include_path}/Utils/ThreadPool.hpp
    ${include_path}/Utils/ThreadSafeQueue.hpp

    ${include_path}/Core.hpp
    ${include_path}/Settings.hpp
    ${include_path}/Gamepad.hpp
    ${include_path}/Common.hpp
)

set(sources
    ${source_path}/Utils/Perlin.cpp

    ${source_path}/Core.cpp
    ${source_path}/Settings.cpp
    ${source_path}/Gamepad.cpp
    ${source_path}/Common.cpp
)

# NanoVG from https://github.com/memononen/nanovg (with some modifications)
set(sources ${sources}
    ${source_path}/nanovg/fontstash.h
    ${source_path}/nanovg/nanovg.c
    ${source_path}/nanovg/nanovg.h
    ${source_path}/nanovg/nanovg_gl.h
    ${source_path}/nanovg/nanovg_gl_utils.h
    ${source_path}/nanovg/stb_image.h
    ${source_path}/nanovg/stb_truetype.h
)

# Gamepad from https://github.com/elanthis/gamepad (does not support MacOS)
set(GAMEPAD_LIB)
set(NATIVE_DEFINITIONS)

if(UNIX AND NOT APPLE)
    set(NATIVE_DEFINITIONS -DGLFW_EXPOSE_NATIVE_X11)
    set(GAMEPAD_LIB udev)
    set(sources ${sources}
        ${source_path}/gamepad/gamepad.c
        ${source_path}/gamepad/gamepad.h
    )
endif()
if(APPLE)
    set(NATIVE_DEFINITIONS -DGLFW_EXPOSE_NATIVE_COCOA -DGLFW_EXPOSE_NATIVE_NSGL -DGOBLIN_NO_GAMEPAD)
endif()
if(WIN32)
    set(NATIVE_DEFINITIONS -DGLFW_EXPOSE_NATIVE_WIN32 -DGLFW_EXPOSE_NATIVE_WGL)
    set(GAMEPAD_LIB XInput)
    set(sources ${sources}
        ${source_path}/gamepad/gamepad.c
        ${source_path}/gamepad/gamepad.h
    )
endif()

set(EXTRA_LIBS)
if(APPLE)
    find_library(cocoa_library Cocoa)
    find_library(opengl_library OpenGL)
    find_library(corevideo_library CoreVideo)
    find_library(iokit_library IOKit)
    set(EXTRA_LIBS ${cocoa_library} ${opengl_library} ${corevideo_library} ${iokit_library})
    set(sources ${sources}
        ${source_path}/darwin.mm
    )
endif()

# Group source files
set(header_group "Header Files (API)")
set(source_group "Source Files")
source_group_by_path(${include_path} "\\\\.h$|\\\\.hpp$" 
    ${header_group} ${headers})
source_group_by_path(${source_path}  "\\\\.cpp$|\\\\.c$|\\\\.h$|\\\\.hpp$" 
    ${source_group} ${sources})


# 
# Create library
# 

# Build library
add_library(${target}
    ${sources}
    ${headers}
)

# Create namespaced alias
add_library(${META_PROJECT_NAME}::${target} ALIAS ${target})

# Export library for downstream projects
export(TARGETS ${target} NAMESPACE ${META_PROJECT_NAME}:: FILE ${PROJECT_BINARY_DIR}/cmake/${target}/${target}-export.cmake)

# Create feature detection header
# Compilers: https://cmake.org/cmake/help/v3.1/variable/CMAKE_LANG_COMPILER_ID.html#variable:CMAKE_%3CLANG%3E_COMPILER_ID
# Feature: https://cmake.org/cmake/help/v3.1/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.html
write_compiler_detection_header(
    FILE ${feature_file}
    PREFIX ${target_upper}
    COMPILERS AppleClang Clang GNU MSVC
    FEATURES cxx_alignas cxx_alignof cxx_constexpr cxx_final cxx_noexcept cxx_nullptr cxx_sizeof_member cxx_thread_local
)

# Create API export header
generate_export_header(${target}
    EXPORT_FILE_NAME  ${export_file}
    EXPORT_MACRO_NAME ${export_macro}
)


# 
# Project options
# 
<commit_msg>Removed the Compiler features detection generated header for now as it won't be used<commit_after>
# 
# External dependencies
# 

# find_package(THIRDPARTY REQUIRED)
find_package(Boost REQUIRED COMPONENTS filesystem system)

# 
# Library name and options
# 

# Target name
set(target engine)

# Exit here if required dependencies are not met
message(STATUS "Lib ${target}")

# Set API export file and macro
string(TOUPPER ${target} target_upper)
set(feature_file "include/${target}/${target}_features.h")
set(export_file  "include/${target}/${target}_api.h")
set(export_macro "${target_upper}_API")


# 
# Sources
# 

set(include_path "${CMAKE_CURRENT_SOURCE_DIR}/include/${target}")
set(source_path  "${CMAKE_CURRENT_SOURCE_DIR}/source")

set(headers
    ${include_path}/Utils/Json.hpp
    ${include_path}/Utils/Perlin.hpp
    ${include_path}/Utils/ThreadPool.hpp
    ${include_path}/Utils/ThreadSafeQueue.hpp

    ${include_path}/Core.hpp
    ${include_path}/Settings.hpp
    ${include_path}/Gamepad.hpp
    ${include_path}/Common.hpp
)

set(sources
    ${source_path}/Utils/Perlin.cpp

    ${source_path}/Core.cpp
    ${source_path}/Settings.cpp
    ${source_path}/Gamepad.cpp
    ${source_path}/Common.cpp
)

# NanoVG from https://github.com/memononen/nanovg (with some modifications)
set(sources ${sources}
    ${source_path}/nanovg/fontstash.h
    ${source_path}/nanovg/nanovg.c
    ${source_path}/nanovg/nanovg.h
    ${source_path}/nanovg/nanovg_gl.h
    ${source_path}/nanovg/nanovg_gl_utils.h
    ${source_path}/nanovg/stb_image.h
    ${source_path}/nanovg/stb_truetype.h
)

# Gamepad from https://github.com/elanthis/gamepad (does not support MacOS)
set(GAMEPAD_LIB)
set(NATIVE_DEFINITIONS)

if(UNIX AND NOT APPLE)
    set(NATIVE_DEFINITIONS -DGLFW_EXPOSE_NATIVE_X11)
    set(GAMEPAD_LIB udev)
    set(sources ${sources}
        ${source_path}/gamepad/gamepad.c
        ${source_path}/gamepad/gamepad.h
    )
endif()
if(APPLE)
    set(NATIVE_DEFINITIONS -DGLFW_EXPOSE_NATIVE_COCOA -DGLFW_EXPOSE_NATIVE_NSGL -DGOBLIN_NO_GAMEPAD)
endif()
if(WIN32)
    set(NATIVE_DEFINITIONS -DGLFW_EXPOSE_NATIVE_WIN32 -DGLFW_EXPOSE_NATIVE_WGL)
    set(GAMEPAD_LIB XInput)
    set(sources ${sources}
        ${source_path}/gamepad/gamepad.c
        ${source_path}/gamepad/gamepad.h
    )
endif()

set(EXTRA_LIBS)
if(APPLE)
    find_library(cocoa_library Cocoa)
    find_library(opengl_library OpenGL)
    find_library(corevideo_library CoreVideo)
    find_library(iokit_library IOKit)
    set(EXTRA_LIBS ${cocoa_library} ${opengl_library} ${corevideo_library} ${iokit_library})
    set(sources ${sources}
        ${source_path}/darwin.mm
    )
endif()

# Group source files
set(header_group "Header Files (API)")
set(source_group "Source Files")
source_group_by_path(${include_path} "\\\\.h$|\\\\.hpp$" 
    ${header_group} ${headers})
source_group_by_path(${source_path}  "\\\\.cpp$|\\\\.c$|\\\\.h$|\\\\.hpp$" 
    ${source_group} ${sources})


# 
# Create library
# 

# Build library
add_library(${target}
    ${sources}
    ${headers}
)

# Create namespaced alias
add_library(${META_PROJECT_NAME}::${target} ALIAS ${target})

# Export library for downstream projects
export(TARGETS ${target} NAMESPACE ${META_PROJECT_NAME}:: FILE ${PROJECT_BINARY_DIR}/cmake/${target}/${target}-export.cmake)

# Create feature detection header
# Compilers: https://cmake.org/cmake/help/v3.1/variable/CMAKE_LANG_COMPILER_ID.html#variable:CMAKE_%3CLANG%3E_COMPILER_ID
# Feature: https://cmake.org/cmake/help/v3.1/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.html
#write_compiler_detection_header(
#    FILE ${feature_file}
#    PREFIX ${target_upper}
#    COMPILERS AppleClang Clang GNU MSVC
#    FEATURES cxx_alignas cxx_alignof cxx_constexpr cxx_final cxx_noexcept cxx_nullptr cxx_sizeof_member cxx_thread_local
#)

# Create API export header
generate_export_header(${target}
    EXPORT_FILE_NAME  ${export_file}
    EXPORT_MACRO_NAME ${export_macro}
)


# 
# Project options
# 

{'fraction_non_alphanumeric': 0.13272750543965187, 'fraction_numerical': 0.0030718034045821067, 'mean_word_length': 4.79673590504451, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 8, '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': '3600115', 'n_tokens_mistral': 2990, 'n_tokens_neox': 2887, 'n_words': 447}