summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Seigo <aseigo@kde.org>2014-11-30 13:51:21 +0100
committerAaron Seigo <aseigo@kde.org>2014-11-30 13:51:21 +0100
commitb49cead47537d8d1d2c78cb4596bb828fd94b347 (patch)
tree1bb531f7d856269bb734c5a5eeeea473b375fe64
parent97b79eeb86eedee57630b8d29f6eeab08ccb02b0 (diff)
downloadsink-b49cead47537d8d1d2c78cb4596bb828fd94b347.tar.gz
sink-b49cead47537d8d1d2c78cb4596bb828fd94b347.zip
create a common lib, autogen the buffer classes there dynamically
simplifies the generate_buffers function a bit. only missing part now: get the binaries to rebuild when the buffer class is updated. apparently this doesn't cause the common library to rebuild and so the client and resource binaries don't know they need to rebuild automatically. but at least the _generated.h files are now dynamically created. huzzah for that.
-rw-r--r--CMakeLists.txt10
-rw-r--r--client/CMakeLists.txt5
-rw-r--r--common/CMakeLists.txt10
-rw-r--r--common/commands/CMakeLists.txt1
-rw-r--r--resource/CMakeLists.txt4
5 files changed, 19 insertions, 11 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 91c4568..09c6a1e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,10 +20,14 @@ include(ECMPackageConfigHelpers)
20 20
21find_package(Qt5Core REQUIRED) 21find_package(Qt5Core REQUIRED)
22find_package(FlatBuffers REQUIRED) 22find_package(FlatBuffers REQUIRED)
23function(generate_flatbuffers dest) 23function(generate_flatbuffers)
24 # TODO: move the file from ${fbs}_generated.h to just ${fbs}?
25 foreach(fbs ${ARGN}) 24 foreach(fbs ${ARGN})
26 execute_process(COMMAND ${FLATBUFFERS_FLATC_EXECUTABLE} -c -b --gen-includes -o ${dest} ${CMAKE_CURRENT_SOURCE_DIR}/${fbs}) 25 message("making ${CMAKE_CURRENT_BINARY_DIR}/${fbs}_generated.h from ${CMAKE_CURRENT_SOURCE_DIR}/${fbs}.fbs")
26 add_custom_command(
27 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${fbs}_generated.h
28 COMMAND ${FLATBUFFERS_FLATC_EXECUTABLE} -c -b --gen-includes -o ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${fbs}.fbs
29 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${fbs}.fbs
30 )
27 endforeach(fbs) 31 endforeach(fbs)
28endfunction(generate_flatbuffers) 32endfunction(generate_flatbuffers)
29 33
diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt
index 186e3fe..859f707 100644
--- a/client/CMakeLists.txt
+++ b/client/CMakeLists.txt
@@ -2,13 +2,12 @@ project(toynadi_client)
2 2
3include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) 3include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
4 4
5set(common_path "../common/")
6
7set(toynadiclient_SRCS 5set(toynadiclient_SRCS
8 ${common_path}/console.cpp
9 main.cpp 6 main.cpp
10 resourceaccess.cpp 7 resourceaccess.cpp
11) 8)
9
12add_executable(${PROJECT_NAME} ${toynadiclient_SRCS}) 10add_executable(${PROJECT_NAME} ${toynadiclient_SRCS})
11target_link_libraries(${PROJECT_NAME} toynadicommon)
13qt5_use_modules(${PROJECT_NAME} Widgets Network) 12qt5_use_modules(${PROJECT_NAME} Widgets Network)
14install(TARGETS ${PROJECT_NAME} DESTINATION bin) 13install(TARGETS ${PROJECT_NAME} DESTINATION bin)
diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt
index 2ceacf8..32e10f6 100644
--- a/common/CMakeLists.txt
+++ b/common/CMakeLists.txt
@@ -1 +1,9 @@
1add_subdirectory(commands) 1project(toynadicommon)
2generate_flatbuffers(commands/handshake)
3
4set(command_SRCS
5 console.cpp
6 ${CMAKE_CURRENT_BINARY_DIR}/commands/handshake_generated.h)
7
8add_library(${PROJECT_NAME} ${command_SRCS})
9qt5_use_modules(${PROJECT_NAME} Widgets)
diff --git a/common/commands/CMakeLists.txt b/common/commands/CMakeLists.txt
deleted file mode 100644
index 2a9ba64..0000000
--- a/common/commands/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
1generate_flatbuffers(${CMAKE_CURRENT_BINARY_DIR} handshake.fbs)
diff --git a/resource/CMakeLists.txt b/resource/CMakeLists.txt
index 3de51b5..d74c705 100644
--- a/resource/CMakeLists.txt
+++ b/resource/CMakeLists.txt
@@ -2,14 +2,12 @@ project(toynadi_resource)
2 2
3include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) 3include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
4 4
5set(common_path "../common/")
6
7set(toynadiresource_SRCS 5set(toynadiresource_SRCS
8 ${common_path}/console.cpp
9 main.cpp 6 main.cpp
10 listener.cpp 7 listener.cpp
11) 8)
12 9
13add_executable(${PROJECT_NAME} ${toynadiresource_SRCS}) 10add_executable(${PROJECT_NAME} ${toynadiresource_SRCS})
11target_link_libraries(${PROJECT_NAME} toynadicommon)
14qt5_use_modules(${PROJECT_NAME} Widgets Network) 12qt5_use_modules(${PROJECT_NAME} Widgets Network)
15install(TARGETS ${PROJECT_NAME} DESTINATION bin) 13install(TARGETS ${PROJECT_NAME} DESTINATION bin)