summaryrefslogtreecommitdiff
path: root/librabbitmq/CMakeLists.txt
diff options
context:
space:
mode:
authorXiaoGuang Zeng <xgzeng@gmail.com>2011-03-03 15:50:06 +0800
committerXiaoGuang Zeng <xgzeng@gmail.com>2011-03-03 15:50:06 +0800
commit1336e40d43905c1934d3b4717e8f03a4c341588f (patch)
tree8a6130cec42bd6f469ff9dad5e819c8d9486c7d8 /librabbitmq/CMakeLists.txt
parent2edff50c851c1dff603b5add904d56436b1dcd4e (diff)
downloadrabbitmq-c-github-ask-1336e40d43905c1934d3b4717e8f03a4c341588f.tar.gz
add cmake build support.
librabbitmq and example/amqp_sendstring can be build under linux now.
Diffstat (limited to 'librabbitmq/CMakeLists.txt')
-rw-r--r--librabbitmq/CMakeLists.txt34
1 files changed, 34 insertions, 0 deletions
diff --git a/librabbitmq/CMakeLists.txt b/librabbitmq/CMakeLists.txt
new file mode 100644
index 0000000..9670280
--- /dev/null
+++ b/librabbitmq/CMakeLists.txt
@@ -0,0 +1,34 @@
+project(librabbitmq "C")
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+file(COPY "${AMQP_CODEGEN_DIR}/amqp_codegen.py" "codegen.py"
+ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
+)
+file(COPY "${AMQP_CODEGEN_DIR}/amqp_codegen.py"
+ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
+)
+set(CODEGEN_PY "${CMAKE_CURRENT_BINARY_DIR}/codegen.py")
+
+#generate amqp_framing.h/amqp_framing.c
+add_custom_command(
+ OUTPUT "amqp_framing.h" "amqp_framing.c"
+ COMMAND ${PYTHON_EXECUTABLE} ARGS ${CODEGEN_PY} header ${AMQP_SPEC_JSON_PATH} "amqp_framing.h"
+ COMMAND ${PYTHON_EXECUTABLE} ARGS ${CODEGEN_PY} body ${AMQP_SPEC_JSON_PATH} "amqp_framing.c"
+ DEPENDS ${AMQP_SPEC_JSON_PATH}
+ VERBATIM)
+
+#prepare config.h
+file(WRITE "config.h" "#define VERSION \"0.0.1\"")
+
+include_directories("unix")
+
+set(RABBITMQ_SOURCES
+ ${CMAKE_CURRENT_BINARY_DIR}/amqp_framing.h
+ ${CMAKE_CURRENT_BINARY_DIR}/amqp_framing.c
+ amqp_api.c amqp.h
+ amqp_connection.c amqp_mem.c amqp_private.h amqp_socket.c amqp_table.c
+ unix/socket.h unix/socket.c
+)
+
+add_library(rabbitmq ${RABBITMQ_SOURCES})