[wip] re #182: try to reproduce in CI

This commit is contained in:
Joao Paulo Magalhaes
2021-12-29 12:46:48 +00:00
parent ee581f8570
commit 18b9f6b985
7 changed files with 48 additions and 1 deletions

View File

@@ -529,6 +529,8 @@ jobs:
- {name: show info, run: source .github/setenv.sh && c4_show_info }
#
- {name: singleheader, run: cd samples/singleheader && ./run.sh $BT }
- {name: singleheaderlib-static, run: cd samples/singleheaderlib && ./run_static.sh $BT }
- {name: singleheaderlib-shared, run: cd samples/singleheaderlib && ./run_shared.sh $BT }
- {name: add_subdirectory, run: cd samples/add_subdirectory && ./run.sh $BT }
- {name: find_package, run: cd samples/find_package && ./run.sh $BT }
- {name: custom_c4core, run: cd samples/custom_c4core && ./run.sh $BT }

View File

@@ -24,9 +24,11 @@
//-----------------------------------------------------------------------------
// ryml can be used as a single header, or as a simple library:
#ifdef RYML_SINGLE_HEADER
#if defined(RYML_SINGLE_HEADER) // using the single header directly in the executable
#define RYML_SINGLE_HDR_DEFINE_NOW
#include <ryml_all.hpp>
#elif defined(RYML_SINGLE_HEADER_LIB) // using the single header from a library
#include <ryml_all.hpp>
#else
// <ryml_std.hpp> is only needed if interop with std types is
// desired; ryml itself does not use any STL container.

View File

@@ -7,6 +7,7 @@ amalgamate_ryml(SINGLE_HEADER_DIR SINGLE_HEADER)
# now simply define the executable:
add_executable(ryml-quickstart ../quickstart.cpp ${SINGLE_HEADER})
target_compile_features(ryml-quickstart PUBLIC cxx_std_11)
target_compile_definitions(ryml-quickstart PUBLIC -DRYML_SINGLE_HEADER)
target_include_directories(ryml-quickstart PUBLIC "${SINGLE_HEADER_DIR}")

View File

@@ -0,0 +1,20 @@
cmake_minimum_required(VERSION 3.15 FATAL_ERROR)
project(ryml-quickstart LANGUAGES CXX)
# create a target to amalgamate ryml into a single header:
include(../singleheader/amalgamate.cmake)
amalgamate_ryml(SINGLE_HEADER_DIR SINGLE_HEADER)
# add a library using the amalgamated header
add_library(ryml lib.cpp ${SINGLE_HEADER})
target_compile_features(ryml PUBLIC cxx_std_11)
target_include_directories(ryml PUBLIC "${SINGLE_HEADER_DIR}")
# now simply define the executable:
add_executable(ryml-quickstart ../quickstart.cpp )
target_link_libraries(ryml-quickstart PRIVATE ryml)
target_compile_definitions(ryml-quickstart PUBLIC -DRYML_SINGLE_HEADER_LIB)
add_custom_target(run ryml-quickstart
COMMAND $<TARGET_FILE:ryml-quickstart>
DEPENDS ryml-quickstart)

View File

@@ -0,0 +1,2 @@
#define RYML_SINGLE_HDR_DEFINE_NOW
#include <ryml_all.hpp>

View File

@@ -0,0 +1,10 @@
#!/bin/bash -x
# take the build type from the command line, or default to release
cfg=${1:-Release}
# make sure to run from where this file is
cd $(dirname $0)
# configure the sample
cmake -S . -B ./build/$cfg-shared -DCMAKE_BUILD_TYPE=$cfg -DBUILD_SHARED_LIBS=ON
# build and run the sample
cmake --build ./build/$cfg-shared --config $cfg --target run

View File

@@ -0,0 +1,10 @@
#!/bin/bash -x
# take the build type from the command line, or default to release
cfg=${1:-Release}
# make sure to run from where this file is
cd $(dirname $0)
# configure the sample
cmake -S . -B ./build/$cfg-static -DCMAKE_BUILD_TYPE=$cfg -DBUILD_SHARED_LIBS=OFF
# build and run the sample
cmake --build ./build/$cfg-static --config $cfg --target run