-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from open205/libtk205-release-0
Libtk205 release 0
- Loading branch information
Showing
32 changed files
with
1,150 additions
and
416 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
[submodule "schema-205"] | ||
path = schema-205 | ||
url = https://github.com/open205/schema-205 | ||
[submodule "libtk205/vendor/json"] | ||
path = libtk205/vendor/json | ||
url = https://github.com/nlohmann/json.git | ||
[submodule "libtk205/vendor/btwxt"] | ||
path = libtk205/vendor/btwxt | ||
url = https://github.com/bigladder/btwxt.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
cmake_minimum_required(VERSION 3.14.0) | ||
project(toolkit-205) | ||
|
||
if (USE_CLANGTIDY_STATIC_ANALYSIS) | ||
set(CMAKE_CXX_CLANG_TIDY | ||
clang-tidy; | ||
-checks=-*,clang-analyzer-*,cppcoreguidelines-* | ||
) | ||
endif() | ||
|
||
# Set a default build type if none was specified | ||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) | ||
message(STATUS "Setting build type to 'Release' as none was specified.") | ||
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) | ||
# Set the possible values of build type for cmake-gui | ||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" | ||
"MinSizeRel" "RelWithDebInfo") | ||
endif() | ||
|
||
option( BUILD_TK205_TESTING "Build libtk205 testing targets" ON ) | ||
|
||
# Set up testing/coverage | ||
if (BUILD_TK205_TESTING) | ||
set(TEST205_INPUT_EXAMPLES_DIR "${PROJECT_SOURCE_DIR}/schema-205") | ||
enable_testing() | ||
endif() | ||
|
||
add_subdirectory(libtk205) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Copyright (c) 2022 Big Ladder Software, LLC | ||
|
||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | ||
|
||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
project(libtk205) | ||
|
||
include(CTest) | ||
set(JSON_BuildTests OFF CACHE INTERNAL "") | ||
|
||
# include_directories adds locations to the -I command line | ||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/vendor/btwxt/src) | ||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/vendor/json/single_include) | ||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/vendor/json/include) | ||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) | ||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../schema-205/build/include) | ||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../schema-205/schema205/src) | ||
|
||
file(GLOB RS_schemas "${PROJECT_SOURCE_DIR}/../schema-205/schema-source/*.schema.yaml") | ||
|
||
foreach(schema IN LISTS RS_schemas) | ||
string(REGEX REPLACE "${PROJECT_SOURCE_DIR}/../schema-205/schema-source/(.*).schema.yaml" "\\1" schema_name "${schema}") | ||
string(TOLOWER ${schema_name} schema_name) | ||
list(APPEND rs_headers "${PROJECT_SOURCE_DIR}/../schema-205/build/include/${schema_name}.h") | ||
list(APPEND rs_src "${PROJECT_SOURCE_DIR}/../schema-205/build/cpp/${schema_name}.cpp") | ||
if (schema_name MATCHES "rs.*") | ||
list(APPEND factory_headers "${PROJECT_SOURCE_DIR}/../schema-205/build/include/${schema_name}_factory.h") | ||
list(APPEND factory_src "${PROJECT_SOURCE_DIR}/../schema-205/build/cpp/${schema_name}_factory.cpp") | ||
endif() | ||
endforeach() | ||
|
||
list(APPEND lib_headers "${CMAKE_CURRENT_SOURCE_DIR}/include/typeinfo_205.h" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/include/loadobject_205.h" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/include/error_handling_tk205.h") | ||
|
||
add_custom_command(OUTPUT ${rs_headers} ${rs_src} ${lib_headers} ${lib_src} | ||
COMMAND poetry run doit cpp | ||
DEPENDS ${RS_schemas} | ||
COMMENT "Generate libtk205 files from YAML schema" | ||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../schema-205") | ||
|
||
set (SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/error_handling_tk205.cpp" | ||
"${rs_headers}" | ||
"${rs_src}" | ||
"${factory_headers}" | ||
"${factory_src}" | ||
"${lib_headers}" | ||
"${lib_src}") | ||
|
||
add_library(libtk205 ${SOURCES}) | ||
|
||
# add_custom_target(update_lib_repo ALL | ||
# COMMAND ${CMAKE_COMMAND} "-DPROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR}" -P "${PROJECT_SOURCE_DIR}/cmake/update_lib_repo.cmake" | ||
# VERBATIM) | ||
# add_dependencies(update_lib_repo libtk205) | ||
|
||
add_subdirectory(vendor) | ||
|
||
if (BUILD_TK205_TESTING) | ||
add_compile_definitions(TEST205_INPUT_EXAMPLES_DIR="${TEST205_INPUT_EXAMPLES_DIR}") | ||
add_subdirectory(test) | ||
endif() | ||
|
||
set(CPACK_PROJECT_NAME ${PROJECT_NAME}) | ||
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION}) | ||
include(CPack) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Copy headers, for classes that must be distributed (not factories), into the project | ||
# include directory | ||
|
||
file(GLOB autogenerated_factories "${PROJECT_SOURCE_DIR}/../schema-205/build/include/*factory.h") | ||
file(GLOB autogenerated_headers "${PROJECT_SOURCE_DIR}/../schema-205/build/include/*.h") | ||
foreach(filename ${autogenerated_factories}) | ||
list(REMOVE_ITEM autogenerated_headers ${filename}) | ||
endforeach(filename) | ||
|
||
foreach(filename ${autogenerated_headers}) | ||
configure_file(${filename} ${PROJECT_SOURCE_DIR}/include COPYONLY) | ||
endforeach(filename) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Copy all autogenerated source (cpp) files into build directory | ||
|
||
file(GLOB template_generated_files "${PROJECT_SOURCE_DIR}/../schema-205/schema205/src/*.h") | ||
|
||
foreach(filename ${template_generated_files}) | ||
configure_file(${filename} ${PROJECT_SOURCE_DIR}/include COPYONLY) | ||
endforeach(filename) |
Oops, something went wrong.