Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use simplesquirrel library for creating Squirrel API binds #2792

Merged
merged 82 commits into from
Jul 6, 2024
Merged
Show file tree
Hide file tree
Changes from 72 commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
1b40a7e
Attempt to include SimpleSquirrel library
Vankata453 Feb 11, 2024
d11e926
Actually add SimpleSquirrel as a dependency
Vankata453 Feb 11, 2024
799e7eb
Use `simplesquirrel` library for creating Squirrel API binds
Vankata453 Feb 20, 2024
961a608
Merge remote-tracking branch 'supertux/master' into simplesquirrel
Vankata453 Feb 20, 2024
6b4a9e6
Fix issues after merging master
Vankata453 Feb 20, 2024
6be93be
GitHub actions: Recursively clone submodules
Vankata453 Feb 20, 2024
7f5a377
Pass string reference to `FloatingImage` scripting constructor
Vankata453 Feb 20, 2024
7cc3e1b
Fix some compiler warnings
Vankata453 Feb 20, 2024
abf197a
Mark getters as `const` in `CustomParticleSystem`
Vankata453 Feb 20, 2024
3560817
Fix some more compiler warnings
Vankata453 Feb 20, 2024
64d9f19
Update simplesquirrel tests
Vankata453 Feb 20, 2024
70c63f0
Move `SquirrelError` to simplesquirrel
Vankata453 Feb 21, 2024
b33bea7
Fix player `set_pos()` usage
Vankata453 Feb 21, 2024
231ebd9
Replace most raw Squirrel API usage with `simplesquirrel`
Vankata453 Feb 24, 2024
13a5000
Fix segfault on non-simplesquirrel thread `wait()`
Vankata453 Feb 25, 2024
28b2013
Bind current sector to d_scope in path object node functions
Vankata453 Feb 25, 2024
188c3bf
Add "Level.data" table for level-wide non-saveable data
Vankata453 Feb 25, 2024
6dafa4e
Fix `sqstd` libraries not being registered
Vankata453 Feb 25, 2024
19f0484
Set Squirrel VM print function to SuperTux default
Vankata453 Feb 25, 2024
8121e1f
Fix not being able to set `FloatingImage` anchor point
Vankata453 Feb 25, 2024
7f98bd1
Add `m_` prefix to `FloatingImage` member variables
Vankata453 Feb 26, 2024
2ffff55
Fix overshadowed variable in `WorldSelect::WorldSelect()`
Vankata453 Feb 26, 2024
61116dc
Fix compilation warnings
Vankata453 Feb 26, 2024
8627587
Update `simplesquirrel` "CMakeLists.txt"
Vankata453 Feb 26, 2024
f9b4547
Fix shadowing global declaration warning
Vankata453 Feb 26, 2024
f96346c
Fix MSVC errors
Vankata453 Feb 26, 2024
0a2707e
Clang: Ignore unused template warning
Vankata453 Feb 26, 2024
42e7fbb
Try to start workflows
Vankata453 Feb 26, 2024
b8ed496
Remove unneeded `this` capture
Vankata453 Feb 26, 2024
8e1545b
Declare `scripting::` functions as `static`
Vankata453 Feb 26, 2024
af3a2a9
Add external/simplesquirrel to DIRS variable to maybe fix MacOS build…
tobbi Mar 3, 2024
5e43c2f
Scripting reference generator updates to support `simplesquirrel`
Vankata453 Apr 14, 2024
1a4c42c
Merge remote-tracking branch 'supertux/master' into simplesquirrel
Vankata453 Apr 14, 2024
9424cb7
Merge branch 'SuperTux:master' into simplesquirrel
Vankata453 Apr 25, 2024
f915887
fix windows
MatusGuy Apr 25, 2024
9a2fb2d
Scriptable granito wip
MatusGuy Apr 25, 2024
66e05ea
scriptable big granito
MatusGuy Apr 27, 2024
e9d8989
Minor code fixes and enumerators for `Granito`
Vankata453 Apr 27, 2024
8ed63c7
Merge branch 'master' into simplesquirrel
Vankata453 Apr 27, 2024
d5cac86
Scripting reference generator fixes, enumerator prefixes
Vankata453 Apr 27, 2024
c6b1a95
Granito: Fix compilation
Vankata453 Apr 27, 2024
45f2559
windows package show wix log if failed
MatusGuy Apr 29, 2024
2cdb325
Merge branch 'simplesquirrel' of https://github.com/Vankata453/supert…
MatusGuy Apr 29, 2024
23f1b4c
remove squirrel from linking
MatusGuy Apr 29, 2024
a9e052e
Scripting workflow: Use proper bot email address
Vankata453 May 1, 2024
5543367
Merge remote-tracking branch 'supertux/master' into simplesquirrel
Vankata453 May 6, 2024
c91b520
Update simplesquirrel
Vankata453 May 16, 2024
b1d4dfa
Build solely simplesquirrel's Squirrel submodule
Vankata453 May 16, 2024
e0d5714
Configure "run_supertux.bat" on Windows
Vankata453 May 16, 2024
9165150
Merge branch 'master' into simplesquirrel
MatusGuy Jun 4, 2024
30db6b2
test remove installer
MatusGuy Jun 5, 2024
fae1c87
Merge branch 'simplesquirrel' of https://github.com/Vankata453/supert…
MatusGuy Jun 5, 2024
2219e2c
fix stuff
MatusGuy Jun 5, 2024
1c0ce32
disable sq installer not ssq
MatusGuy Jun 5, 2024
ba71982
Remove unneeded spaces
Vankata453 Jun 5, 2024
09d6b2e
Merge master
MatusGuy Jun 6, 2024
484dd2d
Merge branch 'master' into simplesquirrel
MatusGuy Jun 6, 2024
7764dff
Notice for scriptable granito users [ci skip]
MatusGuy Jun 6, 2024
4125ed0
Merge branch 'simplesquirrel' of https://github.com/Vankata453/supert…
MatusGuy Jun 6, 2024
e88b593
remove include [ci skip]
MatusGuy Jun 6, 2024
418ba4a
Revert "remove include [ci skip]"
MatusGuy Jun 6, 2024
6ec2d91
Fix Granito::wave() not working right with Scriptable Granito
MatusGuy Jun 7, 2024
2e80df0
BadGuy now inherits MovingSprite
MatusGuy Jun 7, 2024
1b8c801
Change granito reset_detection description [ci skip]
MatusGuy Jun 8, 2024
6a7df40
Default script file variable, remove include
Vankata453 Jun 8, 2024
bcf487c
`LitObject` now inherits `MovingSprite` in scripting
Vankata453 Jun 8, 2024
674993b
Revert removed include
Vankata453 Jun 8, 2024
7b1aadd
Documentation generation improvements
Vankata453 Jun 8, 2024
dc2da2b
Various improvements and fixes to scripting documentation generator
Vankata453 Jun 8, 2024
c6a705a
Scripting docs: Print out function return types
Vankata453 Jun 8, 2024
8acd2ab
Update `FloatingImage` summary
Vankata453 Jun 8, 2024
55124f6
Fix `Sector` scripting docs not being generated
Vankata453 Jun 8, 2024
ae30b78
Merge branch 'master' into simplesquirrel
Vankata453 Jun 29, 2024
98030d3
Fix various code-style issues
Vankata453 Jun 29, 2024
8511e06
Use error functions from the Squirrel standard library by default
Vankata453 Jun 29, 2024
852f656
`print_stacktrace()` now uses Squirrel standard library, remove `wher…
Vankata453 Jun 29, 2024
8e94420
print stacktrace upon error
MatusGuy Jul 3, 2024
2eadef5
update ssq submodule
MatusGuy Jul 3, 2024
c23f801
update ssq
MatusGuy Jul 5, 2024
b3ea3bb
Merge branch 'simplesquirrel' of github.com:Vankata453/supertux into …
MatusGuy Jul 6, 2024
a84cfcc
merge
MatusGuy Jul 6, 2024
bbf5526
remove configure_file here
MatusGuy Jul 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
submodules: recursive

- name: Clone SDL Android repo
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bsd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
with:
# Fetch the whole tree so git describe works
fetch-depth: 0
submodules: true
submodules: recursive

- name: Build in FreeBSD
if: ${{ matrix.vm_os == 'freebsd' }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gnulinux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
with:
# Fetch the whole tree so git describe works
fetch-depth: 0
submodules: true
submodules: recursive

- name: Install 64-bit dependencies
if: ${{ matrix.arch == 64 }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
with:
# Fetch the whole tree so git describe works
fetch-depth: 0
submodules: true
submodules: recursive

- name: Install macos dependencies
if: ${{ matrix.os == 'macos-12' }}
Expand Down
21 changes: 15 additions & 6 deletions .github/workflows/scripting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ name: Scripting
on:
push:
branches: [ "master" ]
paths:
Vankata453 marked this conversation as resolved.
Show resolved Hide resolved
- src/scripting/*.hpp
workflow_dispatch:

jobs:
Expand Down Expand Up @@ -56,31 +54,42 @@ jobs:
cmake --version
mkdir build
cd build
cmake .. -DBUILD_SCRIPTING_DOCUMENTATION=ON
cmake .. -DBUILD_DOCUMENTATION_WITH_SCRIPTING=ON
make

- name: Generate scripting reference
working-directory: tools/scripting_docs_gen/build
run: |
doxygen docs/scripting/Doxyfile
doxygen docs/Doxyfile
rm ../../../wiki/Scripting*.md
./ScriptingDocsGen --dir docs/scripting/doxygen/xml \
./ScriptingDocsGen --dir docs/doxygen/xml \
--home ../../../wiki/templates/ScriptingHome.md \
--page ../../../wiki/templates/ScriptingPage.md \
--output ../../../wiki

- name: Check for changes
working-directory: wiki
run: |
REF_UPDATED=true
if git diff --exit-code; then
REF_UPDATED=false
fi
echo "REFERENCE_UPDATED=$(echo $REF_UPDATED)" >> $GITHUB_ENV

- name: Install SSH key
if: ${{ env.REFERENCE_UPDATED == 'true' }}
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.wiki_repo_key }}
known_hosts: ${{ secrets.wiki_repo_hosts }}

- name: Push changes to wiki
if: ${{ env.REFERENCE_UPDATED == 'true' }}
working-directory: wiki
run: |
git --version
git status
git config --global user.email "supertux-bot"
git config --global user.email "SuperTux-bot@users.noreply.github.com"
git config --global user.name "SuperTux Bot"
git add .
git commit -m "Update scripting reference (SuperTux/supertux@${{ github.sha }})"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu-touch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
with:
# Fetch the whole tree so git describe works
fetch-depth: 0
submodules: true
submodules: recursive

- name: Install clickable
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
with:
# Fetch the whole tree so git describe works
fetch-depth: 0
submodules: true
submodules: recursive

- name: Install emscripten tools
run: |
Expand Down
16 changes: 13 additions & 3 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
with:
# Fetch the whole tree so git describe works
fetch-depth: 0
submodules: true
submodules: recursive

- name: Use cached dependencies
id: cache-dependencies
Expand Down Expand Up @@ -105,13 +105,23 @@ jobs:
"./$Env:BUILD_TYPE/run_tests.exe"

- name: Package
shell: pwsh
working-directory: build
env:
BUILD_TYPE: ${{ matrix.build_type }}
run: |
cpack -C $Env:BUILD_TYPE
mkdir upload
mv *.msi upload/
if ($LASTEXITCODE -ne 0)
{
$code = $LASTEXITCODE
type ./_CPack_Packages/win64/WIX/wix.log
exit $code
}
else
{
mkdir upload
mv *.msi upload/
}

- uses: actions/upload-artifact@v4
with:
Expand Down
9 changes: 3 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[submodule "external/tinygettext"]
path = external/tinygettext
url = https://github.com/SuperTux/tinygettext.git
[submodule "external/squirrel"]
path = external/squirrel
url = https://github.com/albertodemichelis/squirrel.git
[submodule "external/sexp-cpp"]
path = external/sexp-cpp
url = https://github.com/SuperTux/sexp-cpp.git
Expand All @@ -19,9 +16,9 @@
[submodule "external/fmt"]
path = external/fmt
url = https://github.com/fmtlib/fmt.git
[submodule "tools/miniswig"]
path = tools/miniswig
url = https://github.com/WindstilleTeam/miniswig
[submodule "external/glm"]
path = external/glm
url = https://github.com/g-truc/glm.git
[submodule "external/simplesquirrel"]
path = external/simplesquirrel
url = https://github.com/SuperTux/simplesquirrel
15 changes: 7 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ include(SuperTux/ProvideOpenAL)
include(SuperTux/ProvideOggVorbis)
include(SuperTux/ProvidePhysfs)
include(SuperTux/ProvideCurl)
include(SuperTux/ProvideSquirrel)
include(SuperTux/ProvideSimpleSquirrel)
include(SuperTux/ProvideTinygettext)
include(SuperTux/ProvideSDL2_ttf)
include(SuperTux/ProvideDiscord)
Expand All @@ -187,7 +187,11 @@ include(SuperTux/ProvideOpenGL)
include(SuperTux/BuildVersion)
include(SuperTux/BuildDocumentation)
include(SuperTux/BuildMessagePot)
include(SuperTux/BuildMiniswigWrapper)

## Configure a batch file for debug run purposes
if(MSVC)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/mk/msvc/run_supertux.bat.in" "${CMAKE_CURRENT_BINARY_DIR}/run_supertux.bat")
endif()

## Build list of sources for supertux binary
file(GLOB SUPERTUX_SOURCES_C RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} external/obstack/*.c external/findlocale/findlocale.c)
Expand All @@ -205,10 +209,6 @@ list(SORT SUPERTUX_SOURCES_C)
list(SORT SUPERTUX_SOURCES_CXX)
list(SORT SUPERTUX_RESOURCES)

if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src/scripting/wrapper.cpp)
set(SUPERTUX_SOURCES_CXX ${SUPERTUX_SOURCES_CXX} ${CMAKE_CURRENT_SOURCE_DIR}/src/scripting/wrapper.cpp)
endif()

## On Windows, add an icon
if(WIN32)
if(MINGW)
Expand Down Expand Up @@ -269,8 +269,7 @@ endif()

## Link supertux binary with squirrel and other libraries

target_link_libraries(supertux2_lib PUBLIC LibSquirrel)
target_link_libraries(supertux2_lib PUBLIC LibSqstdlib)
target_link_libraries(supertux2_lib PUBLIC LibSimpleSquirrel)
target_link_libraries(supertux2_lib PUBLIC LibTinygettext)
target_link_libraries(supertux2_lib PUBLIC LibSexp)
target_link_libraries(supertux2_lib PUBLIC LibSavePNG)
Expand Down
17 changes: 0 additions & 17 deletions data/scripts/default.nut
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,6 @@
* and variables you define here can be used in all threads
*/

//Create Level table
Level <- {
finish=Level_finish,
has_active_sequence=Level_has_active_sequence,
spawn=Level_spawn,
spawn_transition=Level_spawn_transition,
set_start_point=Level_set_start_point,
set_start_pos=Level_set_start_pos,
set_respawn_point=Level_set_respawn_point,
set_respawn_pos=Level_set_respawn_pos,
flip_vertically=Level_flip_vertically,
toggle_pause=Level_toggle_pause,
pause_target_timer=Level_pause_target_timer,
resume_target_timer=Level_resume_target_timer
};


function end_level()
{
play_music("music/misc/leveldone.ogg");
Expand Down
1 change: 1 addition & 0 deletions external/simplesquirrel
Submodule simplesquirrel added at c60427
1 change: 0 additions & 1 deletion external/squirrel
Submodule squirrel deleted from b31e5b
2 changes: 1 addition & 1 deletion mk/cmake/SuperTux/BuildCPack.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
option(DISABLE_CPACK_BUNDLING "Build an .app bundle without CPack" OFF)

include(InstallRequiredSystemLibraries)
set(DIRS ${Boost_LIBRARY_DIRS} ${CMAKE_CURRENT_BINARY_DIR}/external/squirrel ${CMAKE_CURRENT_BINARY_DIR}/external/tinygettext)
set(DIRS ${CMAKE_CURRENT_BINARY_DIR}/external/tinygettext ${CMAKE_CURRENT_BINARY_DIR}/external/simplesquirrel)

if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT DISABLE_CPACK_BUNDLING)
set(INFOPLIST_CFBUNDLEEXECUTABLE "SuperTux")
Expand Down
25 changes: 7 additions & 18 deletions mk/cmake/SuperTux/BuildDocumentation.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,22 @@
# Adapted from https://tty1.net/blog/2014/cmake-doxygen_en.html
# add a target to generate API documentation with Doxygen
option(BUILD_DOCUMENTATION "Build API documentation using Doxygen" ${DOXYGEN_FOUND})
option(BUILD_SCRIPTING_DOCUMENTATION "Build scripting API documentation using Doxygen" ${DOXYGEN_FOUND})
option(BUILD_DOCUMENTATION_WITH_SCRIPTING "Build API documentation, including scripting API, using Doxygen" OFF)

# CMakeLists, including this file from a different directory, can define PROJECT_SOURCE_DIR as the path to the SuperTux source.
if(NOT DEFINED PROJECT_SOURCE_DIR)
# If not set, use the current source directory.
set(PROJECT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
endif()

if(BUILD_DOCUMENTATION)
if(BUILD_DOCUMENTATION OR BUILD_DOCUMENTATION_WITH_SCRIPTING)
find_package(Doxygen REQUIRED)

set(doxyfile_in ${PROJECT_SOURCE_DIR}/Doxyfile.in)
if(BUILD_DOCUMENTATION_WITH_SCRIPTING)
set(doxyfile_in ${PROJECT_SOURCE_DIR}/mk/doxygen/Doxyfile_scripting.in)
else()
set(doxyfile_in ${PROJECT_SOURCE_DIR}/mk/doxygen/Doxyfile.in)
endif()
set(doxyfile ${CMAKE_CURRENT_BINARY_DIR}/docs/Doxyfile)

configure_file(${doxyfile_in} ${doxyfile} @ONLY)
Expand All @@ -25,19 +29,4 @@ if(BUILD_DOCUMENTATION)
VERBATIM)
endif()

if(BUILD_SCRIPTING_DOCUMENTATION)
find_package(Doxygen REQUIRED)

set(doxyfile_in ${PROJECT_SOURCE_DIR}/mk/doxygen/Doxyfile_scripting.in)
set(doxyfile ${CMAKE_CURRENT_BINARY_DIR}/docs/scripting/Doxyfile)

configure_file(${doxyfile_in} ${doxyfile} @ONLY)

add_custom_target(scripting_doc
COMMAND ${DOXYGEN_EXECUTABLE} ${doxyfile}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating scripting API documentation with Doxygen"
VERBATIM)
endif()

# EOF #
27 changes: 0 additions & 27 deletions mk/cmake/SuperTux/BuildMiniswigWrapper.cmake

This file was deleted.

14 changes: 14 additions & 0 deletions mk/cmake/SuperTux/ProvideSimpleSquirrel.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
if(EMSCRIPTEN)
set(SQ_DISABLE_INSTALLER ON)
endif()

add_subdirectory("${CMAKE_SOURCE_DIR}/external/simplesquirrel/")

if(MSVC)
add_library(LibSimpleSquirrel ALIAS simplesquirrel_static)
else()
add_library(LibSimpleSquirrel ALIAS simplesquirrel)
endif()

# Set variables
set(SQUIRREL_PREFIX ${CMAKE_BINARY_DIR}/external/simplesquirrel/libs/squirrel)
Loading