docs +xcode6 bugfix: do not merge env variables of type dictionary into PROJ_SETTINGS config

This commit is contained in:
Simon 2016-09-25 23:57:43 +02:00
parent 3286beb4ad
commit 7da04766a3
3 changed files with 26 additions and 4 deletions

View File

@ -1,9 +1,13 @@
#include <iostream>
#include "MyLib/TestClass.h"
#include "config.h"
int main(int argc, char const *argv[])
{
TestClass a;
std::cout << a.message();
std::cout << a.message() << std::endl;
std::cout << "Number should be 10: " << NUMBER << std::endl;
return 0;
}

View File

@ -12,15 +12,24 @@ This demo will create an XCode project containing
an App bundle target, a dynamic library target,
a static library target and an executable target.
The generated XCode project can then be opened
and XCode can build those targets.
and XCode can then build those targets.
Tested in XCode 6 & 7.
"""
def configure(conf):
# Use environment variables to set default project configuration
# settings
conf.env.FRAMEWORK_VERSION = '1.0'
conf.env.ARCHS = 'x86_64'
conf.env.INSTALL_PATH = '/my/install/path'
# The xcode6 tool will also pick up any c config files generated by
# the c_config tool, and it'll be added to your project's include path
conf.load('c_config')
conf.define('NUMBER', 10)
conf.write_config_header('config.h')
# This must be called at the end of configure()
conf.load('xcode6')
@ -53,6 +62,7 @@ def build(bld):
uselib='SDL2',
cxxflags='-O3',
framework='Cocoa',
# Override default setting in a target
settings={"Debug": {"CONFIG_NAME": 'Debug'}}
)

View File

@ -124,6 +124,13 @@ TARGET_TYPES = {
'exe' :TARGET_TYPE_EXECUTABLE,
}
def delete_invalid_values(dct):
""" Deletes entries that are dictionaries or sets """
for k, v in list(dct.items()):
if isinstance(v, dict) or isinstance(v, set):
del dct[k]
return dct
"""
Configuration of the global project settings. Sets an environment variable 'PROJ_CONFIGURATION'
which is a dictionary of configuration name and buildsettings pair.
@ -151,9 +158,10 @@ def configure(self):
# Create default project configuration?
if 'PROJ_CONFIGURATION' not in self.env:
defaults = delete_invalid_values(self.env.get_merged_dict())
self.env.PROJ_CONFIGURATION = {
"Debug": self.env.get_merged_dict(),
"Release": self.env.get_merged_dict(),
"Debug": defaults,
"Release": defaults,
}
# Some build settings are required to be present by XCode. We will supply default values