From b304f8feb84c676b8b17a58906d969f04d4a4d3d Mon Sep 17 00:00:00 2001 From: Rui Maciel Date: Mon, 9 Dec 2019 23:22:20 +0100 Subject: [PATCH 1/7] Install interface headers with PUBLIC_HEADER --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index bebff62..f211a49 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,6 +69,7 @@ target_include_directories(${PROJECT_NAME} set_target_properties( ${PROJECT_NAME} PROPERTIES + PUBLIC_HEADER "${msexpr_INCLUDES}" C_STANDARD 90 C_STANDARD_REQUIRED ON C_EXTENSIONS OFF @@ -80,3 +81,10 @@ if (${ENABLE_TESTS}) enable_testing() add_subdirectory(tests) endif() + +install(TARGETS ${PROJECT_NAME} + LIBRARY + DESTINATION lib + PUBLIC_HEADER + DESTINATION include/msexpr + ) From e3f3798a43a1ce3bb8a88e376df4c2388a3148d3 Mon Sep 17 00:00:00 2001 From: Rui Maciel Date: Sun, 5 Apr 2020 22:45:17 +0200 Subject: [PATCH 2/7] CMakeLists cleanup --- CMakeLists.txt | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f211a49..d560ef5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 + include/msexpr/sexpr.h + include/msexpr/serializers.h + include/msexpr/deserializers.h ${CMAKE_CURRENT_BINARY_DIR}/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,7 +63,7 @@ target_include_directories(${PROJECT_NAME} PUBLIC $ $ - PRIVATE + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src ) From 0954381b0f3a681c1ac53496fc6fc7645b4c0b7f Mon Sep 17 00:00:00 2001 From: Rui Maciel Date: Sun, 5 Apr 2020 23:00:48 +0200 Subject: [PATCH 3/7] Reorganize version.h generation --- CMakeLists.txt | 6 +++--- version.h.in => src/version.h.in | 0 2 files changed, 3 insertions(+), 3 deletions(-) rename version.h.in => src/version.h.in (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index d560ef5..6911dbe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,8 +5,8 @@ project(msexpr 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) @@ -26,7 +26,7 @@ set(msexpr_INCLUDES include/msexpr/sexpr.h include/msexpr/serializers.h include/msexpr/deserializers.h - ${CMAKE_CURRENT_BINARY_DIR}/version.h + ${CMAKE_CURRENT_BINARY_DIR}/include/msexpr/version.h ) set(msexpr_SOURCES 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 From 0b4da9851558716314b460ba058f88b2221cebe2 Mon Sep 17 00:00:00 2001 From: Rui Maciel Date: Sun, 5 Apr 2020 23:01:45 +0200 Subject: [PATCH 4/7] Remove empty message --- tests/CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) 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_") From 8d40f81f904c45bfcdf7bf96e53f8d771777c1c2 Mon Sep 17 00:00:00 2001 From: Rui Maciel Date: Sat, 20 Jun 2020 23:46:33 +0100 Subject: [PATCH 5/7] Code cleanup --- src/deserializers.c | 3 +-- src/serializers.c | 1 - tests/check_msexpr_sexpr.c | 8 -------- tests/check_msexpr_sexpr_atom.c | 8 -------- tests/check_msexpr_sexpr_atom_text.c | 8 -------- tests/check_msexpr_sexpr_deserializers_input.c | 8 -------- ...ck_msexpr_sexpr_deserializers_lexer_rivest_canonical.c | 8 -------- tests/check_msexpr_sexpr_ops.c | 8 -------- tests/check_msexpr_sexpr_serializers.c | 8 -------- tests/check_msexpr_sexpr_stack.c | 8 -------- 10 files changed, 1 insertion(+), 67 deletions(-) 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/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; From 0181b2f2c6fb216e8b1235b1db3f0e714561e726 Mon Sep 17 00:00:00 2001 From: Rui Maciel Date: Sun, 21 Jun 2020 00:11:25 +0100 Subject: [PATCH 6/7] Add cpack support --- CMakeLists.txt | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6911dbe..d3d01b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,8 +83,32 @@ if (${ENABLE_TESTS}) endif() install(TARGETS ${PROJECT_NAME} - LIBRARY - DESTINATION lib - PUBLIC_HEADER - DESTINATION include/msexpr + 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) From f754c9148e0785369f5aaca76267f86934f5aed3 Mon Sep 17 00:00:00 2001 From: Rui Maciel Date: Sun, 21 Jun 2020 00:19:33 +0100 Subject: [PATCH 7/7] Bump version number --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d3d01b9..f8470b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.7) project(msexpr - VERSION 0.0.1.0 + VERSION 0.0.2.0 LANGUAGES C )