diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..b40e9bf --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 2.6) + +# Locate GTest +find_package(GTest REQUIRED) +set(LOCAL_INC_DIR "include") +include_directories(${GTEST_INCLUDE_DIRS} ${LOCAL_INC_DIR}) + +#set(SOURCES tests.cpp ${LOCAL_INC_DIR}/nmq.hpp) + +# Link runTests with what we want to test and the GTest and pthread library +add_executable(runTests tests.cpp) +add_executable(local_lat local_lat.cpp) +add_executable(remote_lat remote_lat.cpp) +add_executable(local_thr local_thr.cpp) +add_executable(remote_thr remote_thr.cpp) +target_link_libraries(runTests ${GTEST_LIBRARIES} pthread) diff --git a/Makefile b/Makefile deleted file mode 100644 index 4e1487b..0000000 --- a/Makefile +++ /dev/null @@ -1,327 +0,0 @@ -# CMAKE generated file: DO NOT EDIT! -# Generated by "Unix Makefiles" Generator, CMake Version 2.8 - -# Default target executed when no arguments are given to make. -default_target: all -.PHONY : default_target - -#============================================================================= -# Special targets provided by cmake. - -# Disable implicit rules so canonical targets will work. -.SUFFIXES: - -# Remove some rules from gmake that .SUFFIXES does not remove. -SUFFIXES = - -.SUFFIXES: .hpux_make_needs_suffix_list - -# Suppress display of executed commands. -$(VERBOSE).SILENT: - -# A target that is always out of date. -cmake_force: -.PHONY : cmake_force - -#============================================================================= -# Set environment variables for the build. - -# The shell in which to execute make rules. -SHELL = /bin/sh - -# The CMake executable. -CMAKE_COMMAND = /usr/bin/cmake - -# The command to remove a file. -RM = /usr/bin/cmake -E remove -f - -# Escaping for special characters. -EQUALS = = - -# The top-level source directory on which CMake was run. -CMAKE_SOURCE_DIR = /home/hyan/tmp/nanomq - -# The top-level build directory on which CMake was run. -CMAKE_BINARY_DIR = /home/hyan/tmp/nanomq - -#============================================================================= -# Targets provided globally by CMake. - -# Special rule for the target edit_cache -edit_cache: - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running interactive CMake command-line interface..." - /usr/bin/cmake -i . -.PHONY : edit_cache - -# Special rule for the target edit_cache -edit_cache/fast: edit_cache -.PHONY : edit_cache/fast - -# Special rule for the target rebuild_cache -rebuild_cache: - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..." - /usr/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) -.PHONY : rebuild_cache - -# Special rule for the target rebuild_cache -rebuild_cache/fast: rebuild_cache -.PHONY : rebuild_cache/fast - -# The main all target -all: cmake_check_build_system - $(CMAKE_COMMAND) -E cmake_progress_start /home/hyan/tmp/nanomq/CMakeFiles /home/hyan/tmp/nanomq/CMakeFiles/progress.marks - $(MAKE) -f CMakeFiles/Makefile2 all - $(CMAKE_COMMAND) -E cmake_progress_start /home/hyan/tmp/nanomq/CMakeFiles 0 -.PHONY : all - -# The main clean target -clean: - $(MAKE) -f CMakeFiles/Makefile2 clean -.PHONY : clean - -# The main clean target -clean/fast: clean -.PHONY : clean/fast - -# Prepare targets for installation. -preinstall: all - $(MAKE) -f CMakeFiles/Makefile2 preinstall -.PHONY : preinstall - -# Prepare targets for installation. -preinstall/fast: - $(MAKE) -f CMakeFiles/Makefile2 preinstall -.PHONY : preinstall/fast - -# clear depends -depend: - $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 -.PHONY : depend - -#============================================================================= -# Target rules for targets named local_lat - -# Build rule for target. -local_lat: cmake_check_build_system - $(MAKE) -f CMakeFiles/Makefile2 local_lat -.PHONY : local_lat - -# fast build rule for target. -local_lat/fast: - $(MAKE) -f CMakeFiles/local_lat.dir/build.make CMakeFiles/local_lat.dir/build -.PHONY : local_lat/fast - -#============================================================================= -# Target rules for targets named local_thr - -# Build rule for target. -local_thr: cmake_check_build_system - $(MAKE) -f CMakeFiles/Makefile2 local_thr -.PHONY : local_thr - -# fast build rule for target. -local_thr/fast: - $(MAKE) -f CMakeFiles/local_thr.dir/build.make CMakeFiles/local_thr.dir/build -.PHONY : local_thr/fast - -#============================================================================= -# Target rules for targets named remote_lat - -# Build rule for target. -remote_lat: cmake_check_build_system - $(MAKE) -f CMakeFiles/Makefile2 remote_lat -.PHONY : remote_lat - -# fast build rule for target. -remote_lat/fast: - $(MAKE) -f CMakeFiles/remote_lat.dir/build.make CMakeFiles/remote_lat.dir/build -.PHONY : remote_lat/fast - -#============================================================================= -# Target rules for targets named remote_thr - -# Build rule for target. -remote_thr: cmake_check_build_system - $(MAKE) -f CMakeFiles/Makefile2 remote_thr -.PHONY : remote_thr - -# fast build rule for target. -remote_thr/fast: - $(MAKE) -f CMakeFiles/remote_thr.dir/build.make CMakeFiles/remote_thr.dir/build -.PHONY : remote_thr/fast - -#============================================================================= -# Target rules for targets named runTests - -# Build rule for target. -runTests: cmake_check_build_system - $(MAKE) -f CMakeFiles/Makefile2 runTests -.PHONY : runTests - -# fast build rule for target. -runTests/fast: - $(MAKE) -f CMakeFiles/runTests.dir/build.make CMakeFiles/runTests.dir/build -.PHONY : runTests/fast - -local_lat.o: local_lat.cpp.o -.PHONY : local_lat.o - -# target to build an object file -local_lat.cpp.o: - $(MAKE) -f CMakeFiles/local_lat.dir/build.make CMakeFiles/local_lat.dir/local_lat.cpp.o -.PHONY : local_lat.cpp.o - -local_lat.i: local_lat.cpp.i -.PHONY : local_lat.i - -# target to preprocess a source file -local_lat.cpp.i: - $(MAKE) -f CMakeFiles/local_lat.dir/build.make CMakeFiles/local_lat.dir/local_lat.cpp.i -.PHONY : local_lat.cpp.i - -local_lat.s: local_lat.cpp.s -.PHONY : local_lat.s - -# target to generate assembly for a file -local_lat.cpp.s: - $(MAKE) -f CMakeFiles/local_lat.dir/build.make CMakeFiles/local_lat.dir/local_lat.cpp.s -.PHONY : local_lat.cpp.s - -local_thr.o: local_thr.cpp.o -.PHONY : local_thr.o - -# target to build an object file -local_thr.cpp.o: - $(MAKE) -f CMakeFiles/local_thr.dir/build.make CMakeFiles/local_thr.dir/local_thr.cpp.o -.PHONY : local_thr.cpp.o - -local_thr.i: local_thr.cpp.i -.PHONY : local_thr.i - -# target to preprocess a source file -local_thr.cpp.i: - $(MAKE) -f CMakeFiles/local_thr.dir/build.make CMakeFiles/local_thr.dir/local_thr.cpp.i -.PHONY : local_thr.cpp.i - -local_thr.s: local_thr.cpp.s -.PHONY : local_thr.s - -# target to generate assembly for a file -local_thr.cpp.s: - $(MAKE) -f CMakeFiles/local_thr.dir/build.make CMakeFiles/local_thr.dir/local_thr.cpp.s -.PHONY : local_thr.cpp.s - -remote_lat.o: remote_lat.cpp.o -.PHONY : remote_lat.o - -# target to build an object file -remote_lat.cpp.o: - $(MAKE) -f CMakeFiles/remote_lat.dir/build.make CMakeFiles/remote_lat.dir/remote_lat.cpp.o -.PHONY : remote_lat.cpp.o - -remote_lat.i: remote_lat.cpp.i -.PHONY : remote_lat.i - -# target to preprocess a source file -remote_lat.cpp.i: - $(MAKE) -f CMakeFiles/remote_lat.dir/build.make CMakeFiles/remote_lat.dir/remote_lat.cpp.i -.PHONY : remote_lat.cpp.i - -remote_lat.s: remote_lat.cpp.s -.PHONY : remote_lat.s - -# target to generate assembly for a file -remote_lat.cpp.s: - $(MAKE) -f CMakeFiles/remote_lat.dir/build.make CMakeFiles/remote_lat.dir/remote_lat.cpp.s -.PHONY : remote_lat.cpp.s - -remote_thr.o: remote_thr.cpp.o -.PHONY : remote_thr.o - -# target to build an object file -remote_thr.cpp.o: - $(MAKE) -f CMakeFiles/remote_thr.dir/build.make CMakeFiles/remote_thr.dir/remote_thr.cpp.o -.PHONY : remote_thr.cpp.o - -remote_thr.i: remote_thr.cpp.i -.PHONY : remote_thr.i - -# target to preprocess a source file -remote_thr.cpp.i: - $(MAKE) -f CMakeFiles/remote_thr.dir/build.make CMakeFiles/remote_thr.dir/remote_thr.cpp.i -.PHONY : remote_thr.cpp.i - -remote_thr.s: remote_thr.cpp.s -.PHONY : remote_thr.s - -# target to generate assembly for a file -remote_thr.cpp.s: - $(MAKE) -f CMakeFiles/remote_thr.dir/build.make CMakeFiles/remote_thr.dir/remote_thr.cpp.s -.PHONY : remote_thr.cpp.s - -tests.o: tests.cpp.o -.PHONY : tests.o - -# target to build an object file -tests.cpp.o: - $(MAKE) -f CMakeFiles/runTests.dir/build.make CMakeFiles/runTests.dir/tests.cpp.o -.PHONY : tests.cpp.o - -tests.i: tests.cpp.i -.PHONY : tests.i - -# target to preprocess a source file -tests.cpp.i: - $(MAKE) -f CMakeFiles/runTests.dir/build.make CMakeFiles/runTests.dir/tests.cpp.i -.PHONY : tests.cpp.i - -tests.s: tests.cpp.s -.PHONY : tests.s - -# target to generate assembly for a file -tests.cpp.s: - $(MAKE) -f CMakeFiles/runTests.dir/build.make CMakeFiles/runTests.dir/tests.cpp.s -.PHONY : tests.cpp.s - -# Help Target -help: - @echo "The following are some of the valid targets for this Makefile:" - @echo "... all (the default if no target is provided)" - @echo "... clean" - @echo "... depend" - @echo "... edit_cache" - @echo "... local_lat" - @echo "... local_thr" - @echo "... rebuild_cache" - @echo "... remote_lat" - @echo "... remote_thr" - @echo "... runTests" - @echo "... local_lat.o" - @echo "... local_lat.i" - @echo "... local_lat.s" - @echo "... local_thr.o" - @echo "... local_thr.i" - @echo "... local_thr.s" - @echo "... remote_lat.o" - @echo "... remote_lat.i" - @echo "... remote_lat.s" - @echo "... remote_thr.o" - @echo "... remote_thr.i" - @echo "... remote_thr.s" - @echo "... tests.o" - @echo "... tests.i" - @echo "... tests.s" -.PHONY : help - - - -#============================================================================= -# Special targets to cleanup operation of make. - -# Special rule to run CMake to check the build system integrity. -# No rule that depends on this can have commands that come from listfiles -# because they might be regenerated. -cmake_check_build_system: - $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 -.PHONY : cmake_check_build_system - diff --git a/include/nmq.hpp.gch b/include/nmq.hpp.gch new file mode 100644 index 0000000..308ab8e Binary files /dev/null and b/include/nmq.hpp.gch differ diff --git a/test.sh b/test.sh new file mode 100644 index 0000000..31abcf4 --- /dev/null +++ b/test.sh @@ -0,0 +1,13 @@ +#rm TEST + +./local_lat LAT $1 $2 & +./remote_lat LAT $1 $2 + +killall local_lat +rm LAT + +#./local_thr THR $1 $2 & +#./remote_thr THR $1 $2 +#killall local_thr +#rm THR +