diff --git a/CMakeLists.txt b/CMakeLists.txt index 92b45615a..4db24fbbb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -239,7 +239,9 @@ target_link_libraries(llama PRIVATE utils ggml ${LLAMA_EXTRA_LIBS}) # Executables # -add_executable(main run.cpp) +add_executable(main + main.cpp + run.cpp) target_link_libraries(main PRIVATE llama ggml utils) add_executable(quantize quantize.cpp) diff --git a/Makefile b/Makefile index a8f09db7a..2f11ea166 100644 --- a/Makefile +++ b/Makefile @@ -226,11 +226,14 @@ llama.o: llama.cpp llama.h utils.o: utils.cpp utils.h $(CXX) $(CXXFLAGS) -c utils.cpp -o utils.o +run.o: run.cpp run.h + $(CXX) $(CXXFLAGS) -c run.cpp -o run.o + clean: rm -f *.o main quantize -main: run.cpp ggml.o llama.o utils.o - $(CXX) $(CXXFLAGS) run.cpp ggml.o llama.o utils.o -o main $(LDFLAGS) +main: main.cpp ggml.o llama.o utils.o run.o + $(CXX) $(CXXFLAGS) main.cpp ggml.o llama.o utils.o run.o -o main $(LDFLAGS) @echo "\x1b[36mrun ./main -h for help\x1b[0m" quantize: quantize.cpp ggml.o llama.o utils.o diff --git a/main.cpp b/main.cpp new file mode 100644 index 000000000..61fec449a --- /dev/null +++ b/main.cpp @@ -0,0 +1,5 @@ +#include "run.h" + +int main(int argc, char ** argv) { + return run(argc, argv); +} diff --git a/run.cpp b/run.cpp index 4569ef2a1..e0db76974 100644 --- a/run.cpp +++ b/run.cpp @@ -154,7 +154,7 @@ void sigint_handler(int signo) { } #endif -int main(int argc, char ** argv) { +int run(int argc, char ** argv) { // has to be called once at the start of the program to init ggml stuff ggml_time_init(); diff --git a/run.h b/run.h new file mode 100644 index 000000000..4a490bb98 --- /dev/null +++ b/run.h @@ -0,0 +1,3 @@ +#pragma once + +int run(int argc, char ** argv);