Skip to content
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

Improve to configure working and build directories #3342

Closed
waruqi opened this issue Feb 7, 2023 · 3 comments
Closed

Improve to configure working and build directories #3342

waruqi opened this issue Feb 7, 2023 · 3 comments

Comments

@waruqi
Copy link
Member

waruqi commented Feb 7, 2023

xmake will support two ways of configuring working directory.

Introduction

Working directory

The current working directory where xmake is running, and it is also the directory where the project cache configuration .xmake is stored.

- workdir
  - .xmake
  - build

Build directory (-o/--buildir)

Build the output directory of the build artifacts.

build
└── macosx
    └── x86_64
        └── release
            ├── demo

Project directory (-P/--project)

The root directory of the project's source code, which is also the directory containing the root xmake.lua file.

- projectdir
  - xmake.lua

Internal working directory mode (default)

This is the behaviour of the existing version, which has never changed.

The working directory is the project root directory by default.

- projectdir (workdir)
  - build (generated)
  - .xmake (generated)
  - src
  - xmake.lua
$ cd projectdir
$ xmake

Set the other build directory outside the working directory

we can set the given build directory, but the working directory is still the project root directory.

- projectdir (workdir)
  - .xmake (generated)
  - src
  - xmake.lua
- build
$ cd projectdir
$ xmake f -o ../build

External working directory mode (new)

We can use -P projectdir to set the given project directory and it will enable external working directory mode.

Lock the current directory as the working directory, and xmake will cache the specified project directory.

The working directory is the current directory by default.

- workdir
  - build (generated)
  - .xmake (generated)
- projectdir
  - src 
  - xmake.lua
$ cd workdir
$ xmake f -P ../projectdir
$ xmake

Set the other build directory outside the working directory

- build (generated)
- workdir
  - .xmake (generated)
- projectdir
  - src 
  - xmake.lua
$ cd workdir
$ xmake f -P ../projectdir -o ../build
@waruqi waruqi changed the title Improved switching configuration options Improve to configure options Feb 7, 2023
@waruqi waruqi changed the title Improve to configure options Improve to configure options and build directory Feb 7, 2023
@waruqi waruqi added this to the v2.7.7 milestone Feb 7, 2023
@waruqi waruqi changed the title Improve to configure options and build directory Improve to configure working and build directories Feb 8, 2023
@waruqi
Copy link
Member Author

waruqi commented Feb 8, 2023

$ xmake update -s dev
$ cd workdir
$ xmake f -P ../projectdir
$ xmake
...

@waruqi waruqi closed this as completed Feb 8, 2023
@waruqi
Copy link
Member Author

waruqi commented Feb 8, 2023

@davidchisnall you can try it, I have merged into dev branch.

@davidxiaozhi
Copy link

帮忙测试验证
xmake.lua 存在且能执行 xmake 构建
image

更新 xmake 之后执行 xmake f -P ../projectdir 提示重新生成 xmake.lua
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants