Added gcc8 patch and CMakeLists.txt to be used with CCI

This commit is contained in:
Eyck Jentzsch 2019-06-15 22:32:47 +02:00
parent 8f776c8557
commit 678a216109
2 changed files with 156 additions and 0 deletions

View File

@ -0,0 +1,85 @@
cmake_minimum_required(VERSION 3.8)
MACRO(INSTALL_HEADERS_WITH_DIRECTORY HEADER_LIST)
FOREACH(HEADER ${${HEADER_LIST}})
STRING(REGEX MATCH "(.\\\*)\\\[/\\\]" DIR ${HEADER})
INSTALL(FILES ${HEADER} DESTINATION include/${DIR})
ENDFOREACH(HEADER)
ENDMACRO(INSTALL_HEADERS_WITH_DIRECTORY)
project(cci)
set(LIBRARY_VERSION_MAJOR 1 CACHE STRING "major version" FORCE)
set(LIBRARY_VERSION_MINOR 0 CACHE STRING "minor version" FORCE)
set(LIBRARY_VERSION_PATCH 0 CACHE STRING "minor version" FORCE)
set(LIBRARY_VERSION ${LIBRARY_VERSION_MAJOR}.${LIBRARY_VERSION_MINOR}.${LIBRARY_VERSION_PATCH} CACHE STRING "version" FORCE)
set(LIBRARY_NAME cciapi)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
if(DEFINED ENV{SYSTEMC_HOME})
set(SYSTEMC_ROOT $ENV{SYSTEMC_HOME})
else()
message(ERROR "SYSTEMC_HOME environment variable not defined")
endif()
if(DEFINED ENV{RAPIDJSON_HOME})
set(RAPIDJSON $ENV{RAPIDJSON_HOME})
else()
set(RAPIDJSON ${CMAKE_CURRENT_SOURCE_DIR}/packages/rapidjson)
endif()
if(EXISTS "${SYSTEMC_ROOT}/lib/")
set(SYSTEMC_LIBDIR ${SYSTEMC_ROOT}/lib)
elseif(EXISTS "${SYSTEMC_ROOT}/lib-linux/")
set(SYSTEMC_LIBDIR ${SYSTEMC_ROOT}/lib-linux)
elseif(EXISTS "${SYSTEMC_ROOT}/lib-linux64/")
set(SYSTEMC_LIBDIR ${SYSTEMC_ROOT}/lib-linux64)
endif()
FILE(GLOB CFG_HEADER_FILES src/cci_cfg/*.h )
FILE(GLOB CORE_HEADER_FILES src/cci_core/*.h )
FILE(GLOB UTILS_HEADER_FILES src/cci_utils/*.h )
set(SOURCES
src/cci_cfg/cci_broker_handle.cpp
src/cci_cfg/cci_broker_manager.cpp
src/cci_cfg/cci_originator.cpp
src/cci_cfg/cci_param_if.cpp
src/cci_cfg/cci_param_untyped.cpp
src/cci_cfg/cci_param_untyped_handle.cpp
src/cci_cfg/cci_report_handler.cpp
src/cci_core/cci_name_gen.cpp
src/cci_core/cci_value_converter.cpp
src/cci_core/cci_value.cpp
src/cci_utils/broker.cpp
src/cci_utils/consuming_broker.cpp
)
link_directories(${SYSTEMC_LIBDIR})
add_library(${LIBRARY_NAME} ${SOURCES})
target_include_directories(${LIBRARY_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_include_directories(${LIBRARY_NAME} PRIVATE ${SYSTEMC_ROOT}/include)
target_include_directories(${LIBRARY_NAME} PUBLIC ${RAPIDJSON}/include)
target_link_libraries(${LIBRARY_NAME} systemc)
install(TARGETS ${LIBRARY_NAME}
EXPORT ${PROJECT_NAME}Targets # for downstream dependencies
ARCHIVE DESTINATION lib COMPONENT libs # static lib
LIBRARY DESTINATION lib COMPONENT libs # shared lib
FRAMEWORK DESTINATION bin COMPONENT libs # for mac
PUBLIC_HEADER DESTINATION include COMPONENT devel # headers for mac (note the different component -> different package)
INCLUDES DESTINATION include # headers
PUBLIC_HEADER DESTINATION include
)
install(FILES src/cci_configuration DESTINATION include)
install(FILES ${CFG_HEADER_FILES} DESTINATION include/cci_cfg)
install(FILES ${CORE_HEADER_FILES} DESTINATION include/cci_core)
install(FILES ${UTILS_HEADER_FILES} DESTINATION include/cci_utils)

View File

@ -0,0 +1,71 @@
*** a/cci-1.0.0/packages/rapidjson/include/rapidjson/document.h 2018-07-11 08:24:31.520031354 +0200
--- b/cci-1.0.0/packages/rapidjson/include/rapidjson/document.h 2018-07-11 08:51:58.559221920 +0200
***************
*** 1425,1431 ****
MemberIterator pos = MemberBegin() + (first - MemberBegin());
for (MemberIterator itr = pos; itr != last; ++itr)
itr->~Member();
! std::memmove(&*pos, &*last, static_cast<size_t>(MemberEnd() - last) * sizeof(Member));
data_.o.size -= static_cast<SizeType>(last - first);
return pos;
}
--- 1425,1431 ----
MemberIterator pos = MemberBegin() + (first - MemberBegin());
for (MemberIterator itr = pos; itr != last; ++itr)
itr->~Member();
! std::memmove((void*)&*pos, &*last, static_cast<size_t>(MemberEnd() - last) * sizeof(Member));
data_.o.size -= static_cast<SizeType>(last - first);
return pos;
}
***************
*** 1629,1635 ****
ValueIterator pos = Begin() + (first - Begin());
for (ValueIterator itr = pos; itr != last; ++itr)
itr->~GenericValue();
! std::memmove(pos, last, static_cast<size_t>(End() - last) * sizeof(GenericValue));
data_.a.size -= static_cast<SizeType>(last - first);
return pos;
}
--- 1629,1635 ----
ValueIterator pos = Begin() + (first - Begin());
for (ValueIterator itr = pos; itr != last; ++itr)
itr->~GenericValue();
! std::memmove((void*)pos, last, static_cast<size_t>(End() - last) * sizeof(GenericValue));
data_.a.size -= static_cast<SizeType>(last - first);
return pos;
}
***************
*** 1936,1942 ****
if (count) {
GenericValue* e = static_cast<GenericValue*>(allocator.Malloc(count * sizeof(GenericValue)));
SetElementsPointer(e);
! std::memcpy(e, values, count * sizeof(GenericValue));
}
else
SetElementsPointer(0);
--- 1936,1942 ----
if (count) {
GenericValue* e = static_cast<GenericValue*>(allocator.Malloc(count * sizeof(GenericValue)));
SetElementsPointer(e);
! std::memcpy((void*)e, values, count * sizeof(GenericValue));
}
else
SetElementsPointer(0);
***************
*** 1949,1955 ****
if (count) {
Member* m = static_cast<Member*>(allocator.Malloc(count * sizeof(Member)));
SetMembersPointer(m);
! std::memcpy(m, members, count * sizeof(Member));
}
else
SetMembersPointer(0);
--- 1949,1955 ----
if (count) {
Member* m = static_cast<Member*>(allocator.Malloc(count * sizeof(Member)));
SetMembersPointer(m);
! std::memcpy((void*)m, members, count * sizeof(Member));
}
else
SetMembersPointer(0);