diff options
| author | ruki <[email protected]> | 2019-06-07 00:35:22 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-06-06 21:32:16 +0800 |
| commit | 2a1919432128b99ff7623a55ba9d323cb6e10bab (patch) | |
| tree | fb2adc8d77c0d27251d196f67c4b2a09b2c3cc35 | |
| parent | 7021c6e06c49f78ee948c69c51322fa64071a1b0 (diff) | |
add cuda rules
| -rw-r--r-- | xmake/rules/cuda/device_link/xmake.lua | 32 | ||||
| -rw-r--r-- | xmake/rules/cuda/env/xmake.lua | 31 | ||||
| -rw-r--r-- | xmake/rules/cuda/xmake.lua | 53 |
3 files changed, 116 insertions, 0 deletions
diff --git a/xmake/rules/cuda/device_link/xmake.lua b/xmake/rules/cuda/device_link/xmake.lua new file mode 100644 index 000000000..de2c47167 --- /dev/null +++ b/xmake/rules/cuda/device_link/xmake.lua @@ -0,0 +1,32 @@ +--!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 - 2019, TBOOX Open Source Group. +-- +-- @author ruki +-- @file xmake.lua +-- + +-- define rule: device-link +rule("cuda.device_link") + + -- add rule: cuda environment + add_deps("cuda.env") + + -- on link + on_link(function (target, opt) + -- TODO + print("cuda: link ..") + end) + diff --git a/xmake/rules/cuda/env/xmake.lua b/xmake/rules/cuda/env/xmake.lua new file mode 100644 index 000000000..af6810d10 --- /dev/null +++ b/xmake/rules/cuda/env/xmake.lua @@ -0,0 +1,31 @@ +--!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 - 2019, TBOOX Open Source Group. +-- +-- @author ruki +-- @file xmake.lua +-- + +-- define rule: environment +rule("cuda.env") + + -- before load + before_load(function (target) + + -- find cuda + -- TODO + print("find cuda..") + end) + diff --git a/xmake/rules/cuda/xmake.lua b/xmake/rules/cuda/xmake.lua new file mode 100644 index 000000000..54d3f4215 --- /dev/null +++ b/xmake/rules/cuda/xmake.lua @@ -0,0 +1,53 @@ +--!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 - 2019, TBOOX Open Source Group. +-- +-- @author ruki +-- @file xmake.lua +-- + +-- define rule: cuda static library +rule("cuda.static") + + -- add rules + add_deps("cuda.device_link") + + -- we must set kind before target.on_load(), may we will use target in on_load() + before_load(function (target) + target:set("kind", "static") + end) + +-- define rule: cuda shared library +rule("cuda.shared") + + -- add rules + add_deps("cuda.device_link") + + -- we must set kind before target.on_load(), may we will use target in on_load() + before_load(function (target) + target:set("kind", "shared") + end) + +-- define rule: cuda console +rule("cuda.console") + + -- add rules + add_deps("cuda.device_link") + + -- we must set kind before target.on_load(), may we will use target in on_load() + before_load(function (target) + target:set("kind", "binary") + end) + |
