Skip to content

Commit

Permalink
fix rebase error :(
Browse files Browse the repository at this point in the history
  • Loading branch information
yokofly committed Sep 27, 2023
1 parent 351ac1c commit a32eb3c
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 982 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-20.04, ubuntu-22.04, windows-latest]
os: [macos-latest, ubuntu-20.04, ubuntu-22.04]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v2
Expand All @@ -27,7 +27,3 @@ jobs:
- name: test
if: matrix.os != 'windows-latest'
run: ${{runner.workspace}}/build/d8 -e 42
- name: test-windows
if: matrix.os == 'windows-latest'
run: ${{runner.workspace}}/build/Debug/d8 -e 42
shell: powershell
141 changes: 32 additions & 109 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
cmake_minimum_required(VERSION 3.10)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
project(V8 LANGUAGES CXX C ASM)

option(V8CMAKE_FIND_PYTHON "Enable finding python" ON)

Expand Down Expand Up @@ -45,7 +47,7 @@ set(is-msvc $<CXX_COMPILER_ID:MSVC>)
# FIXME obviously
set(is-arm 0)
set(is-arm64 0)
if (CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "arm64" OR CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "aarch64")
if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*|arm64.*|ARM64.*)")
set(is-arm64 1)
endif ()
set(is-ia32 0)
Expand Down Expand Up @@ -81,7 +83,7 @@ set(
set(disable-exceptions
$<$<CXX_COMPILER_ID:MSVC>:/EHs-c->
$<$<CXX_COMPILER_ID:AppleClang>:-fno-exceptions>
$<$<CXX_COMPILER_ID:Clang>:-fno-exceptions -Wno-undef -Wno-unused-parameter -Wno-covered-switch-default -Wno-poison-system-directories -Wno-gnu-statement-expression -Wno-comma -Wno-format-nonliteral -Wno-format-pedantic -Wno-missing-noreturn -Wno-conditional-uninitialized -Wno-extra-semi-stmt -Wno-unused-parameter -Wno-non-virtual-dtor -Wno-undef -Wno-shadow-field-in-constructor -Wno-shadow-field-in-constructor -Wno-documentation -Wno-reserved-identifier -Wno-shadow-field-in-constructor -Wno-newline-eof -Wno-undefined-reinterpret-cast >
$<$<CXX_COMPILER_ID:Clang>:-fno-exceptions -Wno-invalid-offsetof>
$<$<CXX_COMPILER_ID:GNU>:-fno-exceptions>
)

Expand All @@ -92,94 +94,12 @@ set(enable-exceptions
$<$<CXX_COMPILER_ID:GNU>:-fexceptions>
)

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/generated)
add_library(v8-bytecodes-builtin-list STATIC ${CMAKE_CURRENT_SOURCE_DIR}/generated/builtins-generated/bytecodes-builtins-list.h)
set(enable-fpic
$<$<CXX_COMPILER_ID:AppleClang>:-fPIC>
$<$<CXX_COMPILER_ID:Clang>:-fPIC>
$<$<CXX_COMPILER_ID:GNU>:-fPIC>
)

#
# d8
#

add_executable(
d8
$<${is-posix}:v8/src/d8/d8-posix.cc>
$<${is-win}:v8/src/d8/d8-windows.cc>
v8/src/d8/async-hooks-wrapper.cc
v8/src/d8/d8-console.cc
v8/src/d8/d8-js.cc
v8/src/d8/d8-test.cc
v8/src/d8/d8-platforms.cc
v8/src/d8/d8.cc
)

target_compile_definitions(d8 PRIVATE $<${is-msvc}:_HAS_EXCEPTIONS=0>)
target_compile_options(d8 PRIVATE ${disable-exceptions})
if(enable-fPIC)
target_compile_options(d8 PRIVATE ${enable-fpic})
endif()

target_include_directories(d8
PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/v8/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PRIVATE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/v8>
)

target_link_libraries(d8
PRIVATE
v8_base_without_compiler
v8_compiler
v8_snapshot
v8_inspector
v8_libplatform
)

# add shell and hello-world
add_executable(
shell
v8/samples/shell.cc
)
target_include_directories(shell
PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/v8/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PRIVATE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/v8>
)
target_link_libraries(shell
PRIVATE
v8_base_without_compiler
v8_compiler
v8_snapshot
v8_inspector
v8_libplatform
)

add_executable(
hello-world
v8/samples/hello-world.cc
)
target_include_directories(hello-world
PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/v8/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PRIVATE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/v8>
)
target_link_libraries(hello-world
PRIVATE
v8_base_without_compiler
v8_compiler
v8_snapshot
v8_inspector
v8_libplatform
)

# more granular library support
add_library(v8-i18n-support OBJECT)
set_property(TARGET v8-i18n-support PROPERTY EXCLUDE_FROM_ALL ON)
Expand Down Expand Up @@ -210,7 +130,7 @@ target_compile_options(v8-i18n-support PRIVATE ${disable-exceptions})
target_link_libraries(v8-i18n-support PRIVATE v8_torque_generated)

target_include_directories(v8-i18n-support
PUBLIC
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/v8
${CMAKE_CURRENT_SOURCE_DIR}/v8/src/objects
${CMAKE_CURRENT_SOURCE_DIR}/v8/include
Expand Down Expand Up @@ -405,11 +325,10 @@ if(enable-fPIC)
endif()

target_include_directories(v8_base_without_compiler
PUBLIC
PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/v8/include>
# $<BUILD_INTERFACE:$<TARGET_PROPERTY:v8-bytecodes-builtin-list,INTERFACE_INCLUDE_DIRECTORIES>>
$<BUILD_INTERFACE:$<TARGET_PROPERTY:v8-bytecodes-builtin-list,INTERFACE_INCLUDE_DIRECTORIES>>
${CMAKE_CURRENT_SOURCE_DIR}/v8
${CMAKE_CURRENT_SOURCE_DIR}/v8/include
${CMAKE_CURRENT_SOURCE_DIR}/v8/third_party/zlib
${CMAKE_CURRENT_BINARY_DIR}
)
Expand Down Expand Up @@ -444,9 +363,10 @@ endif()
target_include_directories(v8_compiler
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}
PRIVATE
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/v8
${CMAKE_CURRENT_SOURCE_DIR}/v8/include
# $<BUILD_INTERFACE:$<TARGET_PROPERTY:v8-bytecodes-builtin-list,INTERFACE_INCLUDE_DIRECTORIES>>
$<BUILD_INTERFACE:$<TARGET_PROPERTY:v8-bytecodes-builtin-list,INTERFACE_INCLUDE_DIRECTORIES>>
)

target_link_libraries(v8_compiler
Expand Down Expand Up @@ -522,8 +442,7 @@ if(enable-fPIC)
endif()

target_include_directories(v8_initializers
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/v8/include
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/v8
${CMAKE_CURRENT_BINARY_DIR}
)
Expand All @@ -548,7 +467,7 @@ target_compile_options(v8_snapshot PRIVATE ${disable-exceptions})
if(enable-fPIC)
target_compile_options(v8_snapshot PRIVATE ${enable-fpic})
endif()
target_include_directories(v8_snapshot PRIVATE ${PROJECT_SOURCE_DIR}/v8)
target_include_directories(v8_snapshot PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/v8)

target_link_libraries(v8_snapshot
PRIVATE
Expand All @@ -559,7 +478,7 @@ target_link_libraries(v8_snapshot
# Note: allow passing in v8_random_seed
add_custom_command(
COMMAND
./mksnapshot
mksnapshot
--embedded_src ${CMAKE_CURRENT_BINARY_DIR}/embedded.S
--startup_src ${CMAKE_CURRENT_BINARY_DIR}/snapshot.cc
$<${is-x64}:--target_arch=x64>
Expand Down Expand Up @@ -635,12 +554,12 @@ endif()
target_compile_definitions(v8_inspector PUBLIC $<${is-msvc}:_HAS_EXCEPTIONS=0>)

target_include_directories(v8_inspector
PUBLIC
PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/inspector
${CMAKE_CURRENT_SOURCE_DIR}/v8
${CMAKE_CURRENT_SOURCE_DIR}/v8/include
# ${CMAKE_CURRENT_SOURCE_DIR}/v8/third_party/googletest/src/googlemock/include
# ${CMAKE_CURRENT_SOURCE_DIR}/v8/third_party/googletest/src/googletest/include
${CMAKE_CURRENT_SOURCE_DIR}/v8/third_party/googletest/src/googlemock/include
${CMAKE_CURRENT_SOURCE_DIR}/v8/third_party/googletest/src/googletest/include
)

target_link_libraries(v8_inspector PRIVATE v8_torque_generated)
Expand Down Expand Up @@ -709,6 +628,7 @@ endif()
target_include_directories(v8_libplatform
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/v8/include
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/v8
)

Expand All @@ -721,7 +641,7 @@ target_link_libraries(v8_libplatform PRIVATE v8_libbase)
add_library(v8_libsampler STATIC v8/src/libsampler/sampler.cc)

target_include_directories(v8_libsampler
PUBLIC
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/v8
${CMAKE_CURRENT_SOURCE_DIR}/v8/include
)
Expand All @@ -731,7 +651,7 @@ target_compile_options(v8_libsampler PRIVATE ${disable-exceptions})
if(enable-fPIC)
target_compile_options(v8_libsampler PRIVATE ${enable-fpic})
endif()
target_include_directories(v8_libsampler PRIVATE ${PROJECT_SOURCE_DIR}/v8)
target_include_directories(v8_libsampler PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/v8)
target_link_libraries(v8_libsampler PRIVATE v8_libbase)

#
Expand Down Expand Up @@ -782,7 +702,7 @@ target_compile_options(v8_libbase PRIVATE ${disable-exceptions})
if(enable-fPIC)
target_compile_options(v8_libbase PRIVATE ${enable-fpic})
endif()
target_include_directories(v8_libbase PRIVATE ${PROJECT_SOURCE_DIR}/v8)
target_include_directories(v8_libbase PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/v8)
target_link_libraries(v8_libbase
PRIVATE
Threads::Threads
Expand All @@ -795,6 +715,12 @@ target_link_libraries(v8_libbase
#
# bytecode_builtins_list_generator
#
v8_generate_builtins_list(${CMAKE_CURRENT_BINARY_DIR}/generated)

target_include_directories(v8-bytecodes-builtin-list
INTERFACE
${CMAKE_CURRENT_BINARY_DIR}/generated
)

add_executable(
bytecode_builtins_list_generator
Expand All @@ -804,13 +730,12 @@ add_executable(
)

target_include_directories(bytecode_builtins_list_generator
PUBLIC
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/v8
)

target_link_libraries(bytecode_builtins_list_generator v8_libbase)

target_compile_options(bytecode_builtins_list_generator PUBLIC -Wno-error -Wno-unused-parameter -Wno-undef -Wno-shadow-field-in-constructor -Wno-duplicate-enum)
#
# v8_torque_generated
#
Expand Down Expand Up @@ -923,7 +848,7 @@ target_include_directories(v8_torque_generated

add_custom_command(
COMMAND
./torque
torque
-o ${CMAKE_CURRENT_BINARY_DIR}/torque-generated
-v8-root ${CMAKE_CURRENT_SOURCE_DIR}/v8
${torque_files}
Expand Down Expand Up @@ -955,8 +880,8 @@ file(GLOB torque-program-sources

add_executable(torque)
target_sources(torque PRIVATE ${torque-program-sources})
target_compile_options(torque PRIVATE ${enable-exceptions} PUBLIC -Wno-error -Wno-cast-qual -Wno-used-but-marked-unused -Wno-duplicate-enum -Wno-gnu-zero-variadic-macro-arguments -Wno-old-style-cast -Wno-gnu-anonymous-struct -Wno-cast-qual -Wno-used-but-marked-unused -Wno-duplicate-enum -Wno-deprecated-this-capture -Wno-extra-semi-stmt -Wno-missing-noreturn -Wno-used-but-marked-unused -Wno-conditional-uninitialized -Wno-deprecated-copy-with-dtor -Wno-covered-switch-default -Wno-shadow-field -Wno-shadow-field-in-constructor -Wno-unused-parameter -Wno-undef -Wno-newline-eof -Wno-non-virtual-dtor -Wno-documentation)
target_include_directories(torque PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/v8 ${CMAKE_CURRENT_SOURCE_DIR}/v8/include)
target_compile_options(torque PRIVATE ${enable-exceptions})
target_include_directories(torque PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/v8)
target_link_libraries(torque PRIVATE v8_libbase)

#
Expand All @@ -977,8 +902,8 @@ add_executable(mksnapshot
)

target_compile_definitions(mksnapshot PRIVATE $<${is-msvc}:_HAS_EXCEPTIONS=0>)
target_compile_options(mksnapshot PRIVATE ${disable-exceptions} PUBLIC -Wno-error -Wno-old-style-cast -Wno-frame-larger-than -Wno-unused-macros -Wno-deprecated-copy-with-user-provided-dtor -Wno-shadow-field -Wno-gnu-zero-variadic-macro-arguments -Wno-shadow-uncaptured-local -Wno-old-style-cast -Wno-duplicate-enum -Wno-ambiguous-reversed-operator -Wno-used-but-marked-unused -Wno-cast-qual -Wno-gnu-anonymous-struct)
target_include_directories(mksnapshot PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/v8 ${CMAKE_CURRENT_SOURCE_DIR}/v8/include)
target_compile_options(mksnapshot PRIVATE ${disable-exceptions})
target_include_directories(mksnapshot PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/v8)
target_link_libraries(mksnapshot
PRIVATE
v8_libbase
Expand All @@ -994,8 +919,6 @@ add_library(v8-adler32 OBJECT v8/third_party/zlib/adler32.c)
target_include_directories(v8-adler32
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/v8/third_party/zlib>
${CMAKE_CURRENT_SOURCE_DIR}/v8
${CMAKE_CURRENT_SOURCE_DIR}/v8/include
)

target_compile_options(v8-adler32 PRIVATE -Wno-extra-semi-stmt)
Expand Down
Loading

0 comments on commit a32eb3c

Please sign in to comment.