summaryrefslogtreecommitdiff
path: root/xmake/modules/package/tools/cmake.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2018-09-28 22:52:38 +0800
committerruki <[email protected]>2018-09-28 11:15:48 +0800
commit619eda909993a3ed64816b53b860a9c559a77fed (patch)
tree3a313eac9f5459eefc4583d5b2b7100fde6c9912 /xmake/modules/package/tools/cmake.lua
parent27cf709dda7b6626822534a7e2d18b41cf315c4f (diff)
remove build scripts for package
Diffstat (limited to 'xmake/modules/package/tools/cmake.lua')
-rw-r--r--xmake/modules/package/tools/cmake.lua46
1 files changed, 46 insertions, 0 deletions
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua
new file mode 100644
index 000000000..ae1ecee16
--- /dev/null
+++ b/xmake/modules/package/tools/cmake.lua
@@ -0,0 +1,46 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements. See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership. The ASF licenses this file
+-- to you 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 - 2018, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file cmake.lua
+--
+
+-- imports
+import("core.base.option")
+import("lib.detect.find_file")
+
+-- install package
+function install(package, configs)
+ os.mkdir("build/install")
+ os.cd("build")
+ os.vrun("cmake -a $(arch) -DCMAKE_INSTALL_PREFIX=\"%s\" ..", path.absolute("install"))
+ if is_host("windows") then
+ local slnfile = assert(find_file("*.sln", os.curdir()), "*.sln file not found!")
+ os.vrun("msbuild \"%s\" -nologo -t:Rebuild -p:Configuration=%s -p:Platform=%s", slnfile, package:debug() and "Debug" or "Release", is_arch("x64") and "x64" or "Win32")
+ local projfile = os.isfile("INSTALL.vcxproj") and "INSTALL.vcxproj" or "INSTALL.vcproj"
+ os.vrun("msbuild \"%s\" /property:configuration=%s", projfile, package:debug() and "Debug" or "Release")
+ else
+ os.vrun("make -j4")
+ os.vrun("make install")
+ end
+ os.cp("install/lib", package:installdir())
+ os.cp("install/include", package:installdir())
+end
+