Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:conan-io/conan into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
lasote committed Oct 6, 2016
2 parents acbf233 + 6c18853 commit c9e82f6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
10 changes: 7 additions & 3 deletions conans/client/configure_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ def command_line(self):
exe_linker_flags, shared_linker_flags)
debug = "-g" if self.build_type == "Debug" else "-s -DNDEBUG"
include_flags = " ".join(['-I%s' % i for i in self._deps_cpp_info.include_paths])
cflags = 'CFLAGS="$CFLAGS %s %s %s %s"' % (archflag, " ".join(self._deps_cpp_info.cflags),
cflags = 'CFLAGS="$CFLAGS %s %s %s %s"' % (archflag,
" ".join(self._deps_cpp_info.cflags),
debug, include_flags)

# Append the definition for libcxx
Expand All @@ -87,12 +88,15 @@ def command_line(self):
cpp_flags = 'CPPFLAGS="$CPPFLAGS %s %s %s %s"' % (archflag, " ".join(all_cpp_flags),
debug, include_flags)
include_paths = ":".join(['"%s"' % lib for lib in self._deps_cpp_info.include_paths])
headers_flags = 'C_INCLUDE_PATH=$C_INCLUDE_PATH:{0} CPP_INCLUDE_PATH=$CPP_INCLUDE_PATH:{0}'.format(include_paths)
headers_flags = ('C_INCLUDE_PATH=$C_INCLUDE_PATH:{0} '
'CPP_INCLUDE_PATH=$CPP_INCLUDE_PATH:{0}'.format(include_paths))
command = "env %s %s %s %s %s" % (libs, ldflags, cflags, cpp_flags, headers_flags)
elif self.os == "Windows" and self.compiler == "Visual Studio":
cl_args = " ".join(['/I"%s"' % lib for lib in self._deps_cpp_info.include_paths])
lib_paths = ";".join(['"%s"' % lib for lib in self._deps_cpp_info.lib_paths])
command = "SET LIB=%%LIB%%;%s && SET CL=%%CL%% %s" % (lib_paths, cl_args)
command = ("(if defined LIB (SET LIB=%LIB%;{lib_paths}) else (SET LIB={lib_paths}))"
" && (if defined CL (SET CL=%CL% {cl_args}) else (SET CL={cl_args}))".
format(lib_paths=lib_paths, cl_args=cl_args))

# Add the rest of env variables from deps_env_info
command += " ".join(get_setenv_variables_commands(self._deps_env_info,
Expand Down
9 changes: 6 additions & 3 deletions conans/test/compile_helpers_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,12 @@ class CompileHelpersTest(unittest.TestCase):

def configure_environment_test(self):
env = ConfigureEnvironment(BuildInfoMock(), MockWinSettings())
self.assertEquals(env.command_line, 'SET LIB=%LIB%;"path/to/lib1";"path/to/lib2" && '
'SET CL=%CL% /I"path/to/includes/lib1" '
'/I"path/to/includes/lib2"')

expected = ('(if defined LIB (SET LIB=%LIB%;"path/to/lib1";"path/to/lib2")'
' else (SET LIB="path/to/lib1";"path/to/lib2")) && '
'(if defined CL (SET CL=%CL% /I"path/to/includes/lib1" /I"path/to/includes/lib2")'
' else (SET CL=/I"path/to/includes/lib1" /I"path/to/includes/lib2"))')
self.assertEquals(env.command_line, expected)

env = ConfigureEnvironment(BuildInfoMock(), MockLinuxSettings())
self.assertEquals(env.command_line, 'env LIBS="-llib1 -llib2" LDFLAGS="-Lpath/to/lib1 '
Expand Down

0 comments on commit c9e82f6

Please sign in to comment.