Thank you so much for your timely reply!
I added some printing msg to the cmake file in ns3gym as below, and the cmake output is also attached. It seems libs can be found but somehow the head files are not found on macOS/homebrew. Do you have any hint to address this issue? Note that cmake works well on ubuntu with exactly the same codes.
Thanks again
include(FindPkgConfig)
if(NOT PKG_CONFIG_FOUND)
message(STATUS "pkgconf not found")
return()
endif()
pkg_check_modules(ZMQ libzmq)
if(NOT ZMQ_FOUND)
message(STATUS "zeromq not found")
return()
endif()
# Print ZeroMQ include directories
message(STATUS "ZeroMQ Include Paths:")
foreach(include_dir ${ZMQ_INCLUDE_DIRS})
message(STATUS " - ${include_dir}")
endforeach()
# Print ZeroMQ library directories
message(STATUS "ZeroMQ Library Paths:")
foreach(lib_dir ${ZMQ_LIBRARY_DIRS})
message(STATUS " - ${lib_dir}")
endforeach()
# Optionally, print the libraries to link against
message(STATUS "ZeroMQ Libraries:")
foreach(lib ${ZMQ_LIBRARIES})
message(STATUS " - ${lib}")
endforeach()
find_package(Protobuf 3.0.0)
if(NOT Protobuf_FOUND)
message(STATUS "protobuf not found")
return()
endif()
# Print Protobuf include directories
message(STATUS "Protobuf Include Directories:")
foreach(include_dir ${Protobuf_INCLUDE_DIRS})
message(STATUS " - ${include_dir}")
endforeach()
# Print Protobuf library directories
message(STATUS "Protobuf Library Directories:")
foreach(lib_dir ${Protobuf_LIBRARY_DIRS})
message(STATUS " - ${lib_dir}")
endforeach()
# Print Protobuf libraries to link against
message(STATUS "Protobuf Libraries:")
foreach(lib ${Protobuf_LIBRARIES})
message(STATUS " - ${lib}")
endforeach()
set(proto_source_files
model/messages.proto
)
# generate proto file for C++
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${proto_source_files})
file(RELATIVE_PATH PROTO_HDRS_REL ${CMAKE_CURRENT_SOURCE_DIR} ${PROTO_HDRS})
# generate proto file for Python
FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/model PROTOMODEL_PATH)
FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/model/ns3gym/ns3gym PROTOBINDING_PATH)
FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/${proto_source_files} proto_source_file_native)
EXECUTE_PROCESS(COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} --proto_path=${PROTOMODEL_PATH} --python_out=${PROTOBINDING_PATH}
${proto_source_file_native} RESULT_VARIABLE rv)
IF(${rv})
MESSAGE("Generation of ns3gym Protobuf Python messages failed. Source file: ${proto_native}")
ENDIF()
set(source_files
helper/opengym-helper.cc
model/container.cc
model/opengym_env.cc
model/opengym_interface.cc
model/spaces.cc
${PROTO_SRCS}
)
set(header_files
helper/opengym-helper.h
model/container.h
model/opengym_env.h
model/opengym_interface.h
model/spaces.h
${PROTO_HDRS_REL}
)
build_lib(
LIBNAME opengym
SOURCE_FILES ${source_files}
HEADER_FILES ${header_files}
LIBRARIES_TO_LINK
${libcore}
${ZMQ_LIBRARIES}
${Protobuf_LIBRARIES}
TEST_SOURCES
test/opengym-test-suite.cc
)
# add location of generated messages.pb.h to include directories
target_include_directories(
${libopengym-obj}
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
)
***************************
****CMAKE OUTPUT******
***************************
-- CCache is enabled. Precompiled headers are disabled by default.
-- Using default output directory /Users/charles_gu/Documents/GitHub/sparse-wi-fi/ns-3-dev/build
-- Proceeding without cmake-format
-- find_external_library: SQLite3 was found.
-- Harfbuzz is required by GTK3 and was not found.
-- LibXML2 was found.
-- Lib RT is not supported on Mac OS X. Continuing without it.
-- Visualizer requires Python bindings
CMake Warning (dev) at build-support/macros-and-definitions.cmake:884 (find_package):
Policy CMP0167 is not set: The FindBoost module is removed. Run "cmake
--help-policy CMP0167" for policy details. Use the cmake_policy command to
set the policy and suppress this warning.
Call Stack (most recent call first):
CMakeLists.txt:125 (process_options)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Could NOT find Boost (missing: Boost_INCLUDE_DIR)
-- GSL was not found. Continuing without it.
-- docs: doxygen documentation not enabled due to missing dependencies: doxygen;dot;dia
-- Failed to locate sphinx-build executable (missing: SPHINX_EXECUTABLE)
-- docs: sphinx documentation not enabled due to missing dependencies: Sphinx;epstopdf;pdflatex;latexmk;convert;dvipng
-- Platform doesn't support TAP and EMU features. Continuing without them.
-- Processing contrib/opengym
-- ZeroMQ Include Paths:
-- - /opt/homebrew/Cellar/zeromq/4.3.5_1/include
-- - /opt/homebrew/Cellar/libsodium/1.0.20/include
-- ZeroMQ Library Paths:
-- - /opt/homebrew/Cellar/zeromq/4.3.5_1/lib
-- ZeroMQ Libraries:
-- - zmq
-- Protobuf Include Directories:
-- - /opt/homebrew/include
-- Protobuf Library Directories:
-- Protobuf Libraries:
-- - /opt/homebrew/lib/libprotobuf.dylib
Build profile : debug
-- Configuring done (0.5s)
-- Generating done (0.2s)
-- Build files have been written to: /Users/charles_gu/Documents/GitHub/sparse-wi-fi/ns-3-dev/build
Finished executing the following commands:
cd build; /opt/homebrew/bin/cmake .. ; cd ..