ready for first test
This commit is contained in:
@@ -15,10 +15,11 @@ if(NOT CMAKE_BUILD_TYPE)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# --------------------------------------------------
|
# --------------------------------------------------
|
||||||
# External dependency: spdlog
|
# External dependency: spdlog + LLU
|
||||||
# --------------------------------------------------
|
# --------------------------------------------------
|
||||||
add_subdirectory(external/spdlog)
|
add_subdirectory(external/spdlog)
|
||||||
add_subdirectory(external/LibraryLinkUtilities)
|
add_subdirectory(external/LibraryLinkUtilities)
|
||||||
|
|
||||||
# --------------------------------------------------
|
# --------------------------------------------------
|
||||||
# Executable
|
# Executable
|
||||||
# --------------------------------------------------
|
# --------------------------------------------------
|
||||||
@@ -38,7 +39,10 @@ foreach(dir ${SRC_SUBDIRS})
|
|||||||
endif()
|
endif()
|
||||||
endforeach()
|
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
|
# Auto-discover all .cpp except main.cpp
|
||||||
|
|||||||
42
src/main.cpp
42
src/main.cpp
@@ -1,4 +1,40 @@
|
|||||||
int main (int argc, char *argv[]) {
|
#include "spdlog/spdlog.h"
|
||||||
|
extern "C" {
|
||||||
return 0;
|
#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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user