ready for first test

This commit is contained in:
2026-02-18 20:11:11 -06:00
parent 0c3fa5556d
commit 1b7e2408a1
2 changed files with 45 additions and 5 deletions

View File

@@ -15,10 +15,11 @@ if(NOT CMAKE_BUILD_TYPE)
endif()
# --------------------------------------------------
# External dependency: spdlog
# External dependency: spdlog + LLU
# --------------------------------------------------
add_subdirectory(external/spdlog)
add_subdirectory(external/LibraryLinkUtilities)
# --------------------------------------------------
# Executable
# --------------------------------------------------
@@ -38,7 +39,10 @@ foreach(dir ${SRC_SUBDIRS})
endif()
endforeach()
target_include_directories(${PROJECT_NAME} PRIVATE ${SRC_INCLUDES})
target_include_directories(${PROJECT_NAME} PRIVATE
${SRC_INCLUDES}
${CMAKE_CURRENT_SOURCE_DIR}/external/LibraryLinkUtilities/include
)
# --------------------------------------------------
# Auto-discover all .cpp except main.cpp

View File

@@ -1,4 +1,40 @@
int main (int argc, char *argv[]) {
return 0;
#include "spdlog/spdlog.h"
extern "C" {
#include <wstp.h>
}
#include <LLU/WSTP/WSStream.hpp>
int main() {
WSEnvironment env = WSInitialize(nullptr);
if (!env) {
spdlog::error("Failed to initialize WSTP environment");
return 1;
}
const char* args[] = {
"client",
"-linkname", "1240@localhost",
"-linkprotocol", "TCPIP",
"-linkmode", "connect"
};
int err = 0;
WSLINK mlp = WSOpenArgv(env,
const_cast<char**>(args),
const_cast<char**>(args) + (sizeof(args)/sizeof(args[0])),
&err);
if (!mlp || err != WSEOK) {
spdlog::error("Failed to open WSTP link (err={})", err);
WSDeinitialize(env);
return 1;
}
LLU::WSStream<LLU::WS::Encoding::Native, LLU::WS::Encoding::Native> stream(mlp);
stream << 42 << LLU::WS::Flush;
WSClose(mlp);
WSDeinitialize(env);
spdlog::info("Done");
return 0;
}