| 44 | |
| 45 | template <class F> |
| 46 | static std::function<F> compile_function(std::string_view src, const std::string& symbol_name) |
| 47 | { |
| 48 | migraphx::src_compiler compiler; |
| 49 | compiler.flags.emplace_back("-std=c++14"); |
| 50 | #ifndef _WIN32 |
| 51 | compiler.flags.emplace_back("-fPIC"); |
| 52 | compiler.flags.emplace_back("-DEXPORT=\"\""); |
| 53 | #else |
| 54 | compiler.flags.emplace_back("-DEXPORT=__declspec(dllexport)"); |
| 55 | #endif |
| 56 | compiler.flags.emplace_back("-shared"); |
| 57 | compiler.output = migraphx::make_shared_object_filename("simple"); |
| 58 | migraphx::src_file f{"main.cpp", src}; |
| 59 | auto image = compiler.compile({f}); |
| 60 | return migraphx::dynamic_loader{image}.get_function<F>(symbol_name); |
| 61 | } |
| 62 | |
| 63 | template <class F> |
| 64 | static std::function<F> compile_module(const migraphx::module& m) |
nothing calls this directly
no test coverage detected