Skip to content

Commit

Permalink
Link any frameworks in Premake (#9371)
Browse files Browse the repository at this point in the history
  • Loading branch information
sheepsteak committed Aug 26, 2021
1 parent d17f843 commit ed76df6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion conans/client/generators/premake.py
Expand Up @@ -18,6 +18,7 @@ def __init__(self, deps_cpp_info):
self.cflags = ", ".join('"%s"' % p for p in deps_cpp_info.cflags)
self.sharedlinkflags = ", ".join('"%s"' % p.replace('"', '\\"') for p in deps_cpp_info.sharedlinkflags)
self.exelinkflags = ", ".join('"%s"' % p.replace('"', '\\"') for p in deps_cpp_info.exelinkflags)
self.frameworks = ", ".join('"%s.framework"' % p.replace('"', '\\"') for p in deps_cpp_info.frameworks)

self.rootpath = "%s" % deps_cpp_info.rootpath.replace("\\", "/")

Expand All @@ -40,7 +41,8 @@ def content(self):
'conan_cxxflags{dep} = {{{deps.cxxflags}}}\n'
'conan_cflags{dep} = {{{deps.cflags}}}\n'
'conan_sharedlinkflags{dep} = {{{deps.sharedlinkflags}}}\n'
'conan_exelinkflags{dep} = {{{deps.exelinkflags}}}\n')
'conan_exelinkflags{dep} = {{{deps.exelinkflags}}}\n'
'conan_frameworks{dep} = {{{deps.frameworks}}}\n')

sections = ["#!lua"]

Expand Down Expand Up @@ -68,6 +70,7 @@ def content(self):
" libdirs{conan_libdirs}\n"
" links{conan_libs}\n"
" links{conan_system_libs}\n"
" links{conan_frameworks}\n"
" defines{conan_defines}\n"
" bindirs{conan_bindirs}\n"
"end\n")
Expand Down
5 changes: 5 additions & 0 deletions conans/test/unittests/client/generators/premake_test.py
Expand Up @@ -33,6 +33,7 @@ class PremakeGeneratorTest(unittest.TestCase):
conan_cflags = {{"-mtune=native", "-fPIC"}}
conan_sharedlinkflags = {{"-framework AudioFoundation", "-framework \\\"Some Spaced Framework\\\"", "-framework Cocoa"}}
conan_exelinkflags = {{"-framework VideoToolbox", "-framework \\\"Other Spaced Framework\\\"", "-framework QuartzCore"}}
conan_frameworks = {{"AudioUnit.framework"}}
conan_includedirs_MyPkg1 = {{"{include1}"}}
conan_libdirs_MyPkg1 = {{"{lib1}"}}
Expand All @@ -44,6 +45,7 @@ class PremakeGeneratorTest(unittest.TestCase):
conan_cflags_MyPkg1 = {{"-fPIC"}}
conan_sharedlinkflags_MyPkg1 = {{"-framework Cocoa"}}
conan_exelinkflags_MyPkg1 = {{"-framework QuartzCore"}}
conan_frameworks_MyPkg1 = {{"AudioUnit.framework"}}
conan_rootpath_MyPkg1 = "{root1}"
conan_includedirs_MyPkg2 = {{"{include2}"}}
Expand All @@ -56,6 +58,7 @@ class PremakeGeneratorTest(unittest.TestCase):
conan_cflags_MyPkg2 = {{"-mtune=native"}}
conan_sharedlinkflags_MyPkg2 = {{"-framework AudioFoundation", "-framework \\\"Some Spaced Framework\\\""}}
conan_exelinkflags_MyPkg2 = {{"-framework VideoToolbox", "-framework \\\"Other Spaced Framework\\\""}}
conan_frameworks_MyPkg2 = {{}}
conan_rootpath_MyPkg2 = "{root2}"
function conan_basic_setup()
Expand All @@ -65,6 +68,7 @@ class PremakeGeneratorTest(unittest.TestCase):
libdirs{{conan_libdirs}}
links{{conan_libs}}
links{{conan_system_libs}}
links{{conan_frameworks}}
defines{{conan_defines}}
bindirs{{conan_bindirs}}
end
Expand Down Expand Up @@ -95,6 +99,7 @@ def setUp(self):
cpp_info.cxxflags = ['-fPIE']
cpp_info.sharedlinkflags = ['-framework Cocoa']
cpp_info.exelinkflags = ['-framework QuartzCore']
cpp_info.frameworks = ['AudioUnit']
self.conanfile.deps_cpp_info.add(ref.name, cpp_info)
ref = ConanFileReference.loads("MyPkg2/3.2.3@lasote/stables")
cpp_info = CppInfo(ref.name, self.tmp_folder2)
Expand Down

0 comments on commit ed76df6

Please sign in to comment.