diff --git a/CMakeLists.txt b/CMakeLists.txt index bebff62..f8470b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,12 +1,12 @@ cmake_minimum_required(VERSION 3.7) project(msexpr - VERSION 0.0.1.0 + VERSION 0.0.2.0 LANGUAGES C ) -configure_file(version.h.in - "${CMAKE_CURRENT_BINARY_DIR}/version.h" @ONLY +configure_file(src/version.h.in + "${CMAKE_CURRENT_BINARY_DIR}/include/msexpr/version.h" @ONLY ) option(USES_RE2C "Uses re2c to regenerate the lexer files" OFF) if(USES_RE2C) @@ -23,33 +23,33 @@ if(USES_RE2C) endif() set(msexpr_INCLUDES - ${CMAKE_CURRENT_SOURCE_DIR}/include/msexpr/sexpr.h - ${CMAKE_CURRENT_SOURCE_DIR}/include/msexpr/serializers.h - ${CMAKE_CURRENT_SOURCE_DIR}/include/msexpr/deserializers.h - ${CMAKE_CURRENT_BINARY_DIR}/version.h + include/msexpr/sexpr.h + include/msexpr/serializers.h + include/msexpr/deserializers.h + ${CMAKE_CURRENT_BINARY_DIR}/include/msexpr/version.h ) set(msexpr_SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/src/sexpr.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/sexpr_ops.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/sexpr_stack.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/serializers.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/deserializers.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/deserializer/token.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/deserializer/input.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/deserializer/rivest_canonical_lexer.c + src/sexpr.c + src/sexpr_ops.c + src/sexpr_stack.c + src/serializers.c + src/deserializers.c + src/deserializer/token.c + src/deserializer/input.c + src/deserializer/rivest_canonical_lexer.c ) set(msexpr_HEADERS - ${CMAKE_CURRENT_SOURCE_DIR}/src/sexpr_ops.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/sexpr_stack.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/deserializer/token.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/deserializer/input.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/deserializer/rivest_canonical_lexer.h + src/sexpr_ops.h + src/sexpr_stack.h + src/deserializer/token.h + src/deserializer/input.h + src/deserializer/rivest_canonical_lexer.h ) set(msexpr_RE2C - ${CMAKE_CURRENT_SOURCE_DIR}/src/deserializer/rivest_canonical_lexer.c.re2c + src/deserializer/rivest_canonical_lexer.c.re2c ) add_library(${PROJECT_NAME} SHARED @@ -63,12 +63,13 @@ target_include_directories(${PROJECT_NAME} PUBLIC $ $ - PRIVATE + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src ) set_target_properties( ${PROJECT_NAME} PROPERTIES + PUBLIC_HEADER "${msexpr_INCLUDES}" C_STANDARD 90 C_STANDARD_REQUIRED ON C_EXTENSIONS OFF @@ -80,3 +81,34 @@ if (${ENABLE_TESTS}) enable_testing() add_subdirectory(tests) endif() + +install(TARGETS ${PROJECT_NAME} + EXPORT ${PROJECT_NAME} + LIBRARY DESTINATION lib/${PROJECT_NAME} + PUBLIC_HEADER DESTINATION include/${PROJECT_NAME} + ) + + +install(FILES + ${CMAKE_CURRENT_BINARY_DIR}/include/msexpr/version.h + DESTINATION include/${PROJECT_NAME} + ) + +install( + EXPORT ${PROJECT_NAME} + DESTINATION lib/cmake/${PROJECT_NAME} + ) + +#Setup CPACK to generate installer +set(CPACK_PACKAGE_NAME ${PROJECT_NAME}) +set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) +set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}) +set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) +set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR}) +set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH}) +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") +set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md") +set(CPACK_GENERATOR "DEB;TGZ;ZIP") +set(CPACK_DEBIAN_PACKAGE_NAME "msexpr") +set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Rui Maciel") +include(CPack) diff --git a/src/deserializers.c b/src/deserializers.c index 94d9ded..8f81c10 100644 --- a/src/deserializers.c +++ b/src/deserializers.c @@ -59,8 +59,7 @@ struct msexpr_parse_result msexpr_parse_rivest_canonical(FILE *stream) msexpr_token_stack_push(&stack, TOKEN_RIVEST_DOCUMENT); token = rivest_canonical_lexer(stream, &input); - while(stack.current_size > 0) /* */ - /* while(token.token != TOKEN_RIVEST_EOF) /* */ + while(stack.current_size > 0) { const enum TOKEN_RIVEST_NT top = msexpr_token_stack_top(&stack); diff --git a/src/serializers.c b/src/serializers.c index a01ae88..76b0ac5 100644 --- a/src/serializers.c +++ b/src/serializers.c @@ -13,7 +13,6 @@ int msexpr_fprint_csexpr(FILE *stream, struct msexpr *sexpr) return 0; } - switch(sexpr->type) { diff --git a/version.h.in b/src/version.h.in similarity index 100% rename from version.h.in rename to src/version.h.in diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 0bfdcd7..4c2aee0 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -3,8 +3,6 @@ find_package(Threads REQUIRED) find_package(check REQUIRED) find_package(subunit REQUIRED) -message("") - include_directories(${PROJECT_SOURCE_DIR}) set(msexpr_test_SOURCES_PREFIX "check_msexpr_") diff --git a/tests/check_msexpr_sexpr.c b/tests/check_msexpr_sexpr.c index 4607a35..372b0f7 100644 --- a/tests/check_msexpr_sexpr.c +++ b/tests/check_msexpr_sexpr.c @@ -77,14 +77,6 @@ START_TEST(test_sexpr_GIVEN_pointer_to_input_atom_WHEN_cons_input_atom_as_cdr_TH } END_TEST -//START_TEST(test_sexpr_GIVEN_WHEN_THEN_) -//{ -// /* Given */ -// /* When */ -// /* Then */ -//} -//END_TEST - Suite * msexpr_suite(void) { Suite *s; diff --git a/tests/check_msexpr_sexpr_atom.c b/tests/check_msexpr_sexpr_atom.c index f37f97d..5daee7f 100644 --- a/tests/check_msexpr_sexpr_atom.c +++ b/tests/check_msexpr_sexpr_atom.c @@ -30,14 +30,6 @@ START_TEST(test_sexpr_GIVEN_float_atom_WHEN_new_float_atom_THEN_output_valid_flo } END_TEST -//START_TEST(test_sexpr_GIVEN_WHEN_THEN_) -//{ -// /* Given */ -// /* When */ -// /* Then */ -//} -//END_TEST - Suite * msexpr_suite(void) { Suite *s; diff --git a/tests/check_msexpr_sexpr_atom_text.c b/tests/check_msexpr_sexpr_atom_text.c index 3d4b60a..23dabad 100644 --- a/tests/check_msexpr_sexpr_atom_text.c +++ b/tests/check_msexpr_sexpr_atom_text.c @@ -17,14 +17,6 @@ START_TEST(test_sexpr_GIVEN_text_atom_WHEN_new_text_atom_THEN_output_valid_text_ } END_TEST -//START_TEST(test_sexpr_GIVEN_WHEN_THEN_) -//{ -// /* Given */ -// /* When */ -// /* Then */ -//} -//END_TEST - Suite * msexpr_suite(void) { Suite *s; diff --git a/tests/check_msexpr_sexpr_deserializers_input.c b/tests/check_msexpr_sexpr_deserializers_input.c index cfc9343..f99ce8a 100644 --- a/tests/check_msexpr_sexpr_deserializers_input.c +++ b/tests/check_msexpr_sexpr_deserializers_input.c @@ -45,14 +45,6 @@ START_TEST(test_sexpr_GIVEN_cursor_has_moved_WHEN_input_fill_THEN_input_becomes_ } END_TEST -//START_TEST(test_sexpr_GIVEN_WHEN_THEN_) -//{ -// /* Given */ -// /* When */ -// /* Then */ -//} -//END_TEST - Suite * msexpr_suite(void) { Suite *s; diff --git a/tests/check_msexpr_sexpr_deserializers_lexer_rivest_canonical.c b/tests/check_msexpr_sexpr_deserializers_lexer_rivest_canonical.c index effd25c..320ce4e 100644 --- a/tests/check_msexpr_sexpr_deserializers_lexer_rivest_canonical.c +++ b/tests/check_msexpr_sexpr_deserializers_lexer_rivest_canonical.c @@ -141,14 +141,6 @@ START_TEST(test_GIVEN_string_with_nested_verbatim_string_WHEN_call_lexer_three_t } END_TEST -//START_TEST(test_sexpr_GIVEN_WHEN_THEN_) -//{ -// /* Given */ -// /* When */ -// /* Then */ -//} -//END_TEST - Suite * msexpr_suite(void) { Suite *s; diff --git a/tests/check_msexpr_sexpr_ops.c b/tests/check_msexpr_sexpr_ops.c index 76c5646..de03423 100644 --- a/tests/check_msexpr_sexpr_ops.c +++ b/tests/check_msexpr_sexpr_ops.c @@ -49,14 +49,6 @@ Suite * msexpr_suite(void) return s; } -//START_TEST(test_sexpr_GIVEN_WHEN_THEN_) -//{ -// /* Given */ -// /* When */ -// /* Then */ -//} -//END_TEST - int main(void) { int number_failed = 0; diff --git a/tests/check_msexpr_sexpr_serializers.c b/tests/check_msexpr_sexpr_serializers.c index accf745..256b97e 100644 --- a/tests/check_msexpr_sexpr_serializers.c +++ b/tests/check_msexpr_sexpr_serializers.c @@ -49,14 +49,6 @@ START_TEST(test_sexpr_GIVEN_cons_cell_with_float_atom_and_null_WHEN_fprint_csexp } END_TEST -//START_TEST(test_sexpr_GIVEN_WHEN_THEN_) -//{ -// /* Given */ -// /* When */ -// /* Then */ -//} -//END_TEST - Suite * msexpr_suite(void) { Suite *s; diff --git a/tests/check_msexpr_sexpr_stack.c b/tests/check_msexpr_sexpr_stack.c index fc8908e..d7ede51 100644 --- a/tests/check_msexpr_sexpr_stack.c +++ b/tests/check_msexpr_sexpr_stack.c @@ -128,14 +128,6 @@ START_TEST(test_sexpr_GIVEN_initialized_stack_WHEN_push_twice_and_popped_twice_T } END_TEST -//START_TEST(test_sexpr_GIVEN_WHEN_THEN_) -//{ -// /* Given */ -// /* When */ -// /* Then */ -//} -//END_TEST - Suite * msexpr_suite(void) { Suite *s;