Skip to content

Commit

Permalink
Implement simplesquirrel library to replace Miniswig wrapper genera…
Browse files Browse the repository at this point in the history
…tion (#71)

Implement `simplesquirrel` library to replace Miniswig wrapper generation

The `simplesquirrel` library is a simple binding to Squirrel in C++11.

It allows Brux to easily bind its API functions, each with a single line of code, removing the need for wrapper generation and the various inconveniences around it - everything is done from the code in "src/brux". Since there is no longer any wrapper generation, the "src/api" and "src/squirrel" directories have been deleted.

Additionally, `simplesquirrel` also provides handy wrappers across all types of Squirrel objects and a lot of general functions, which have been utilized in some places here.

Closes #66.

* Update simplesquirrel

* GitHub workflows: Recursively fetch submodules

Allows for fetching the required Squirrel submodule, contained in the simplesquirrel submodule.

* Add simplesquirrel Squirrel include dir patch

* Fix illegal token error with `std::min` and `std::max`

* Fix Squirrel linking issue in `simplesquirrel`

* Update `simplesquirrel`

* Revert copyright header change

Don't know why I did this.
  • Loading branch information
Vankata453 authored May 16, 2024
1 parent d161f20 commit 0b39712
Show file tree
Hide file tree
Showing 61 changed files with 1,267 additions and 7,564 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gnu_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: true
submodules: recursive

- name: Install 32-bit dependencies
if: ${{ matrix.arch == 32 }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: true
submodules: recursive

- name: Use cached dependencies
id: cache-dependencies
Expand Down
9 changes: 3 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[submodule "rte/external/miniswig"]
path = rte/external/miniswig
url = https://github.com/WindstilleTeam/miniswig
[submodule "rte/external/squirrel"]
path = rte/external/squirrel
url = https://github.com/albertodemichelis/squirrel.git
[submodule "rte/external/physfs"]
path = rte/external/physfs
url = https://github.com/icculus/physfs
[submodule "rte/external/simplesquirrel"]
path = rte/external/simplesquirrel
url = https://github.com/SuperTux/simplesquirrel
25 changes: 8 additions & 17 deletions rte/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@ if (USE_SDL2_MIXER)
option(USE_FASTFILL "Use an O(1) algorithm for replacing unloaded sounds with new sounds instead of the original O(n) algorithm" ON)
endif()

if (USE_SDL2_MIXER)
set(AUDIO_SOURCE src/audio/audio_sdl2.cpp)
else()
set(AUDIO_SOURCE src/audio/audio_none.cpp)
endif()

# preprocess config.hpp, used for optional libraries

configure_file(src/config.hpp.in config.hpp)
Expand Down Expand Up @@ -73,8 +67,9 @@ find_package(SDL2 REQUIRED)
find_package(SDL2_image REQUIRED)
find_package(SDL2_gfx REQUIRED)

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

include(ProvidePhysFS)
include(ProvideSquirrel)

# If static linking is enabled, link additional libraries
# Also, look at all of the dependencies it uses. This is one of the reasons why the portability API exists.
Expand Down Expand Up @@ -104,20 +99,14 @@ if(BUILD_STATIC_LIBS)
endif()
endif()

# Include additional scripts
include(BuildMiniswigWrapper)

# Set include directories
include_directories(${SDL2_INCLUDE_DIRS})
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/src")

# Search for source files and copy the test suite to the output directory
file(GLOB SRCFILES src/api/*.cpp
file(GLOB SRCFILES src/audio/*.cpp
src/brux/*.cpp
${AUDIO_SOURCE}
src/external/*.c
src/squirrel/*.cpp
src/squirrel/wrapper.cpp)
src/external/*.c)
add_executable(brux ${SRCFILES})
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/test/" DESTINATION "${RUNTIME_OUTPUT_DIR}")

Expand All @@ -131,6 +120,8 @@ if(WIN32) # FIXME: Proper way of having the SDL2 libraries copied over to binary
if (USE_SDL2_MIXER)
target_link_libraries(brux PUBLIC ${SDL2_MIXER_LIBRARIES})
endif()

target_link_libraries(brux PUBLIC simplesquirrel_static)
else()
target_link_libraries(brux PUBLIC SDL2)
target_link_libraries(brux PUBLIC SDL2::Image)
Expand All @@ -139,8 +130,8 @@ else()
if (USE_SDL2_MIXER)
target_link_libraries(brux PUBLIC SDL2::Mixer)
endif()

target_link_libraries(brux PUBLIC simplesquirrel)
endif()

target_link_libraries(brux PUBLIC LibPhysfs)
target_link_libraries(brux PUBLIC LibSquirrel)
target_link_libraries(brux PUBLIC LibSqstdlib)
25 changes: 0 additions & 25 deletions rte/cmake/BuildMiniswigWrapper.cmake

This file was deleted.

83 changes: 0 additions & 83 deletions rte/cmake/ProvideSquirrel.cmake

This file was deleted.

1 change: 0 additions & 1 deletion rte/external/miniswig
Submodule miniswig deleted from 029d2c
1 change: 1 addition & 0 deletions rte/external/simplesquirrel
Submodule simplesquirrel added at c60427
1 change: 0 additions & 1 deletion rte/external/squirrel
Submodule squirrel deleted from 57b8f5
13 changes: 0 additions & 13 deletions rte/src/api/api.hpp

This file was deleted.

125 changes: 0 additions & 125 deletions rte/src/api/audio.cpp

This file was deleted.

Loading

0 comments on commit 0b39712

Please sign in to comment.