Skip to content

Commit e4da552

Browse files
committed
Use version agnostic homebrew prefix
- Use version agnostic homebrew prefix - Recent versions of v8 requires C++ 20 - Accept V8 backend as option from make - Export compile commands from cmake Signed-off-by: Balakrishna Avulapati <ba@bavulapati.com>
1 parent c23e5b7 commit e4da552

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ include(vendor/noa/cmake/noa.cmake)
77
include(cmake/CompilerOptions.cmake)
88

99
# C++ standard
10-
set(CMAKE_CXX_STANDARD 17)
10+
set(CMAKE_CXX_STANDARD 20)
1111

1212
# Options
1313
set(INCLUDEJS_BACKEND "JavaScriptCore" CACHE STRING "The IncludeJS Engine backend")

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ CTEST = ctest
55
# Options
66
PRESET = Debug
77
SHARED = OFF
8-
BACKEND = JavaScriptCore
8+
BACKEND ?= JavaScriptCore
99

1010
all: configure compile test
1111

@@ -17,7 +17,8 @@ configure: .always
1717
-DINCLUDEJS_ENGINE:BOOL=ON \
1818
-DINCLUDEJS_TESTS:BOOL=ON \
1919
-DINCLUDEJS_DOCS:BOOL=ON \
20-
-DBUILD_SHARED_LIBS:BOOL=$(SHARED)
20+
-DBUILD_SHARED_LIBS:BOOL=$(SHARED) \
21+
-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON
2122

2223
compile: .always
2324
$(CMAKE) --build ./build --config $(PRESET) --target clang_format

cmake/FindV8.cmake

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,15 @@ if(NOT V8_FOUND)
55
# Clang, it is unable to find the V8 library and headers which have been
66
# downloaded from Homebrew.
77
# Refs: https://github.com/Homebrew/homebrew-core/issues/45061#issuecomment-541420664
8-
set(V8_VERSION "12.1.285.24")
98
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
10-
set(HOMEBREW_CELLAR "/opt/homebrew/Cellar")
9+
set(HOMEBREW_PREFIX "/opt/homebrew/opt/v8")
1110
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
12-
set(HOMEBREW_CELLAR "/usr/local/Cellar")
11+
set(HOMEBREW_PREFIX "/usr/local/opt/v8")
1312
endif()
1413
target_include_directories(v8
15-
INTERFACE "${HOMEBREW_CELLAR}/v8/${V8_VERSION}/include")
14+
INTERFACE "${HOMEBREW_PREFIX}/include")
1615
target_link_directories(v8
17-
INTERFACE "${HOMEBREW_CELLAR}/v8/${V8_VERSION}/lib")
16+
INTERFACE "${HOMEBREW_PREFIX}/lib")
1817
target_link_libraries(v8 INTERFACE "-lv8")
1918
target_link_libraries(v8 INTERFACE "-lv8_libplatform")
2019
target_compile_definitions(v8

0 commit comments

Comments
 (0)