@@ -56,15 +56,20 @@ def build(profile: str = typer.Option(None, "--profile", "-p", callback=unsuppor
5656 if is_cmake : # Repo uses CMake, so execute CMake commands.
5757 print ("[bold blue]CMake project detected." )
5858
59- # If CMakeCache.txt doesn't exist or has wrong paths, configure CMake
60- if not os .path .exists ("build/CMakeCache.txt" ):
61- print ("[blue]No CMake cache found. Configuring CMake...[/blue]" )
62- run_command (["docker" , "compose" , "run" , "--rm" , "ner-gcc-arm" , "bash" , "-c" , "cd /home/app && mkdir -p build && cd build && cmake .." ], stream_output = True )
63-
6459 if clean :
65- run_command (["docker" , "compose" , "run" , "--rm" , "ner-gcc-arm" , "cmake" , "--build" , "build" , "--target" , "clean" ], stream_output = True )
60+ # Clean by removing build directory entirely
61+ run_command (["docker" , "compose" , "run" , "--rm" , "ner-gcc-arm" , "rm" , "-rf" , "/home/app/build" ], stream_output = True )
62+ print ("[blue]Cleaned build directory.[/blue]" )
6663 else :
67- run_command (["docker" , "compose" , "run" , "--rm" , "ner-gcc-arm" , "cmake" , "--build" , "build" ], stream_output = True )
64+ # Always configure and build in one command to ensure consistency
65+ build_cmd = """
66+ cd /home/app && \
67+ mkdir -p build && \
68+ cd build && \
69+ cmake .. && \
70+ cmake --build .
71+ """
72+ run_command (["docker" , "compose" , "run" , "--rm" , "ner-gcc-arm" , "bash" , "-c" , build_cmd ], stream_output = True )
6873 else : # Repo uses Make, so execute Make commands.
6974 print ("[bold blue]Makefile project detected." )
7075 if clean :
0 commit comments