From dc5344c90503e2ae1363d2a8e78f6ff315ba9a9f Mon Sep 17 00:00:00 2001 From: barracuda156 Date: Tue, 7 Nov 2023 05:21:35 +0800 Subject: [PATCH] CMakeLists: support ppc and aarch64 --- CMakeLists.txt | 61 +++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 55 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 176eed83..d2313b07 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,7 +27,7 @@ endif() if (NOT CMAKE_C_STANDARD) - set(CMAKE_C_STANDARD 90) + set(CMAKE_C_STANDARD 99) endif() set(is-freebsd $) @@ -48,15 +48,20 @@ set(is-arm 0) set(is-arm64 0) set(is-ia32 0) +set(is-x64 0) set(is-mips 0) set(is-mips64 0) set(is-ppc 0) +set(is-ppc64 0) +set(is-s390 0) -set(is-s390 $) -string(CONCAT is-x64 $, - $ ->) +if (CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "ppc" OR (APPLE AND CMAKE_OSX_ARCHITECTURES MATCHES "ppc")) + set(is-ppc 1) +elseif (CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "arm") + set(is-arm64 1) +else () + set(is-x64 1) +endif () option(V8_ENABLE_CONCURRENT_MARKING "Enable concurrent marking" ON) option(V8_ENABLE_I18N "Enable Internationalization support") @@ -65,6 +70,7 @@ v8_defines $<${is-darwin}:V8_HAVE_TARGET_OS> $<${is-darwin}:V8_TARGET_OS_MACOSX> + $<${is-darwin}:V8_OS_MACOSX> $<${is-linux}:V8_HAVE_TARGET_OS> $<${is-linux}:V8_TARGET_OS_LINUX> $<${is-win}:V8_HAVE_TARGET_OS> @@ -74,6 +80,9 @@ $<$:V8_OS_WINX64> $<$:V8_CONCURRENT_MARKING> $<${is-win}:V8_OS_WIN32> + $<${is-arm64}:V8_TARGET_ARCH_ARM64> + $<${is-ppc}:V8_TARGET_ARCH_PPC> + $<${is-ppc64}:V8_TARGET_ARCH_PPC64> ) set(D ${PROJECT_SOURCE_DIR}/v8) @@ -211,6 +220,44 @@ $<$:${D}/src/diagnostics/unwinding-info-win64.cc> $<$:${D}/src/trap-handler/handler-inside-win.cc> $<$:${D}/src/trap-handler/handler-outside-win.cc> + $<${is-arm64}:${D}/src/codegen/arm64/assembler-arm64.cc> + $<${is-arm64}:${D}/src/codegen/arm64/cpu-arm64.cc> + $<${is-arm64}:${D}/src/codegen/arm64/decoder-arm64.cc> + $<${is-arm64}:${D}/src/codegen/arm64/instructions-arm64-constants.cc> + $<${is-arm64}:${D}/src/codegen/arm64/instructions-arm64.cc> + $<${is-arm64}:${D}/src/codegen/arm64/interface-descriptors-arm64.cc> + $<${is-arm64}:${D}/src/codegen/arm64/macro-assembler-arm64.cc> + $<${is-arm64}:${D}/src/codegen/arm64/register-arm64.cc> + $<${is-arm64}:${D}/src/codegen/arm64/utils-arm64.cc> + $<${is-arm64}:${D}/src/compiler/backend/arm64/code-generator-arm64.cc> + $<${is-arm64}:${D}/src/compiler/backend/arm64/instruction-scheduler-arm64.cc> + $<${is-arm64}:${D}/src/compiler/backend/arm64/instruction-selector-arm64.cc> + $<${is-arm64}:${D}/src/compiler/backend/arm64/unwinding-info-writer-arm64.cc> + $<${is-arm64}:${D}/src/debug/arm64/debug-arm64.cc> + $<${is-arm64}:${D}/src/deoptimizer/arm64/deoptimizer-arm64.cc> + $<${is-arm64}:${D}/src/diagnostics/arm64/disasm-arm64.cc> + $<${is-arm64}:${D}/src/diagnostics/arm64/eh-frame-arm64.cc> + $<${is-arm64}:${D}/src/execution/arm64/frame-constants-arm64.cc> + $<${is-arm64}:${D}/src/execution/arm64/pointer-auth-arm64.cc> + $<${is-arm64}:${D}/src/execution/arm64/simulator-arm64.cc> + $<${is-arm64}:${D}/src/execution/arm64/simulator-logic-arm64.cc> + $<${is-arm64}:${D}/src/regexp/arm64/regexp-macro-assembler-arm64.cc> + $<${is-ppc}:${D}/src/codegen/ppc/assembler-ppc.cc> + $<${is-ppc}:${D}/src/codegen/ppc/constants-ppc.cc> + $<${is-ppc}:${D}/src/codegen/ppc/cpu-ppc.cc> + $<${is-ppc}:${D}/src/codegen/ppc/interface-descriptors-ppc.cc> + $<${is-ppc}:${D}/src/codegen/ppc/macro-assembler-ppc.cc> + $<${is-ppc}:${D}/src/compiler/backend/ppc/code-generator-ppc.cc> + $<${is-ppc}:${D}/src/compiler/backend/ppc/instruction-scheduler-ppc.cc> + $<${is-ppc}:${D}/src/compiler/backend/ppc/instruction-selector-ppc.cc> + $<${is-ppc}:${D}/src/compiler/backend/ppc/unwinding-info-writer-ppc.cc> + $<${is-ppc}:${D}/src/debug/ppc/debug-ppc.cc> + $<${is-ppc}:${D}/src/deoptimizer/ppc/deoptimizer-ppc.cc> + $<${is-ppc}:${D}/src/diagnostics/ppc/disasm-ppc.cc> + $<${is-ppc}:${D}/src/diagnostics/ppc/eh-frame-ppc.cc> + $<${is-ppc}:${D}/src/execution/ppc/frame-constants-ppc.cc> + $<${is-ppc}:${D}/src/execution/ppc/simulator-ppc.cc> + $<${is-ppc}:${D}/src/regexp/ppc/regexp-macro-assembler-ppc.cc> $<${is-x64}:${D}/src/codegen/x64/assembler-x64.cc> $<${is-x64}:${D}/src/codegen/x64/cpu-x64.cc> $<${is-x64}:${D}/src/codegen/x64/interface-descriptors-x64.cc> @@ -452,7 +499,10 @@ mksnapshot --embedded_src ${PROJECT_BINARY_DIR}/embedded.S --startup_src ${PROJECT_BINARY_DIR}/snapshot.cc + $<${is-arm64}:--target_arch=arm64> $<${is-x64}:--target_arch=x64> + $<${is-ppc}:--target_arch=ppc> + $<${is-ppc64}:--target_arch=ppc64> $<$:--target_os=mac> $<$:--target_os=linux> $<$:--target_os=win>