compile_bin

in gems/aws-crt/ext/compile.rb [43:91]


def compile_bin
  platform = local_platform
  native_dir = File.expand_path('../aws-crt-ffi', File.dirname(__FILE__))
  tmp_build_dir = File.expand_path('../tmp/build', File.dirname(__FILE__))

  
  
  
  tmp_install_dir = File.expand_path('../tmp/install', File.dirname(__FILE__))

  build_type = 'RelWithDebInfo'

  config_cmd = [
    CMAKE,
    "-H#{native_dir}",
    "-B#{tmp_build_dir}",
    "-DCMAKE_INSTALL_PREFIX=#{tmp_install_dir}",
    "-DCMAKE_BUILD_TYPE=#{build_type}",
  ]

  build_cmd = [
    CMAKE,
    '--build', tmp_build_dir,
    '--target', 'install',
    '--config', build_type,
  ]

  
  if cmake_has_parallel_flag?
    build_cmd.append('--parallel')
    build_cmd.append(Etc.nprocessors.to_s)
  end

  run_cmd(config_cmd)
  run_cmd(build_cmd)

  
  bin_dir = crt_bin_dir(platform)
  FileUtils.mkdir_p(bin_dir)
  bin_name = crt_bin_name(platform)
  search_dirs = [
    'bin', 
    'lib64', 
    'lib', 
  ]
  tmp_path = find_file(bin_name, search_dirs, tmp_install_dir)
  FileUtils.cp(tmp_path, bin_dir)
end