<commit_before># Find the requested package
function(vortex2d_find_package)
    list(GET ARGN 0 target)
    list(REMOVE_AT ARGN 0)

    if (IOS_PLATFORM)
        find_host_package(${target} REQUIRED)
    else()
        find_package(${target} REQUIRED)
    endif()
endfunction()

# Find the requested program
function(vortex2d_find_program)
    if (IOS_PLATFORM)
        find_host_program(${ARGN})
    else()
        find_program(${ARGN})
    endif()
endfunction()

set(vortex2d_macro__internal_dir ${CMAKE_CURRENT_LIST_DIR} CACHE INTERNAL "")

# Function to compile the shaders and generate a C++ source file to include
function(compile_shader)
    cmake_parse_arguments(SHADER "" "OUTPUT;VERSION" "SOURCES" ${ARGN})

    if (NOT DEFINED GLSL_VALIDATOR)
      vortex2d_find_program(GLSL_VALIDATOR glslangValidator hints "$ENV{VULKAN_SDK}/Bin" "$ENV{VULKAN_SDK}/bin")
    elseif(NOT IS_ABSOLUTE ${GLSL_VALIDATOR})
      set(GLSL_VALIDATOR "${CMAKE_CURRENT_LIST_DIR}/${GLSL_VALIDATOR}")
    endif()
    message("Using compiler: ${GLSL_VALIDATOR}")

    file(REMOVE "${SHADER_OUTPUT}.h" "${SHADER_OUTPUT}.cpp")

    set(COMPILE_SCRIPT ${vortex2d_macro__internal_dir}/../Scripts/GenerateSPIRV.py)
    add_custom_command(
       OUTPUT "${SHADER_OUTPUT}.h" "${SHADER_OUTPUT}.cpp"
       COMMAND ${PYTHON_EXECUTABLE} ${COMPILE_SCRIPT} --compiler ${GLSL_VALIDATOR} --vulkan_version ${SHADER_VERSION} --output ${SHADER_OUTPUT} ${SHADER_SOURCES}
       DEPENDS ${SHADER_SOURCES} ${COMPILE_SCRIPT})
endfunction()

# Copy dlls
function(vortex2d_copy_dll)
    list(GET ARGN 0 target)
    list(REMOVE_AT ARGN 0)

    add_custom_command(
    TARGET ${target} POST_BUILD
    COMMAND ${CMAKE_COMMAND} -E copy
        $<TARGET_FILE:vortex2d>
        $<TARGET_FILE_DIR:${target}>)
endfunction()

# Find vulkan or MoltenVK on macOS/iOS
function(vortex2d_find_vulkan)
  if(APPLE)
    if(NOT DEFINED MOLTENVK_DIR)
      message(FATAL_ERROR "Must specify MOLTENVK_DIR")
    endif()
    if(NOT IS_ABSOLUTE ${MOLTENVK_DIR})
      set(MOLTENVK_DIR "${CMAKE_CURRENT_LIST_DIR}/${MOLTENVK_DIR}")
    endif()

    if(IOS_PLATFORM)
      set(VORTEX2D_OS "ios-arm64")
    else()
      set(VORTEX2D_OS "macos-arm64-x86_64")
    endif()

  	set(VULKAN_LIBRARIES "-L${MOLTENVK_DIR}/MoltenVK.xcframework/${VORTEX2D_OS} -lMoltenVK -framework Metal -framework IOSurface -framework QuartzCore -framework IOKit -framework Foundation -framework Cocoa" PARENT_SCOPE)
  	set(VULKAN_INCLUDES "${MOLTENVK_DIR}/include" PARENT_SCOPE)
  else()
  	find_package(Vulkan REQUIRED)
  	set(VULKAN_LIBRARIES Vulkan::Vulkan PARENT_SCOPE)
    if (NOT Vulkan_FOUND)
      message(FATAL_ERROR "Cannot find vulkan")
    endif()
  endif()
endfunction()

# Generate a Vortex2DConfig.cmake file (and associated files) from the targets registered against
# the EXPORT name "Vortex2DConfigExport" (EXPORT parameter of install(TARGETS))
function(vortex2d_export_targets)
    # CMAKE_CURRENT_LIST_DIR or CMAKE_CURRENT_SOURCE_DIR not usable for files that are to be included like this one
    set(CURRENT_DIR "${PROJECT_SOURCE_DIR}/cmake")<commit_msg>include all possible macos vulkan location in cmake<commit_after># Find the requested package
function(vortex2d_find_package)
    list(GET ARGN 0 target)
    list(REMOVE_AT ARGN 0)

    if (IOS_PLATFORM)
        find_host_package(${target} REQUIRED)
    else()
        find_package(${target} REQUIRED)
    endif()
endfunction()

# Find the requested program
function(vortex2d_find_program)
    if (IOS_PLATFORM)
        find_host_program(${ARGN})
    else()
        find_program(${ARGN})
    endif()
endfunction()

set(vortex2d_macro__internal_dir ${CMAKE_CURRENT_LIST_DIR} CACHE INTERNAL "")

# Function to compile the shaders and generate a C++ source file to include
function(compile_shader)
    cmake_parse_arguments(SHADER "" "OUTPUT;VERSION" "SOURCES" ${ARGN})

    if (NOT DEFINED GLSL_VALIDATOR)
      vortex2d_find_program(GLSL_VALIDATOR glslangValidator hints "$ENV{VULKAN_SDK}/Bin" "$ENV{VULKAN_SDK}/bin")
    elseif(NOT IS_ABSOLUTE ${GLSL_VALIDATOR})
      set(GLSL_VALIDATOR "${CMAKE_CURRENT_LIST_DIR}/${GLSL_VALIDATOR}")
    endif()
    message("Using compiler: ${GLSL_VALIDATOR}")

    file(REMOVE "${SHADER_OUTPUT}.h" "${SHADER_OUTPUT}.cpp")

    set(COMPILE_SCRIPT ${vortex2d_macro__internal_dir}/../Scripts/GenerateSPIRV.py)
    add_custom_command(
       OUTPUT "${SHADER_OUTPUT}.h" "${SHADER_OUTPUT}.cpp"
       COMMAND ${PYTHON_EXECUTABLE} ${COMPILE_SCRIPT} --compiler ${GLSL_VALIDATOR} --vulkan_version ${SHADER_VERSION} --output ${SHADER_OUTPUT} ${SHADER_SOURCES}
       DEPENDS ${SHADER_SOURCES} ${COMPILE_SCRIPT})
endfunction()

# Copy dlls
function(vortex2d_copy_dll)
    list(GET ARGN 0 target)
    list(REMOVE_AT ARGN 0)

    add_custom_command(
    TARGET ${target} POST_BUILD
    COMMAND ${CMAKE_COMMAND} -E copy
        $<TARGET_FILE:vortex2d>
        $<TARGET_FILE_DIR:${target}>)
endfunction()

# Find vulkan or MoltenVK on macOS/iOS
function(vortex2d_find_vulkan)
  if(APPLE)
    if(NOT DEFINED MOLTENVK_DIR)
      message(FATAL_ERROR "Must specify MOLTENVK_DIR")
    endif()
    if(NOT IS_ABSOLUTE ${MOLTENVK_DIR})
      set(MOLTENVK_DIR "${CMAKE_CURRENT_LIST_DIR}/${MOLTENVK_DIR}")
    endif()

    if(IOS_PLATFORM)
      set(VORTEX2D_OS "ios-arm64")
    else()
      set(VORTEX2D_OS "macos-arm64_x86_64")
    endif()

  	set(VULKAN_LIBRARIES "-L${MOLTENVK_DIR}/${VORTEX2D_OS}/static -L${MOLTENVK_DIR}/MoltenVK.xcframework/${VORTEX2D_OS} -lMoltenVK -framework Metal -framework IOSurface -framework QuartzCore -framework IOKit -framework Foundation -framework Cocoa" PARENT_SCOPE)
  	set(VULKAN_INCLUDES "${MOLTENVK_DIR}/include" PARENT_SCOPE)
  else()
  	find_package(Vulkan REQUIRED)
  	set(VULKAN_LIBRARIES Vulkan::Vulkan PARENT_SCOPE)
    if (NOT Vulkan_FOUND)
      message(FATAL_ERROR "Cannot find vulkan")
    endif()
  endif()
endfunction()

# Generate a Vortex2DConfig.cmake file (and associated files) from the targets registered against
# the EXPORT name "Vortex2DConfigExport" (EXPORT parameter of install(TARGETS))
function(vortex2d_export_targets)
    # CMAKE_CURRENT_LIST_DIR or CMAKE_CURRENT_SOURCE_DIR not usable for files that are to be included like this one
    set(CURRENT_DIR "${PROJECT_SOURCE_DIR}/cmake")
{'fraction_non_alphanumeric': 0.10851472471190782, 'fraction_numerical': 0.008482714468629962, 'mean_word_length': 4.759447004608295, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '2178981', 'n_tokens_mistral': 2420, 'n_tokens_neox': 2293, 'n_words': 449}