mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2025-12-12 23:59:34 -08:00
Overhaul common's CMakeLists.txt
* Use automoc instead of a manual list of headers * Remove Qt4 detection * Created missing .cpp for .h files (for automoc detection) * Remove pthread linking * Forcing -lprotobuf is not needed for mingw; msvc only?
This commit is contained in:
@@ -9,10 +9,12 @@ SET(common_SOURCES
|
||||
server.cpp
|
||||
server_abstractuserinterface.cpp
|
||||
server_arrow.cpp
|
||||
server_arrowtarget.h
|
||||
server_card.cpp
|
||||
server_cardzone.cpp
|
||||
server_counter.cpp
|
||||
server_game.cpp
|
||||
server_database_interface.cpp
|
||||
server_player.cpp
|
||||
server_protocolhandler.cpp
|
||||
server_remoteuserinterface.cpp
|
||||
@@ -21,34 +23,12 @@ SET(common_SOURCES
|
||||
serverinfo_user_container.cpp
|
||||
sfmt/SFMT.c
|
||||
)
|
||||
SET(common_HEADERS
|
||||
decklist.h
|
||||
rng_abstract.h
|
||||
rng_sfmt.h
|
||||
server.h
|
||||
server_arrowtarget.h
|
||||
server_card.h
|
||||
server_database_interface.h
|
||||
server_game.h
|
||||
server_player.h
|
||||
server_protocolhandler.h
|
||||
server_room.h
|
||||
)
|
||||
|
||||
FIND_PACKAGE(Qt4 REQUIRED)
|
||||
FIND_PACKAGE(Protobuf REQUIRED)
|
||||
|
||||
QT4_WRAP_CPP(common_HEADERS_MOC ${common_HEADERS})
|
||||
INCLUDE(${QT_USE_FILE})
|
||||
INCLUDE_DIRECTORIES(pb)
|
||||
INCLUDE_DIRECTORIES(sfmt)
|
||||
INCLUDE_DIRECTORIES(${PROTOBUF_INCLUDE_DIR})
|
||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
add_library(cockatrice_common ${common_SOURCES} ${common_HEADERS_MOC})
|
||||
# Without this check, Linux will put -pthread out of order in link.txt and build will fail
|
||||
if (UNIX)
|
||||
target_link_libraries(cockatrice_common cockatrice_protocol pthread)
|
||||
else (UNIX)
|
||||
add_library(cockatrice_common ${common_SOURCES} ${common_MOC_SRCS})
|
||||
target_link_libraries(cockatrice_common cockatrice_protocol)
|
||||
endif (UNIX)
|
||||
|
||||
@@ -144,14 +144,13 @@ SET(PROTO_FILES
|
||||
session_event.proto
|
||||
)
|
||||
|
||||
find_package(Protobuf REQUIRED)
|
||||
include_directories(${PROTOBUF_INCLUDE_DIRS})
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS ${PROTO_FILES})
|
||||
|
||||
add_library(cockatrice_protocol ${PROTO_SRCS} ${PROTO_HDRS})
|
||||
set(cockatrice_protocol_LIBS ${PROTOBUF_LIBRARIES})
|
||||
if (WIN32)
|
||||
if (MSVC)
|
||||
set(cockatrice_protocol_LIBS ${cockatrice_protocol_LIBS} -lprotobuf)
|
||||
endif (WIN32)
|
||||
endif (MSVC)
|
||||
target_link_libraries(cockatrice_protocol ${cockatrice_protocol_LIBS})
|
||||
|
||||
2
common/server_arrowtarget.cpp
Normal file
2
common/server_arrowtarget.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
#include "server_arrowtarget.h"
|
||||
2
common/server_database_interface.cpp
Normal file
2
common/server_database_interface.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
#include "server_database_interface.h"
|
||||
Reference in New Issue
Block a user