Skip to content

Instantly share code, notes, and snippets.

@qinghon
Created September 11, 2022 16:53
Show Gist options
  • Save qinghon/31d1d755b81a5db47616d9d1f0378321 to your computer and use it in GitHub Desktop.
Save qinghon/31d1d755b81a5db47616d9d1f0378321 to your computer and use it in GitHub Desktop.
ovs support cmake
Index: tests/CMakeLists.txt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
new file mode 100644
--- /dev/null (date 1662902023379)
+++ b/tests/CMakeLists.txt (date 1662902023379)
@@ -0,0 +1,62 @@
+
+set(TEST_OVSDB_SRC tests/test-ovsdb.c)
+set(TEST_LIB_SRC tests/test-lib.c)
+set(TEST_DPDKR_SRC tests/dpdk/ring_client.c)
+
+set(TEST_OVSTEST_SRC
+ tests/ovstest.c
+ tests/ovstest.h
+ tests/test-aes128.c
+ tests/test-atomic.c
+ tests/test-bundle.c
+ tests/test-byte-order.c
+ tests/test-classifier.c
+ tests/test-ccmap.c
+ tests/test-cmap.c
+ tests/test-conntrack.c
+ tests/test-csum.c
+ tests/test-flows.c
+ tests/test-hash.c
+ tests/test-heap.c
+ tests/test-hindex.c
+ tests/test-hmap.c
+ tests/test-json.c
+ tests/test-jsonrpc.c
+ tests/test-list.c
+ tests/test-lockfile.c
+ tests/test-multipath.c
+ tests/test-netflow.c
+ tests/test-odp.c
+ tests/test-ofpbuf.c
+ tests/test-packets.c
+ tests/test-random.c
+ tests/test-rcu.c
+ tests/test-reconnect.c
+ tests/test-rstp.c
+ tests/test-sflow.c
+ tests/test-sha1.c
+ tests/test-skiplist.c
+ tests/test-stp.c
+ tests/test-unixctl.c
+ tests/test-util.c
+ tests/test-uuid.c
+ tests/test-bitmap.c
+ tests/test-vconn.c
+ tests/test-aa.c
+ tests/test-stopwatch.c
+ )
+
+if (UNIX)
+ set(TEST_OVSTEST_SRC ${TEST_OVSTEST_SRC}
+ tests/test-unix-socket.c
+ )
+endif ()
+if (LINUX)
+ set(TEST_OVSTEST_SRC ${TEST_OVSTEST_SRC}
+ tests/test-netlink-conntrack.c
+ )
+endif ()
+
+set(TEST_STEAM_SRC tests/test-stream.c)
+set(TEST_STRTOK_R_SRC tests/test-strtok_r.c)
+set(TEST_TYPE_PROPS_SRC tests/test-type-props.c)
\ No newline at end of file
Index: include/CMakeLists.txt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
new file mode 100644
--- /dev/null (date 1662913591187)
+++ b/include/CMakeLists.txt (date 1662913591187)
@@ -0,0 +1,20 @@
+
+
+#add_custom_command(
+# OUTPUT include/odp-netlink.h
+# COMMAND sed -f build-aux/extract-odp-netlink-h < datapath/linux/compat/include/linux/openvswitch.h
+# WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+# VERBATIM
+#)
+ovs_cus_command(NAME odp-netlink
+ OUTPUT include/odp-netlink.h
+ COMMENT "Gen:include/odp-netlink.h"
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ COMMAND sed -f build-aux/extract-odp-netlink-h < datapath/linux/compat/include/linux/openvswitch.h
+ )
+ovs_cus_command(NAME odp-netlink-macros
+ OUTPUT include/odp-netlink-macros.h
+ COMMENT "Gen include/odp-netlink-macros.h"
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ COMMAND build-aux/extract-odp-netlink-macros-h include/odp-netlink.h
+ )
\ No newline at end of file
Index: vswitchd/CMakeLists.txt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/vswitchd/CMakeLists.txt b/vswitchd/CMakeLists.txt
new file mode 100644
--- /dev/null (date 1662902589257)
+++ b/vswitchd/CMakeLists.txt (date 1662902589257)
@@ -0,0 +1,11 @@
+
+
+set(OVS_VSWITCHD_SRC
+ vswitchd/bridge.c
+vswitchd/bridge.h
+vswitchd/ovs-vswitchd.c
+vswitchd/system-stats.c
+vswitchd/system-stats.h
+vswitchd/xenserver.c
+vswitchd/xenserver.h
+ )
\ No newline at end of file
Index: lib/CMakeLists.txt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
new file mode 100644
--- /dev/null (date 1662910430025)
+++ b/lib/CMakeLists.txt (date 1662910430025)
@@ -0,0 +1,483 @@
+
+
+set(LIB_OPENVSWITCH_SRC
+ lib/aes128.c
+ lib/aes128.h
+ lib/async-append.h
+ lib/backtrace.c
+ lib/backtrace.h
+ lib/bfd.c
+ lib/bfd.h
+ lib/bitmap.h
+ lib/bundle.c
+ lib/bundle.h
+ lib/byte-order.h
+ lib/byteq.c
+ lib/byteq.h
+ lib/cfm.c
+ lib/cfm.h
+ lib/classifier.c
+ lib/classifier.h
+ lib/classifier-private.h
+ lib/ccmap.c
+ lib/ccmap.h
+ lib/cmap.c
+ lib/cmap.h
+ lib/colors.c
+ lib/colors.h
+ lib/command-line.c
+ lib/command-line.h
+ lib/compiler.h
+ lib/connectivity.c
+ lib/connectivity.h
+ lib/conntrack-icmp.c
+ lib/conntrack-private.h
+ lib/conntrack-tcp.c
+ lib/conntrack-other.c
+ lib/conntrack.c
+ lib/conntrack.h
+ lib/coverage.c
+ lib/coverage.h
+ lib/crc32c.c
+ lib/crc32c.h
+ lib/csum.c
+ lib/csum.h
+ lib/ct-dpif.c
+ lib/ct-dpif.h
+ lib/daemon.c
+ lib/daemon.h
+ lib/daemon-private.h
+ lib/db-ctl-base.c
+ lib/db-ctl-base.h
+ lib/dhcp.h
+ lib/dummy.c
+ lib/dummy.h
+ lib/dhparams.h
+ lib/dirs.h
+ lib/dpctl.c
+ lib/dpctl.h
+ lib/dp-packet.h
+ lib/dp-packet.c
+ lib/dpdk.h
+ lib/dpif-netdev-lookup-generic.c
+ lib/dpif-netdev.c
+ lib/dpif-netdev.h
+ lib/dpif-netdev-private.h
+ lib/dpif-netdev-perf.c
+ lib/dpif-netdev-perf.h
+ lib/dpif-provider.h
+ lib/dpif.c
+ lib/dpif.h
+ lib/heap.c
+ lib/heap.h
+ lib/dynamic-string.c
+ lib/entropy.c
+ lib/entropy.h
+ lib/fat-rwlock.c
+ lib/fat-rwlock.h
+ lib/fatal-signal.c
+ lib/fatal-signal.h
+ lib/flow.c
+ lib/flow.h
+ lib/guarded-list.c
+ lib/guarded-list.h
+ lib/hash.c
+ lib/hash.h
+ lib/hash-aarch64.h
+ lib/hindex.c
+ lib/hindex.h
+ lib/hmap.c
+ lib/hmapx.c
+ lib/hmapx.h
+ lib/id-pool.c
+ lib/id-pool.h
+ lib/if-notifier-manual.c
+ lib/if-notifier.h
+ lib/ipf.c
+ lib/ipf.h
+ lib/jhash.c
+ lib/jhash.h
+ lib/json.c
+ lib/jsonrpc.c
+ lib/jsonrpc.h
+ lib/lacp.c
+ lib/lacp.h
+ lib/latch.h
+ lib/learn.c
+ lib/learn.h
+ lib/learning-switch.c
+ lib/learning-switch.h
+ lib/lockfile.c
+ lib/lockfile.h
+ lib/mac-learning.c
+ lib/mac-learning.h
+ lib/match.c
+ lib/mcast-snooping.c
+ lib/mcast-snooping.h
+ lib/memory.c
+ lib/memory.h
+ lib/meta-flow.c
+ lib/multipath.c
+ lib/multipath.h
+ lib/namemap.c
+ lib/netdev-dpdk.h
+ lib/netdev-dummy.c
+ lib/netdev-offload.c
+ lib/netdev-offload.h
+ lib/netdev-offload-provider.h
+ lib/netdev-provider.h
+ lib/netdev-vport.c
+ lib/netdev-vport.h
+ lib/netdev-vport-private.h
+ lib/netdev.c
+ lib/netdev.h
+ lib/netflow.h
+ lib/netlink.c
+ lib/netlink.h
+ lib/netnsid.h
+ lib/nx-match.c
+ lib/nx-match.h
+ lib/object-collection.c
+ lib/object-collection.h
+ lib/odp-execute.c
+ lib/odp-execute.h
+ lib/odp-util.c
+ lib/odp-util.h
+ lib/ofp-actions.c
+ lib/ofp-bundle.c
+ lib/ofp-connection.c
+ lib/ofp-ed-props.c
+ lib/ofp-errors.c
+ lib/ofp-flow.c
+ lib/ofp-group.c
+ lib/ofp-ipfix.c
+ lib/ofp-match.c
+ lib/ofp-meter.c
+ lib/ofp-monitor.c
+ lib/ofp-msgs.c
+ lib/ofp-packet.c
+ lib/ofp-parse.c
+ lib/ofp-port.c
+ lib/ofp-print.c
+ lib/ofp-prop.c
+ lib/ofp-protocol.c
+ lib/ofp-queue.c
+ lib/ofp-switch.c
+ lib/ofp-table.c
+ lib/ofp-util.c
+ lib/ofp-version-opt.h
+ lib/ofp-version-opt.c
+ lib/ofpbuf.c
+ lib/ovs-atomic-c++.h
+ lib/ovs-atomic-c11.h
+ lib/ovs-atomic-clang.h
+ lib/ovs-atomic-flag-gcc4.7+.h
+ lib/ovs-atomic-gcc4+.h
+ lib/ovs-atomic-gcc4.7+.h
+ lib/ovs-atomic-i586.h
+ lib/ovs-atomic-locked.c
+ lib/ovs-atomic-locked.h
+ lib/ovs-atomic-msvc.h
+ lib/ovs-atomic-pthreads.h
+ lib/ovs-atomic-x86_64.h
+ lib/ovs-atomic.h
+ lib/ovs-lldp.c
+ lib/ovs-lldp.h
+ lib/ovs-numa.c
+ lib/ovs-numa.h
+ lib/ovs-rcu.c
+ lib/ovs-rcu.h
+ lib/ovs-router.h
+ lib/ovs-router.c
+ lib/ovs-thread.c
+ lib/ovs-thread.h
+ lib/ovsdb-data.c
+ lib/ovsdb-data.h
+ lib/ovsdb-error.c
+ lib/ovsdb-error.h
+ lib/ovsdb-idl-provider.h
+ lib/ovsdb-idl.c
+ lib/ovsdb-idl.h
+ lib/ovsdb-map-op.c
+ lib/ovsdb-map-op.h
+ lib/ovsdb-set-op.c
+ lib/ovsdb-set-op.h
+ lib/ovsdb-condition.h
+ lib/ovsdb-condition.c
+ lib/ovsdb-parser.c
+ lib/ovsdb-parser.h
+ lib/ovsdb-session.c
+ lib/ovsdb-session.h
+ lib/ovsdb-types.c
+ lib/ovsdb-types.h
+ lib/ox-stat.c
+ lib/ox-stat.h
+ lib/packets.c
+ lib/packets.h
+ lib/pcap-file.c
+ lib/pcap-file.h
+ lib/perf-counter.h
+ lib/perf-counter.c
+ lib/stopwatch.h
+ lib/stopwatch.c
+ lib/poll-loop.c
+ lib/process.c
+ lib/process.h
+ lib/pvector.c
+ lib/pvector.h
+ lib/random.c
+ lib/random.h
+ lib/rconn.c
+ lib/rculist.h
+ lib/reconnect.c
+ lib/reconnect.h
+ lib/rstp.c
+ lib/rstp.h
+ lib/rstp-common.h
+ lib/rstp-state-machines.c
+ lib/rstp-state-machines.h
+ lib/sat-math.h
+ lib/seq.c
+ lib/seq.h
+ lib/sha1.c
+ lib/sha1.h
+ lib/shash.c
+ lib/simap.c
+ lib/simap.h
+ lib/skiplist.c
+ lib/skiplist.h
+ lib/smap.c
+ lib/smap.h
+ lib/socket-util.c
+ lib/socket-util.h
+ lib/sort.c
+ lib/sort.h
+ lib/sset.c
+ lib/sset.h
+ lib/stp.c
+ lib/stp.h
+ lib/stream-fd.c
+ lib/stream-fd.h
+ lib/stream-provider.h
+ lib/stream-ssl.h
+ lib/stream-tcp.c
+ lib/stream.c
+ lib/stream.h
+ lib/stdio.c
+ lib/string.c
+ lib/svec.c
+ lib/svec.h
+ lib/syslog-direct.c
+ lib/syslog-direct.h
+ lib/syslog-libc.c
+ lib/syslog-libc.h
+ lib/syslog-null.c
+ lib/syslog-null.h
+ lib/syslog-provider.h
+ lib/table.c
+ lib/table.h
+ lib/timer.c
+ lib/timer.h
+ lib/timeval.c
+ lib/timeval.h
+ lib/tnl-neigh-cache.c
+ lib/tnl-neigh-cache.h
+ lib/tnl-ports.c
+ lib/tnl-ports.h
+ lib/netdev-native-tnl.c
+ lib/netdev-native-tnl.h
+ lib/token-bucket.c
+ lib/tun-metadata.c
+ lib/tun-metadata.h
+ lib/unaligned.h
+ lib/unicode.c
+ lib/unicode.h
+ lib/unixctl.c
+ lib/unixctl.h
+ lib/userspace-tso.c
+ lib/userspace-tso.h
+ lib/util.c
+ lib/util.h
+ lib/uuid.c
+ lib/uuid.h
+ lib/valgrind.h
+ lib/vconn-provider.h
+ lib/vconn-stream.c
+ lib/vconn.c
+ lib/versions.h
+ lib/vl-mff-map.h
+ lib/vlan-bitmap.c
+ lib/vlan-bitmap.h
+ lib/vlog.c
+ lib/lldp/aa-structs.h
+ lib/lldp/lldp.c
+ lib/lldp/lldp-const.h
+ lib/lldp/lldp-tlv.h
+ lib/lldp/lldpd.c
+ lib/lldp/lldpd.h
+ lib/lldp/lldpd-structs.c
+ lib/lldp/lldpd-structs.h
+ )
+
+if (DPDK_NETDEV)
+ set(LIB_OPENVSWITCH_SRC ${LIB_OPENVSWITCH_SRC}
+ lib/dpdk.c
+ lib/netdev-dpdk.c
+ lib/netdev-offload-dpdk.c
+ lib/seq-pool.c
+ lib/llring.c)
+else ()
+ set(LIB_OPENVSWITCH_SRC ${LIB_OPENVSWITCH_SRC} lib/dpdk-stub.c)
+endif ()
+
+if (WIN32)
+ set(LIB_OPENVSWITCH_SRC ${LIB_OPENVSWITCH_SRC}
+ lib/daemon-windows.c
+ lib/getopt_long.c
+ lib/getrusage-windows.c
+ lib/latch-windows.c
+ lib/route-table-stub.c
+ lib/if-notifier-stub.c
+ lib/stream-windows.c
+ lib/strsep.c
+ )
+else ()
+ set(LIB_OPENVSWITCH_SRC ${LIB_OPENVSWITCH_SRC}
+ lib/daemon-unix.c
+ lib/latch-unix.c
+ lib/signals.c
+ lib/signals.h
+ lib/socket-util-unix.c
+ lib/stream-unix.c
+ )
+ add_definitions(-DHAVE_STRUCT_MMSGHDR_MSG_LEN=1)
+endif ()
+
+if (LINUX)
+ set(LIB_OPENVSWITCH_SRC ${LIB_OPENVSWITCH_SRC}
+ lib/dpif-netlink.c
+ lib/dpif-netlink.h
+ lib/dpif-netlink-rtnl.c
+ lib/dpif-netlink-rtnl.h
+ lib/if-notifier.c
+ lib/netdev-linux.c
+ lib/netdev-linux.h
+ lib/netdev-linux-private.h
+ lib/netdev-offload-tc.c
+ lib/netlink-conntrack.c
+ lib/netlink-conntrack.h
+ lib/netlink-notifier.c
+ lib/netlink-notifier.h
+ lib/netlink-protocol.h
+ lib/netlink-socket.c
+ lib/netlink-socket.h
+ lib/rtnetlink.c
+ lib/rtnetlink.h
+ lib/route-table.c
+ lib/route-table.h
+ lib/tc.c
+ lib/tc.h
+ )
+endif ()
+
+if (HAVE_AF_XDP)
+ set(LIB_OPENVSWITCH_SRC ${LIB_OPENVSWITCH_SRC}
+ lib/netdev-afxdp-pool.c
+ lib/netdev-afxdp-pool.h
+ lib/netdev-afxdp.c
+ lib/netdev-afxdp.h
+ )
+endif ()
+
+if (HAVE_POSIX_AIO)
+ set(LIB_OPENVSWITCH_SRC ${LIB_OPENVSWITCH_SRC}
+ lib/async-append-aio.c
+ )
+
+else ()
+ set(LIB_OPENVSWITCH_SRC ${LIB_OPENVSWITCH_SRC}
+ lib/async-append-null.c
+ )
+endif ()
+
+if (HAVE_IF_DL)
+ set(LIB_OPENVSWITCH_SRC ${LIB_OPENVSWITCH_SRC}
+ lib/if-notifier-bsd.c
+ lib/netdev-bsd.c
+ lib/rtbsd.c
+ lib/rtbsd.h
+ lib/route-table-bsd.c
+ )
+endif ()
+
+if (HAVE_OPENSSL)
+ add_custom_command(
+ OUTPUT lib/dhparams.c
+ COMMAND ${CMAKE_SOURCE_DIR}/build-aux/generate-dhparams-c
+ )
+ set(LIB_OPENVSWITCH_SRC ${LIB_OPENVSWITCH_SRC}
+ lib/stream-ssl.c
+ lib/dhparams.c
+ )
+else ()
+ set(LIB_OPENVSWITCH_SRC ${LIB_OPENVSWITCH_SRC}
+ lib/stream-nossl.c
+ )
+endif ()
+
+set(LIB_OPENVSWITCH_SRC ${LIB_OPENVSWITCH_SRC} lib/dns-resolve.h)
+if (HAVE_UNBOUND)
+ set(LIB_OPENVSWITCH_SRC ${LIB_OPENVSWITCH_SRC} lib/dns-resolve.c)
+else ()
+ set(LIB_OPENVSWITCH_SRC ${LIB_OPENVSWITCH_SRC} lib/dns-resolve-stub.c)
+endif ()
+
+configure_file(lib/libopenvswitch.pc.in libopenvswitch.pc @ONLY)
+configure_file(lib/libsflow.pc.in libsflow.pc @ONLY)
+
+add_custom_command(
+ OUTPUT lib/dirs.c
+ sed "lib/dirs.c.in" "-e" 's,[@]srcdir[@],$(srcdir),g'
+ -e 's,[@]LOGDIR[@],"$(LOGDIR)",g'
+ -e 's,[@]RUNDIR[@],"$(RUNDIR)",g'
+ -e 's,[@]DBDIR[@],"$(DBDIR)",g'
+ -e 's,[@]bindir[@],"$(bindir)",g'
+ -e 's,[@]sysconfdir[@],"$(sysconfdir)",g'
+ -e 's,[@]pkgdatadir[@],"$(pkgdatadir)",g'
+)
+add_custom_command(
+ OUTPUT lib/meta-flow.inc
+ python meta-flow include/openvswitch/meta-flow.h
+)
+add_custom_command(
+ OUTPUT lib/nx-match.inc
+ python nx-match include/openvswitch/meta-flow.h
+)
+add_custom_command(
+ OUTPUT lib/ofp-actions.inc1
+ python prototypes lib/ofp-actions.c
+)
+add_custom_command(
+ OUTPUT lib/ofp-actions.inc2
+ python definitions lib/ofp-actions.c
+)
+add_custom_command(
+ OUTPUT lib/ofp-errors.inc
+ python ${CMAKE_SOURCE_DIR}/build-aux/extract-ofp-errors include/openvswitch/ofp-errors.h include/openflow/openflow-common.h
+)
+add_custom_command(
+ OUTPUT lib/ofp-msgs.inc
+ python ${CMAKE_SOURCE_DIR}/build-aux/extract-ofp-msgs include/openvswitch/ofp-msgs.h lib/ofp-msgs.inc
+)
+set(libsflow_SRC
+ lib/sflow_api.h
+ lib/sflow.h
+ lib/sflow_agent.c
+ lib/sflow_sampler.c
+ lib/sflow_poller.c
+ lib/sflow_receiver.c
+ )
+#add_custom_command(
+# OUTPUT lib/ovsdb-server-idl.ovsidl
+# python meta-flow $(srcdir)/include/openvswitch/meta-flow.h
+#)
\ No newline at end of file
Index: vtep/CMakeLists.txt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/vtep/CMakeLists.txt b/vtep/CMakeLists.txt
new file mode 100644
--- /dev/null (date 1662902589265)
+++ b/vtep/CMakeLists.txt (date 1662902589265)
@@ -0,0 +1,6 @@
+
+
+set(libvtep_SRC
+ vtep/vtep-idl.c
+vtep/vtep-idl.h
+ )
\ No newline at end of file
Index: ovsdb/CMakeLists.txt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/ovsdb/CMakeLists.txt b/ovsdb/CMakeLists.txt
new file mode 100644
--- /dev/null (date 1662903132724)
+++ b/ovsdb/CMakeLists.txt (date 1662903132724)
@@ -0,0 +1,57 @@
+
+set(LIBOVSDB_SRC
+ ovsdb/column.c
+ovsdb/column.h
+ovsdb/condition.c
+ovsdb/condition.h
+ovsdb/execution.c
+ovsdb/file.c
+ovsdb/file.h
+ovsdb/jsonrpc-server.c
+ovsdb/jsonrpc-server.h
+ovsdb/log.c
+ovsdb/log.h
+ovsdb/mutation.c
+ovsdb/mutation.h
+ovsdb/ovsdb.c
+ovsdb/ovsdb.h
+ovsdb/monitor.c
+ovsdb/monitor.h
+ovsdb/query.c
+ovsdb/query.h
+ovsdb/raft.c
+ovsdb/raft.h
+ovsdb/raft-private.c
+ovsdb/raft-private.h
+ovsdb/raft-rpc.c
+ovsdb/raft-rpc.h
+ovsdb/rbac.c
+ovsdb/rbac.h
+ovsdb/replication.c
+ovsdb/replication.h
+ovsdb/row.c
+ovsdb/row.h
+ovsdb/server.c
+ovsdb/server.h
+ovsdb/storage.c
+ovsdb/storage.h
+ovsdb/table.c
+ovsdb/table.h
+ovsdb/trigger.c
+ovsdb/trigger.h
+ovsdb/transaction.c
+ovsdb/transaction.h
+ovsdb/ovsdb-util.c
+ovsdb/ovsdb-util.h
+ )
+configure_file(ovsdb/libovsdb.pc.in libovsdb.pc @ONLY)
+
+set(OVSDB_TOOL_SRC
+ ovsdb/ovsdb-tool.c
+ )
+set(OVSDB_CLIENT_SRC
+ ovsdb/ovsdb-client.c
+ )
+set(OVSDB_SEVER_SRC
+ ovsdb/ovsdb-server.c
+ )
\ No newline at end of file
Index: ofproto/CMakeLists.txt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/ofproto/CMakeLists.txt b/ofproto/CMakeLists.txt
new file mode 100644
--- /dev/null (date 1662901176518)
+++ b/ofproto/CMakeLists.txt (date 1662901176518)
@@ -0,0 +1,51 @@
+
+set(LIBOFPROTO_SRC
+ ofproto/bond.c
+ ofproto/bond.h
+ ofproto/collectors.c
+ ofproto/collectors.h
+ ofproto/connmgr.c
+ ofproto/connmgr.h
+ ofproto/fail-open.c
+ ofproto/fail-open.h
+ ofproto/in-band.c
+ ofproto/in-band.h
+ ofproto/names.c
+ ofproto/netflow.c
+ ofproto/netflow.h
+ ofproto/ofproto.c
+ ofproto/ofproto.h
+ ofproto/ofproto-dpif.c
+ ofproto/ofproto-dpif.h
+ ofproto/ofproto-dpif-ipfix.c
+ ofproto/ofproto-dpif-ipfix.h
+ ofproto/ofproto-dpif-mirror.c
+ ofproto/ofproto-dpif-mirror.h
+ ofproto/ofproto-dpif-monitor.c
+ ofproto/ofproto-dpif-monitor.h
+ ofproto/ofproto-dpif-rid.c
+ ofproto/ofproto-dpif-rid.h
+ ofproto/ofproto-dpif-sflow.c
+ ofproto/ofproto-dpif-sflow.h
+ ofproto/ofproto-dpif-trace.c
+ ofproto/ofproto-dpif-trace.h
+ ofproto/ofproto-dpif-upcall.c
+ ofproto/ofproto-dpif-upcall.h
+ ofproto/ofproto-dpif-xlate.c
+ ofproto/ofproto-dpif-xlate.h
+ ofproto/ofproto-provider.h
+ ofproto/ofproto-dpif-xlate-cache.c
+ ofproto/ofproto-dpif-xlate-cache.h
+ ofproto/pinsched.c
+ ofproto/pinsched.h
+ ofproto/tunnel.c
+ ofproto/tunnel.h
+ ofproto/bundles.c
+ ofproto/bundles.h
+ )
+configure_file(ofproto/libofproto.pc.in ofproto/libofproto.pc @ONLY)
+
+add_custom_command(
+ OUTPUT lib/meta-flow.inc
+ ofproto/ipfix-gen-entities ofproto/ipfix.xml
+)
\ No newline at end of file
Index: CMakeLists.txt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
--- /dev/null (date 1662914732907)
+++ b/CMakeLists.txt (date 1662914732907)
@@ -0,0 +1,159 @@
+cmake_minimum_required(VERSION 3.10)
+project(openvswitch C)
+find_package(PkgConfig)
+
+set(CMAKE_C_COMPILER "gcc")
+set(CMAKE_CXX_COMPILER "g++")
+
+set(PACKAGE_VERSION "2.13.6")
+set(PACKAGE_STRING "${PROJECT_NAME} ${PACKAGE_VERSION}")
+set(LT_CURRENT 0)
+set(LT_REVISION 0)
+set(LT_AGE 0)
+
+if (WITH_DPDK)
+ message(STATUS "enable dpdk")
+ pkg_search_module(DPDK REQUIRED libdpdk)
+ include_directories(${DPDK_INCLUDE_DIRS})
+ set(DPDK_NETDEV 1)
+ add_definitions(-DDPDK_NETDEV=1)
+ # message(STATUS "${DPDK_INCLUDE_DIRS}")
+endif ()
+if (ENABLE_SSL)
+ message(STATUS "enable ssl")
+ pkg_search_module(OPENSSL REQUIRED openssl)
+ include_directories(${OPENSSL_INCLUDE_DIRS})
+ set(HAVE_OPENSSL 1)
+endif ()
+
+
+include_directories(include)
+include_directories(build/include)
+include_directories(include/sparse)
+include_directories(include/openvswitch)
+include_directories(include/openflow)
+include_directories(include/linux)
+include_directories(include/linux/netfilter)
+include_directories(include/linux/tc_act)
+include_directories(lib)
+include_directories(.)
+include_directories(datapath/linux/compat/include)
+include_directories(datapath/linux/compat)
+
+#set(custom_depends )
+
+function(ovs_cus_command)
+ set(oneValueArgs NAME OUTPUT WORKING_DIRECTORY)
+ set(multiValueArgs COMMENT COMMAND)
+ cmake_parse_arguments(OVS_CUS_COMMAND "${options}" "${oneValueArgs}"
+ "${multiValueArgs}" ${ARGN})
+
+# message(STATUS "unparse ${OVS_CUS_COMMAND_UNPARSED_ARGUMENTS}" )
+# message(STATUS "no value ${OVS_CUS_COMMAND_KEYWORDS_MISSING_VALUES}" )
+ if(NOT DEFINED OVS_CUS_COMMAND_NAME)
+ message(FATAL_ERROR "OVS_CUS_COMMAND: Missing NAME argument")
+ endif()
+# message(STATUS "custom command ${OVS_CUS_COMMAND_NAME}")
+ add_custom_command(
+ OUTPUT ${OVS_CUS_COMMAND_OUTPUT}
+ COMMAND ${OVS_CUS_COMMAND_COMMAND}
+ COMMENT "${OVS_CUS_COMMAND_COMMENT}"
+ WORKING_DIRECTORY ${OVS_CUS_COMMAND_WORKING_DIRECTORY}
+ )
+ add_custom_target(${OVS_CUS_COMMAND_NAME} ALL
+ DEPENDS ${OUTPUT})
+ message(STATUS "custom command ${OVS_CUS_COMMAND_NAME}")
+
+ set(custom_depends ${custom_depends} ${OVS_CUS_COMMAND_NAME} PARENT_SCOPE)
+endfunction()
+
+
+
+include(lib/CMakeLists.txt)
+include(ofproto/CMakeLists.txt)
+include(utilities/CMakeLists.txt)
+include(tests/CMakeLists.txt)
+include(include/CMakeLists.txt)
+include(vswitchd/CMakeLists.txt)
+include(ovsdb/CMakeLists.txt)
+
+configure_file(config.h.in ${CMAKE_SOURCE_DIR}/config.h @ONLY)
+configure_file(include/openvswitch/version.h.in ${CMAKE_SOURCE_DIR}/include/openvswitch/version.h @ONLY)
+add_compile_options(
+ -Wall
+ -Wextra
+ -Wno-sign-compare
+ -Wpointer-arith
+ -Wformat
+ -Wformat-security
+ -Wswitch-enum
+ -Wunused-parameter
+ -Wbad-function-cast
+ -Wcast-align
+ -Wstrict-prototypes
+ -Wold-style-definition
+ -Wmissing-prototypes
+ -Wmissing-field-initializers
+ # -Wthread-safety
+ -fno-strict-aliasing
+ -Wswitch-bool
+ -Wlogical-not-parentheses
+ -Wsizeof-array-argument
+ -Wbool-compare
+ -Wshift-negative-value
+ -Wduplicated-cond
+ # -Qunused-arguments
+ -Wshadow
+ -Wmultistatement-macros
+ -Wcast-align=strict
+ -Wno-unused-parameter
+ # -Wno-null-pointer-arithmetic
+ # -Warray-bounds-pointer-arithmetic
+)
+add_definitions(-D__CHECKER__)
+#aux_source_directory(lib LIBSRC)
+#aux_source_directory(datapath DATAPATH)
+#aux_source_directory(vswitchd VSWITCHD)
+#aux_source_directory(ofproto OFPROTO)
+#aux_source_directory(vtep VTEP)
+#aux_source_directory(ovsdb OVSDB_SRC)
+
+#add_library(libopenvswitch SHARED
+# ${LIBSRC}
+# ${DATAPATH}
+# ${OFPROTO}
+# )
+
+add_library(openvswitch ${LIB_OPENVSWITCH_SRC})
+#MESSAGE(STATUS ${custom_depends})
+add_dependencies(openvswitch ${custom_depends})
+
+
+if (OPENSSL_FOUND)
+ target_link_libraries(openvswitch ${OPENSSL_LIBRARIES})
+endif ()
+
+add_executable(ovs-vswitchd ${OVS_VSWITCHD_SRC})
+add_library(libovsdb ${LIBOVSDB_SRC})
+add_executable(ovsdb-server ${OVSDB_SEVER_SRC})
+add_executable(ovsdb-client ${OVSDB_CLIENT_SRC})
+add_executable(ovs-appctl ${OVS_APPCTL_SRC})
+add_executable(ovs-dpctl ${OVS_DPCTL_SRC})
+add_executable(ovs-ofctl ${OVS_OFCTL_SRC})
+add_executable(ovs-vsctl ${OVS_VSCTL_SRC})
+
+target_link_libraries(ovsdb-server libovsdb)
+target_link_libraries(ovsdb-client libovsdb)
+target_link_libraries(ovs-vsctl libovsdb)
+
+target_link_libraries(ovsdb-server openvswitch)
+target_link_libraries(ovs-vswitchd openvswitch)
+
+
+#add_executable(ovs-appctl utilities/ovs-appctl.c)
+#add_executable(ovs-vsctl utilities/ovs-vsctl.c)
+#add_executable(ovs-dpctl utilities/ovs-dpctl.c)
+
+#target_link_libraries(ovs-appctl libopenvswitch)
+#target_link_libraries(ovs-vsctl libopenvswitch)
+#target_link_libraries(ovs-dpctl libopenvswitch)
Index: utilities/CMakeLists.txt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/utilities/CMakeLists.txt b/utilities/CMakeLists.txt
new file mode 100644
--- /dev/null (date 1662901579593)
+++ b/utilities/CMakeLists.txt (date 1662901579593)
@@ -0,0 +1,19 @@
+
+set(OVS_APPCTL_SRC
+ utilities/ovs-appctl.c
+ )
+set(OVS_TESTCONTROLLER_SRC
+ utilities/ovs-testcontroller.c
+ )
+set(OVS_DPCTL_SRC
+ utilities/ovs-dpctl.c
+ )
+set(OVS_OFCTL_SRC
+ utilities/ovs-ofctl.c
+ )
+set(OVS_VSCTL_SRC
+ utilities/ovs-vsctl.c
+ )
+if (UNIX)
+ set(NLMON_SRC utilities/nlmon.c)
+endif ()
\ No newline at end of file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment