mf523
mf523
CMakeFile.txt ```cmake_minimum_required(VERSION 3.5) project(CppModelServ CXX) project(CppModelServ VERSION 1.0) configure_file(CppModelServConfig.h.in CppModelServConfig.h) include(CheckIncludeFileCXX) check_include_file_cxx(any HAS_ANY) check_include_file_cxx(string_view HAS_STRING_VIEW) check_include_file_cxx(coroutine HAS_COROUTINE) # specify the C++ standard if (HAS_ANY AND HAS_STRING_VIEW AND HAS_COROUTINE) set(CMAKE_CXX_STANDARD 20)...
@marty1885 , thanks for quick reply. please follow this https://pytorch.org/cppdocs/installing.html it's good enough for a simple pytorch startup, then the rest are all about how to put drogon and torch...
``` #pragma once #include "CppModelServConfig.h" #include using namespace drogon; struct Model{ std::string modelName; std::string modelUrl; }; class MmsCtrl:public drogon::HttpController { public: METHOD_LIST_BEGIN //use METHOD_ADD to add your custom processing function...
``` #include "MmsCtrl.h" #include #include .... void MmsCtrl::invoke(const HttpRequestPtr &req, std::function &&callback, std::string model_name) const { LOG_DEBUG
@marty1885 per your request, above is the code I am working one, other than that, everything else is standard drogon framework. the error comes only when I include pytorch lib...
I tried the PRIVATE key word, doesn't work, my os is ubuntu, can you advice your libtorch version? will try your way.
btw, just out of curiosity, how come libtorch version could cause linker complain undefined reference on drogon side? @marty1885