mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-27 05:55:02 +03:00
test harness for dll exports
This commit is contained in:
parent
0af3b0b56a
commit
b35ba85196
@ -11,6 +11,8 @@ Global
|
||||
Debug|x64 = Debug|x64
|
||||
Debug-exe|Win32 = Debug-exe|Win32
|
||||
Debug-exe|x64 = Debug-exe|x64
|
||||
Debug-exe2|Win32 = Debug-exe2|Win32
|
||||
Debug-exe2|x64 = Debug-exe2|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
Release-exe|Win32 = Release-exe|Win32
|
||||
@ -25,6 +27,10 @@ Global
|
||||
{B4304E97-D37F-4022-BD03-841A4FAEE398}.Debug-exe|Win32.Build.0 = Debug-exe|x64
|
||||
{B4304E97-D37F-4022-BD03-841A4FAEE398}.Debug-exe|x64.ActiveCfg = Debug-exe|x64
|
||||
{B4304E97-D37F-4022-BD03-841A4FAEE398}.Debug-exe|x64.Build.0 = Debug-exe|x64
|
||||
{B4304E97-D37F-4022-BD03-841A4FAEE398}.Debug-exe2|Win32.ActiveCfg = Debug-exe2|x64
|
||||
{B4304E97-D37F-4022-BD03-841A4FAEE398}.Debug-exe2|Win32.Build.0 = Debug-exe2|x64
|
||||
{B4304E97-D37F-4022-BD03-841A4FAEE398}.Debug-exe2|x64.ActiveCfg = Debug-exe2|x64
|
||||
{B4304E97-D37F-4022-BD03-841A4FAEE398}.Debug-exe2|x64.Build.0 = Debug-exe2|x64
|
||||
{B4304E97-D37F-4022-BD03-841A4FAEE398}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{B4304E97-D37F-4022-BD03-841A4FAEE398}.Release|Win32.Build.0 = Release|Win32
|
||||
{B4304E97-D37F-4022-BD03-841A4FAEE398}.Release|x64.ActiveCfg = Release|x64
|
||||
|
@ -1,6 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug-exe2|x64">
|
||||
<Configuration>Debug-exe2</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug-exe|x64">
|
||||
<Configuration>Debug-exe</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
@ -42,6 +46,13 @@
|
||||
<CLRSupport>false</CLRSupport>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-exe2|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<CLRSupport>false</CLRSupport>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-DLL|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
@ -74,6 +85,9 @@
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug-exe|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug-exe2|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug-DLL|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
@ -83,6 +97,9 @@
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug-exe|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug-exe2|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug-DLL|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
@ -113,6 +130,10 @@
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<TargetName>$(ProjectName)decoder</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-exe2|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<TargetName>$(ProjectName)decoder</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-DLL|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<TargetName>$(ProjectName)decoder</TargetName>
|
||||
@ -189,6 +210,36 @@
|
||||
<SuppressStartupBanner>false</SuppressStartupBanner>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-exe2|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>NO_COMPACT_TABLES;HAVE_CMPHXXX;MAX_NUM_FACTORS=4;KENLM_MAX_ORDER=6;_USE_MATH_DEFINES;NOMINMAX;WITH_THREADS;NO_PIPES;_WIN32;WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(ZlibDir);$(BoostDir);$(MSBuildProjectDirectory)/../../..;C:\Program Files (x86)\Visual Leak Detector\include;C:\depot\translator\private\mt\mman;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<ObjectFileName>$(IntDir)\%(RelativeDir)\%(Filename).obj</ObjectFileName>
|
||||
<SuppressStartupBanner>false</SuppressStartupBanner>
|
||||
<ShowIncludes>false</ShowIncludes>
|
||||
<LanguageStandard>Default</LanguageStandard>
|
||||
<LanguageStandard_C>
|
||||
</LanguageStandard_C>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAsManaged>false</CompileAsManaged>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(BoostDir)\lib64-msvc-14.0;$(ZlibDir)\dll\bin\x64\Debug;C:\Program Files (x86)\Visual Leak Detector\lib\Win64</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ShowProgress>LinkVerbose</ShowProgress>
|
||||
<SuppressStartupBanner>false</SuppressStartupBanner>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-DLL|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
@ -429,7 +480,6 @@
|
||||
<ClCompile Include="..\..\..\moses2\legacy\ThreadPool.cpp" />
|
||||
<ClCompile Include="..\..\..\moses2\legacy\Timer.cpp" />
|
||||
<ClCompile Include="..\..\..\moses2\legacy\Util2.cpp" />
|
||||
<ClCompile Include="..\..\..\moses2\Main.cpp" />
|
||||
<ClCompile Include="..\..\..\moses2\ManagerBase.cpp" />
|
||||
<ClCompile Include="..\..\..\moses2\MemPool.cpp" />
|
||||
<ClCompile Include="..\..\..\moses2\parameters\AllOptions.cpp" />
|
||||
|
@ -465,9 +465,6 @@
|
||||
<ClCompile Include="..\..\..\moses2\InputType.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\moses2\Main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\moses2\ManagerBase.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include "Moses2Wrapper.h"
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <cassert>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
@ -70,4 +72,37 @@ extern "C" EXPORT MosesApiErrorCode __stdcall EngineVersion() {
|
||||
//std::cout << "windows build on v1142/ msvc 14.27.29110"<< std::endl;
|
||||
std::cout << "0.0.1" << std::endl;
|
||||
return MS_API_OK;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
assert(argc >= 2);
|
||||
cerr << "Starting" << endl;
|
||||
string filePath(argv[1]); // = ".\\enu.rus.generalnn_contextual_translit.mosesconfig.ini";
|
||||
Moses2::Moses2Wrapper *pObject = nullptr;
|
||||
MosesApiErrorCode ret = GetMosesSystem(filePath.c_str(), &pObject);
|
||||
assert(ret == MS_API_OK);
|
||||
|
||||
ifstream inFile;
|
||||
inFile.open(argv[2]);
|
||||
|
||||
long id = 44;
|
||||
string input;
|
||||
while (std::getline(inFile, input))
|
||||
{
|
||||
char* output;
|
||||
ret = Translate(pObject, id, input.c_str(), &output);
|
||||
assert(ret == MS_API_OK);
|
||||
cerr << output << flush;
|
||||
|
||||
ret = FreeMemory(output);
|
||||
assert(ret == MS_API_OK);
|
||||
|
||||
++id;
|
||||
}
|
||||
|
||||
ret = ReleaseSystem(&pObject);
|
||||
assert(ret == MS_API_OK);
|
||||
|
||||
cerr << "Finished" << endl;
|
||||
}
|
0
moses2/Jamfile
Normal file → Executable file
0
moses2/Jamfile
Normal file → Executable file
0
moses2/legacy/Util2.cpp
Normal file → Executable file
0
moses2/legacy/Util2.cpp
Normal file → Executable file
Loading…
Reference in New Issue
Block a user