Skip to content

Free, open-source 3D sculpting for Linux, macOS and Windows: dense meshes, remeshing, painting, built-in AI (image/text to 3D), Send to Unreal, game-ready LODs, Gaussian splats and OpenUSD.

httpSupported(): the mocked Rodin flow skips in builds without libcurl

islandmed489fd87ff1bd
diff --git a/src/ai/Http.cpp b/src/ai/Http.cpp
index 065a4d19..bfdb259a 100644
--- a/src/ai/Http.cpp
+++ b/src/ai/Http.cpp
@@ -24,6 +24,14 @@ std::atomic<uint64_t> gRequests{0};
uint64_t httpRequestCount() { return gRequests; }
void resetHttpRequestCount() { gRequests = 0; }
+bool httpSupported() {
+#if defined(_WIN32) || defined(SF_HAVE_CURL)
+ return true;
+#else
+ return false;
+#endif
+}
+
HttpResponse httpRequest(const std::string& method, const std::string& url, const std::vector<std::string>& headers,
const std::string& body, int timeoutSeconds) {
std::string received;
diff --git a/src/ai/Http.h b/src/ai/Http.h
index a56364aa..74ae93f6 100644
--- a/src/ai/Http.h
+++ b/src/ai/Http.h
@@ -62,6 +62,8 @@ std::string multipartBody(const std::vector<MultipartField>& fields, std::string
// Every request this process started (tests: the AI switch sends nothing while it is off).
uint64_t httpRequestCount();
void resetHttpRequestCount(); // (the warm UI test server, between scripts: app/UiServe.h)
+// False in a build without libcurl (non-Windows): every request fails at once. Tests that talk to a local server skip.
+bool httpSupported();
inline HttpResponse httpPostJson(const std::string& url, const std::vector<std::string>& headers, const std::string& body,
int timeoutSeconds = 120) {
diff --git a/tests/test_rodin_fal.cpp b/tests/test_rodin_fal.cpp
index 27e3f963..c1d206a4 100644
--- a/tests/test_rodin_fal.cpp
+++ b/tests/test_rodin_fal.cpp
@@ -10,6 +10,7 @@
#include "ai/ImageTo3DService.h"
#include "link/HttpServer.h"
+#include <cstdio>
#include <filesystem>
#include <fstream>
#include <mutex>
@@ -58,6 +59,7 @@ TEST(rodin_fal_request_bodies) {
}
TEST(rodin_fal_text_to_3d_mocked) {
+ if (!ai::httpSupported()) return; // a build without libcurl
// A fake fal.ai queue: submit, one status poll, the result, then the file download, all on 127.0.0.1.
link::HttpServer server;
link::HttpServer::Options o;
@@ -94,6 +96,7 @@ TEST(rodin_fal_text_to_3d_mocked) {
const std::string stem = tempPath("sf_rodin_text");
ai::GeneratorResult r = ai::generate3DFromText(s, "a stylised dragon head", stem);
server.stop();
+ if (!r.ok) std::fprintf(stderr, " rodin mock: %s\n", r.error.c_str());
CHECK(r.ok);
CHECK(r.outputPath == stem + ".glb");
std::ifstream f(r.outputPath, std::ios::binary);