diff --git a/CMakeLists.txt b/CMakeLists.txt index f26eff021..f7014dbeb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -135,6 +135,7 @@ if("${SRB2_CONFIG_SYSTEM_LIBRARIES}") find_package(OPENMPT REQUIRED) find_package(GME REQUIRED) find_package(DiscordRPC REQUIRED) + find_package(acsvm REQUIRED) endif() if(${PROJECT_SOURCE_DIR} MATCHES ${PROJECT_BINARY_DIR}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 318c9cb7e..77442180f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -130,6 +130,8 @@ add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32 k_profiles.c k_specialstage.c k_roulette.c + k_acs.c + k_acs-func.c ) if("${CMAKE_COMPILER_IS_GNUCC}" AND "${CMAKE_SYSTEM_NAME}" MATCHES "Windows") @@ -198,6 +200,8 @@ target_link_libraries(SRB2SDL2 PRIVATE DiscordRPC::DiscordRPC) target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_DISCORDRPC -DUSE_STUN) target_sources(SRB2SDL2 PRIVATE discord.c stun.c) +target_link_libraries(SRB2SDL2 PRIVATE acsvm::acsvm) + set(SRB2_HAVE_THREADS ON) target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_THREADS) diff --git a/src/k_acs-func.c b/src/k_acs-func.c index 5d1efa3c7..cc46d7958 100644 --- a/src/k_acs-func.c +++ b/src/k_acs-func.c @@ -34,6 +34,19 @@ #include "s_sound.h" #include "r_textures.h" +ACSVM_String *ACSVM_MapScope_GetString(ACSVM_MapScope *map, ACSVM_Word index) +{ + (void)map; + (void)index; + return NULL; +} + +ACSVM_ThreadInfo *ACSVM_AllocThreadInfo(void *activator) +{ + (void)activator; + return NULL; +} + /*-------------------------------------------------- static bool ACS_GetMobjTypeFromString(const char *word, mobjtype_t *type) diff --git a/src/k_acs.c b/src/k_acs.c index 80e772f1e..ed2e319d8 100644 --- a/src/k_acs.c +++ b/src/k_acs.c @@ -28,13 +28,13 @@ #include "p_tick.h" #include "p_local.h" -#include "CAPI/BinaryIO.h" -#include "CAPI/Environment.h" -#include "CAPI/Module.h" -#include "CAPI/PrintBuf.h" -#include "CAPI/Scope.h" -#include "CAPI/String.h" -#include "CAPI/Thread.h" +#include +#include +#include +#include +#include +#include +#include static ACSVM_Environment *ACSenv = NULL; diff --git a/src/k_acs.h b/src/k_acs.h index 41cbe8ec5..b4bb6628f 100644 --- a/src/k_acs.h +++ b/src/k_acs.h @@ -21,13 +21,17 @@ #include "p_polyobj.h" #include "d_player.h" -#include "CAPI/BinaryIO.h" -#include "CAPI/Environment.h" -#include "CAPI/Module.h" -#include "CAPI/PrintBuf.h" -#include "CAPI/Scope.h" -#include "CAPI/String.h" -#include "CAPI/Thread.h" +#include +#include +#include +#include +#include +#include +#include + +// Temp +ACSVM_String *ACSVM_MapScope_GetString(ACSVM_MapScope *map, ACSVM_Word index); +ACSVM_ThreadInfo *ACSVM_AllocThreadInfo(void *activator); // // Special global script types. diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt index 8e9793ee7..e5a5fd5d6 100644 --- a/thirdparty/CMakeLists.txt +++ b/thirdparty/CMakeLists.txt @@ -540,3 +540,105 @@ if(NOT "${SRB2_CONFIG_SYSTEM_LIBRARIES}") target_include_directories(discord-rpc INTERFACE "${DiscordRPC_SOURCE_DIR}/include") add_library(DiscordRPC::DiscordRPC ALIAS discord-rpc) endif() + +if(NOT "${SRB2_CONFIG_SYSTEM_LIBRARIES}") + CPMAddPackage( + NAME acsvm + VERSION 0 + URL "https://github.com/DavidPH/ACSVM/archive/7011af443dd03e8592d7810b0b91f46c49bdde59.zip" + EXCLUDE_FROM_ALL ON + DOWNLOAD_ONLY YES + ) + + if(acsvm_ADDED) + # Sal -- While ACSVM can be built as a shared library, a lot of its options are + # tied to directories existing, because the project suggests just copying it into + # your own project directly. I don't want us to do that, so I made our own target. + set( + acsvm_SOURCES + + ACSVM/Action.cpp + ACSVM/Action.hpp + ACSVM/Array.cpp + ACSVM/Array.hpp + ACSVM/BinaryIO.cpp + ACSVM/BinaryIO.hpp + ACSVM/CallFunc.cpp + ACSVM/CallFunc.hpp + ACSVM/Code.hpp + ACSVM/CodeData.cpp + ACSVM/CodeData.hpp + ACSVM/CodeList.hpp + ACSVM/Environment.cpp + ACSVM/Environment.hpp + ACSVM/Error.cpp + ACSVM/Error.hpp + ACSVM/Function.cpp + ACSVM/Function.hpp + ACSVM/HashMap.hpp + ACSVM/HashMapFixed.hpp + ACSVM/ID.hpp + ACSVM/Init.cpp + ACSVM/Init.hpp + ACSVM/Jump.cpp + ACSVM/Jump.hpp + ACSVM/Module.cpp + ACSVM/Module.hpp + ACSVM/ModuleACS0.cpp + ACSVM/ModuleACSE.cpp + ACSVM/PrintBuf.cpp + ACSVM/PrintBuf.hpp + ACSVM/Scope.cpp + ACSVM/Scope.hpp + ACSVM/Script.cpp + ACSVM/Script.hpp + ACSVM/Serial.cpp + ACSVM/Serial.hpp + ACSVM/Stack.hpp + ACSVM/Store.hpp + ACSVM/String.cpp + ACSVM/String.hpp + ACSVM/Thread.cpp + ACSVM/Thread.hpp + ACSVM/ThreadExec.cpp + ACSVM/Tracer.cpp + ACSVM/Tracer.hpp + ACSVM/Types.hpp + ACSVM/Vector.hpp + + Util/Floats.cpp + Util/Floats.hpp + + # temp + CAPI/Array.cpp + CAPI/Array.h + CAPI/BinaryIO.cpp + CAPI/BinaryIO.h + CAPI/Environment.cpp + CAPI/Environment.h + CAPI/Floats.cpp + CAPI/Floats.h + CAPI/Module.cpp + CAPI/Module.h + CAPI/PrintBuf.cpp + CAPI/PrintBuf.h + CAPI/Scope.cpp + CAPI/Scope.h + CAPI/String.cpp + CAPI/String.h + CAPI/Thread.cpp + CAPI/Thread.h + CAPI/Types.h + ) + list(TRANSFORM acsvm_SOURCES PREPEND "${acsvm_SOURCE_DIR}/") + add_library(acsvm "${SRB2_INTERNAL_LIBRARY_TYPE}" ${acsvm_SOURCES}) + + target_compile_features(acsvm PRIVATE cxx_std_11) + #target_compile_definitions(ACSVM_SHARED="${SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}") + + target_include_directories(acsvm INTERFACE "${acsvm_SOURCE_DIR}") + + target_link_libraries(acsvm PRIVATE acsvm::acsvm) + add_library(acsvm::acsvm ALIAS acsvm) + endif() +endif()