Add experimental cmake support

This commit is contained in:
Yuichi Nishiwaki 2014-03-02 01:52:41 +09:00
parent 366b6fd7f5
commit e30529d629
4 changed files with 30 additions and 3 deletions

5
.gitignore vendored
View File

@ -1,9 +1,8 @@
bin/* bin/*
lib/*
build/*
src/lex.yy.c src/lex.yy.c
src/lex.yy.h src/lex.yy.h
src/y.tab.c
src/y.tab.h
lib/*
.dir-locals.el .dir-locals.el
GPATH GPATH
GRTAGS GRTAGS

15
CMakeLists.txt Normal file
View File

@ -0,0 +1,15 @@
cmake_minimum_required(VERSION 2.8)
project(picrin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY lib)
# external libraries
add_library(xfile SHARED extlib/xfile/xfile.c)
# build picrin
include_directories(include extlib)
link_directories(${PROJECT_SOURCE_DIR}/lib)
include(src/CMakeLists.txt)
include(tools/CMakeLists.txt)

10
src/CMakeLists.txt Normal file
View File

@ -0,0 +1,10 @@
find_package(FLEX REQUIRED)
execute_process(COMMAND flex scan.l WORKING_DIRECTORY src)
add_library(picrin SHARED
src/blob.c src/bool.c src/char.c src/codegen.c src/cont.c src/error.c
src/file.c src/gc.c src/init.c src/lex.yy.c src/lib.c src/load.c src/macro.c
src/number.c src/pair.c src/port.c src/proc.c src/read.c src/state.c
src/string.c src/symbol.c src/system.c src/time.c src/var.c src/vector.c
src/vm.c src/write.c)
target_link_libraries(picrin m xfile)

3
tools/CMakeLists.txt Normal file
View File

@ -0,0 +1,3 @@
add_executable(repl tools/main.c)
set_target_properties(repl PROPERTIES OUTPUT_NAME picrin)
target_link_libraries(repl picrin readline)