aleuly / ifcplusplus

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

Missing definition in CMake files #13

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Compile Carve and Ifcplusplus

What is the expected output? What do you see instead?
No errors, but I get lots of compile errors. I think you forgot a CMake 
Definition. In the CMakeLists.txt of the folders Carve, IfcPlusPlus and 
IfcPlusPlusGeometry (and SimpleViewer I guess) you have the line after finding 
boost:

add_definitions(-DCARVE_SYSTEM_BOOST)

But this is missing the HAVE_BOOST_UNORDERED_COLLECTIONS defintion. So changing 
this line to 

add_definitions(-DCARVE_SYSTEM_BOOST -DHAVE_BOOST_UNORDERED_COLLECTIONS)

solves all boost errors.

In addition, in /Carve/src/include/carve/win32.h, line 24:
#  include <carve/cbrt.h>

gives also errors, as cbrt is already defined. I guess you have to move it 
below for an older VS version, or just remove it?

Last thing, somehow the libs are not created, only the dll files. I changed all 
libraries to static and that worked, don't know yet why they are not created.

What version of the product are you using? On what operating system?
CMake 3.0, VS2013 x64

Original issue reported on code.google.com by robert.h...@gmail.com on 9 Jul 2014 at 9:53

GoogleCodeExporter commented 9 years ago
For VS 2013, I recommend not to use CMake, but simply open the existing .sln 
file, as described in the build instructions wiki page.

HAVE_BOOST_UNORDERED_COLLECTIONS is defined in vcpp_config.h, you don't have to 
define it in a global project scope.

cbrt.h does not have include guards, but it is included only in win32.h, which 
does have include guards. So there are no duplicate symbols, unless you include 
cbrt.h manually somewhere else.

Original comment by fabian.g...@gmail.com on 9 Jul 2014 at 10:14

GoogleCodeExporter commented 9 years ago
Thanks for the info, but as you already have an almost working CMake system, 
why make the effort and maintain also the VS project files? It would be easier 
to only have CMake, fix one or two errors and you can generate for whatever IDE 
you want (theoretically). It would also be easier as you don't have those ugly 
cmd batch files to set variables (OSG_DIR).

Yes, HAVE_BOOST_UNORDERED_COLLECTIONS is defined in vcpp_config.h, but if you 
use CMake, config.h is included instead of vcpp_config.h (in 
Carve/src/include/carve/carve.hpp) and therefore not defined.

One more argument for Cmake is, I build IfcPlusPlus as an external project with 
EXTERNALPROJECT_ADD. Therefore, VS project files are not that useful.

I changed the Cmake files, so for me it's Ok, but I think others would also 
benefit from a Cmake system for all platforms. 

Feature request? :-)
Thanks for the good work!

Original comment by robert.h...@gmail.com on 9 Jul 2014 at 11:47

GoogleCodeExporter commented 9 years ago
The .sln file is my working environment, so it is no additional effort to 
maintain it.
The batch script is necessary to set the paths to Qt and OSG. It is the easiest 
way to handle different versions of the libs and to switch to a new version (or 
if you have to handle both 32 bit and 64 bit libs).
Ok, the cmd syntax is ugly, but I would say that CMake syntax is even worse :)

>Yes, HAVE_BOOST_UNORDERED_COLLECTIONS is defined in vcpp_config.h, but if you 
use CMake, config.h is included instead of vcpp_config.h (in 
Carve/src/include/carve/carve.hpp) and therefore not defined.

I think there is a misunderstanding here in the way CMake and C++ compilers 
work:
CMake does not include header files, they are included during compile time in a 
.cpp file by the compiler. CMake does not change the code in a .cpp file.
You can leave out all the header files in CMakeLists.txt, and it still compiles 
correctly. It is only there for the dev environment to list the files in the 
project.

INCLUDE_DIRECTORIES is important though, because it tells the compiler where to 
look for #include header files when compiling a .cpp file.

Original comment by fabian.g...@gmail.com on 9 Jul 2014 at 1:14