Skip to content

Commit 92d758e

Browse files
committed
make VM computed goto dispatch table configurable
1 parent 6c4ab58 commit 92d758e

File tree

2 files changed

+152
-124
lines changed

2 files changed

+152
-124
lines changed

CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ set(ZIP_SRC thirdparty/zip/src)
99

1010
option(LIBSCRATCHCPP_BUILD_UNIT_TESTS "Build unit tests" ON)
1111
option(LIBSCRATCHCPP_NETWORK_SUPPORT "Support for downloading projects" ON)
12+
option(LIBSCRATCHCPP_COMPUTED_GOTO "Support for computed goto" ON)
13+
14+
if (NOT (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"))
15+
# Computed goto not supported on anything except GCC
16+
set(LIBSCRATCHCPP_COMPUTED_GOTO OFF CACHE BOOL "" FORCE)
17+
endif()
1218

1319
find_package(nlohmann_json 3.9.1 REQUIRED)
1420
find_package(utf8cpp REQUIRED)
@@ -18,6 +24,10 @@ add_subdirectory(src)
1824
include_directories(src) # TODO: Remove this line
1925
include_directories(include)
2026

27+
if (LIBSCRATCHCPP_COMPUTED_GOTO)
28+
target_compile_definitions(scratchcpp PRIVATE ENABLE_COMPUTED_GOTO)
29+
endif()
30+
2131
target_sources(scratchcpp
2232
PUBLIC
2333
include/scratchcpp/global.h

0 commit comments

Comments
 (0)