+# --- T2-COPYRIGHT-BEGIN --- +# t2/package/*/hocon/t2-build.patch +# Copyright (C) 2025 The T2 SDE Project +# SPDX-License-Identifier: GPL-2.0 or patched project license +# --- T2-COPYRIGHT-END --- diff --git a/CMakeLists.txt b/CMakeLists.txt index b246223..1cbb64d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,9 +22,15 @@ endif(ASAN) flex_target(LEXER "scanner.l" "${LEXER_OUT}" DEFINES_FILE "${PARSER_DIR}/scanner.h") bison_target(PARSER "parser.y" "${PARSER_OUT}" DEFINES_FILE "${PARSER_DIR}/parser.h") -add_flex_bison_dependency(LEXER PARSER) -add_library(hocon SHARED "${LEXER_OUT}" "${PARSER_OUT}" "cJSON.c" "hocon.c") +add_library(hocon SHARED "${LEXER_OUT}" "${PARSER_OUT}" "hocon.c") +target_link_libraries(hocon cjson) +set_target_properties(hocon PROPERTIES PUBLIC_HEADER "hocon.h") +include(GNUInstallDirs) +install(TARGETS hocon + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) target_include_directories(hocon PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) target_include_directories(hocon PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) @@ -32,3 +38,5 @@ target_include_directories(hocon PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) add_executable(hocon_parser ${CMAKE_CURRENT_SOURCE_DIR}/main.c hocon) target_include_directories(hocon_parser PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) target_link_libraries(hocon_parser PRIVATE hocon) + install(TARGETS hocon_parser + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/hocon.h b/hocon.h index ed26b66..c2093b8 100644 --- a/hocon.h +++ b/hocon.h @@ -1,8 +1,8 @@ #ifndef HOCON_H #define HOCON_H -#include "cJSON.h" +#include "cjson/cJSON.h" cJSON *hocon_parse_file(const char *file); cJSON *hocon_parse_str(char *str, size_t len); -#endif \ No newline at end of file +#endif diff --git a/parser.y b/parser.y index b4722d3..56772f3 100644 --- a/parser.y +++ b/parser.y @@ -1,6 +1,6 @@ %{ #include -#include "cJSON.h" +#include "cjson/cJSON.h" #include "cvector.h" #include #include