summaryrefslogtreecommitdiffstats
path: root/cmake/Functions.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/Functions.cmake')
-rw-r--r--cmake/Functions.cmake88
1 files changed, 63 insertions, 25 deletions
diff --git a/cmake/Functions.cmake b/cmake/Functions.cmake
index 37d097b6a..3f01646ed 100644
--- a/cmake/Functions.cmake
+++ b/cmake/Functions.cmake
@@ -362,36 +362,74 @@ function(qt_internal_add_external_project_dependency_to_root_project name)
endfunction()
function(get_gn_arch result arch)
- if("${arch}" STREQUAL "i386")
- set(${result} "x86" PARENT_SCOPE)
- elseif("${arch}" STREQUAL "x86_64")
- set(${result} "x64" PARENT_SCOPE)
- elseif("${arch}" STREQUAL "arm")
- set(${result} "arm" PARENT_SCOPE)
- elseif("${arch}" STREQUAL "arm64")
- set(${result} "arm64" PARENT_SCOPE)
- elseif("${arch}" STREQUAL "mipsel")
- set(${result} "mipsel" PARENT_SCOPE)
- elseif("${arch}" STREQUAL "mipsel64")
- set(${result} "mips64el" PARENT_SCOPE)
- else()
- message(DEBUG "Unsupported achitecture: ${arch}")
- endif()
+ if(arch STREQUAL "i386")
+ set(${result} "x86" PARENT_SCOPE)
+ elseif(arch STREQUAL "x86_64")
+ set(${result} "x64" PARENT_SCOPE)
+ elseif(arch STREQUAL "arm")
+ set(${result} "arm" PARENT_SCOPE)
+ elseif(arch STREQUAL "arm64")
+ set(${result} "arm64" PARENT_SCOPE)
+ elseif(arch STREQUAL "mipsel")
+ set(${result} "mipsel" PARENT_SCOPE)
+ elseif(arch STREQUAL "mipsel64")
+ set(${result} "mips64el" PARENT_SCOPE)
+ else()
+ message(DEBUG "Unsupported architecture: ${arch}")
+ endif()
+endfunction()
+
+function(get_v8_arch result targetArch hostArch)
+ set(list32 i386 arm mipsel)
+ if(hostArch STREQUAL targetArch)
+ set(${result} "${targetArch}" PARENT_SCOPE)
+ elseif(targetArch IN_LIST list32)
+ # 32bit target which needs a 32bit compatible host
+ if(hostArch STREQUAL "x86_64")
+ set(${result} "i386" PARENT_SCOPE)
+ elseif(hostArch STREQUAL "arm64")
+ set(${result} "arm" PARENT_SCOPE)
+ elseif(hostArch STREQUAL "mips64")
+ set(${result} "mipsel" PARENT_SCOPE)
+ elseif(hostArch STREQUAL "mipsel64")
+ set(${result} "mipsel" PARENT_SCOPE)
+ else()
+ message(DEBUG "Unsupported architecture: ${hostArch}")
+ endif()
+ else()
+ # assume 64bit target which matches 64bit host
+ set(${result} "${hostArch}" PARENT_SCOPE)
+ endif()
endfunction()
-function(get_v8_arch result targetArch)
- set(list32 i386 arm mipsel)
- if("${targetArch}" IN_LIST list32)
- set(${result} "i386" PARENT_SCOPE)
- else()
- set(${result} "x86_64" PARENT_SCOPE)
- endif()
+function(get_gn_os result)
+ if(WIN32)
+ set(${result} "win" PARENT_SCOPE)
+ elseif(LINUX)
+ set(${result} "linux" PARENT_SCOPE)
+ elseif(MACOS)
+ set(${result} "mac" PARENT_SCOPE)
+ elseif(IOS)
+ set(${result} "ios" PARENT_SCOPE)
+ else()
+ message(DEBUG "Unrecognized OS")
+ endif()
+endfunction()
+
+function(get_gn_is_clang result)
+ if(CLANG)
+ set(${result} "true" PARENT_SCOPE)
+ else()
+ set(${result} "false" PARENT_SCOPE)
+ endif()
endfunction()
-function(configure_gn_toolchain name cpuType v8CpuType toolchainIn toolchainOut)
+function(configure_gn_toolchain name binTargetCpu v8TargetCpu toolchainIn toolchainOut)
set(GN_TOOLCHAIN ${name})
- get_gn_arch(GN_CPU ${cpuType})
- get_gn_arch(GN_V8_CPU ${v8CpuType})
+ get_gn_os(GN_OS)
+ get_gn_is_clang(GN_IS_CLANG)
+ get_gn_arch(GN_CPU ${binTargetCpu})
+ get_gn_arch(GN_V8_CPU ${v8TargetCpu})
configure_file(${toolchainIn} ${toolchainOut}/BUILD.gn @ONLY)
endfunction()