Open lewisl opened 2 months ago
Xmake does not support nim incremental compilation yet, because I don't know how to get all its dependent files based on the nim main file. (like -MMD
flag for gcc/cpp)
OK. Thanks for replying. I don’t know if the nim compile command even does. Nim compiles so fast I just do xmake -r.
Where is the nim.cfg you use? I note that you compile down smaller executable with no loss in performance comparing to use nim cmdline.
Close it.
From: ruki @.> Reply-To: xmake-io/xmake @.> Date: Monday, August 19, 2024 at 7:34 AM To: xmake-io/xmake @.> Cc: Lewis Levin @.>, Author @.***> Subject: Re: [xmake-io/xmake] nim building requires xmake build -r or else build doesn't see file changes (Issue #5482)
Xmake does not support nim incremental compilation yet, because I don't know how to get all its dependent files based on the nim main file. (like -MMD flag for gcc/cpp)
— Reply to this email directly, view it on GitHubhttps://github.com/xmake-io/xmake/issues/5482#issuecomment-2296732570, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAIYWLMITHOXIB4FETC6VNDZSH7AFAVCNFSM6AAAAABMWSQFASVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJWG4ZTENJXGA. You are receiving this because you authored the thread.Message ID: @.***>
OK. Thanks for replying. I don’t know if the nim compile command even does. Nim compiles so fast I just do xmake -r.
Where is the nim.cfg you use? I note that you compile down smaller executable with no loss in performance comparing to use nim cmdline.
xmake does not use nim.cfg. it will call nim
to build project directly. you can run xmake -rv
to see the whole build command.
Xmake Version
xmake v2.9.4+20240729
Operating System Version and Architecture
macOS 14.6.1 (23G93)
Describe Bug
Change a source file in the nim project other than the "main" file. xmake build doesn't see the change and does nothing. you must run xmake build -r. this should not be necessary.
Another related problem: for nim prefers that only the "main" file is added to the project. In my case, that is
If I do
add_files("src/*.nim)"" then I get the error
Error: arguments can only be given if the '--run' option is selected```This is a bogus error.
In fact, the situation is so bad that xmake build doesn't even realize that xmake.lua has changed.
this is all using the embedded terminal in VS Code, which might have some weird state management problems. I will note that this problem does not occur when using an external terminal (terminal.app on macosx). xmake sees any file that has changed. A work around then, is using the external terminal. This loses some convenience though...
Expected Behavior
xmake should see any change in any source file in the project that is imported into the "main" nim file. And it should not be necessary to explicitly add all source files, which causes other unrelated errors.
Project Configuration
Additional Information and Error Logs
so it turns out that xmake does not see changes to nim source files at all. We must always use xmake build -r whether using the external terminal or the vscode embedded terminal. Not fair to blame vscode for this.
If all source files are included, then the bogus command line argument requiring the --run option occurs.
So, we must only include the "main" source file and use the -r (rebuild) option.
I have only used xmake with c++ and nim. I have not see such a problem with c++.
I think it is also relevant to show the nim setup info from the .xmake directory:
this is xmake.conf:
here is detect from the xmake cache:
this is toolchain from the xmake cache: