mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-14 14:32:15 -07:00
Try like this.
Took 8 minutes
This commit is contained in:
parent
e8bba94be2
commit
fdf08780b3
1 changed files with 13 additions and 7 deletions
|
|
@ -167,15 +167,22 @@ set(PROTO_FILES
|
||||||
|
|
||||||
if(${Protobuf_VERSION} VERSION_LESS "3.21.0.0")
|
if(${Protobuf_VERSION} VERSION_LESS "3.21.0.0")
|
||||||
message(STATUS "Using Protobuf Legacy Mode")
|
message(STATUS "Using Protobuf Legacy Mode")
|
||||||
include_directories(${PROTOBUF_INCLUDE_DIRS})
|
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
|
||||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/pb)
|
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/pb)
|
||||||
set(PROTO_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/pb")
|
set(PROTO_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/pb")
|
||||||
|
|
||||||
|
include_directories(${PROTOBUF_INCLUDE_DIRS})
|
||||||
|
include_directories(${PROTO_BINARY_DIR}) # pb/ folder
|
||||||
|
|
||||||
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${PROTO_FILES})
|
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${PROTO_FILES})
|
||||||
|
|
||||||
foreach (file ${PROTO_SRCS} ${PROTO_HDRS})
|
# Move files at build time using a custom command
|
||||||
get_filename_component(fname ${file} NAME)
|
foreach (f ${PROTO_SRCS} ${PROTO_HDRS})
|
||||||
file(RENAME ${file} ${CMAKE_CURRENT_BINARY_DIR}/pb/${fname})
|
get_filename_component(fname ${f} NAME)
|
||||||
|
add_custom_command(
|
||||||
|
TARGET cockatrice_protocol POST_BUILD
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy ${f} ${PROTO_BINARY_DIR}/${fname}
|
||||||
|
)
|
||||||
endforeach ()
|
endforeach ()
|
||||||
|
|
||||||
add_library(cockatrice_protocol ${PROTO_SRCS} ${PROTO_HDRS})
|
add_library(cockatrice_protocol ${PROTO_SRCS} ${PROTO_HDRS})
|
||||||
|
|
@ -184,8 +191,7 @@ if(${Protobuf_VERSION} VERSION_LESS "3.21.0.0")
|
||||||
set(cockatrice_protocol_LIBS ${cockatrice_protocol_LIBS} -lpthread)
|
set(cockatrice_protocol_LIBS ${cockatrice_protocol_LIBS} -lpthread)
|
||||||
endif(UNIX)
|
endif(UNIX)
|
||||||
target_link_libraries(cockatrice_protocol ${cockatrice_protocol_LIBS})
|
target_link_libraries(cockatrice_protocol ${cockatrice_protocol_LIBS})
|
||||||
target_include_directories(cockatrice_protocol PUBLIC "${PROTOBUF_INCLUDE_DIRS}" PUBLIC ${CMAKE_CURRENT_BINARY_DIR} PUBLIC ${PROTO_BINARY_DIR})
|
target_include_directories(cockatrice_protocol PUBLIC ${PROTO_BINARY_DIR})
|
||||||
|
|
||||||
# ubuntu uses an outdated package for protobuf, 3.1.0 is required
|
# ubuntu uses an outdated package for protobuf, 3.1.0 is required
|
||||||
if(${Protobuf_VERSION} VERSION_LESS "3.1.0")
|
if(${Protobuf_VERSION} VERSION_LESS "3.1.0")
|
||||||
# remove unused parameter and misleading indentation warnings when compiling to avoid errors
|
# remove unused parameter and misleading indentation warnings when compiling to avoid errors
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue