phcerdan / SGEXT

Spatial Graph Extractor. Library and scripts to study graphs extracted from binary images, or to generate graphs and analyze them completely in-silico. Used at least in biopolymers simulations and vascular networks.
GNU General Public License v3.0
5 stars 2 forks source link

Is it possible to build the project using Visual Studio 2015? #27

Closed XiaotianJia closed 4 years ago

XiaotianJia commented 4 years ago

Hi, I am building the project using cmake-gui and Visual Studio 2015. But it report an error “Required library TBB not found”. I know C++17 is required. Is it possible to build the project using Visual Studio 2015?

phcerdan commented 4 years ago

The project should compile in all platforms.

However, it doesn't perform a super-build (yet) to manage its dependencies. All of them have to be installed before hand. Some of them are optional, and only need if enabling particular modules. But you have to disable those modules (all are ON by default).

Check the docker script for an example. Dependencies:

If you don't have access to c++17 disable the Generate and Dynamics modules and set CMAKE_CXX_STANDARD to 14.

XiaotianJia commented 4 years ago

Thanks for your help. The cmake-gui doesn't report errors after disabling the Generate and Dynamics module. But other problems arose. When I build the projects using Visual Studio 2015, I got many errors. The followings are some of the errors:

14> convert_to_vtk_graph.cpp 17>gtest.lib(gtest-all.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in test_boundary_conditions.obj 18>gtest.lib(gtest-all.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in test_bounding_box.obj 17>msvcprt.lib(MSVCP140.dll) : error LNK2005: "protected: cdecl std::basic_streambuf<char,struct std::char_traits >::basic_streambuf<char,struct std::char_traits >(void)" (??0?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAA@XZ) already defined in gtest.lib(gtest-all.obj) 17>msvcprt.lib(MSVCP140.dll) : error LNK2005: "public: virtual cdecl std::basic_streambuf<char,struct std::char_traits >::~basic_streambuf<char,struct std::char_traits >(void)" (??1?$basic_streambuf@DU?$char_traits@D@std@@@std@@UEAA@XZ) already defined in gtest.lib(gtest-all.obj) 18>msvcprt.lib(MSVCP140.dll) : error LNK2005: "protected: __cdecl std::basic_streambuf<char,struct std::char_traits >::basic_streambuf<char,struct std::char_traits >(void)" (??0?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAA@XZ) already defined in gtest.lib(gtest-all.obj)

Is there anything else I need to pay attention to?

phcerdan commented 4 years ago

Seems like a msvc issue, the gtest subprojects have different flags. First, I would try a clean cmake configuration and rebuild. Secondly, I would follow the hints given here: https://stackoverflow.com/questions/14714877/mismatch-detected-for-runtimelibrary

Let me know if that helps!

phcerdan commented 4 years ago

The project dependencies can be built using the dependencies subproject. Check the Readme.