Browse Source

Changed build structure to not have lib in subdir

Eyck Jentzsch 6 months 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)
19 19
 find_package(ZLIB)
20 20
 find_package(${SystemCPackage} REQUIRED)
21 21
 
22
-add_subdirectory (src)
22
+FILE(GLOB LibHeaders incl/*.h incl/*/*.h)
23
+set(LIB_HEADERS ${LibHeaders} )
24
+
25
+set(LIB_SOURCES
26
+    src/sc_logic_7.cpp
27
+    src/utilities.cpp
28
+    src/report.cpp
29
+    src/perf_estimator.cpp
30
+    src/io-redirector.cpp
31
+)
32
+
33
+if(CCI_FOUND)
34
+    set(LIB_SOURCES ${LIB_SOURCES} 
35
+	    src/tracer_base.cpp
36
+	    src/tracer.cpp
37
+	    src/configurable_tracer.cpp
38
+	    src/configurer.cpp
39
+    	src/jsoncpp.cpp
40
+    	src/value_registry.cpp
41
+    )
42
+endif()
43
+
44
+if(SCV_FOUND)
45
+    if(ZLIB_FOUND)
46
+        set(LIB_SOURCES ${LIB_SOURCES} src/scv_tr_compressed.cpp)
47
+    endif(ZLIB_FOUND)
48
+    if(FALSE)
49
+    	set(LIB_SOURCES ${LIB_SOURCES} src/scv_tr_binary/scv_tr_binary.cpp)
50
+	    if(CONAN_LEVELDB_ROOT)
51
+		    set(LIB_SOURCES ${LIB_SOURCES} src/scv_tr_ldb/scv_tr_ldb.cpp )
52
+	    endif()
53
+    endif()
54
+    set(LIB_SOURCES ${LIB_SOURCES} src/scv_tr_sqlite/scv_tr_sqlite.cpp src/scv_tr_sqlite/sqlite3.c )
55
+endif(SCV_FOUND)
56
+
57
+# Define two variables in order not to repeat ourselves.
58
+set(LIBRARY_NAME sc-components)
59
+if(${CMAKE_VERSION} VERSION_LESS "3.13.0") 
60
+	link_directories(${SystemC_LIBRARY_DIRS})
61
+endif()
62
+
63
+# Define the library
64
+add_library(${LIBRARY_NAME} ${LIB_SOURCES})
65
+
66
+target_include_directories (${LIBRARY_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/incl)
67
+set_target_properties(${LIBRARY_NAME} PROPERTIES
68
+  VERSION ${VERSION}  # ${VERSION} was defined in the main CMakeLists.
69
+  FRAMEWORK FALSE
70
+  PUBLIC_HEADER "${LIB_HEADERS}" # specify the public headers
71
+)
72
+
73
+if(CCI_FOUND)
74
+    target_compile_definitions(${LIBRARY_NAME} PUBLIC -DWITH_CCI)
75
+	target_include_directories (${LIBRARY_NAME} PUBLIC ${CCI_INCLUDE_DIRS})
76
+	target_link_libraries(${LIBRARY_NAME} ${CCI_LIBRARIES} )
77
+	if(NOT ${CMAKE_VERSION} VERSION_LESS "3.13.0") 
78
+		target_link_directories(${LIBRARY_NAME} PUBLIC ${CCI_LIBRARY_DIRS})
79
+	endif()
80
+endif()
81
+
82
+if(SCV_FOUND)   
83
+    target_compile_definitions(${LIBRARY_NAME} PUBLIC -DWITH_SCV)
84
+	target_include_directories (${LIBRARY_NAME} PUBLIC ${SCV_INCLUDE_DIRS})
85
+    target_link_libraries (${LIBRARY_NAME} ${SCV_LIBRARIES})
86
+	if(NOT ${CMAKE_VERSION} VERSION_LESS "3.13.0") 
87
+		target_link_directories(${LIBRARY_NAME} PUBLIC ${SCV_LIBRARY_DIRS})
88
+	endif()
89
+endif()
90
+
91
+target_include_directories (${LIBRARY_NAME} PUBLIC ${SystemC_INCLUDE_DIRS})	
92
+target_link_libraries(${LIBRARY_NAME} ${SystemC_LIBRARIES} )
93
+if(NOT ${CMAKE_VERSION} VERSION_LESS "3.13.0") 
94
+	target_link_directories(${LIBRARY_NAME} PUBLIC ${SystemC_LIBRARY_DIRS})
95
+endif()
96
+
97
+# build a separate JSON library for the use in non-systemc based systems
98
+add_library(jsoncpp src/jsoncpp.cpp)
99
+FILE(GLOB JsonLibHeaders incl/json/*.h)
100
+set_target_properties(jsoncpp PROPERTIES
101
+  VERSION ${VERSION}  # ${VERSION} was defined in the main CMakeLists.
102
+  FRAMEWORK FALSE
103
+  PUBLIC_HEADER "${JsonLibHeaders}" # specify the public headers
104
+)
105
+target_include_directories (jsoncpp PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/incl)
106
+
107
+install(TARGETS ${LIBRARY_NAME} jsoncpp
108
+        RUNTIME DESTINATION bin
109
+        LIBRARY DESTINATION lib
110
+        ARCHIVE DESTINATION lib/static)

+ 5
- 1
cmake/FindSLSSystemC.cmake View File

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

+ 0
- 85
src/CMakeLists.txt View File

@@ -1,85 +0,0 @@
1
-FILE(GLOB LibHeaders ../incl/*/*.h)
2
-set(LIB_HEADERS ${LibHeaders} )
3
-
4
-set(LIB_SOURCES
5
-    sc_logic_7.cpp
6
-    utilities.cpp
7
-    report.cpp
8
-    perf_estimator.cpp
9
-    io-redirector.cpp
10
-)
11
-
12
-if(CCI_FOUND)
13
-    set(LIB_SOURCES ${LIB_SOURCES} 
14
-	    tracer_base.cpp
15
-	    tracer.cpp
16
-	    configurable_tracer.cpp
17
-	    configurer.cpp
18
-    	jsoncpp.cpp
19
-    	value_registry.cpp
20
-    )
21
-endif()
22
-
23
-if(SCV_FOUND)
24
-    if(ZLIB_FOUND)
25
-        set(LIB_SOURCES ${LIB_SOURCES} scv_tr_compressed.cpp)
26
-    endif(ZLIB_FOUND)
27
-    if(FALSE)
28
-    	set(LIB_SOURCES ${LIB_SOURCES} scv_tr_binary/scv_tr_binary.cpp)
29
-	    if(CONAN_LEVELDB_ROOT)
30
-		    set(LIB_SOURCES ${LIB_SOURCES} scv_tr_ldb/scv_tr_ldb.cpp )
31
-	    endif()
32
-    endif()
33
-    set(LIB_SOURCES ${LIB_SOURCES} scv_tr_sqlite/scv_tr_sqlite.cpp scv_tr_sqlite/sqlite3.c )
34
-endif(SCV_FOUND)
35
-
36
-# Define two variables in order not to repeat ourselves.
37
-set(LIBRARY_NAME sc-components)
38
-if(${CMAKE_VERSION} VERSION_LESS "3.13.0") 
39
-	link_directories(${SystemC_LIBRARY_DIRS})
40
-endif()
41
-
42
-# Define the library
43
-add_library(${LIBRARY_NAME} ${LIB_SOURCES})
44
-
45
-target_include_directories (${LIBRARY_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../incl)
46
-set_target_properties(${LIBRARY_NAME} PROPERTIES
47
-  VERSION ${VERSION}  # ${VERSION} was defined in the main CMakeLists.
48
-  FRAMEWORK FALSE
49
-  PUBLIC_HEADER "${LIB_HEADERS}" # specify the public headers
50
-)
51
-
52
-if(CCI_FOUND)
53
-    target_compile_definitions(${LIBRARY_NAME} PUBLIC -DWITH_CCI)
54
-	target_include_directories (${LIBRARY_NAME} PUBLIC ${CCI_INCLUDE_DIRS})
55
-	target_link_libraries(${LIBRARY_NAME} ${CCI_LIBRARIES} )
56
-	if(NOT ${CMAKE_VERSION} VERSION_LESS "3.13.0") 
57
-		target_link_directories(${LIBRARY_NAME} PUBLIC ${CCI_LIBRARY_DIRS})
58
-	endif()
59
-endif()
60
-
61
-if(SCV_FOUND)   
62
-    target_compile_definitions(${LIBRARY_NAME} PUBLIC -DWITH_SCV)
63
-	target_include_directories (${LIBRARY_NAME} PUBLIC ${SCV_INCLUDE_DIRS})
64
-    target_link_libraries (${LIBRARY_NAME} ${SCV_LIBRARIES})
65
-	if(NOT ${CMAKE_VERSION} VERSION_LESS "3.13.0") 
66
-		target_link_directories(${LIBRARY_NAME} PUBLIC ${SCV_LIBRARY_DIRS})
67
-	endif()
68
-endif()
69
-
70
-target_include_directories (${LIBRARY_NAME} PUBLIC ${SystemC_INCLUDE_DIRS})	
71
-target_link_libraries(${LIBRARY_NAME} ${SystemC_LIBRARIES} )
72
-if(NOT ${CMAKE_VERSION} VERSION_LESS "3.13.0") 
73
-	target_link_directories(${LIBRARY_NAME} PUBLIC ${SystemC_LIBRARY_DIRS})
74
-endif()
75
-
76
-# build a separate JSON library for the use in non-systemc based systems
77
-add_library(jsoncpp jsoncpp.cpp)
78
-FILE(GLOB JsonLibHeaders ../incl/json/*.h)
79
-set_target_properties(jsoncpp PROPERTIES
80
-  VERSION ${VERSION}  # ${VERSION} was defined in the main CMakeLists.
81
-  FRAMEWORK FALSE
82
-  PUBLIC_HEADER "${JsonLibHeaders}" # specify the public headers
83
-)
84
-target_include_directories (jsoncpp PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../incl)
85
-