<commit_before># ffig_add_library
# ----------------
#
# This module defines a function that allows the user to add a build target
# that constructs a shared library with a C-API and optional language bindings
# that make use of the C-API. 
#
# FIXME: Make output directory user-configurable.
# Currently the generated bindings and libraries go into ${CMAKE_BINARY_DIR}/generated.
#
# Usage:
#
# ffig_add_library(NAME myModuleName INPUTS myHeader.h RUBY PYTHON)
#
# This will create a build target called myModuleName_c which creates a shared library:
# * libmyModuleName.so on Linux
# * libmyModuleName.dylib on macOS
# * myModuleName.dll on Windows
#
# NAME is required, 
# FIXME: relax constraints on INPUTS
# INPUTS currently supports only a single header file (which must have only standard library includes).
#
# Optional bindings can be created by passing in any of the optional arguments:
# * RUBY - creates myModuleName.rb
# * PYTHON - creates myModuleName.py
# * CPP - creates myModuleName_cpp.h
# * CPP_MOCKS - creates myModuleName_mocks.h

function(ffig_add_library)
  set(options RUBY PYTHON CPP CPP_MOCKS GO)
  set(oneValueArgs NAME INPUTS)
  cmake_parse_arguments(ffig_add_library "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

  set(module ${ffig_add_library_NAME})
  set(input ${ffig_add_library_INPUTS})

  set(ffig_invocation "-i;${input};-m;${module};-o;${CMAKE_BINARY_DIR}/generated;-b;_c.h.tmpl;_c.cpp.tmpl")
  set(ffig_outputs "${CMAKE_BINARY_DIR}/generated/${module}_c.h;${CMAKE_BINARY_DIR}/generated/${module}_c.cpp")  
  set(ffig_output_dir "${CMAKE_BINARY_DIR}/generated")

  if(ffig_add_library_RUBY)
    set(ffig_invocation "${ffig_invocation};rb.tmpl")
    set(ffig_outputs "${ffig_outputs};${ffig_output_dir}/${module}.rb")
  endif()
  if(ffig_add_library_PYTHON)
    set(ffig_invocation "${ffig_invocation};python")
    set(ffig_outputs "${ffig_outputs};${ffig_output_dir}/${module}/__init__.py")
    set(ffig_outputs "${ffig_outputs};${ffig_output_dir}/${module}/interop_py2.py")
    set(ffig_outputs "${ffig_outputs};${ffig_output_dir}/${module}/interop_py3.py")<commit_msg>correct generated filenames output in cmake file (#192)<commit_after># ffig_add_library
# ----------------
#
# This module defines a function that allows the user to add a build target
# that constructs a shared library with a C-API and optional language bindings
# that make use of the C-API. 
#
# FIXME: Make output directory user-configurable.
# Currently the generated bindings and libraries go into ${CMAKE_BINARY_DIR}/generated.
#
# Usage:
#
# ffig_add_library(NAME myModuleName INPUTS myHeader.h RUBY PYTHON)
#
# This will create a build target called myModuleName_c which creates a shared library:
# * libmyModuleName.so on Linux
# * libmyModuleName.dylib on macOS
# * myModuleName.dll on Windows
#
# NAME is required, 
# FIXME: relax constraints on INPUTS
# INPUTS currently supports only a single header file (which must have only standard library includes).
#
# Optional bindings can be created by passing in any of the optional arguments:
# * RUBY - creates myModuleName.rb
# * PYTHON - creates myModuleName.py
# * CPP - creates myModuleName_cpp.h
# * CPP_MOCKS - creates myModuleName_mocks.h

function(ffig_add_library)
  set(options RUBY PYTHON CPP CPP_MOCKS GO)
  set(oneValueArgs NAME INPUTS)
  cmake_parse_arguments(ffig_add_library "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

  set(module ${ffig_add_library_NAME})
  set(input ${ffig_add_library_INPUTS})

  set(ffig_invocation "-i;${input};-m;${module};-o;${CMAKE_BINARY_DIR}/generated;-b;_c.h.tmpl;_c.cpp.tmpl")
  set(ffig_outputs "${CMAKE_BINARY_DIR}/generated/${module}_c.h;${CMAKE_BINARY_DIR}/generated/${module}_c.cpp")  
  set(ffig_output_dir "${CMAKE_BINARY_DIR}/generated")

  if(ffig_add_library_RUBY)
    set(ffig_invocation "${ffig_invocation};rb.tmpl")
    set(ffig_outputs "${ffig_outputs};${ffig_output_dir}/${module}.rb")
  endif()
  if(ffig_add_library_PYTHON)
    set(ffig_invocation "${ffig_invocation};python")
    set(ffig_outputs "${ffig_outputs};${ffig_output_dir}/${module}/__init__.py")
    set(ffig_outputs "${ffig_outputs};${ffig_output_dir}/${module}/_py2.py")
    set(ffig_outputs "${ffig_outputs};${ffig_output_dir}/${module}/_py3.py")
{'fraction_non_alphanumeric': 0.12897940074906367, 'fraction_numerical': 0.0016385767790262173, 'mean_word_length': 5.573846153846154, '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': '5583488', 'n_tokens_mistral': 1510, 'n_tokens_neox': 1467, 'n_words': 336}