Embed our own duktape library

Duktape is geared around compile time switches. We can't rely on shared libraries.
This commit is contained in:
Ted John 2021-12-07 23:54:05 +00:00
parent e78704f48f
commit b5d66e099e
11 changed files with 106350 additions and 51 deletions

View File

@ -1,36 +0,0 @@
# 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
)

2
debian/control vendored
View File

@ -4,7 +4,7 @@ Section: misc
Priority: optional
Standards-Version: 3.9.2
Multi-Arch: same
Build-Depends: debhelper (>= 9), cmake (>= 3.8), duktape-dev, libsdl2-dev, g++ (>= 4:7), pkg-config, nlohmann-json3-dev (>= 3.6.0), libspeex-dev, libspeexdsp-dev, libcurl4-openssl-dev, libcrypto++-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev, libssl-dev, libzip-dev (>= 1.0.0), libicu-dev (>= 59.0)
Build-Depends: debhelper (>= 9), cmake (>= 3.8), libsdl2-dev, g++ (>= 4:7), pkg-config, nlohmann-json3-dev (>= 3.6.0), libspeex-dev, libspeexdsp-dev, libcurl4-openssl-dev, libcrypto++-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev, libssl-dev, libzip-dev (>= 1.0.0), libicu-dev (>= 59.0)
Package: openrct2
Architecture: any

View File

@ -78,7 +78,7 @@
</ClCompile>
<Link>
<GenerateDebugInformation>DebugFull</GenerateDebugInformation>
<AdditionalDependencies>benchmarkd.lib;brotlicommon-static.lib;brotlidec-static.lib;brotlienc-static.lib;libbreakpadd.lib;libbreakpad_clientd.lib;bz2d.lib;discord-rpc.lib;duktape.lib;freetyped.lib;libpng16d.lib;libspeexdsp.lib;SDL2d.lib;zip.lib;zlibd.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>benchmarkd.lib;brotlicommon-static.lib;brotlidec-static.lib;brotlienc-static.lib;libbreakpadd.lib;libbreakpad_clientd.lib;bz2d.lib;discord-rpc.lib;freetyped.lib;libpng16d.lib;libspeexdsp.lib;SDL2d.lib;zip.lib;zlibd.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
@ -97,7 +97,7 @@
<GenerateDebugInformation>DebugFull</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>benchmark.lib;brotlicommon-static.lib;brotlidec-static.lib;brotlienc-static.lib;libbreakpad.lib;libbreakpad_client.lib;bz2.lib;discord-rpc.lib;duktape.lib;freetype.lib;libpng16.lib;libspeexdsp.lib;SDL2.lib;zip.lib;zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>benchmark.lib;brotlicommon-static.lib;brotlidec-static.lib;brotlienc-static.lib;libbreakpad.lib;libbreakpad_client.lib;bz2.lib;discord-rpc.lib;freetype.lib;libpng16.lib;libspeexdsp.lib;SDL2.lib;zip.lib;zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>

View File

@ -110,7 +110,6 @@ OpenRCT2 requires original files of RollerCoaster Tycoon 2 to play. It can be bo
- icu (>= 59.0)
- zlib
- gl (commonly provided by Mesa or GPU vendors; only for UI client, can be disabled)
- duktape (unless scripting is disabled)
- cmake
- innoextract (optional runtime dependency; used for GOG installer extraction during setup)

View File

@ -18,7 +18,13 @@ if (APPLE)
set_source_files_properties(${OPENRCT2_CORE_MM_SOURCES} PROPERTIES COMPILE_FLAGS "-x objective-c++ -fmodules")
endif ()
add_library(${PROJECT_NAME} ${OPENRCT2_CORE_SOURCES} ${OPENRCT2_CORE_MM_SOURCES})
if (ENABLE_SCRIPTING)
include_directories("${CMAKE_CURRENT_LIST_DIR}/../thirdparty/duktape")
set(OPENRCT2_DUKTAPE_SOURCES "${CMAKE_CURRENT_LIST_DIR}/../thirdparty/duktape/duktape.cpp")
set_source_files_properties(${OPENRCT2_DUKTAPE_SOURCES} PROPERTIES COMPILE_FLAGS "-w")
endif ()
add_library(${PROJECT_NAME} ${OPENRCT2_CORE_SOURCES} ${OPENRCT2_CORE_MM_SOURCES} ${OPENRCT2_DUKTAPE_SOURCES})
if (APPLE)
target_link_platform_libraries(${PROJECT_NAME})
endif ()
@ -104,16 +110,6 @@ if (NOT DISABLE_GOOGLE_BENCHMARK)
endif ()
endif ()
if (ENABLE_SCRIPTING)
find_package(duktape CONFIG REQUIRED)
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${DUKTAPE_INCLUDE_DIRS})
if (STATIC)
target_link_libraries(${PROJECT_NAME} ${DUKTAPE_LIBRARY} ${DUKTAPE_STATIC_LIBRARY})
else ()
target_link_libraries(${PROJECT_NAME} ${DUKTAPE_LIBRARY})
endif ()
endif ()
# Third party libraries
if (MSVC)
find_package(png 1.6 REQUIRED)

View File

@ -945,6 +945,7 @@
<ClCompile Include="world/TileElementBase.cpp" />
<ClCompile Include="world\TileInspector.cpp" />
<ClCompile Include="world\Wall.cpp" />
<ClCompile Include="..\thirdparty\duktape\duktape.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>

View File

@ -1438,4 +1438,9 @@ int32_t OpenRCT2::Scripting::GetTargetAPIVersion()
return plugin->GetTargetAPIVersion();
}
duk_bool_t duk_exec_timeout_check(void*)
{
return false;
}
#endif

3213
src/thirdparty/duktape/duk_config.h vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

99760
src/thirdparty/duktape/duktape.cpp vendored Normal file

File diff suppressed because it is too large Load Diff

1450
src/thirdparty/duktape/duktape.h vendored Normal file

File diff suppressed because it is too large Load Diff