summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-01-19 09:37:14 +0800
committerruki <[email protected]>2020-01-19 09:37:14 +0800
commit3509342134d24e31940a8ad71066a764ba664d89 (patch)
tree7eff9d690a8b3d34cd98fcf6a3f9085d35ee2516
parent6500e9b88e33a0c8b6c25b1471783c340ffc318b (diff)
improve self-build with xmake.lua
-rw-r--r--.appveyor.yml10
-rw-r--r--.travis.yml6
-rw-r--r--core/src/demo/xmake.lua3
-rw-r--r--core/src/xmake/xmake.lua4
-rw-r--r--core/xmake.lua9
-rw-r--r--scripts/installer.nsi2
-rw-r--r--scripts/srcenv.bat2
-rw-r--r--scripts/srcenv.profile6
-rw-r--r--xmake.lua11
9 files changed, 27 insertions, 26 deletions
diff --git a/.appveyor.yml b/.appveyor.yml
index 71fd471e8..a88b6d5d9 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -41,13 +41,11 @@ before_build:
build_script:
# self build
- - ps: Push-Location ./core
- ps: xmake config --arch=$env:platform
- ps: xmake build
- - ps: Pop-Location
# use new xmake
- ps: Set-AppveyorBuildVariable -Name XMAKE_PROGRAM_DIR -Value $(Resolve-Path ./xmake)
- - ps: Copy-Item -Force .\core\build\xmake.exe $(Get-Command xmake).Path
+ - ps: Copy-Item -Force .\build\xmake.exe $(Get-Command xmake).Path
- ps: (Get-Command xmake).FileVersionInfo.ProductVersion
# use bitcodes
- ps: xmake l -v private.utils.bcsave --rootname='@programdir' -x 'scripts/**|templates/**' xmake
@@ -55,8 +53,8 @@ build_script:
after_build:
# publish exe
- - ps: Push-AppveyorArtifact .\core\build\xmake.exe -FileName xmake.exe -DeploymentName "xmake-executable"
- - ps: (Get-FileHash .\core\build\xmake.exe -Algorithm SHA256).Hash.ToLower() + " *xmake.exe`n" | Out-File ./shafile -Encoding ASCII -NoNewLine
+ - ps: Push-AppveyorArtifact .\build\xmake.exe -FileName xmake.exe -DeploymentName "xmake-executable"
+ - ps: (Get-FileHash .\build\xmake.exe -Algorithm SHA256).Hash.ToLower() + " *xmake.exe`n" | Out-File ./shafile -Encoding ASCII -NoNewLine
# compose & publish installer
- ps: Copy-Item C:\winenv\ . -Recurse
- ps: $version = (Get-Command xmake).FileVersionInfo
@@ -72,7 +70,7 @@ after_build:
# publish zip archive
- ps: Copy-Item .\*.md .\xmake
- ps: Copy-Item C:\winenv\ .\xmake -Recurse
- - ps: Copy-Item .\core\build\xmake.exe .\xmake
+ - ps: Copy-Item .\build\xmake.exe .\xmake
- ps: |-
Add-Type -AssemblyName System.Text.Encoding
Add-Type -AssemblyName System.IO.Compression.FileSystem
diff --git a/.travis.yml b/.travis.yml
index 34afdb3f6..4ae244e19 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -23,11 +23,11 @@ script:
- scripts/get.sh __local__
- source ~/.xmake/profile
- xmake --version
- - xmake -P core
+ - xmake
- export XMAKE_PROGRAM_DIR=$PWD/xmake
- - core/build/xmake --version
+ - build/xmake --version
- export XMAKE_PROGRAM_DIR=~/.local/share/xmake
- - cp core/build/xmake "$XMAKE_PROGRAM_DIR" || sudo cp core/build/xmake "$XMAKE_PROGRAM_DIR"
+ - cp build/xmake "$XMAKE_PROGRAM_DIR" || sudo cp build/xmake "$XMAKE_PROGRAM_DIR"
- xmake --version
- xmake l private.utils.bcsave --rootname='@programdir' -x 'scripts/**|templates/**' xmake
- xmake --version
diff --git a/core/src/demo/xmake.lua b/core/src/demo/xmake.lua
index d0ac78909..863a611d3 100644
--- a/core/src/demo/xmake.lua
+++ b/core/src/demo/xmake.lua
@@ -10,9 +10,6 @@ target("demo")
-- add defines
add_defines("__tb_prefix__=\"xmake\"")
- -- set the object files directory
- set_objectdir("$(buildir)/.objs")
-
-- add includes directory
add_includedirs("$(projectdir)", "$(projectdir)/src")
diff --git a/core/src/xmake/xmake.lua b/core/src/xmake/xmake.lua
index c3df93473..6063a5fcb 100644
--- a/core/src/xmake/xmake.lua
+++ b/core/src/xmake/xmake.lua
@@ -18,8 +18,8 @@ target("xmake")
add_configfiles("xmake.config.h.in")
-- add includes directory
- add_includedirs("$(projectdir)")
- add_includedirs("$(buildir)/$(plat)/$(arch)/$(mode)")
+ add_includedirs("..", {interface = true})
+ add_includedirs("$(buildir)/$(plat)/$(arch)/$(mode)", {public = true})
-- add the common source files
add_files("**.c|winos/*.c")
diff --git a/core/xmake.lua b/core/xmake.lua
index 3eb575a70..89abc1909 100644
--- a/core/xmake.lua
+++ b/core/xmake.lua
@@ -1,12 +1,3 @@
--- project
-set_project("xmake")
-
--- version
-set_version("2.2.9", {build = "%Y%m%d%H%M"})
-
--- set xmake min version
-set_xmakever("2.2.3")
-
-- set warning all as error
set_warnings("all", "error")
diff --git a/scripts/installer.nsi b/scripts/installer.nsi
index a1d2b73dd..d5b82e06f 100644
--- a/scripts/installer.nsi
+++ b/scripts/installer.nsi
@@ -232,7 +232,7 @@ Section "XMake (required)" InstallExeutable
; Put file there
File /r /x ".DS_Store" /x "*.swp" "..\xmake\*.*"
File "..\*.md"
- File "..\core\build\xmake.exe"
+ File "..\build\xmake.exe"
File /r /x ".DS_Store" "..\winenv"
WriteUninstaller "uninstall.exe"
diff --git a/scripts/srcenv.bat b/scripts/srcenv.bat
index 974c640b9..93a70d1a3 100644
--- a/scripts/srcenv.bat
+++ b/scripts/srcenv.bat
@@ -1,4 +1,4 @@
@echo off
-set PATH=%cd%\..\core\build;%PATH%
+set PATH=%cd%\..\build;%PATH%
set XMAKE_PROGRAM_DIR=%cd%\..\xmake
start cmd /k cd ..
diff --git a/scripts/srcenv.profile b/scripts/srcenv.profile
index 46cb17234..9a29d7324 100644
--- a/scripts/srcenv.profile
+++ b/scripts/srcenv.profile
@@ -1,6 +1,10 @@
# cd projectdir
export XMAKE_PROGRAM_DIR=`pwd`/xmake
-alias xmake=`pwd`/core/src/demo/demo.b
+if [ -f `pwd`/build/xmake ]; then
+ alias xmake=`pwd`/build/xmake
+else
+ alias xmake=`pwd`/core/src/demo/demo.b
+fi
xmake --version
xmake l xmake.programdir
xmake l xmake.programfile
diff --git a/xmake.lua b/xmake.lua
new file mode 100644
index 000000000..6b6e92c9d
--- /dev/null
+++ b/xmake.lua
@@ -0,0 +1,11 @@
+-- project
+set_project("xmake")
+
+-- version
+set_version("2.2.9", {build = "%Y%m%d%H%M"})
+
+-- set xmake min version
+set_xmakever("2.2.3")
+
+-- only build core project
+includes("core")