OpenSourceRisk / ORE-SWIG

Other
49 stars 46 forks source link

Java Swig and Visual Studio Cmake #2

Closed rkapl123 closed 4 years ago

rkapl123 commented 5 years ago

I've managed now to almost get the java version of OREAnalytics (so including all other modules) to build, there are just 18 compile errors left to resolve (after I've fixed the python define problem in ored_log.i):

C:\dev\ORE-SWIG\builddir\oreanalytics\oreanalyticsJAVA_wrap.cxx(288128): error C2440: "=": "SubPeriodsCouponPricerPtr " kann nicht in "boost::shared_ptr<QuantLib::F loatingRateCouponPricer> " konvertiert werden [C:\dev\ORE-SWIG\builddir\OREAnalyticsJava.vcxproj] C:\dev\ORE-SWIG\builddir\oreanalytics\oreanalyticsJAVA_wrap.cxx(288128): note: Die Typen, auf die verwiesen wird, sind nicht verknüpft; die Konvertierung erfordert einen reinterpret_cast-Operator oder eine Typumwandlung im C- oder Funktionsformat. C:\dev\ORE-SWIG\builddir\oreanalytics\oreanalyticsJAVA_wrap.cxx(288312): error C2440: "=": "ZeroRateConventionPtr " kann nicht in "boost::shared_ptr<ore::data::Conv ention> " konvertiert werden [C:\dev\ORE-SWIG\builddir\OREAnalyticsJava.vcxproj] C:\dev\ORE-SWIG\builddir\oreanalytics\oreanalyticsJAVA_wrap.cxx(288312): note: Die Typen, auf die verwiesen wird, sind nicht verknüpft; die Konvertierung erfordert einen reinterpret_cast-Operator oder eine Typumwandlung im C- oder Funktionsformat. C:\dev\ORE-SWIG\builddir\oreanalytics\oreanalyticsJAVA_wrap.cxx(288320): error C2440: "=": "DepositConventionPtr " kann nicht in "boost::shared_ptr<ore::data::Conve ntion> " konvertiert werden [C:\dev\ORE-SWIG\builddir\OREAnalyticsJava.vcxproj]

....

I've also added a separate Cmake runner to use only the VS Generate toolset (VS 2017), since I couldn't get ninja to cooperate with my x64 build of ORE/quantlib/boost. I'm trying now to get a cmake of ORE itself to build, maybe that will resolve above compiler errors.

-regards, Roland

rkapl123 commented 4 years ago

After updating the ORE-SWIG with the latest version and replacing -G "Visual Studio 15 2017" with -G "Visual Studio 16 2019" in runCmakeVS.cmd, the swig wrapper creation almost ran perfectly, with one notable exception: At the linking stage, the linker failed to find the lib files in the specified directories: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\bin\HostX64\x64\link.exe /ERRORREPORT:QUEUE /OUT:"C:\dev\ORE-SWIG\builddir\Release\OREAnalyticsJava .dll" /INCREMENTAL:NO /NOLOGO /LIBPATH:C:/dev/ORE/master/build/QuantLib/ql /LIBPATH:C:/dev/ORE/master/build/QuantLib/ql/Release /LIBPATH:C:/dev/ORE/master/build/QuantExt/qle /LIBPATH:C:/d ev/ORE/master/build/QuantExt/qle/Release /LIBPATH:C:/dev/ORE/master/build/OREData/ored /LIBPATH:C:/dev/ORE/master/build/OREData/ored/Release /LIBPATH:C:/dev/ORE/master/build/OREAnalytics/ orea /LIBPATH:C:/dev/ORE/master/build/OREAnalytics/orea/Release "QuantLib-x64-mt.lib" "QuantExt-x64-mt.lib" "OREData-x64-mt.lib" "OREAnalytics-x64-mt.lib" "C:\dev\boost\lib\libboost_seria lization-vc141-mt-x64-1_69.lib" "C:\dev\boost\lib\libboost_date_time-vc141-mt-x64-1_69.lib" "C:\dev\boost\lib\libboost_regex-vc141-mt-x64-1_69.lib" "C:\dev\boost\lib\libboost_filesystem-v c141-mt-x64-1_69.lib" "C:\dev\boost\lib\libboost_system-vc141-mt-x64-1_69.lib" kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib adva pi32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /PDB:"C:/dev/ORE-SWIG/builddir/Release/OREAnalyticsJava.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:/dev/ORE-SWIG/builddir/Release/OREAnalyticsJava.lib" /MACHINE:X64 /machine:x64 /DLL OREAnalyticsJava.dir\Release\oreanalyticsJAVA_wrap.obj LINK : fatal error LNK1181: Eingabedatei "QuantExt-x64-mt.lib" kann nicht ge÷ffnet werden. [C:\dev\ORE-SWIG\builddir\OREAnalyticsJava.vcxproj] The same happened for Quantlib\ql, OreData\ored and OreAnalytics\orea. After I've copied the lib files from their actual place (C:\dev\ORE\master\\lib ) to the expected place, the linking stage completed successfully and the jars were created.

rkapl123 commented 4 years ago

I've discovered that once you do CMake with ORE_SWIG, you need to do CMake with ORE as well. As a consequence , I've written a runCmakeVS.cmd for ORE as well (put that in the ORE main folder): mkdir build cmake -G "Visual Studio 16 2019" -A x64 -D BOOST_LIBRARYDIR=C:\dev\boost\lib -DBOOST_ROOT=C:\dev\boost -B build cmake --build build -v --config Release This creates the libraries in the expected folders.