# Copyright 2018 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("../third_party.gni")

copy("copy-nima-cpp") {
  sources = [
    "../externals/Nima-Cpp/Source",
  ]
  outputs = [
    "$target_gen_dir/Nima-Cpp/nima",
  ]
}

copy("copy-nima-math-cpp") {
  sources = [
    "../externals/Nima-Math-Cpp/Source",
  ]
  outputs = [
    "$target_gen_dir/Nima-Math-Cpp/nima",
  ]
}

third_party("Nima-Cpp") {
  deps = [
    ":copy-nima-cpp",
    ":copy-nima-math-cpp",
  ]

  public_include_dirs = [
    "$target_gen_dir/Nima-Cpp",
    "$target_gen_dir/Nima-Math-Cpp",
  ]

  configs -= [
    "//gn:no_exceptions",
    "//gn:no_rtti",
  ]

  sources = [
    "../externals/Nima-Cpp/Source/Actor.cpp",
    "../externals/Nima-Cpp/Source/ActorBone.cpp",
    "../externals/Nima-Cpp/Source/ActorCollider.cpp",
    "../externals/Nima-Cpp/Source/ActorComponent.cpp",
    "../externals/Nima-Cpp/Source/ActorEvent.cpp",
    "../externals/Nima-Cpp/Source/ActorIKTarget.cpp",
    "../externals/Nima-Cpp/Source/ActorImage.cpp",
    "../externals/Nima-Cpp/Source/ActorInstance.cpp",
    "../externals/Nima-Cpp/Source/ActorNode.cpp",
    "../externals/Nima-Cpp/Source/ActorNodeSolo.cpp",
    "../externals/Nima-Cpp/Source/ActorRenderNode.cpp",
    "../externals/Nima-Cpp/Source/ActorRootBone.cpp",
    "../externals/Nima-Cpp/Source/ActorStaticMesh.cpp",
    "../externals/Nima-Cpp/Source/Animation/ActorAnimation.cpp",
    "../externals/Nima-Cpp/Source/Animation/ActorAnimationInstance.cpp",
    "../externals/Nima-Cpp/Source/Animation/ComponentAnimation.cpp",
    "../externals/Nima-Cpp/Source/Animation/Interpolators/CubicSolver.cpp",
    "../externals/Nima-Cpp/Source/Animation/Interpolators/ValueTimeCurveInterpolator.cpp",
    "../externals/Nima-Cpp/Source/Animation/KeyFrames/KeyFrame.cpp",
    "../externals/Nima-Cpp/Source/Animation/KeyFrames/KeyFrameActiveChild.cpp",
    "../externals/Nima-Cpp/Source/Animation/KeyFrames/KeyFrameCustomProperty.cpp",
    "../externals/Nima-Cpp/Source/Animation/KeyFrames/KeyFrameDrawOrder.cpp",
    "../externals/Nima-Cpp/Source/Animation/KeyFrames/KeyFrameIKStrength.cpp",
    "../externals/Nima-Cpp/Source/Animation/KeyFrames/KeyFrameIsCollisionEnabled.cpp",
    "../externals/Nima-Cpp/Source/Animation/KeyFrames/KeyFrameLength.cpp",
    "../externals/Nima-Cpp/Source/Animation/KeyFrames/KeyFrameNumeric.cpp",
    "../externals/Nima-Cpp/Source/Animation/KeyFrames/KeyFrameOpacity.cpp",
    "../externals/Nima-Cpp/Source/Animation/KeyFrames/KeyFramePosX.cpp",
    "../externals/Nima-Cpp/Source/Animation/KeyFrames/KeyFramePosY.cpp",
    "../externals/Nima-Cpp/Source/Animation/KeyFrames/KeyFrameRotation.cpp",
    "../externals/Nima-Cpp/Source/Animation/KeyFrames/KeyFrameScaleX.cpp",
    "../externals/Nima-Cpp/Source/Animation/KeyFrames/KeyFrameScaleY.cpp",
    "../externals/Nima-Cpp/Source/Animation/KeyFrames/KeyFrameSequence.cpp",
    "../externals/Nima-Cpp/Source/Animation/KeyFrames/KeyFrameTrigger.cpp",
    "../externals/Nima-Cpp/Source/Animation/KeyFrames/KeyFrameVertexDeform.cpp",
    "../externals/Nima-Cpp/Source/Animation/KeyFrames/KeyFrameWithInterpolation.cpp",
    "../externals/Nima-Cpp/Source/Animation/PropertyAnimation.cpp",
    "../externals/Nima-Cpp/Source/BinaryReader.cpp",
    "../externals/Nima-Cpp/Source/BlockReader.cpp",
    "../externals/Nima-Cpp/Source/CustomProperty.cpp",
    "../externals/Nima-Cpp/Source/NestedActorAsset.cpp",
    "../externals/Nima-Cpp/Source/NestedActorNode.cpp",
    "../externals/Nima-Math-Cpp/Source/Mat2D.cpp",
    "../externals/Nima-Math-Cpp/Source/Vec2D.cpp",
  ]

  cflags_cc = []
  if (is_win) {
    defines = [ "_USE_MATH_DEFINES" ]
    cflags_cc += [
      "/FI",
      "algorithm",
    ]
  }

  enabled = !is_win || !is_clang
}