Browse Source

Changed build structure to not have lib in subdir

pull/2/head
Eyck Jentzsch 1 year ago
parent
commit
4cdfd9bdd3
3 changed files with 94 additions and 87 deletions
  1. 89
    1
      CMakeLists.txt
  2. 5
    1
      cmake/FindSLSSystemC.cmake
  3. 0
    85
      src/CMakeLists.txt

+ 89
- 1
CMakeLists.txt View File

@@ -19,4 +19,92 @@ find_package(Threads)
find_package(ZLIB)
find_package(${SystemCPackage} REQUIRED)

add_subdirectory (src)
FILE(GLOB LibHeaders incl/*.h incl/*/*.h)
set(LIB_HEADERS ${LibHeaders} )

set(LIB_SOURCES
src/sc_logic_7.cpp
src/utilities.cpp
src/report.cpp
src/perf_estimator.cpp
src/io-redirector.cpp
)

if(CCI_FOUND)
set(LIB_SOURCES ${LIB_SOURCES}
src/tracer_base.cpp
src/tracer.cpp
src/configurable_tracer.cpp
src/configurer.cpp
src/jsoncpp.cpp
src/value_registry.cpp
)
endif()

if(SCV_FOUND)
if(ZLIB_FOUND)
set(LIB_SOURCES ${LIB_SOURCES} src/scv_tr_compressed.cpp)
endif(ZLIB_FOUND)
if(FALSE)
set(LIB_SOURCES ${LIB_SOURCES} src/scv_tr_binary/scv_tr_binary.cpp)
if(CONAN_LEVELDB_ROOT)
set(LIB_SOURCES ${LIB_SOURCES} src/scv_tr_ldb/scv_tr_ldb.cpp )
endif()
endif()
set(LIB_SOURCES ${LIB_SOURCES} src/scv_tr_sqlite/scv_tr_sqlite.cpp src/scv_tr_sqlite/sqlite3.c )
endif(SCV_FOUND)

# Define two variables in order not to repeat ourselves.
set(LIBRARY_NAME sc-components)
if(${CMAKE_VERSION} VERSION_LESS "3.13.0")
link_directories(${SystemC_LIBRARY_DIRS})
endif()

# Define the library
add_library(${LIBRARY_NAME} ${LIB_SOURCES})

target_include_directories (${LIBRARY_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/incl)
set_target_properties(${LIBRARY_NAME} PROPERTIES
VERSION ${VERSION} # ${VERSION} was defined in the main CMakeLists.
FRAMEWORK FALSE
PUBLIC_HEADER "${LIB_HEADERS}" # specify the public headers
)

if(CCI_FOUND)
target_compile_definitions(${LIBRARY_NAME} PUBLIC -DWITH_CCI)
target_include_directories (${LIBRARY_NAME} PUBLIC ${CCI_INCLUDE_DIRS})
target_link_libraries(${LIBRARY_NAME} ${CCI_LIBRARIES} )
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.13.0")
target_link_directories(${LIBRARY_NAME} PUBLIC ${CCI_LIBRARY_DIRS})
endif()
endif()

if(SCV_FOUND)
target_compile_definitions(${LIBRARY_NAME} PUBLIC -DWITH_SCV)
target_include_directories (${LIBRARY_NAME} PUBLIC ${SCV_INCLUDE_DIRS})
target_link_libraries (${LIBRARY_NAME} ${SCV_LIBRARIES})
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.13.0")
target_link_directories(${LIBRARY_NAME} PUBLIC ${SCV_LIBRARY_DIRS})
endif()
endif()

target_include_directories (${LIBRARY_NAME} PUBLIC ${SystemC_INCLUDE_DIRS})
target_link_libraries(${LIBRARY_NAME} ${SystemC_LIBRARIES} )
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.13.0")
target_link_directories(${LIBRARY_NAME} PUBLIC ${SystemC_LIBRARY_DIRS})
endif()

# build a separate JSON library for the use in non-systemc based systems
add_library(jsoncpp src/jsoncpp.cpp)
FILE(GLOB JsonLibHeaders incl/json/*.h)
set_target_properties(jsoncpp PROPERTIES
VERSION ${VERSION} # ${VERSION} was defined in the main CMakeLists.
FRAMEWORK FALSE
PUBLIC_HEADER "${JsonLibHeaders}" # specify the public headers
)
target_include_directories (jsoncpp PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/incl)

install(TARGETS ${LIBRARY_NAME} jsoncpp
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib/static)

+ 5
- 1
cmake/FindSLSSystemC.cmake View File

@@ -111,7 +111,11 @@ if(SystemC_FOUND)
#see https://gitlab.kitware.com/cmake/community/wikis/FAQ#how-do-i-use-a-different-compiler
#set(CMAKE_CXX_COMPILER $ENV{SNPS_VP_HOME}/common/bin/g++)
set(SystemC_INCLUDE_DIRS ${TLM_INCLUDE_DIRS} ${SystemC_INCLUDE_DIRS})
set(SystemC_LIBRARIES SnpsVPExt SnpsVP tbb omniORB4 omnithread dwarf elf)
set(SystemC_LIBRARIES SnpsVPExt SnpsVP tbb omniORB4 omniDynamic4 omnithread dwarf elf)
#-L${SNPS_VP_HOME}/IP_common/common_debug/lib/linux.gcc-4.8.3-64
#-lipdebug
#-L${SNPS_VP_HOME}/IP/SBLGCCI_BL/Internal/lib/linux.gcc-4.8.3-64
#-lsblgcci
if(SCV_FOUND)
set(SCV_LIBRARIES ${SystemC_LIBRARIES})
endif(SCV_FOUND)

+ 0
- 85
src/CMakeLists.txt View File

@@ -1,85 +0,0 @@
FILE(GLOB LibHeaders ../incl/*/*.h)
set(LIB_HEADERS ${LibHeaders} )

set(LIB_SOURCES
sc_logic_7.cpp
utilities.cpp
report.cpp
perf_estimator.cpp
io-redirector.cpp
)

if(CCI_FOUND)
set(LIB_SOURCES ${LIB_SOURCES}
tracer_base.cpp
tracer.cpp
configurable_tracer.cpp
configurer.cpp
jsoncpp.cpp
value_registry.cpp
)
endif()

if(SCV_FOUND)
if(ZLIB_FOUND)
set(LIB_SOURCES ${LIB_SOURCES} scv_tr_compressed.cpp)
endif(ZLIB_FOUND)
if(FALSE)
set(LIB_SOURCES ${LIB_SOURCES} scv_tr_binary/scv_tr_binary.cpp)
if(CONAN_LEVELDB_ROOT)
set(LIB_SOURCES ${LIB_SOURCES} scv_tr_ldb/scv_tr_ldb.cpp )
endif()
endif()
set(LIB_SOURCES ${LIB_SOURCES} scv_tr_sqlite/scv_tr_sqlite.cpp scv_tr_sqlite/sqlite3.c )
endif(SCV_FOUND)

# Define two variables in order not to repeat ourselves.
set(LIBRARY_NAME sc-components)
if(${CMAKE_VERSION} VERSION_LESS "3.13.0")
link_directories(${SystemC_LIBRARY_DIRS})
endif()

# Define the library
add_library(${LIBRARY_NAME} ${LIB_SOURCES})

target_include_directories (${LIBRARY_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../incl)
set_target_properties(${LIBRARY_NAME} PROPERTIES
VERSION ${VERSION} # ${VERSION} was defined in the main CMakeLists.
FRAMEWORK FALSE
PUBLIC_HEADER "${LIB_HEADERS}" # specify the public headers
)

if(CCI_FOUND)
target_compile_definitions(${LIBRARY_NAME} PUBLIC -DWITH_CCI)
target_include_directories (${LIBRARY_NAME} PUBLIC ${CCI_INCLUDE_DIRS})
target_link_libraries(${LIBRARY_NAME} ${CCI_LIBRARIES} )
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.13.0")
target_link_directories(${LIBRARY_NAME} PUBLIC ${CCI_LIBRARY_DIRS})
endif()
endif()

if(SCV_FOUND)
target_compile_definitions(${LIBRARY_NAME} PUBLIC -DWITH_SCV)
target_include_directories (${LIBRARY_NAME} PUBLIC ${SCV_INCLUDE_DIRS})
target_link_libraries (${LIBRARY_NAME} ${SCV_LIBRARIES})
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.13.0")
target_link_directories(${LIBRARY_NAME} PUBLIC ${SCV_LIBRARY_DIRS})
endif()
endif()

target_include_directories (${LIBRARY_NAME} PUBLIC ${SystemC_INCLUDE_DIRS})
target_link_libraries(${LIBRARY_NAME} ${SystemC_LIBRARIES} )
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.13.0")
target_link_directories(${LIBRARY_NAME} PUBLIC ${SystemC_LIBRARY_DIRS})
endif()

# build a separate JSON library for the use in non-systemc based systems
add_library(jsoncpp jsoncpp.cpp)
FILE(GLOB JsonLibHeaders ../incl/json/*.h)
set_target_properties(jsoncpp PROPERTIES
VERSION ${VERSION} # ${VERSION} was defined in the main CMakeLists.
FRAMEWORK FALSE
PUBLIC_HEADER "${JsonLibHeaders}" # specify the public headers
)
target_include_directories (jsoncpp PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../incl)


Loading…
Cancel
Save