Skip to content

Commit

Permalink
Embed our own duktape library
Browse files Browse the repository at this point in the history
Duktape is geared around compile time switches. We can't rely on shared libraries.
  • Loading branch information
IntelOrca committed Jan 18, 2022
1 parent e78704f commit b5d66e0
Show file tree
Hide file tree
Showing 11 changed files with 106,350 additions and 51 deletions.
36 changes: 0 additions & 36 deletions cmake/duktapeConfig.cmake

This file was deleted.

2 changes: 1 addition & 1 deletion debian/control
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions openrct2.common.props
Expand Up @@ -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'">
Expand All @@ -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>

Expand Down
1 change: 0 additions & 1 deletion readme.md
Expand Up @@ -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)

Expand Down
18 changes: 7 additions & 11 deletions src/openrct2/CMakeLists.txt
Expand Up @@ -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 ()
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions src/openrct2/libopenrct2.vcxproj
Expand Up @@ -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>
5 changes: 5 additions & 0 deletions src/openrct2/scripting/ScriptEngine.cpp
Expand Up @@ -1438,4 +1438,9 @@ int32_t OpenRCT2::Scripting::GetTargetAPIVersion()
return plugin->GetTargetAPIVersion();
}

duk_bool_t duk_exec_timeout_check(void*)
{
return false;
}

#endif

0 comments on commit b5d66e0

Please sign in to comment.