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

Support independent working/build directory #820

Closed
waruqi opened this issue Jun 2, 2020 · 10 comments
Closed

Support independent working/build directory #820

waruqi opened this issue Jun 2, 2020 · 10 comments

Comments

@waruqi
Copy link
Member

waruqi commented Jun 2, 2020

If we do not want to create .xmake and build directories under the current project directory, and keep the project directory clean.

We can try run:

$ mkdir /xxx/working; cd /xxx/working

# We manually create an empty .xmake directory and 
# specify the current directory as the working and build directory
$ mkdir .xmake

$ xmake -P /xxxx/myproject

It will generate build and .xmake dirs to /xxx/working

If we only want to move projectdir/.xmake to build/.xmake, we can run

$ cd projectdir
$ mkdir build; cd build

# We manually create an empty .xmake directory and 
# specify the current directory as the working and build directory
# mkdir .xmake

$ xmake -P ..

Or we can uses environment vars to set these dirs.

$ export XMAKE_CONFIGDIR = /xxx/working
$ cd projectdir
$ xmake f --buildir=/xxx/working/build
$ xmake
@waruqi waruqi added this to the v2.3.4 milestone Jun 2, 2020
@waruqi
Copy link
Member Author

waruqi commented Jun 2, 2020

done, xmake update -s dev

@waruqi waruqi closed this as completed Jun 2, 2020
@davidchisnall
Copy link

The requirement to create .xmake in the directory is annoying. The normal idiom for building is:

  • Create build directory.
  • Change to the build directory.
  • Run the build tool, pointed at the source directory.

With xmake, this sequence appears to work but actually scatters files in my source directory. In secure build environments, the source directory is mounted read-only and so something that looks as if it's working will then fail. This makes it harder for me to convince other people to try xmake, because their normal workflow requires extra steps and has annoying failure modes.

@davidchisnall
Copy link

It looks as if you need to specify -o $(pwd) while doing the configure step as well to actually get the expected behaviour (all build state is in the build directory).

It's unfortunate that xmake defaults to trying to build from the source directory.

@waruqi
Copy link
Member Author

waruqi commented Sep 1, 2022

It looks as if you need to specify -o $(pwd) while doing the configure step as well to actually get the expected behaviour (all build state is in the build directory).

It's unfortunate that xmake defaults to trying to build from the source directory.

If you're already in the build directory, you don't need to specify -o

@waruqi
Copy link
Member Author

waruqi commented Sep 1, 2022

It looks as if you need to specify -o $(pwd) while doing the configure step as well to actually get the expected behaviour (all build state is in the build directory).

It's unfortunate that xmake defaults to trying to build from the source directory.

If you're already in the build directory, you don't need to specify -o

The requirement to create .xmake in the directory is annoying. The normal idiom for building is:

  • Create build directory.
  • Change to the build directory.
  • Run the build tool, pointed at the source directory.

With xmake, this sequence appears to work but actually scatters files in my source directory. In secure build environments, the source directory is mounted read-only and so something that looks as if it's working will then fail. This makes it harder for me to convince other people to try xmake, because their normal workflow requires extra steps and has annoying failure modes.

will not fail, even if your source directory is read-only. With the following command, xmake will not create any files in the source directory.

$ mkdir /xxx/working; cd /xxx/working
$ mkdir .xmake
$ xmake -P /xxxx/myproject (readonly)

@davidchisnall
Copy link

If you're already in the build directory, you don't need to specify -o

I agree that this should be the behaviour, however when I don't specify -o it creates a build directory in my source tree and puts object files there. When I do, it creates them in the current directory.

My exact sequence:

$ cd build
$ mkdir {my project and build config name}
$ cd {my project and build config name}
$ mkdir .xmake
$ xmake f -P ~/{my project name} --{configuration args}
$ xmake -P ~/{my project name}

The build files are created under ~/{my project name}/build/.objs, not in my build directory. If I specify -o $(pwd), then the build files are created in the build directory. The paths are slightly confusing, because it appears that xmake runs the compiler from the source directory and provides it with a relative path to the build directory, rather than running it in the build directory and providing it with an absolute path to the source directory, but the end result is correct.

@waruqi
Copy link
Member Author

waruqi commented Sep 2, 2022

I have improved it, try it again. xmake update dev

@davidchisnall
Copy link

I have built from source. If I run xmake update dev, it complains that I don't have unzip or 7zip installed (unzip is in the FreeBSD base system, so I do have it), not sure what it's trying to do. I've updated the git repo and submodules and I don't see any changes in the commit history that I'd expect to address this. Can you link to the commit with the improvements so that I can make sure that I have it?

@SirLynix
Copy link
Member

SirLynix commented Sep 2, 2022

The error message is a bit misleading as you need both actually (or at least 7zip).

The change is on the dev branch: e59566a

@davidchisnall
Copy link

Thanks, I can confirm that this works if I move to the dev branch.

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

3 participants