Add main.cpp back and invoke "run" from it

Signed-off-by: Thiago Padilha <thiago@padilha.cc>
This commit is contained in:
Thiago Padilha 2023-03-22 09:16:33 -03:00
parent 90175ee13f
commit d7d53b84db
No known key found for this signature in database
GPG Key ID: 309C78E5ED1B3D5E
5 changed files with 17 additions and 4 deletions

View File

@ -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)

View File

@ -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

5
main.cpp Normal file
View File

@ -0,0 +1,5 @@
#include "run.h"
int main(int argc, char ** argv) {
return run(argc, argv);
}

View File

@ -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();

3
run.h Normal file
View File

@ -0,0 +1,3 @@
#pragma once
int run(int argc, char ** argv);