Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: INSTALL.md can now be followed to install grSim on macOS. #179

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
# it is not in the default /usr/local prefix.
list(APPEND CMAKE_PREFIX_PATH "/usr/local/opt/qt")
endif()
find_package(Qt5 COMPONENTS Core Widgets OpenGL Network REQUIRED)

Check failure on line 68 in CMakeLists.txt

View workflow job for this annotation

GitHub Actions / build-windows

By not providing "FindQt5.cmake" in CMAKE_MODULE_PATH this project has
list(APPEND libs Qt5::Core Qt5::Widgets Qt5::OpenGL Qt5::Network)

# ODE
Expand Down Expand Up @@ -106,12 +106,14 @@
list(APPEND libs ${VARTYPES_LIBRARIES})

# Protobuf
find_package(Protobuf REQUIRED)
include_directories(${PROTOBUF_INCLUDE_DIRS})
list(APPEND libs ${PROTOBUF_LIBRARIES})
find_package(protobuf CONFIG REQUIRED)
list(APPEND libs protobuf::libprotobuf)

set (Protobuf_IMPORT_DIRS ${Protobuf_INCLUDE_DIR})
protobuf_generate_cpp(PROTO_CPP PROTO_H
if(protobuf_VERBOSE)
message(STATUS "Using Protocol Buffers ${protobuf_VERSION}")
endif()

set(PROTOS
src/proto/grSim_Commands.proto
src/proto/grSim_Packet.proto
src/proto/grSim_Replacement.proto
Expand Down Expand Up @@ -189,8 +191,7 @@
# files to be compiled
set(srcs
${CONFIG_FILES}
${PROTO_CPP}
${PROTO_H}
${PROTOS}
${RESOURCES}
${HEADERS}
${SOURCES}
Expand All @@ -203,6 +204,15 @@
install(TARGETS ${app} DESTINATION bin)
target_link_libraries(${app} ${libs})

set(PROTO_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated")
file(MAKE_DIRECTORY ${PROTO_BINARY_DIR})
target_include_directories(${app} PUBLIC "$<BUILD_INTERFACE:${PROTO_BINARY_DIR}>")
protobuf_generate(
TARGET ${app}
IMPORT_DIRS "${CMAKE_CURRENT_LIST_DIR}/src/proto"
PROTOC_OUT_DIR "${PROTO_BINARY_DIR}"
)

if(APPLE AND CMAKE_MACOSX_BUNDLE)
# use CMAKE_MACOSX_BUNDLE if you want to build a mac bundle
set(MACOSX_BUNDLE_ICON_FILE "${PROJECT_SOURCE_DIR}/resources/icons/grsim.icns")
Expand Down
35 changes: 20 additions & 15 deletions clients/qt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,31 @@ set(libs)
find_package(Qt5 COMPONENTS Core Widgets Network REQUIRED)
list(APPEND libs Qt5::Core Qt5::Widgets Qt5::Network)

find_package(protobuf CONFIG REQUIRED)
list(APPEND libs protobuf::libprotobuf)

find_package(Protobuf REQUIRED)
include_directories(${PROTOBUF_INCLUDE_DIRS})
list(APPEND libs ${PROTOBUF_LIBRARIES})

protobuf_generate_cpp(PROTO_CPP PROTO_H
../../src/proto/grSim_Replacement.proto
../../src/proto/grSim_Commands.proto
../../src/proto/grSim_Packet.proto
)

set(app client)

add_executable(${app} MACOSX_BUNDLE
${PROTO_CPP}
${PROTO_H}
main.cpp
mainwindow.cpp
mainwindow.h
)
main.cpp
mainwindow.cpp
mainwindow.h
../../src/proto/grSim_Replacement.proto
../../src/proto/grSim_Commands.proto
../../src/proto/grSim_Packet.proto
)

target_link_libraries(${app} ${libs})

# Set the directory where the generated protobuf files will be placed
set(PROTO_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated")
file(MAKE_DIRECTORY ${PROTO_BINARY_DIR})
target_include_directories(${app} PUBLIC "$<BUILD_INTERFACE:${PROTO_BINARY_DIR}>")

# Generate the sources from the .proto files
protobuf_generate(
TARGET ${app}
IMPORT_DIRS "${CMAKE_CURRENT_LIST_DIR}/../../src/proto"
PROTOC_OUT_DIR "${PROTO_BINARY_DIR}"
)
Loading