diff options
author | starkos <unknown> | 2009-09-21 17:59:25 +0400 |
---|---|---|
committer | starkos <unknown> | 2009-09-21 17:59:25 +0400 |
commit | 3f3cabd28f5396d462d4b8c86628597eb1fcab76 (patch) | |
tree | 54d466bab2b3eff9c5f33e60fae02edbac850cec | |
parent | 72682355c3471a1586047044a17601d5a638df10 (diff) |
Fixed naming of static libraries in Xcode
-rw-r--r-- | samples/project/premake4.lua | 4 | ||||
-rw-r--r-- | src/actions/xcode/_xcode.lua | 2 | ||||
-rw-r--r-- | src/actions/xcode/xcode_pbxproj.lua | 7 | ||||
-rw-r--r-- | src/base/action.lua | 26 | ||||
-rw-r--r-- | tests/actions/test_xcode.lua | 22 |
5 files changed, 53 insertions, 8 deletions
diff --git a/samples/project/premake4.lua b/samples/project/premake4.lua index 7ce87bd..530e93d 100644 --- a/samples/project/premake4.lua +++ b/samples/project/premake4.lua @@ -20,8 +20,8 @@ solution "PremakeTestbox" include "CppWindowedApp" include "CppSharedLib" include "CppStaticLib" - - if _ACTION ~= "codeblocks" and _ACTION ~= "codelite" then + + if premake.action.supports(premake.action.current(), "C#") then include "CsSharedLib" include "CsConsoleApp" end diff --git a/src/actions/xcode/_xcode.lua b/src/actions/xcode/_xcode.lua index 06402d6..d216b85 100644 --- a/src/actions/xcode/_xcode.lua +++ b/src/actions/xcode/_xcode.lua @@ -13,7 +13,7 @@ description = "Apple Xcode 3 (experimental)", os = "macosx", - valid_kinds = { "ConsoleApp", "WindowedApp" }, + valid_kinds = { "ConsoleApp", "WindowedApp", "SharedLib", "StaticLib" }, valid_languages = { "C", "C++" }, diff --git a/src/actions/xcode/xcode_pbxproj.lua b/src/actions/xcode/xcode_pbxproj.lua index c5c1452..f1dceb4 100644 --- a/src/actions/xcode/xcode_pbxproj.lua +++ b/src/actions/xcode/xcode_pbxproj.lua @@ -35,8 +35,8 @@ if #tr.children == 1 then tr = tr.children[1] tr.parent = nil - tr.solution = sln end + tr.solution = sln -- convert localized resources from their filesystem layout (English.lproj/MainMenu.xib) -- to Xcode's display layout (MainMenu.xib/English). @@ -345,8 +345,6 @@ -- Strangely, targets are specified relative to the project.pbxproj file -- rather than the .xcodeproj directory like the rest of the files. local basepath = path.join(node.cfg.project.solution.location, "project.pbxproj") --- local projpath = path.join(node.cfg.project.location, node.cfg.buildtarget.rootdir) --- local targpath = path.join(path.getrelative(basepath, projpath), node.cfg.buildtarget.root) local targpath = path.getrelative(basepath, node.cfg.buildtarget.bundlepath) _p(2,'%s /* %s */ = {isa = PBXFileReference; explicitFileType = %s; includeInIndex = 0; name = %s; path = %s; sourceTree = BUILT_PRODUCTS_DIR; };', node.id, node.name, xcode.gettargettype(node), node.name, targpath) @@ -573,7 +571,8 @@ _p(4,'INFOPLIST_FILE = %s;', target.prjnode.infoplist.path) end - _p(4,'PRODUCT_NAME = %s;', cfg.buildtarget.name) + _p(4,'PRODUCT_NAME = %s;', cfg.buildtarget.basename) + _p(4,'SYMROOT = %s;', xcode.rebase(prj, cfg.objectsdir)) _p(3,'};') _p(3,'name = %s;', cfg.name) diff --git a/src/base/action.lua b/src/base/action.lua index d664dc2..0ec7c56 100644 --- a/src/base/action.lua +++ b/src/base/action.lua @@ -112,3 +112,29 @@ return premake.action.list[keys[i]] end end + + +-- +-- Determines if an action supports a particular language or target type. +-- +-- @param action +-- The action to test. +-- @param feature +-- The feature to check, either a programming language or a target type. +-- @returns +-- True if the feature is supported, false otherwise. +-- + + function premake.action.supports(action, feature) + if action.valid_languages then + if table.contains(action.valid_languages, feature) then + return true + end + end + if action.valid_kinds then + if table.contains(action.valid_kinds, feature) then + return true + end + end + return false + end diff --git a/tests/actions/test_xcode.lua b/tests/actions/test_xcode.lua index 935b91d..86a818c 100644 --- a/tests/actions/test_xcode.lua +++ b/tests/actions/test_xcode.lua @@ -687,7 +687,7 @@ end - function T.xcode3.XCBuildConfigurationBlock_OnDefaults() + function T.xcode3.XCBuildConfigurationBlock_OnConsoleAppDefaults() Call_XCBuildConfigurationBlock() test.capture [[ [MyProject:Debug] /* Debug */ = { @@ -706,6 +706,26 @@ end + function T.xcode3.XCBuildConfigurationBlock_OnStaticLibDefaults() + kind "StaticLib" + Call_XCBuildConfigurationBlock() + test.capture [[ + [libMyProject.a:Debug] /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CONFIGURATION_BUILD_DIR = .; + GCC_DYNAMIC_NO_PIC = NO; + GCC_MODEL_TUNING = G5; + PRODUCT_NAME = MyProject; + SYMROOT = obj/Debug; + }; + name = Debug; + }; + ]] + end + + function T.xcode3.XCBuildConfigurationBlock_OnInfoPlist() files { "Info.plist" } Call_XCBuildConfigurationBlock() |