vvdoogy / alembic

Automatically exported from code.google.com/p/alembic
Other
1 stars 0 forks source link

integrate Alembic in c++ application using gcc 4.8 and std=c++11 #355

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Compile and install Alembic as usual
2. Create new application and attempt to read an .abc file using: 
IArchive archive( Alembic::AbcCoreHDF5::ReadArchive(), "your archive.abc");
3. Compile and link using gcc 4.8 and std-c++11

What is the expected output? What do you see instead?
Should compile and run but get link error: unable to resolve std::shared_ptr...;

What version of the product are you using? On what operating system?
Ubuntu 14.04 SP1, gcc 4.8 with c++11 features, alembic 1.5.8

Please provide any additional information below.
I realized that Alembic/Util/Foundation.h is testing for the cplusplus version 
to decide using the std::shared_ptr or the std::tr1::shared_ptr (line 115);
However, under Linux, CMake is never assuming the possibility to use -std=c++11 
(unlike for Darwin) and so will always use std::tr1;

In the main CMakeLists.txt, I added a "ADD_DEFINITIONS( "-std=c++11" )" to the 
LINUX test to solve this problem like so:

SET( LINUX FALSE )
IF( "${CMAKE_SYSTEM_NAME}" MATCHES "Linux" )
  SET( LINUX TRUE )
  ADD_DEFINITIONS( "-std=c++11" )
ENDIF()

This probably needs an additional test, but as far as I'm concerned, I need 
C++11 features and so require this update;

Original issue reported on code.google.com by sylvain.bouxin@whtcorp.com on 21 Feb 2015 at 2:44

Attachments:

GoogleCodeExporter commented 8 years ago
We shouldn't turn it on unconditionally under Linux, but we can come up with a 
setting which will enable it.

Original comment by miller.lucas on 23 Feb 2015 at 10:53

GoogleCodeExporter commented 8 years ago
agreed!

Original comment by sylvain.bouxin@whtcorp.com on 23 Feb 2015 at 11:14