OpenXcom Forum
Contributions => Programming => Topic started by: SupSuper on October 16, 2011, 07:45:23 pm
-
There's a long-standing dilemma on how OpenXcom should include yaml-cpp, either through:
#include "yaml.h"
Or:
#include "yaml-cpp/yaml.h"
Each approach has their own pros/cons. Currently OpenXcom uses the former because of this issue with Mac builds (https://openxcom.org/forum/index.php/topic,143.0.html). However, in the latest version of yaml-cpp 0.2.7, the pkconfig file has been changed to only support the latter option (https://code.google.com/p/yaml-cpp/issues/detail?id=122), which breaks our Linux builds without manual modifications.
So I was hoping you platform porters could come to an agreement?
-
As I have said on the IRC channel, I'm waiting to get my hands on a mac. Once done, I will try to check if the second option can be used.
apart from possible name clashes, it also make more difficult to openxcom. For example i have to add the following to get it built with makefile
CXXFLAGS=-I/usr/local/include/yaml-cpp make
or autotools:
YAML_CFLAGS=-I/usr/local/include/yaml-cpp ./configure
-
Well, if we stick with the subdir option, we'll have to find some way around to build it with Xcode. Right now, I have no idea how to do that, and won't be able to look deeper into the matter until I get some spare time - something that I currently lack :(
-
You could use macros on the code like this
#ifdef DARWIN
#include yaml.h
#else
#include "yaml-cpp/yaml.h"
#endif
And define -DDARWIN definition on build-system
Another way is switch to CMake buildsystem and write own module for yaml-cpp.cmake.
-
Have you tried using angle brackets instead of quotes? This is generally the approach when including system libraries.
#include <yaml-cpp/yaml.h>
See the distinction between angle bracket form and quoted form here: https://msdn.microsoft.com/en-us/library/36k2cdd4(v=vs.80).aspx
-
I had access to a mac this weekend and manage to build openxcom with the yaml-cpp sub directory.
The fixed YAML framework can be obtained here: https://gchevallereau.net/guillaume/openxcom/YAML.framework.tar.bz2
I have a branch with all yaml.h include transformed to yaml-cpp/yaml.h here : https://github.com/gchevallereau/OpenXcom/tree/yaml_fix
-
Nice! I'll check it out when I get a free minute. Thanks!
-
Some people still contact me about this issue, so I'd like to get a clear agreement on this: Is it OK to change the include to <yaml-cpp/yaml.h> along all platforms without people coming to my house with torches and pitchforks? :P
-
Since, unfortunately, I am rather dormant in terms of active OSX build management - I will concur to whatever decision you stick to :)
However, this doesn't mean we won't go back to this issue later, if it turns out problematic, but for now the actual development should take top priority.