declare_args() {
    # Default Tizen profile for the build
    profile = "{{.ProfileID}}"

    # Default Tizen version for the build
    api_version = "{{.APIVersion}}"

    # Default build type [debug/ release/ test]
    build_type = "{{.BuildType}}"

    # Build with debug info
    debug_build = true

    # Build with tests
    test_build = false
}

{{- if or .Native .NativeTests }}

declare_args() {

    # Default rootstrap to use for build [llvm/ gcc]
    rootstrap = "{{.Rootstrap}}"

    # Default compiler to use for build [llvm/ gcc]
    compiler = "{{.Compiler}}"

    # default architecture to build for [x86/ x86_64/ arm/ aarch64]
    arch = "{{.Arch}}"

    # Pass verbose option to tools
    verbose_build = false

    # Strip debug info from final binary
    strip_debug_info = false

}

test_incs = []
if (test_build) {
    test_incs = [
        {{- range .NativeTests}}
        "//{{.Path}}/inc",
        {{- end}}
    ]
}


{{- end}}

# Workspace type
ws_type = "{{.Type}}"

target_os = "linux"
if (ws_type != "web") {
target_cpu = arch
}



# Tizen package ID
package_id = "{{.PackageID}}"

# Tizen package version
version = "{{.Version}}"

# Author certificate for package signing
author_cert = "{{to_slash author_cert}}"

# Distributor certificate for package signing
distributor_cert = "{{to_slash dist_cert}}"

# Distributor2 certificate for package signing
distributor2_cert = "{{to_slash dist2_cert}}"

# Tizen Studio path
tizen_studio = "{{to_slash tizen_studio}}"

# Tizen core path
tizen_core = "{{to_slash tizen_core}}"

# Out directory for package file
if (ws_type == "web") {
    out_dir = "wgt"
}else {
    out_dir = "tpk"
}


# Out directory for native package file
native_out_dir = "tpk"

web_out_dir = "wgt"

# Source path filter patterns
exclude_patterns = [
{{- range .SrcFilters}}
    "{{.}}",
{{- end}}
]

# Test source path pattern
test_src_patterns = [
{{- range .TestFilters}}
    "{{.}}",
{{- end}}
]

if (!test_build) {
    exclude_patterns += test_src_patterns
}

set_sources_assignment_filter(exclude_patterns)
if (ws_type == "web") {
     set_default_toolchain("${tizen_core}/web/toolchains:web_builder")
}else {
    set_default_toolchain("${tizen_core}/native/toolchains/tizen-${api_version}:${arch}_${compiler}")
}