-
-
Notifications
You must be signed in to change notification settings - Fork 810
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add naive csharp project support for vsxmake #4510
Draft
Kethers
wants to merge
14
commits into
xmake-io:dev
Choose a base branch
from
Kethers:C#VSProjSupport
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
e934895
Init CSharp proj support for VS solution
Kethers bf5c764
fix csproj dependency build error, remove cuda and vc relevant things
Kethers 3586f80
Add project reference in .csproj, VS editor C# IntelliSense works fin…
Kethers 9ce9c62
Use MSBuild for compiling .csproj and modified the obj dir
Kethers 4b62543
fix: set_objectdir not works with vsxmake
Kethers 864dfd9
Add project Reference in .vcxproj
Kethers e5c6da5
Merge remote-tracking branch 'upstream/dev' into C#VSProjSupport
Kethers 81b8de5
Add License info in csharp relevant file
Kethers 8aec760
Unused apis clean up and some code reformat
Kethers cec4d81
Use sourcekind to differentiate project type
Kethers eddd355
Update load.lua
waruqi 6e17c82
Initially add C# support for VS proj generator
Kethers afc278c
Merge remote-tracking branch 'upstream/dev' into C#VSProjSupport
Kethers c5f8523
Remove getinfo in vs201x_csproj.lua, revert vs200x relevant files
Kethers File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--!A cross-platform build utility based on Lua | ||
-- | ||
-- Licensed under the Apache License, Version 2.0 (the "License"); | ||
-- you may not use this file except in compliance with the License. | ||
-- You may obtain a copy of the License at | ||
-- | ||
-- http://www.apache.org/licenses/LICENSE-2.0 | ||
-- | ||
-- Unless required by applicable law or agreed to in writing, software | ||
-- distributed under the License is distributed on an "AS IS" BASIS, | ||
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
-- See the License for the specific language governing permissions and | ||
-- limitations under the License. | ||
-- | ||
-- Copyright (C) 2015-present, TBOOX Open Source Group. | ||
-- | ||
-- @author Kethers | ||
-- @file check_main.lua | ||
-- | ||
|
||
|
||
-- check it | ||
function main(sourcefile) | ||
|
||
-- load source code | ||
local sourcecode = io.readfile(sourcefile) | ||
|
||
-- remove comment first | ||
sourcecode = sourcecode:gsub("/%*.-%*/", "") | ||
sourcecode = sourcecode:gsub("//.-\n", "\n") | ||
|
||
-- find static void Main(string[] args) {} | ||
if sourcecode:find("%s+Main%s*%(.-%)") then | ||
return true | ||
end | ||
|
||
-- no main function | ||
return false | ||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
--!A cross-platform build utility based on Lua | ||
-- | ||
-- Licensed under the Apache License, Version 2.0 (the "License"); | ||
-- you may not use this file except in compliance with the License. | ||
-- You may obtain a copy of the License at | ||
-- | ||
-- http://www.apache.org/licenses/LICENSE-2.0 | ||
-- | ||
-- Unless required by applicable law or agreed to in writing, software | ||
-- distributed under the License is distributed on an "AS IS" BASIS, | ||
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
-- See the License for the specific language governing permissions and | ||
-- limitations under the License. | ||
-- | ||
-- Copyright (C) 2015-present, TBOOX Open Source Group. | ||
-- | ||
-- @author ruki | ||
-- @file load.lua | ||
-- | ||
|
||
-- get apis | ||
function _get_apis() | ||
local apis = {} | ||
apis.values = { | ||
-- target.add_xxx | ||
"target.add_links" | ||
, "target.add_syslinks" | ||
, "target.add_ldflags" | ||
, "target.add_arflags" | ||
, "target.add_shflags" | ||
, "target.add_defines" | ||
, "target.add_undefines" | ||
, "target.add_frameworks" | ||
, "target.add_rpathdirs" -- @note do not translate path, it's usually an absolute path or contains $ORIGIN/@loader_path | ||
, "target.add_forceincludes" | ||
-- option.add_xxx | ||
, "option.add_links" | ||
, "option.add_syslinks" | ||
, "option.add_ldflags" | ||
, "option.add_arflags" | ||
, "option.add_shflags" | ||
, "option.add_defines" | ||
, "option.add_undefines" | ||
, "option.add_frameworks" | ||
, "option.add_rpathdirs" | ||
-- toolchain.add_xxx | ||
, "toolchain.add_links" | ||
, "toolchain.add_syslinks" | ||
, "toolchain.add_ldflags" | ||
, "toolchain.add_arflags" | ||
, "toolchain.add_shflags" | ||
, "toolchain.add_defines" | ||
, "toolchain.add_undefines" | ||
, "toolchain.add_frameworks" | ||
, "toolchain.add_rpathdirs" | ||
, "toolchain.add_linkdirs" | ||
, "toolchain.add_includedirs" | ||
, "toolchain.add_sysincludedirs" | ||
, "toolchain.add_frameworkdirs" | ||
} | ||
apis.groups = { | ||
-- target.add_xxx | ||
"target.add_linkorders" | ||
, "target.add_linkgroups" | ||
-- package.add_xxx | ||
, "package.add_linkorders" | ||
, "package.add_linkgroups" | ||
} | ||
apis.paths = { | ||
-- target.set_xxx | ||
"target.set_pcheader" | ||
, "target.set_pcxxheader" | ||
-- target.add_xxx | ||
, "target.add_headerfiles" | ||
, "target.add_linkdirs" | ||
, "target.add_includedirs" | ||
, "target.add_sysincludedirs" | ||
, "target.add_frameworkdirs" | ||
-- option.add_xxx | ||
, "option.add_linkdirs" | ||
, "option.add_includedirs" | ||
, "option.add_sysincludedirs" | ||
, "option.add_frameworkdirs" | ||
} | ||
return apis | ||
end | ||
|
||
function main() | ||
return {apis = _get_apis()} | ||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
--!A cross-platform build utility based on Lua | ||
-- | ||
-- Licensed under the Apache License, Version 2.0 (the "License"); | ||
-- you may not use this file except in compliance with the License. | ||
-- You may obtain a copy of the License at | ||
-- | ||
-- http://www.apache.org/licenses/LICENSE-2.0 | ||
-- | ||
-- Unless required by applicable law or agreed to in writing, software | ||
-- distributed under the License is distributed on an "AS IS" BASIS, | ||
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
-- See the License for the specific language governing permissions and | ||
-- limitations under the License. | ||
-- | ||
-- Copyright (C) 2015-present, TBOOX Open Source Group. | ||
-- | ||
-- @author Kethers | ||
-- @file xmake.lua | ||
-- | ||
|
||
language("csharp") | ||
add_rules("csharp") | ||
set_sourcekinds {cs = {".cs"}} | ||
set_targetkinds {binary = "ld", static = "ar", shared = "sh"} | ||
set_targetflags {binary = "ldflags", static = "arflags", shared = "shflags"} | ||
set_langkinds {cs = "cs"} | ||
set_mixingkinds("cs") | ||
|
||
on_load("load") | ||
-- may not have main function entry when used as scripting language | ||
-- on_check_main("check_main") | ||
|
||
set_nameflags { | ||
object = { | ||
"config.includedirs" | ||
, "config.frameworkdirs" | ||
, "config.frameworks" | ||
, "target.symbols" | ||
, "target.warnings" | ||
, "target.fpmodels" | ||
, "target.optimize:check" | ||
, "target.vectorexts:check" | ||
, "target.languages" | ||
, "target.runtimes" | ||
, "target.includedirs" | ||
, "target.defines" | ||
, "target.undefines" | ||
, "target.frameworkdirs" | ||
, "target.frameworks" | ||
, "target.exceptions" | ||
, "target.encodings" | ||
, "target.pcheader" | ||
, "target.pcxxheader" | ||
, "target.forceincludes" | ||
, "toolchain.includedirs" | ||
, "toolchain.defines" | ||
, "toolchain.undefines" | ||
, "toolchain.frameworkdirs" | ||
, "toolchain.frameworks" | ||
, "target.sysincludedirs" | ||
, "toolchain.sysincludedirs" | ||
} | ||
, binary = { | ||
"config.linkdirs" | ||
, "config.frameworkdirs" | ||
, "target.linkdirs" | ||
, "target.frameworkdirs" | ||
, "target.rpathdirs" | ||
, "target.strip" | ||
, "target.symbols" | ||
, "target.optimize:check" | ||
, "target.runtimes" | ||
, "toolchain.linkdirs" | ||
, "toolchain.rpathdirs" | ||
, "toolchain.frameworkdirs" | ||
, "config.links" | ||
, "target.linkgroups" -- we must move it before target.links, because we need sort correct order for package and its deps | ||
, "target.links" | ||
, "toolchain.links" | ||
, "config.frameworks" | ||
, "target.frameworks" | ||
, "toolchain.frameworks" | ||
, "config.syslinks" | ||
, "target.syslinks" | ||
, "toolchain.syslinks" | ||
} | ||
, shared = { | ||
"config.linkdirs" | ||
, "config.frameworkdirs" | ||
, "target.linkdirs" | ||
, "target.frameworkdirs" | ||
, "target.rpathdirs" | ||
, "target.strip" | ||
, "target.symbols" | ||
, "target.optimize:check" | ||
, "target.runtimes" | ||
, "toolchain.linkdirs" | ||
, "toolchain.rpathdirs" | ||
, "toolchain.frameworkdirs" | ||
, "config.links" | ||
, "target.links" | ||
, "target.linkgroups" | ||
, "toolchain.links" | ||
, "config.frameworks" | ||
, "target.frameworks" | ||
, "toolchain.frameworks" | ||
, "config.syslinks" | ||
, "target.syslinks" | ||
, "toolchain.syslinks" | ||
} | ||
, static = { | ||
"target.strip" | ||
, "target.symbols" | ||
} | ||
} | ||
|
||
set_menu { | ||
config = | ||
{ | ||
{category = "Cross Complation Configuration/Linker Configuration" } | ||
, {nil, "ld", "kv", nil, "The Linker" } | ||
, {nil, "ar", "kv", nil, "The Static Library Linker" } | ||
, {nil, "sh", "kv", nil, "The Shared Library Linker" } | ||
, {nil, "ranlib", "kv", nil, "The Static Library Index Generator" } | ||
|
||
, {category = "Cross Complation Configuration/Linker Flags Configuration" } | ||
, {nil, "ldflags", "kv", nil, "The Binary Linker Flags" } | ||
, {nil, "arflags", "kv", nil, "The Static Library Linker Flags" } | ||
, {nil, "shflags", "kv", nil, "The Shared Library Linker Flags" } | ||
|
||
, {category = "Cross Complation Configuration/Builtin Flags Configuration" } | ||
, {nil, "links", "kv", nil, "The Link Libraries" } | ||
, {nil, "syslinks", "kv", nil, "The System Link Libraries" } | ||
, {nil, "linkdirs", "kv", nil, "The Link Search Directories" } | ||
, {nil, "includedirs", "kv", nil, "The Include Search Directories" } | ||
, {nil, "frameworks", "kv", nil, "The Frameworks" } | ||
, {nil, "frameworkdirs", "kv", nil, "The Frameworks Search Directories" } | ||
} | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add
set_sourceflags {cs = {"csflags"}}