Merge pull request #1 from friendlyanon/master

CMake project structure
pull/4/head
Clyne 4 years ago committed by GitHub
commit f61645c9e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,63 @@
cmake_minimum_required(VERSION 3.14)
project(consteval_huffman
VERSION 0.0.1
DESCRIPTION "Compile-time Huffman coding compression using C++20"
HOMEPAGE_URL "https://github.com/tcsullivan/consteval-huffman"
LANGUAGES CXX)
# ---- Warning guard ----
# Protect dependents from this project's warnings if the guard isn't disabled
set(consteval_huffman_warning_guard SYSTEM)
if(consteval_huffman_INCLUDE_WITHOUT_SYSTEM)
set(consteval_huffman_warning_guard "")
endif()
# ---- Declare library ----
add_library(consteval_huffman INTERFACE)
add_library(tcsullivan::consteval_huffman ALIAS consteval_huffman)
target_include_directories(consteval_huffman
${consteval_huffman_warning_guard}
INTERFACE
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>")
target_compile_features(consteval_huffman INTERFACE cxx_std_20)
# ---- Install ----
include(CPack)
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
set(consteval_huffman_directory "consteval_huffman-${PROJECT_VERSION}")
set(consteval_huffman_include_directory
"${CMAKE_INSTALL_INCLUDEDIR}/${consteval_huffman_directory}")
install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/"
DESTINATION "${consteval_huffman_include_directory}"
COMPONENT consteval_huffman_Development)
install(TARGETS consteval_huffman
EXPORT consteval_huffmanTargets
INCLUDES DESTINATION "${consteval_huffman_include_directory}")
write_basic_package_version_file(
consteval_huffman-config-version.cmake
COMPATIBILITY SameMajorVersion
ARCH_INDEPENDENT)
set(consteval_huffman_install_cmakedir
"${CMAKE_INSTALL_LIBDIR}/cmake/${consteval_huffman_directory}")
install(FILES "${PROJECT_BINARY_DIR}/consteval_huffman-config-version.cmake"
DESTINATION "${consteval_huffman_install_cmakedir}"
COMPONENT consteval_huffman_Package)
install(EXPORT consteval_huffmanTargets
FILE consteval_huffman-config.cmake
NAMESPACE tcsullivan::
DESTINATION "${consteval_huffman_install_cmakedir}"
COMPONENT consteval_huffman_Package)

@ -26,7 +26,7 @@ A string of numbers 1 to 100 separated with spaces can be compressed to 64% of i
```cpp
// 1. Include
#include "consteval_huffman.hpp"
#include <consteval_huffman/consteval_huffman.hpp>
// 2. Use _huffman suffix (data now stores compressed string)
auto data = "This is my string of data"_huffman; // "\0\x1 Non-text data works too!"

Loading…
Cancel
Save