1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
|
From: Mathias Gibbens <gibmat@debian.org>
Description: Use system-packaged duktape library (upstream chose to use an embedded copy: https://github.com/OpenRCT2/OpenRCT2/pull/16153)
Forwarded: not-needed
diff --git a/cmake/duktapeConfig.cmake b/cmake/duktapeConfig.cmake
new file mode 100644
index 00000000..f75cf340
--- /dev/null
+++ b/cmake/duktapeConfig.cmake
@@ -0,0 +1,36 @@
+# This file was obtained from:
+# https://github.com/microsoft/vcpkg/blob/master/ports/duktape/duktapeConfig.cmake.in
+# It is used under the terms of the MIT License.
+
+# - Try to find duktape
+# Once done this will define
+#
+# DUKTAPE_FOUND - system has Duktape
+# DUKTAPE_INCLUDE_DIRS - the Duktape include directory
+# DUKTAPE_LIBRARIES - Link these to use DUKTAPE
+# DUKTAPE_DEFINITIONS - Compiler switches required for using Duktape
+#
+
+PKG_CHECK_MODULES(PC_DUK QUIET duktape libduktape)
+
+find_path(DUKTAPE_INCLUDE_DIR duktape.h
+ HINTS ${PC_DUK_INCLUDEDIR} ${PC_DUK_INCLUDE_DIRS}
+ PATH_SUFFIXES duktape)
+
+find_library(DUKTAPE_LIBRARY
+ NAMES duktape libduktape
+ HINTS ${PC_DUK_LIBDIR} ${PC_DUK_LIBRARY_DIRS})
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(duktape
+ REQUIRED_VARS DUKTAPE_LIBRARY DUKTAPE_INCLUDE_DIR)
+
+if (DUKTAPE_FOUND)
+ set (DUKTAPE_LIBRARIES ${DUKTAPE_LIBRARY})
+ set (DUKTAPE_INCLUDE_DIRS ${DUKTAPE_INCLUDE_DIR} )
+endif ()
+
+MARK_AS_ADVANCED(
+ DUKTAPE_INCLUDE_DIR
+ DUKTAPE_LIBRARY
+)
diff --git a/src/openrct2/CMakeLists.txt b/src/openrct2/CMakeLists.txt
index b3db7caf..3444cf15 100644
--- a/src/openrct2/CMakeLists.txt
+++ b/src/openrct2/CMakeLists.txt
@@ -7,18 +7,6 @@ if (APPLE)
set_source_files_properties(${OPENRCT2_CORE_MM_SOURCES} PROPERTIES COMPILE_FLAGS "-x objective-c++ -fmodules")
endif ()
-if (ENABLE_SCRIPTING)
- include_directories("${CMAKE_CURRENT_LIST_DIR}/../thirdparty/duktape")
-
- # duktape is third party, ignore all warnings
- set(OPENRCT2_DUKTAPE_SOURCES "${CMAKE_CURRENT_LIST_DIR}/../thirdparty/duktape/duktape.cpp")
- if (MSVC)
- set_source_files_properties(${OPENRCT2_DUKTAPE_SOURCES} PROPERTIES COMPILE_FLAGS "/w")
- else ()
- set_source_files_properties(${OPENRCT2_DUKTAPE_SOURCES} PROPERTIES COMPILE_FLAGS "-w")
- endif ()
-endif ()
-
# On macOS the compiler computes typeids to different values in shared library and in the executable.
# This causes issues with RTTI and results in "bad any cast" exception getting thrown at runtime.
# It should be possible to expose relevant types with visibility default attribute, but we can make the whole issue go away by
@@ -28,9 +16,15 @@ set(LIBOPENRCT2_LINKAGE)
if (APPLE)
set(LIBOPENRCT2_LINKAGE STATIC)
endif()
-add_library(libopenrct2 ${LIBOPENRCT2_LINKAGE} ${OPENRCT2_CORE_SOURCES} ${OPENRCT2_CORE_MM_SOURCES} ${OPENRCT2_DUKTAPE_SOURCES})
+add_library(libopenrct2 ${LIBOPENRCT2_LINKAGE} ${OPENRCT2_CORE_SOURCES} ${OPENRCT2_CORE_MM_SOURCES})
add_library(OpenRCT2::libopenrct2 ALIAS libopenrct2)
+if (ENABLE_SCRIPTING)
+ find_package(duktape CONFIG REQUIRED)
+ include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${DUKTAPE_INCLUDE_DIRS})
+ target_link_libraries(libopenrct2 ${DUKTAPE_LIBRARIES})
+endif ()
+
if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "13")
message(WARNING "Buggy GCC 12 detected! Disabling some warnings")
set_source_files_properties("${CMAKE_CURRENT_LIST_DIR}/localisation/FormatCodes.cpp" PROPERTIES COMPILE_FLAGS "-Wno-restrict")
diff --git a/src/openrct2/scripting/ScriptEngine.cpp b/src/openrct2/scripting/ScriptEngine.cpp
index aff46dee..4aa03387 100644
--- a/src/openrct2/scripting/ScriptEngine.cpp
+++ b/src/openrct2/scripting/ScriptEngine.cpp
@@ -1858,9 +1858,4 @@ int32_t OpenRCT2::Scripting::GetTargetAPIVersion()
return plugin->GetTargetAPIVersion();
}
-duk_bool_t duk_exec_timeout_check(void*)
-{
- return false;
-}
-
#endif
|