So, I think I have gotten it working. First of all, I had the same problem
as you with the macro_ensure_version string. For the moment I just replaced
those lines in CMakeLists.txt with:
set(GCC_IS_NEWER_THAN_4_0 TRUE)
set(GCC_IS_NEWER_THAN_4_1 TRUE)
set(GCC_IS_NEWER_THAN_4_2 TRUE)
I also had some problem at the link stage with InChI, so I just turned that
off (-DWITH_INCHI=FALSE).
In src/dlhandler_win32.cpp, after the lines:
if(!handle)
handle = GetModuleHandle("openbabel-2.dll");//CMake/VC++2008 build will
use this.
...I added:
if (!handle)
handle = GetModuleHandle("libopenbabel.dll"); // MinGW
And finally, in src/CMakeLists.txt I changed MSVC to WIN32 in one section
as follows:
if(BUILD_SHARED)
if(WIN32)
set(openbabel_srcs ${openbabel_srcs}
dlhandler_win32.cpp
)
else(WIN32)
set(openbabel_srcs ${openbabel_srcs}
dlhandler_unix.cpp
)
endif(WIN32)
else(BUILD_SHARED)
If you can check/confirm that this makes things work for you, then I look
into making these changes permanent and setting up an automated build.
Regards,
- Noel
On 22 February 2018 at 17:00, Noel O'Boyle <baoille...@gmail.com> wrote:
> I'll try to sort this out asap. Unfortunately, we don't have a build
> server for MinGW (or indeed Cygwin) and so it tends to bit rot. It has
> worked in the past though, and we should get it working again.
>
> Actually, I just looked up AppVeyor, and it seems they also support MinGW
> (as well as our current MSVC build), so if we get it going, we can ensure
> that it stays working in future.
>
> Regards,
> - Noel
>
> On 22 February 2018 at 16:34, Sébastien Le Roux <sebastien.leroux@ipcms.
> unistra.fr> wrote:
>
>> Dear all,
>> same guy here trying to use the devel. lib of Openbabel for windows
>> (msys, mingw64),
>> thanks to Noel O'Boyle I managed to build the lib, and after that build
>> my program ...
>> only to see that I could not open a file using babel on windows,
>> openbabel systematically
>> fails on the conv.Read or conv.ReadFile instructions, and I have no clue
>> why ...
>> any idea to help me ?
>>
>> Thanks in advance for your help, again ...
>>
>> Best regards.
>>
>> Sébastien
>>
>> Here is my code:
>>
>> ------------------------------------------------------------
>> -------------------------------------------------------------------
>>
>> OBConversion conv;
>> std::string filename;
>>
>> filename = this_file;
>> std::string fileformat;
>>
>> fileformat = this_format;
>> std::ifstream ifs(filename.c_str());
>>
>> if (! ifs)
>> {
>> // Error reading file
>> cout<<"Reading failed";
>> return 1;
>> }
>>
>> OBFormat * format = conv.FormatFromExt(fileformat.c_str());
>> if(! conv.SetInFormat(format))
>> {
>> cout<<"Set In Format failed";
>> // Error with this format
>> return 2;
>> }
>>
>> OBMol mol;
>> conv.AddOption("b", OBConversion::INOPTIONS);
>>
>> if (! conv.Read(& mol, &ifs))
>> {
>>
>> // Error reading molecule in file
>> cout<<"Reading molecule failed";
>>
>> // It always return at this point ...
>> // Note that before I tried to open the file using "ReadFile (&mol,
>> filename.c_str()))"
>> // the result was the same.
>>
>> return 3;
>> }
>>
>> if (mol.HasData(OBGenericDataType::UnitCell))
>> {
>> OBUnitCell * uc = (OBUnitCell *)mol.GetData(OBGenericDataTyp
>> e::UnitCell);
>> if (strcmp(this_format, "cif") == 0) uc -> FillUnitCell (&mol);
>> }
>>
>>
>> ------------------------------------------------------------
>> -------------------------------------------------------------------
>>
>> --
>> ===========================================================
>> Dr. Sébastien Le Roux
>> Ingénieur de Recherche CNRS
>> Institut de Physique et Chimie des Matériaux de Strasbourg
>> Département des Matériaux Organiques
>> 23, rue du Loess
>> <https://maps.google.com/?q=23,+rue+du+Loess&entry=gmail&source=g>
>> BP 43
>> F-67034 Strasbourg Cedex 2, France
>> E-mail: sebastien.ler...@ipcms.unistra.fr
>> Webpage: http://www.ipcms.unistra.fr/?page_id=14965&lang=en
>> RINGS project: http://rings-code.sourceforge.net/
>> ISAACS project: http://isaacs.sourceforge.net/
>> Fax: +33 3 88 10 72 46
>> Phone: +33 3 88 10 71 58
>> ===========================================================
>>
>>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss