2014-06-15 13:22:09 -04:00
|
|
|
cmake_minimum_required(VERSION 2.6)
|
2014-10-07 10:00:27 -04:00
|
|
|
cmake_policy(VERSION 2.6)
|
2014-10-07 20:50:59 -04:00
|
|
|
if(POLICY CMP0037)
|
|
|
|
cmake_policy(SET CMP0037 OLD)
|
|
|
|
endif()
|
2014-03-01 11:52:41 -05:00
|
|
|
|
2014-03-02 00:34:02 -05:00
|
|
|
PROJECT(picrin)
|
2014-03-02 00:51:50 -05:00
|
|
|
|
|
|
|
# load extra cmake modules
|
2014-03-02 00:34:02 -05:00
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
|
2014-03-01 11:52:41 -05:00
|
|
|
|
2014-03-02 00:51:50 -05:00
|
|
|
# ----
|
|
|
|
|
2014-03-01 22:07:16 -05:00
|
|
|
# git submodule update --init
|
2014-03-26 01:08:55 -04:00
|
|
|
find_package(Git REQUIRED)
|
2014-03-01 22:07:16 -05:00
|
|
|
execute_process(
|
|
|
|
COMMAND ${GIT_EXECUTABLE} submodule update --init
|
|
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
|
|
|
)
|
|
|
|
|
2014-03-01 11:52:41 -05:00
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY bin)
|
|
|
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY lib)
|
2014-07-27 01:58:56 -04:00
|
|
|
set(CMAKE_C_FLAGS "-O2 -Wall -Wextra")
|
2014-03-04 10:39:43 -05:00
|
|
|
set(CMAKE_C_FLAGS_DEBUG "-g -DDEBUG=1")
|
2014-05-29 21:34:44 -04:00
|
|
|
|
|
|
|
option(USE_C11_FEATURE "Enable c11 feature" OFF)
|
|
|
|
if(USE_C11_FEATURE)
|
|
|
|
add_definitions(-std=c11)
|
|
|
|
else()
|
|
|
|
add_definitions(-std=c99) # at least c99 is required
|
|
|
|
endif()
|
|
|
|
|
2014-08-31 20:33:28 -04:00
|
|
|
include_directories(extlib/benz/include)
|
2014-03-01 11:52:41 -05:00
|
|
|
|
|
|
|
# build picrin
|
2014-05-20 11:48:56 -04:00
|
|
|
include(piclib/CMakeLists.txt)
|
2014-03-31 07:43:36 -04:00
|
|
|
include(contrib/CMakeLists.txt)
|
2014-03-01 11:52:41 -05:00
|
|
|
include(src/CMakeLists.txt)
|
2014-03-01 12:39:50 -05:00
|
|
|
|
2014-03-02 00:51:50 -05:00
|
|
|
# ----
|
|
|
|
|
2014-03-01 12:40:04 -05:00
|
|
|
# $ make run
|
|
|
|
add_custom_target(run bin/picrin DEPENDS repl)
|
2014-03-01 22:23:36 -05:00
|
|
|
|
2014-06-22 07:32:34 -04:00
|
|
|
# $ make test
|
2014-07-22 08:33:03 -04:00
|
|
|
add_custom_target(test DEPENDS test-r7rs test-contribs)
|
2014-03-01 22:23:36 -05:00
|
|
|
|
2014-06-22 09:29:02 -04:00
|
|
|
# $ make test-r7rs
|
|
|
|
add_custom_target(test-r7rs bin/picrin ${PROJECT_SOURCE_DIR}/t/r7rs-tests.scm DEPENDS repl)
|
|
|
|
|
2014-07-22 08:33:03 -04:00
|
|
|
# $ make test-contribs
|
|
|
|
add_custom_target(test-contribs DEPENDS ${CONTRIB_TESTS})
|
|
|
|
|
2014-03-01 22:23:36 -05:00
|
|
|
# $ make tak
|
2014-07-11 11:03:09 -04:00
|
|
|
add_custom_target(tak bin/picrin ${PROJECT_SOURCE_DIR}/etc/tak.scm DEPENDS repl)
|
2014-03-01 22:23:36 -05:00
|
|
|
|
|
|
|
# $ make lines
|
|
|
|
add_custom_target(lines find . -name "*.[chyl]" | xargs wc -l WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
|