<commit_before>##############################################################################
# Copyright (c) <NAME>
# Licenced under MIT license. See LICENSE.txt for details.
#
# cppcoro library
#
# This file defines the set of build variants available to be built and
# their corresponding tools and settings.
#
##############################################################################

import os
import sys

import cake.path
import cake.system

from cake.engine import Variant
from cake.script import Script

configuration = Script.getCurrent().configuration
engine = configuration.engine

# Add path containing custom cake extensions to Python's import path.
toolsDir = configuration.abspath(cake.path.join('tools', 'cake_extensions'))
sys.path.insert(0, toolsDir)

hostPlatform = cake.system.platform().lower()
hostArchitecture = cake.system.architecture().lower()

baseVariant = Variant()

from cake.library.script import ScriptTool
from cake.library.variant import VariantTool
from cake.library.env import EnvironmentTool
from cake.library.project import ProjectTool
from cake.library.compilers import CompilerNotFoundError
from testtool import UnitTestTool

baseVariant.tools["script"] = script = ScriptTool(configuration=configuration)
baseVariant.tools["variant"] = variant = VariantTool(configuration=configuration)
baseVariant.tools["test"] = test = UnitTestTool(configuration=configuration)

baseVariant.tools["env"] = env = EnvironmentTool(configuration=configuration)

env["VARIANT"] = "${PLATFORM}_${ARCHITECTURE}_${COMPILER}${COMPILER_VERSION}_${RELEASE}"
env["BUILD"] = "build/${VARIANT}"

env["CPPCORO"] = "."
env["CPPCORO_BUILD"] = "${BUILD}"
env["CPPCORO_PROJECT"] = "build/project"
env["CPPCORO_BIN"] = "${CPPCORO_BUILD}/bin"
env["CPPCORO_LIB"] = "${CPPCORO_BUILD}/lib"

baseVariant.tools["project"] = project = ProjectTool(configuration=configuration)
project.product = project.VS2015
project.enabled = engine.options.createProjects
if project.enabled:
  test.enabled = False
  engine.addBuildSuccessCallback(project.build)

if cake.system.isWindows() or cake.system.isCygwin():
  # Uncomment the next line to use an experimental MSVC compiler version
  # downloaded from the https://vcppdogfooding.azurewebsites.net/ NuGet repository.
  # Unzip the .nuget file to a folder and specify the path here.
  nugetPath = None #r'C:\Path\To\VisualCppTools.Community.VS2017Layout.14.11.25415-Pre'

  for arch in ("x64", "x86"):
    try:
      from cake.library.compilers.msvc import getVisualStudio2017Compiler, findMsvc2017InstallDir
      if nugetPath:
        vcInstallDir = cake.path.join(nugetPath, 'lib', 'native')
      else:
        vcInstallDir = str(findMsvc2017InstallDir(targetArchitecture=arch, allowPreRelease=True))
      compiler = getVisualStudio2017Compiler(
        configuration,
        targetArchitecture=arch,
        vcInstallDir=vcInstallDir,
        )

      msvcVariant = baseVariant.clone(
        platform="windows",
        compiler="msvc",
        architecture=arch,
        )

      msvcVariant.tools["compiler"] = compiler

      project = msvcVariant.tools["project"]
      project.solutionPlatformName = "Windows " + arch
      if arch == "x86":
        project.projectPlatformName = "Win32"
      elif arch == "x64":
        project.projectPlatformName = "x64"

      if engine.options.createProjects:
        compiler.enabled = False

      compiler.enableRtti = True
      compiler.enableExceptions = True
      compiler.outputMapFile = True
      compiler.outputFullPath = True
      compiler.messageStyle = compiler.MSVS_CLICKABLE
      compiler.warningLevel = '4'
      compiler.warningsAsErrors = True

      # Enable experimental C++ coroutines via command-line flag.
      compiler.addCppFlag('/await')<commit_msg>Print out path of MSVC install dir during builds.<commit_after>##############################################################################
# Copyright (c) <NAME>
# Licenced under MIT license. See LICENSE.txt for details.
#
# cppcoro library
#
# This file defines the set of build variants available to be built and
# their corresponding tools and settings.
#
##############################################################################

import os
import sys

import cake.path
import cake.system

from cake.engine import Variant
from cake.script import Script

configuration = Script.getCurrent().configuration
engine = configuration.engine

# Add path containing custom cake extensions to Python's import path.
toolsDir = configuration.abspath(cake.path.join('tools', 'cake_extensions'))
sys.path.insert(0, toolsDir)

hostPlatform = cake.system.platform().lower()
hostArchitecture = cake.system.architecture().lower()

baseVariant = Variant()

from cake.library.script import ScriptTool
from cake.library.variant import VariantTool
from cake.library.env import EnvironmentTool
from cake.library.project import ProjectTool
from cake.library.compilers import CompilerNotFoundError
from testtool import UnitTestTool

baseVariant.tools["script"] = script = ScriptTool(configuration=configuration)
baseVariant.tools["variant"] = variant = VariantTool(configuration=configuration)
baseVariant.tools["test"] = test = UnitTestTool(configuration=configuration)

baseVariant.tools["env"] = env = EnvironmentTool(configuration=configuration)

env["VARIANT"] = "${PLATFORM}_${ARCHITECTURE}_${COMPILER}${COMPILER_VERSION}_${RELEASE}"
env["BUILD"] = "build/${VARIANT}"

env["CPPCORO"] = "."
env["CPPCORO_BUILD"] = "${BUILD}"
env["CPPCORO_PROJECT"] = "build/project"
env["CPPCORO_BIN"] = "${CPPCORO_BUILD}/bin"
env["CPPCORO_LIB"] = "${CPPCORO_BUILD}/lib"

baseVariant.tools["project"] = project = ProjectTool(configuration=configuration)
project.product = project.VS2015
project.enabled = engine.options.createProjects
if project.enabled:
  test.enabled = False
  engine.addBuildSuccessCallback(project.build)

if cake.system.isWindows() or cake.system.isCygwin():
  # Uncomment the next line to use an experimental MSVC compiler version
  # downloaded from the https://vcppdogfooding.azurewebsites.net/ NuGet repository.
  # Unzip the .nuget file to a folder and specify the path here.
  nugetPath = None #r'C:\Path\To\VisualCppTools.Community.VS2017Layout.14.11.25415-Pre'

  for arch in ("x64", "x86"):
    try:
      from cake.library.compilers.msvc import getVisualStudio2017Compiler, findMsvc2017InstallDir
      if nugetPath:
        vcInstallDir = cake.path.join(nugetPath, 'lib', 'native')
      else:
        vcInstallDir = str(findMsvc2017InstallDir(targetArchitecture=arch, allowPreRelease=True))
      compiler = getVisualStudio2017Compiler(
        configuration,
        targetArchitecture=arch,
        vcInstallDir=vcInstallDir,
        )

      engine.logger.outputInfo("MSVC (" + arch + "): " + vcInstallDir + "\n")

      msvcVariant = baseVariant.clone(
        platform="windows",
        compiler="msvc",
        architecture=arch,
        )

      msvcVariant.tools["compiler"] = compiler

      project = msvcVariant.tools["project"]
      project.solutionPlatformName = "Windows " + arch
      if arch == "x86":
        project.projectPlatformName = "Win32"
      elif arch == "x64":
        project.projectPlatformName = "x64"

      if engine.options.createProjects:
        compiler.enabled = False

      compiler.enableRtti = True
      compiler.enableExceptions = True
      compiler.outputMapFile = True
      compiler.outputFullPath = True
      compiler.messageStyle = compiler.MSVS_CLICKABLE
      compiler.warningLevel = '4'
      compiler.warningsAsErrors = True

      # Enable experimental C++ coroutines via command-line flag.
      compiler.addCppFlag('/await')
{'fraction_non_alphanumeric': 0.1435275713727024, 'fraction_numerical': 0.012253943423282492, 'mean_word_length': 4.5959153902261125, 'pattern_counts': {'":': 4, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '558158', 'n_tokens_mistral': 2222, 'n_tokens_neox': 2094, 'n_words': 499}