Merge pull request #1144 from tempura-sukiyaki/xcode4-sharedlibtype
Add `sharedlibtype` in xcode4
This commit is contained in:
commit
11e11268db
@ -150,6 +150,32 @@
|
||||
end
|
||||
|
||||
|
||||
function suite.PBXFileReference_ListsOSXBundleTarget()
|
||||
kind "SharedLib"
|
||||
sharedlibtype "OSXBundle"
|
||||
prepare()
|
||||
xcode.PBXFileReference(tr)
|
||||
test.capture [[
|
||||
/* Begin PBXFileReference section */
|
||||
[MyProject.bundle:product] /* MyProject.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; name = MyProject.bundle; path = MyProject.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.PBXFileReference_ListsOSXFrameworkTarget()
|
||||
kind "SharedLib"
|
||||
sharedlibtype "OSXFramework"
|
||||
prepare()
|
||||
xcode.PBXFileReference(tr)
|
||||
test.capture [[
|
||||
/* Begin PBXFileReference section */
|
||||
[MyProject.framework:product] /* MyProject.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = MyProject.framework; path = MyProject.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.PBXFileReference_ListsSourceFiles()
|
||||
files { "source.c" }
|
||||
prepare()
|
||||
@ -953,6 +979,50 @@
|
||||
end
|
||||
|
||||
|
||||
function suite.XCBuildConfigurationTarget_OnOSXBundle()
|
||||
kind "SharedLib"
|
||||
sharedlibtype "OSXBundle"
|
||||
prepare()
|
||||
xcode.XCBuildConfiguration_Target(tr, tr.products.children[1], tr.configs[1])
|
||||
test.capture [[
|
||||
[MyProject.bundle:Debug] /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CONFIGURATION_BUILD_DIR = bin/Debug;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
|
||||
PRODUCT_NAME = MyProject;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.XCBuildConfigurationTarget_OnOSXFramework()
|
||||
kind "SharedLib"
|
||||
sharedlibtype "OSXFramework"
|
||||
prepare()
|
||||
xcode.XCBuildConfiguration_Target(tr, tr.products.children[1], tr.configs[1])
|
||||
test.capture [[
|
||||
[MyProject.framework:Debug] /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CONFIGURATION_BUILD_DIR = bin/Debug;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
PRODUCT_NAME = MyProject;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.XCBuildConfigurationTarget_OnTargetPrefix()
|
||||
kind "SharedLib"
|
||||
targetprefix "xyz"
|
||||
@ -1160,6 +1230,102 @@
|
||||
end
|
||||
|
||||
|
||||
function suite.XCBuildConfigurationTarget_OnOSXBundleTargetExtension()
|
||||
kind "SharedLib"
|
||||
sharedlibtype "OSXBundle"
|
||||
targetextension ".xyz"
|
||||
prepare()
|
||||
xcode.XCBuildConfiguration_Target(tr, tr.products.children[1], tr.configs[1])
|
||||
test.capture [[
|
||||
[MyProject.xyz:Debug] /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CONFIGURATION_BUILD_DIR = bin/Debug;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
|
||||
PRODUCT_NAME = MyProject;
|
||||
WRAPPER_EXTENSION = xyz;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.XCBuildConfigurationTarget_OnOSXBundleNoTargetExtension()
|
||||
kind "SharedLib"
|
||||
sharedlibtype "OSXBundle"
|
||||
targetextension ""
|
||||
prepare()
|
||||
xcode.XCBuildConfiguration_Target(tr, tr.products.children[1], tr.configs[1])
|
||||
test.capture [[
|
||||
[MyProject:Debug] /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CONFIGURATION_BUILD_DIR = bin/Debug;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
|
||||
PRODUCT_NAME = MyProject;
|
||||
WRAPPER_EXTENSION = "";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.XCBuildConfigurationTarget_OnOSXFrameworkTargetExtension()
|
||||
kind "SharedLib"
|
||||
sharedlibtype "OSXFramework"
|
||||
targetextension ".xyz"
|
||||
prepare()
|
||||
xcode.XCBuildConfiguration_Target(tr, tr.products.children[1], tr.configs[1])
|
||||
test.capture [[
|
||||
[MyProject.xyz:Debug] /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CONFIGURATION_BUILD_DIR = bin/Debug;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
PRODUCT_NAME = MyProject;
|
||||
WRAPPER_EXTENSION = xyz;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.XCBuildConfigurationTarget_OnOSXFrameworkNoTargetExtension()
|
||||
kind "SharedLib"
|
||||
sharedlibtype "OSXFramework"
|
||||
targetextension ""
|
||||
prepare()
|
||||
xcode.XCBuildConfiguration_Target(tr, tr.products.children[1], tr.configs[1])
|
||||
test.capture [[
|
||||
[MyProject:Debug] /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CONFIGURATION_BUILD_DIR = bin/Debug;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
PRODUCT_NAME = MyProject;
|
||||
WRAPPER_EXTENSION = "";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.XCBuildConfigurationTarget_OnInfoPlist()
|
||||
files { "./a/b/c/MyProject-Info.plist" }
|
||||
prepare()
|
||||
|
@ -262,12 +262,14 @@
|
||||
|
||||
function xcode.getproducttype(node)
|
||||
local types = {
|
||||
ConsoleApp = "com.apple.product-type.tool",
|
||||
WindowedApp = "com.apple.product-type.application",
|
||||
StaticLib = "com.apple.product-type.library.static",
|
||||
SharedLib = "com.apple.product-type.library.dynamic",
|
||||
ConsoleApp = "com.apple.product-type.tool",
|
||||
WindowedApp = "com.apple.product-type.application",
|
||||
StaticLib = "com.apple.product-type.library.static",
|
||||
SharedLib = "com.apple.product-type.library.dynamic",
|
||||
OSXBundle = "com.apple.product-type.bundle",
|
||||
OSXFramework = "com.apple.product-type.framework",
|
||||
}
|
||||
return types[node.cfg.kind]
|
||||
return types[iif(node.cfg.kind == "SharedLib" and node.cfg.sharedlibtype, node.cfg.sharedlibtype, node.cfg.kind)]
|
||||
end
|
||||
|
||||
|
||||
@ -282,12 +284,14 @@
|
||||
|
||||
function xcode.gettargettype(node)
|
||||
local types = {
|
||||
ConsoleApp = "\"compiled.mach-o.executable\"",
|
||||
WindowedApp = "wrapper.application",
|
||||
StaticLib = "archive.ar",
|
||||
SharedLib = "\"compiled.mach-o.dylib\"",
|
||||
ConsoleApp = "\"compiled.mach-o.executable\"",
|
||||
WindowedApp = "wrapper.application",
|
||||
StaticLib = "archive.ar",
|
||||
SharedLib = "\"compiled.mach-o.dylib\"",
|
||||
OSXBundle = "wrapper.cfbundle",
|
||||
OSXFramework = "wrapper.framework",
|
||||
}
|
||||
return types[node.cfg.kind]
|
||||
return types[iif(node.cfg.kind == "SharedLib" and node.cfg.sharedlibtype, node.cfg.sharedlibtype, node.cfg.kind)]
|
||||
end
|
||||
|
||||
|
||||
@ -911,11 +915,20 @@
|
||||
end
|
||||
|
||||
if cfg.buildtarget.extension then
|
||||
local exts = {
|
||||
WindowedApp = "app",
|
||||
SharedLib = "dylib",
|
||||
StaticLib = "a",
|
||||
OSXBundle = "bundle",
|
||||
OSXFramework = "framework",
|
||||
}
|
||||
local ext = cfg.buildtarget.extension:sub(2)
|
||||
if cfg.kind == "WindowedApp" and ext ~= "app" then
|
||||
settings['WRAPPER_EXTENSION'] = ext
|
||||
elseif (cfg.kind == "StaticLib" and ext ~= "a") or (cfg.kind == "SharedLib" and ext ~= "dylib") then
|
||||
settings['EXECUTABLE_EXTENSION'] = ext
|
||||
if ext ~= exts[iif(cfg.kind == "SharedLib" and cfg.sharedlibtype, cfg.sharedlibtype, cfg.kind)] then
|
||||
if cfg.kind == "WindowedApp" or (cfg.kind == "SharedLib" and cfg.sharedlibtype) then
|
||||
settings['WRAPPER_EXTENSION'] = ext
|
||||
elseif cfg.kind == "SharedLib" or cfg.kind == "StaticLib" then
|
||||
settings['EXECUTABLE_EXTENSION'] = ext
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -930,13 +943,15 @@
|
||||
settings['INFOPLIST_FILE'] = config.findfile(cfg, path.getextension(tr.infoplist.name))
|
||||
end
|
||||
|
||||
installpaths = {
|
||||
local installpaths = {
|
||||
ConsoleApp = '/usr/local/bin',
|
||||
WindowedApp = '"$(HOME)/Applications"',
|
||||
SharedLib = '/usr/local/lib',
|
||||
StaticLib = '/usr/local/lib',
|
||||
OSXBundle = '$(LOCAL_LIBRARY_DIR)/Bundles',
|
||||
OSXFramework = '$(LOCAL_LIBRARY_DIR)/Frameworks',
|
||||
}
|
||||
settings['INSTALL_PATH'] = installpaths[cfg.kind]
|
||||
settings['INSTALL_PATH'] = installpaths[iif(cfg.kind == "SharedLib" and cfg.sharedlibtype, cfg.sharedlibtype, cfg.kind)]
|
||||
|
||||
local fileNameList = {}
|
||||
local file_tree = project.getsourcetree(tr.project)
|
||||
|
@ -1761,6 +1761,14 @@
|
||||
filter { "system:MacOSX", "kind:SharedLib" }
|
||||
targetextension ".dylib"
|
||||
|
||||
filter { "system:MacOSX", "kind:SharedLib", "sharedlibtype:OSXBundle" }
|
||||
targetprefix ""
|
||||
targetextension ".bundle"
|
||||
|
||||
filter { "system:MacOSX", "kind:SharedLib", "sharedlibtype:OSXFramework" }
|
||||
targetprefix ""
|
||||
targetextension ".framework"
|
||||
|
||||
-- Windows and friends.
|
||||
|
||||
filter { "system:Windows or language:C# or language:F#", "kind:ConsoleApp or WindowedApp" }
|
||||
|
@ -48,9 +48,9 @@
|
||||
local bundlename = ""
|
||||
local bundlepath = ""
|
||||
|
||||
if cfg.system == p.MACOSX and kind == p.WINDOWEDAPP then
|
||||
if cfg.system == p.MACOSX and (kind == p.WINDOWEDAPP or (kind == p.SHAREDLIB and cfg.sharedlibtype)) then
|
||||
bundlename = basename .. extension
|
||||
bundlepath = path.join(bundlename, "Contents/MacOS")
|
||||
bundlepath = path.join(bundlename, iif(kind == p.SHAREDLIB and cfg.sharedlibtype == "OSXFramework", "Versions/A", "Contents/MacOS"))
|
||||
end
|
||||
|
||||
local info = {}
|
||||
|
@ -31,6 +31,7 @@
|
||||
_options = true,
|
||||
options = true,
|
||||
platforms = true,
|
||||
sharedlibtype = true,
|
||||
system = true,
|
||||
toolset = true,
|
||||
tags = true,
|
||||
|
@ -105,13 +105,13 @@
|
||||
|
||||
self.location = self.location or self.basedir
|
||||
context.basedir(self, self.location)
|
||||
|
||||
|
||||
-- Build a master list of configuration/platform pairs from all of the
|
||||
-- projects contained by the workspace; I will need this when generating
|
||||
-- workspace files in order to provide a map from workspace configurations
|
||||
-- to project configurations.
|
||||
|
||||
self.configs = oven.bakeConfigs(self)
|
||||
self.configs = oven.bakeConfigs(self)
|
||||
|
||||
-- Now bake down all of the projects contained in the workspace, and
|
||||
-- store that for future reference
|
||||
@ -601,6 +601,9 @@
|
||||
-- if a kind is set, allow that to influence the configuration
|
||||
context.addFilter(ctx, "kind", ctx.kind)
|
||||
|
||||
-- if a sharedlibtype is set, allow that to influence the configuration
|
||||
context.addFilter(ctx, "sharedlibtype", ctx.sharedlibtype)
|
||||
|
||||
-- if tags are set, allow that to influence the configuration
|
||||
context.addFilter(ctx, "tags", ctx.tags)
|
||||
|
||||
|
@ -183,7 +183,7 @@
|
||||
test.isequal("libMyProject.a", i.name)
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Name should use a prefix if set.
|
||||
--
|
||||
@ -219,6 +219,32 @@
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Bundle path should be set for macOS/iOS cocoa bundle.
|
||||
--
|
||||
|
||||
function suite.bundlepathSet_onMacSharedLibOSXBundle()
|
||||
kind "SharedLib"
|
||||
sharedlibtype "OSXBundle"
|
||||
system "macosx"
|
||||
i = prepare()
|
||||
test.isequal("bin/Debug/MyProject.bundle/Contents/MacOS", path.getrelative(os.getcwd(), i.bundlepath))
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Bundle path should be set for macOS/iOS framework.
|
||||
--
|
||||
|
||||
function suite.bundlepathSet_onMacSharedLibOSXFramework()
|
||||
kind "SharedLib"
|
||||
sharedlibtype "OSXFramework"
|
||||
system "macosx"
|
||||
i = prepare()
|
||||
test.isequal("bin/Debug/MyProject.framework/Versions/A", path.getrelative(os.getcwd(), i.bundlepath))
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Target extension is used if set.
|
||||
--
|
||||
|
Reference in New Issue
Block a user