move main.c to src/

This commit is contained in:
Yuichi Nishiwaki
2014-09-01 09:40:55 +09:00
parent 83f580bfcf
commit 8764bec50b
4 changed files with 14 additions and 10 deletions
+14
View File
@@ -1,3 +1,5 @@
### libpicrin ###
find_package(Perl REQUIRED)
# benz
@@ -31,3 +33,15 @@ target_link_libraries(picrin m ${PICRIN_CONTRIB_LIBRARIES})
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib)
install(TARGETS picrin DESTINATION lib)
install(DIRECTORY extlib/benz/include/ DESTINATION include FILES_MATCHING PATTERN "*.h")
### picrin ###
list(APPEND REPL_LIBRARIES picrin)
# build
add_executable(repl src/main.c)
set_target_properties(repl PROPERTIES OUTPUT_NAME picrin)
target_link_libraries(repl ${REPL_LIBRARIES})
# install
install(TARGETS repl RUNTIME DESTINATION bin)
+28
View File
@@ -0,0 +1,28 @@
/**
* See Copyright Notice in picrin.h
*/
#include "picrin.h"
#include "picrin/error.h"
int
main(int argc, char *argv[], char **envp)
{
pic_state *pic;
int status = 0;
pic = pic_open(argc, argv, envp);
pic_try {
pic_import(pic, pic_read_cstr(pic, "(picrin main)"));
pic_funcall(pic, "main", pic_nil_value());
}
pic_catch {
pic_print_backtrace(pic, pic->err);
status = 1;
}
pic_close(pic);
return status;
}