mirror of https://github.com/gityf/crc.git
commit
990cb648f3
@ -0,0 +1,28 @@
|
|||||||
|
# C++ objects and libs
|
||||||
|
*.slo
|
||||||
|
*.lo
|
||||||
|
*.o
|
||||||
|
*.a
|
||||||
|
*.la
|
||||||
|
*.lai
|
||||||
|
*.so
|
||||||
|
*.dll
|
||||||
|
*.dylib
|
||||||
|
|
||||||
|
# cmake
|
||||||
|
|
||||||
|
CMakeLists.txt.user
|
||||||
|
CMakeCache.txt
|
||||||
|
CMakeFiles
|
||||||
|
CMakeScripts
|
||||||
|
Testing
|
||||||
|
Makefile
|
||||||
|
cmake_install.cmake
|
||||||
|
install_manifest.txt
|
||||||
|
compile_commands.json
|
||||||
|
CTestTestfile.cmake
|
||||||
|
_deps
|
||||||
|
|
||||||
|
|
||||||
|
# git
|
||||||
|
*.orig
|
@ -0,0 +1,47 @@
|
|||||||
|
if(DEFINED CRC_LIBRARY)
|
||||||
|
return()
|
||||||
|
else()
|
||||||
|
set(CRC_LIBRARY 1)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
project(crc)
|
||||||
|
|
||||||
|
if(TARGET ${PROJECT_NAME})
|
||||||
|
message("The ${PROJECT_NAME} arledy included in main Project")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.1)
|
||||||
|
|
||||||
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||||
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
option(BUILD_SHARED_LIBS "Enable or disable shared libraries" OFF)
|
||||||
|
option(CRC_TESTS "Enable tests of the ${PROJECT_NAME} library" OFF)
|
||||||
|
|
||||||
|
file(GLOB SOURCE_CPP
|
||||||
|
"crc/*.h"
|
||||||
|
"crc/*.cpp"
|
||||||
|
"crc/*.c"
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(${PROJECT_NAME} ${SOURCE_CPP})
|
||||||
|
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_LIST_DIR})
|
||||||
|
|
||||||
|
|
||||||
|
if (CRC_TESTS)
|
||||||
|
|
||||||
|
file(GLOB SOURCE_CPP_TEST
|
||||||
|
"unit-test/*.h"
|
||||||
|
"unit-test/*.cpp"
|
||||||
|
"unit-test/*.c"
|
||||||
|
|
||||||
|
"unit-test/ut/*.h"
|
||||||
|
"unit-test/ut/*.cpp"
|
||||||
|
"unit-test/ut/*.c"
|
||||||
|
)
|
||||||
|
|
||||||
|
add_executable(${PROJECT_NAME}_test ${SOURCE_CPP_TEST})
|
||||||
|
target_link_libraries(${PROJECT_NAME}_test PUBLIC ${PROJECT_NAME})
|
||||||
|
|
||||||
|
endif()
|
@ -1,2 +1,39 @@
|
|||||||
# crc
|
# crc
|
||||||
crc16/crc32/crc64
|
crc16/crc32/crc64
|
||||||
|
|
||||||
|
## Build
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
git clone https://github.com/gityf/crc.git
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake .. -DBUILD_SHARED_LIBS=1 -DCRC_TESTS=1
|
||||||
|
make
|
||||||
|
```
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
./crc_test
|
||||||
|
[ RUN ] ==== Test CRC8Test.BasicTest
|
||||||
|
[ RUN ] ==== Test CRC16Test.BasicTest
|
||||||
|
[ RUN ] ==== Test CRC32Test.BasicTest
|
||||||
|
[ RUN ] ==== Test CRC64Test.BasicTest
|
||||||
|
[ RUN ] ==== Test CRC8PolyTest.BasicTest
|
||||||
|
[ RUN ] ==== Test CRC16PolyTest.BasicTest
|
||||||
|
[ RUN ] ==== Test CRC32PolyTest.BasicTest
|
||||||
|
[ PASS ] ==== PASSED 7 tests
|
||||||
|
[ NOPASS ] ==== ERROR 0 tests
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
## Include
|
||||||
|
|
||||||
|
### Cmake build system
|
||||||
|
|
||||||
|
``` cmake
|
||||||
|
add_subdirectory(crc)
|
||||||
|
|
||||||
|
target_link_libraries(${PROJECT_NAME} PUBLIC crc)
|
||||||
|
|
||||||
|
```
|
||||||
|
Loading…
Reference in New Issue