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

.xmake directory always appears next to xmake.lua #5439

Open
LostTime76 opened this issue Aug 5, 2024 · 5 comments
Open

.xmake directory always appears next to xmake.lua #5439

LostTime76 opened this issue Aug 5, 2024 · 5 comments
Labels

Comments

@LostTime76
Copy link

LostTime76 commented Aug 5, 2024

Xmake Version

2.9.4

Operating System Version and Architecture

Windows 10

Describe Bug

No matter what I seem to do, an .xmake directory always appears next to the xmake.lua file, regardless of the current working directory.

Expected Behavior

cd target_dir
xmake -P ../build

I am expecting all outputs generated by xmake to be within target_dir. It places a .xmake directory inside of target_dir AND inside of ../build directory where xmake.lua is. I do not want the scripts directory polluted in this example.

This seems to do with AppData/temp/xmake directory. This directory seems to store invocation dates for a particular xmake execution on the specified folder. After the first run, if you delete .xmake within ../build, .xmake directory will not appear again within ../build. However, if you delete the generated data within AppData/temp/xmake directory, the next xmake invocation generates .xmake within ../build.

I do not want any outputs generated within ../build (this example)

Project Configuration

toolchain("myclang")
set_toolset("cc", "clang")
set_toolset("ld", "clang")
toolchain_end()

set_config("plat", "cross")
set_toolchains("myclang")
target("test")
set_kind("binary")
add_files("../src/*.c")

Additional Information and Error Logs

image

@LostTime76 LostTime76 added the bug label Aug 5, 2024
@waruqi
Copy link
Member

waruqi commented Aug 6, 2024

see #3342

External working directory mode (new)

$ cd target_dir
$ xmake f -P ../build
$ xmake

@LostTime76
Copy link
Author

LostTime76 commented Aug 6, 2024

I have already tried that. It does not work. .xmake still appears next to xmake.lua in ../build

image

image

image

image

@waruqi
Copy link
Member

waruqi commented Aug 6, 2024

It works for me.

ruki:test ruki$ tree .
.
├── build
│   └── xmake.lua
├── out
└── src
    └── main.cpp

3 directories, 2 files
ruki:test ruki$ ls -a ./build/
.		..		xmake.lua
ruki:test ruki$ ls -a ./
.		..		.gitignore	build		out		src
ruki:test ruki$ cd out/
ruki:out ruki$ xmake f -P ../build/
checking for platform ... macosx
checking for architecture ... x86_64
checking for Xcode directory ... /Applications/Xcode.app
checking for SDK version of Xcode for macosx (x86_64) ... 14.0
checking for Minimal target version of Xcode for macosx (x86_64) ... 14.0
ruki:out ruki$ xmake
[ 50%]: cache compiling.release ../src/main.cpp
[ 75%]: linking.release test
[100%]: build ok, spent 1.283s
ruki:out ruki$ ls -a ../build/
.		..		xmake.lua
ruki:out ruki$ ls -a ../
.		..		.gitignore	build		out		src
ruki:out ruki$ ls -a .
.	..	.xmake	build

@LostTime76
Copy link
Author

Are you running on mac? My system is windows. I don't think I understand the justification "it works for me" when the example you gave would be on a different OS.

It does not work on windows. It is generating the erroneous .xmake next to xmake.lua

@waruqi
Copy link
Member

waruqi commented Aug 7, 2024

It still works for me on windows.

PS C:\Users\wangrunqing\Downloads\tst> dir .


    目录: C:\Users\wangrunqing\Downloads\tst


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----          2024/8/7     12:12                build
d-----          2024/8/7     12:21                out
d-----          2024/8/7     12:08                src
-a----         2024/3/25      9:42             64 .gitignore


PS C:\Users\wangrunqing\Downloads\tst> dir .\build


    目录: C:\Users\wangrunqing\Downloads\tst\build


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----          2024/8/7     12:09           1964 xmake.lua


PS C:\Users\wangrunqing\Downloads\tst> dir .\out
PS C:\Users\wangrunqing\Downloads\tst> cd out
PS C:\Users\wangrunqing\Downloads\tst\out> xmake f -P ..\build
checking for platform ... windows
checking for architecture ... x64
checking for Microsoft Visual Studio (x64) version ... 2022
checking for Microsoft C/C++ Compiler (x64) version ... 19.41.33923
PS C:\Users\wangrunqing\Downloads\tst\out> xmake
[ 50%]: compiling.release ..\src\main.cpp
[ 75%]: linking.release tst.exe
[100%]: build ok, spent 1.125s
PS C:\Users\wangrunqing\Downloads\tst\out> dir ..\build


    目录: C:\Users\wangrunqing\Downloads\tst\build


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----          2024/8/7     12:09           1964 xmake.lua


PS C:\Users\wangrunqing\Downloads\tst\out> dir .


    目录: C:\Users\wangrunqing\Downloads\tst\out


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----          2024/8/7     12:21                .xmake
d-----          2024/8/7     12:21                build

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

No branches or pull requests

2 participants