diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..8b2b698a --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,65 @@ +####################################################################### +# The Embedded Template Library (https://www.etlcpp.com/) +####################################################################### +cmake_minimum_required(VERSION 3.5.0) +project(etl) + +####################################################################### +# Define an option to allow consumers of the library to +# specify the profile they would like to compile to. If +# not explicitly set CMake will attempt to choose an appropriate +# profile based on the compiler +####################################################################### +set(ETL_PROFILE "DEFAULT" CACHE STRING "Defines what profile header to include. See https://www.etlcpp.com/setup.html" +) + +add_library(etl + src/binary.cpp + src/crc16_ccitt.cpp + src/crc16_kermit.cpp + src/crc32.cpp + src/crc64_ecma.cpp + src/crc8_ccitt.cpp + src/error_handler.cpp + src/pearson.cpp + src/random.cpp + src/private + src/private/pvoidvector.cpp + ) +target_include_directories(etl + PUBLIC + src/ + src/atomic + src/profiles + PRIVATE + src/private + ) + +if (${ETL_PROFILE} STREQUAL DEFAULT) + if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") + set(ETL_PROFILE "PROFILE_GCC_GENERIC") + + elseif (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") + set(ETL_PROFILE "PROFILE_MSVC") + + elseif (CMAKE_CXX_COMPILER_ID MATCHES "ARMCC") + if (CXX_STANDARD EQUAL 11) + set(ETL_PROFILE "PROFILE_ARMV6") + else () + set(ETL_PROFILE "PROFILE_ARMV5") + endif() + elseif (CMAKE_CXX_COMPILER_ID MATCHES "TI") + set(ETL_PROFILE "PROFILE_TICC") + + else() + message(FATAL_ERROR "Can't generate default profile for compiler: ${CMAKE_CXX_COMPILER_ID}") + endif() +endif() + +message(STATUS "Compiling with ETL profile set to: ${ETL_PROFILE}") + +target_compile_definitions(etl + PUBLIC + ${ETL_PROFILE} + ) + diff --git a/src/profiles/etl_profile.h b/src/profiles/etl_profile.h new file mode 100644 index 00000000..45596b1a --- /dev/null +++ b/src/profiles/etl_profile.h @@ -0,0 +1,60 @@ +///\file + +/****************************************************************************** +The MIT License(MIT) + +Embedded Template Library. +https://github.com/ETLCPP/etl +https://www.etlcpp.com + +Copyright(c) 2017 jwellbelove, scott-eddy + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files(the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions : + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +******************************************************************************/ +#ifndef __ETL_PROFILE_H__ +#define __ETL_PROFILE_H__ +#ifdef PROFILE_MSVC + #include "msvc_x86.h" +#elif PROFILE_GCC_GENERIC + #include "gcc_generic.h" +#elif PROFILE_GCC_LINUX_X86 + #include "gcc_linux_x86.h" +#elif PROFILE_GCC_WINDOWS_X86 + #include "gcc_windows_x86.h" +#elif PROFILE_ARM_V5_GENERIC + #include "armv5.h" +#elif PROFILE_ARM_V6_GENERIC + #include "armv6.h" +#elif PROFILE_ARDUINO + #include "arduino_arm.h" +#elif PROFILE_TICC + #include "ticc.h" +#elif PROFILE_CPP03_GENERIC + #include "cpp03.h" +#elif PROFILE_CPP11_GENERIC + #include "cpp11.h" +#elif PROFILE_CPP14_GENERIC + #include "cpp14.h" +#elif PROFILE_CUSTOM + #include "custom_profile.h" +#else + #error Must provide a profile header file when buiding ETL. See https://www.etlcpp.com/setup.html +#endif + +#endif // __ETL_PROFILE_H_ diff --git a/test/codeblocks/ETL.layout b/test/codeblocks/ETL.layout deleted file mode 100644 index ccf9f11d..00000000 --- a/test/codeblocks/ETL.layout +++ /dev/null @@ -1,585 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -