From 9cb84cf65e16d55a8652259159ae4785eabc925a Mon Sep 17 00:00:00 2001 From: Aldrin Piri Date: Thu, 5 May 2016 17:32:57 -0400 Subject: [PATCH 1/9] MINIFI-34 Establishing CMake build system to provide build functionality equivalent to pre-existing Makefile. --- .gitignore | 7 ++ CMakeLists.txt | 74 ++++++++++++ Makefile | 109 ------------------ README.md | 90 ++++++++++++--- {inc => include}/spdlog/async_logger.h | 2 +- {inc => include}/spdlog/common.h | 0 .../spdlog/details/async_log_helper.h | 0 .../spdlog/details/async_logger_impl.h | 0 {inc => include}/spdlog/details/file_helper.h | 0 {inc => include}/spdlog/details/format.cc | 0 {inc => include}/spdlog/details/format.h | 0 {inc => include}/spdlog/details/line_logger.h | 0 {inc => include}/spdlog/details/log_msg.h | 0 {inc => include}/spdlog/details/logger_impl.h | 0 .../spdlog/details/mpmc_bounded_q.h | 0 {inc => include}/spdlog/details/null_mutex.h | 0 {inc => include}/spdlog/details/os.h | 0 .../spdlog/details/pattern_formatter_impl.h | 0 {inc => include}/spdlog/details/registry.h | 0 {inc => include}/spdlog/details/spdlog_impl.h | 0 {inc => include}/spdlog/formatter.h | 0 {inc => include}/spdlog/logger.h | 2 +- {inc => include}/spdlog/sinks/base_sink.h | 0 {inc => include}/spdlog/sinks/file_sinks.h | 0 {inc => include}/spdlog/sinks/null_sink.h | 0 {inc => include}/spdlog/sinks/ostream_sink.h | 0 {inc => include}/spdlog/sinks/sink.h | 0 {inc => include}/spdlog/sinks/stdout_sinks.h | 2 +- {inc => include}/spdlog/sinks/syslog_sink.h | 0 {inc => include}/spdlog/spdlog.h | 0 {inc => include}/spdlog/tweakme.h | 0 libminifi/CMakeLists.txt | 51 ++++++++ {inc => libminifi/include}/Configure.h | 0 {inc => libminifi/include}/Connection.h | 0 {inc => libminifi/include}/Exception.h | 0 .../include}/FlowControlProtocol.h | 0 {inc => libminifi/include}/FlowController.h | 0 {inc => libminifi/include}/FlowFileRecord.h | 0 {inc => libminifi/include}/GenerateFlowFile.h | 0 {inc => libminifi/include}/GetFile.h | 0 {inc => libminifi/include}/ListenSyslog.h | 0 {inc => libminifi/include}/LogAttribute.h | 0 {inc => libminifi/include}/Logger.h | 0 {inc => libminifi/include}/ProcessContext.h | 0 {inc => libminifi/include}/ProcessGroup.h | 0 {inc => libminifi/include}/ProcessSession.h | 0 {inc => libminifi/include}/Processor.h | 0 {inc => libminifi/include}/Property.h | 0 .../include}/RealTimeDataCollector.h | 0 {inc => libminifi/include}/Relationship.h | 0 .../include}/RemoteProcessorGroupPort.h | 0 {inc => libminifi/include}/ResourceClaim.h | 0 {inc => libminifi/include}/SchedulingAgent.h | 0 .../include}/Site2SiteClientProtocol.h | 0 {inc => libminifi/include}/Site2SitePeer.h | 0 {inc => libminifi/include}/TailFile.h | 0 {inc => libminifi/include}/TimeUtil.h | 0 .../include}/TimerDrivenSchedulingAgent.h | 0 {src => libminifi/src}/Configure.cpp | 0 {src => libminifi/src}/Connection.cpp | 0 .../src}/FlowControlProtocol.cpp | 0 {src => libminifi/src}/FlowController.cpp | 0 {src => libminifi/src}/FlowFileRecord.cpp | 0 {src => libminifi/src}/GenerateFlowFile.cpp | 0 {src => libminifi/src}/GetFile.cpp | 0 {src => libminifi/src}/ListenSyslog.cpp | 0 {src => libminifi/src}/LogAttribute.cpp | 0 {src => libminifi/src}/Logger.cpp | 0 {src => libminifi/src}/ProcessGroup.cpp | 0 {src => libminifi/src}/ProcessSession.cpp | 0 {src => libminifi/src}/Processor.cpp | 0 .../src}/RealTimeDataCollector.cpp | 0 .../src}/RemoteProcessorGroupPort.cpp | 0 {src => libminifi/src}/ResourceClaim.cpp | 0 {src => libminifi/src}/SchedulingAgent.cpp | 0 .../src}/Site2SiteClientProtocol.cpp | 0 {src => libminifi/src}/Site2SitePeer.cpp | 0 {src => libminifi/src}/TailFile.cpp | 0 .../src}/TimerDrivenSchedulingAgent.cpp | 0 .../test}/FlowFileRecordTest.cpp | 0 {test => libminifi/test}/Server.cpp | 0 main/CMakeLists.txt | 44 +++++++ thirdparty/yaml-cpp-yaml-cpp-0.5.3/Makefile | 40 ------- 83 files changed, 250 insertions(+), 171 deletions(-) create mode 100644 CMakeLists.txt delete mode 100644 Makefile rename {inc => include}/spdlog/async_logger.h (99%) rename {inc => include}/spdlog/common.h (100%) rename {inc => include}/spdlog/details/async_log_helper.h (100%) rename {inc => include}/spdlog/details/async_logger_impl.h (100%) rename {inc => include}/spdlog/details/file_helper.h (100%) rename {inc => include}/spdlog/details/format.cc (100%) rename {inc => include}/spdlog/details/format.h (100%) rename {inc => include}/spdlog/details/line_logger.h (100%) rename {inc => include}/spdlog/details/log_msg.h (100%) rename {inc => include}/spdlog/details/logger_impl.h (100%) rename {inc => include}/spdlog/details/mpmc_bounded_q.h (100%) rename {inc => include}/spdlog/details/null_mutex.h (100%) rename {inc => include}/spdlog/details/os.h (100%) rename {inc => include}/spdlog/details/pattern_formatter_impl.h (100%) rename {inc => include}/spdlog/details/registry.h (100%) rename {inc => include}/spdlog/details/spdlog_impl.h (100%) rename {inc => include}/spdlog/formatter.h (100%) rename {inc => include}/spdlog/logger.h (99%) rename {inc => include}/spdlog/sinks/base_sink.h (100%) rename {inc => include}/spdlog/sinks/file_sinks.h (100%) rename {inc => include}/spdlog/sinks/null_sink.h (100%) rename {inc => include}/spdlog/sinks/ostream_sink.h (100%) rename {inc => include}/spdlog/sinks/sink.h (100%) rename {inc => include}/spdlog/sinks/stdout_sinks.h (98%) rename {inc => include}/spdlog/sinks/syslog_sink.h (100%) rename {inc => include}/spdlog/spdlog.h (100%) rename {inc => include}/spdlog/tweakme.h (100%) create mode 100644 libminifi/CMakeLists.txt rename {inc => libminifi/include}/Configure.h (100%) rename {inc => libminifi/include}/Connection.h (100%) rename {inc => libminifi/include}/Exception.h (100%) rename {inc => libminifi/include}/FlowControlProtocol.h (100%) rename {inc => libminifi/include}/FlowController.h (100%) rename {inc => libminifi/include}/FlowFileRecord.h (100%) rename {inc => libminifi/include}/GenerateFlowFile.h (100%) rename {inc => libminifi/include}/GetFile.h (100%) rename {inc => libminifi/include}/ListenSyslog.h (100%) rename {inc => libminifi/include}/LogAttribute.h (100%) rename {inc => libminifi/include}/Logger.h (100%) rename {inc => libminifi/include}/ProcessContext.h (100%) rename {inc => libminifi/include}/ProcessGroup.h (100%) rename {inc => libminifi/include}/ProcessSession.h (100%) rename {inc => libminifi/include}/Processor.h (100%) rename {inc => libminifi/include}/Property.h (100%) rename {inc => libminifi/include}/RealTimeDataCollector.h (100%) rename {inc => libminifi/include}/Relationship.h (100%) rename {inc => libminifi/include}/RemoteProcessorGroupPort.h (100%) rename {inc => libminifi/include}/ResourceClaim.h (100%) rename {inc => libminifi/include}/SchedulingAgent.h (100%) rename {inc => libminifi/include}/Site2SiteClientProtocol.h (100%) rename {inc => libminifi/include}/Site2SitePeer.h (100%) rename {inc => libminifi/include}/TailFile.h (100%) rename {inc => libminifi/include}/TimeUtil.h (100%) rename {inc => libminifi/include}/TimerDrivenSchedulingAgent.h (100%) rename {src => libminifi/src}/Configure.cpp (100%) rename {src => libminifi/src}/Connection.cpp (100%) rename {src => libminifi/src}/FlowControlProtocol.cpp (100%) rename {src => libminifi/src}/FlowController.cpp (100%) rename {src => libminifi/src}/FlowFileRecord.cpp (100%) rename {src => libminifi/src}/GenerateFlowFile.cpp (100%) rename {src => libminifi/src}/GetFile.cpp (100%) rename {src => libminifi/src}/ListenSyslog.cpp (100%) rename {src => libminifi/src}/LogAttribute.cpp (100%) rename {src => libminifi/src}/Logger.cpp (100%) rename {src => libminifi/src}/ProcessGroup.cpp (100%) rename {src => libminifi/src}/ProcessSession.cpp (100%) rename {src => libminifi/src}/Processor.cpp (100%) rename {src => libminifi/src}/RealTimeDataCollector.cpp (100%) rename {src => libminifi/src}/RemoteProcessorGroupPort.cpp (100%) rename {src => libminifi/src}/ResourceClaim.cpp (100%) rename {src => libminifi/src}/SchedulingAgent.cpp (100%) rename {src => libminifi/src}/Site2SiteClientProtocol.cpp (100%) rename {src => libminifi/src}/Site2SitePeer.cpp (100%) rename {src => libminifi/src}/TailFile.cpp (100%) rename {src => libminifi/src}/TimerDrivenSchedulingAgent.cpp (100%) rename {test => libminifi/test}/FlowFileRecordTest.cpp (100%) rename {test => libminifi/test}/Server.cpp (100%) create mode 100644 main/CMakeLists.txt delete mode 100644 thirdparty/yaml-cpp-yaml-cpp-0.5.3/Makefile diff --git a/.gitignore b/.gitignore index 9d78a7ff2b..69c2234b75 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,10 @@ # Filter out generated files from the included libuuid thirdparty/uuid/tst_uuid* assemblies +CMakeCache.txt +CMakeFiles +CMakeScripts +Makefile +cmake_install.cmake +install_manifest.txt +CTestTestfile.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000000..1cc95c296e --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,74 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +cmake_minimum_required(VERSION 2.6) + +set(PROJECT "nifi-minifi-cpp") +set(VERSION "0.1.0") + +#### Establish Project Configuration #### +# Enable usage of the VERSION specifier +# https://cmake.org/cmake/help/v3.0/policy/CMP0048.html#policy:CMP0048 +cmake_policy(SET CMP0048 NEW) + +project(${PROJECT} + VERSION ${VERSION}) + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +# Provide custom modules for the project +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") + +#file(GLOB SOURCES "libminifi/src/*.cpp") +add_subdirectory(thirdparty/yaml-cpp-yaml-cpp-0.5.3) +add_subdirectory(libminifi) +add_subdirectory(main) + +# Generate source assembly +set(ASSEMBLY_BASE_NAME "${CMAKE_PROJECT_NAME}-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}") +set(CPACK_SOURCE_GENERATOR "TGZ") +set(CPACK_SOURCE_PACKAGE_FILE_NAME "${ASSEMBLY_BASE_NAME}-source") +set(CPACK_SOURCE_IGNORE_FILES "/build/;/.bzr/;~$;${CPACK_SOURCE_IGNORE_FILES}") + +# Generate binary assembly +install(FILES conf/minifi.properties + DESTINATION conf + COMPONENT bin) + +install(PROGRAMS bin/minifi.sh + DESTINATION bin + COMPONENT bin) + +install(FILES LICENSE README.md NOTICE + DESTINATION . + COMPONENT bin) + +set(CPACK_GENERATOR "TGZ") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Apache NiFi MiNiFi C++ version ${VERSION}") +set(CPACK_PACKAGE_VENDOR "Apache NiFi") +set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md") +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") +set(CPACK_PACKAGE_FILE_NAME "${ASSEMBLY_BASE_NAME}") +set(CPACK_BINARY_TGZ, "ON") + +set(CPACK_ARCHIVE_COMPONENT_INSTALL ON) +set(CPACK_COMPONENTS_ALL bin) + +include(CPack) diff --git a/Makefile b/Makefile deleted file mode 100644 index 0b03842c28..0000000000 --- a/Makefile +++ /dev/null @@ -1,109 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License - - -# for ARM make CROSS_COMPILE=arm-linux-gnueabi ARCH=arm -VERSION=0.1.0 -CC=$(CROSS_COMPILE)-g++ -AR=$(CROSS_COMPILE)-ar -BUILD_DIR= ./build -TARGET_DIR=./target -ASSEMBLIES_DIR = ./assemblies -TARGET_LIB=libminifi.a -PROJECT=minifi -TARGET_EXE=$(PROJECT) -CFLAGS=-Os -fexceptions -fpermissive -Wno-write-strings -std=c++11 -fPIC -Wall -g -Wno-unused-private-field -INCLUDES=-I./inc -I./src -I./test -I./thirdparty -I/usr/include/libxml2 -I./thirdparty/yaml-cpp-yaml-cpp-0.5.3/include -LDDIRECTORY=-L./build -L./thirdparty/uuid -L./thirdparty/yaml-cpp-yaml-cpp-0.5.3/lib/ -LDFLAGS=-lminifi -lxml2 -pthread -luuid -lyaml-cpp - -UNAME_S := $(shell uname -s) -ifeq ($(UNAME_S),Linux) - LDFLAGS += -lrt -endif -ifeq ($(UNAME_S),Darwin) -endif - -OBJS:=$(shell /bin/ls src/*.cpp | xargs -n1 basename 2>/dev/null | awk '/\.cpp$$/{a=$$0; gsub("\\.cpp$$",".o", a); print "$(BUILD_DIR)/" a}') -TESTS:=Server - -all: thirdparty/yaml-cpp-yaml-cpp-0.5.3/lib/libyaml-cpp.a directory $(BUILD_DIR)/$(TARGET_LIB) minifi tests assembly-pkgs - -thirdparty/yaml-cpp-yaml-cpp-0.5.3/lib/libyaml-cpp.a: - make -C thirdparty/yaml-cpp-yaml-cpp-0.5.3 - - -.PHONY: directory -directory: - mkdir -p $(BUILD_DIR) - mkdir -p $(TARGET_DIR) - make -C thirdparty/uuid - -$(BUILD_DIR)/%.o: src/%.cpp - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -$(BUILD_DIR)/$(TARGET_LIB): $(OBJS) - $(AR) crs $@ $(OBJS) - -minifi: $(BUILD_DIR)/$(TARGET_LIB) thirdparty/yaml-cpp-yaml-cpp-0.5.3/lib/libyaml-cpp.a - $(CC) $(CFLAGS) $(INCLUDES) -o $(BUILD_DIR)/$(TARGET_EXE) main/MiNiFiMain.cpp $(LDDIRECTORY) $(LDFLAGS) - cp $(BUILD_DIR)/$(TARGET_EXE) $(TARGET_DIR)/$(TARGET_EXE) - cp $(BUILD_DIR)/$(TARGET_EXE) bin/$(TARGET_EXE) - -.PHONY: tests -tests: $(BUILD_DIR)/$(TARGET_LIB) thirdparty/yaml-cpp-yaml-cpp-0.5.3/lib/libyaml-cpp.a - $(foreach TEST_NAME, $(TESTS),\ - $(CC) $(CFLAGS) $(INCLUDES) -o $(BUILD_DIR)/$(TEST_NAME) test/$(TEST_NAME).cpp $(LDDIRECTORY) $(LDFLAGS)) - -$(ASSEMBLIES_DIR) : - mkdir -p $(ASSEMBLIES_DIR) - -.PHONY: assembly-pkgs -assembly-pkgs: $(ASSEMBLIES_DIR)/$(PROJECT)-$(VERSION)-bin.tar.gz $(ASSEMBLIES_DIR)/$(PROJECT)-$(VERSION)-source.tar.gz - -$(ASSEMBLIES_DIR)/$(PROJECT)-$(VERSION)-source.tar.gz : $(ASSEMBLIES_DIR) - mkdir -p $(ASSEMBLIES_DIR)/$(PROJECT)-$(VERSION)-source - cp -r LICENSE \ - NOTICE \ - README.md \ - inc \ - src \ - main \ - bin \ - conf \ - thirdparty \ - Makefile \ - $(ASSEMBLIES_DIR)/$(PROJECT)-$(VERSION)-source - tar -czf $(ASSEMBLIES_DIR)/$(PROJECT)-$(VERSION)-source.tar.gz -C $(ASSEMBLIES_DIR) $(PROJECT)-$(VERSION)-source - -$(ASSEMBLIES_DIR)/$(PROJECT)-$(VERSION)-bin.tar.gz : $(ASSEMBLIES_DIR) $(TARGET_EXE) - mkdir -p $(ASSEMBLIES_DIR)/$(PROJECT)-$(VERSION)-bin - cp -R LICENSE \ - NOTICE \ - README.md \ - conf \ - bin \ - $(ASSEMBLIES_DIR)/$(PROJECT)-$(VERSION)-bin - cp target/minifi $(ASSEMBLIES_DIR)/$(PROJECT)-$(VERSION)-bin/bin/ - tar -czf $(ASSEMBLIES_DIR)/$(PROJECT)-$(VERSION)-bin.tar.gz -C $(ASSEMBLIES_DIR) $(PROJECT)-$(VERSION)-bin - -.PHONY: clean -clean: - rm -rf $(BUILD_DIR) - rm -rf $(TARGET_DIR) - rm -rf $(ASSEMBLIES_DIR) - make -C thirdparty/yaml-cpp-yaml-cpp-0.5.3 clean - make -C thirdparty/uuid clean diff --git a/README.md b/README.md index 4b0b743174..fd2b01263b 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,8 @@ Perspectives of the role of MiNiFi should be from the perspective of the agent a ### To build #### Utilities -* Make +* CMake + * 2.8 or greater * gcc * 4.8.4 or greater * g++ @@ -77,33 +78,84 @@ Perspectives of the role of MiNiFi should be from the perspective of the agent a ## Getting Started ### Building -From your source checkout, perform `make` in the root of the directory where the Makefile is located. For parallel building, the '-j' or '--jobs' option maybe used. On an average development machine, a serial build takes approximately 90 seconds. +- From your source checkout, create a directory to perform the build (e.g. build) and cd into that directory. + + + # ~/Development/code/apache/nifi-minifi-cpp on git:master + $ mkdir build + # ~/Development/code/apache/nifi-minifi-cpp on git:master + $ cd build + + +- Perform a `cmake ..` to generate the project files + + + # ~/Development/code/apache/nifi-minifi-cpp on git:master + $ cmake .. + ... + -- Configuring done + -- Generating done + -- Build files have been written to: /Users/apiri/Development/code/apache/nifi-minifi-cpp/build + + +- Perform a build + # ~/Development/code/apache/nifi-minifi-cpp on git:master $ make - make -C thirdparty/yaml-cpp-yaml-cpp-0.5.3 - mkdir -p ./build - g++ -Os -I./include -c -o build/parse.o src/parse.cpp - mkdir -p ./build - g++ -Os -I./include -c -o build/parser.o src/parser.cpp - mkdir -p ./build - g++ -Os -I./include -c -o build/regex_yaml.o src/regex_yaml.cpp + Scanning dependencies of target gmock_main + Scanning dependencies of target gmock + Scanning dependencies of target minifi + Scanning dependencies of target gtest + Scanning dependencies of target yaml-cpp + [ 1%] Building CXX object thirdparty/yaml-cpp-yaml-cpp-0.5.3/test/gmock-1.7.0/gtest/CMakeFiles/gtest.dir/src/gtest-all.cc.o + [ 3%] Building CXX object thirdparty/yaml-cpp-yaml-cpp-0.5.3/test/gmock-1.7.0/CMakeFiles/gmock.dir/gtest/src/gtest-all.cc.o + [ 3%] Building CXX object thirdparty/yaml-cpp-yaml-cpp-0.5.3/test/gmock-1.7.0/CMakeFiles/gmock.dir/src/gmock-all.cc.o + [ 6%] Building CXX object thirdparty/yaml-cpp-yaml-cpp-0.5.3/test/gmock-1.7.0/CMakeFiles/gmock_main.dir/gtest/src/gtest-all.cc.o + [ 6%] Building CXX object thirdparty/yaml-cpp-yaml-cpp-0.5.3/test/gmock-1.7.0/CMakeFiles/gmock_main.dir/src/gmock-all.cc.o + [ 7%] Building CXX object libminifi/CMakeFiles/minifi.dir/src/Configure.cpp.o + ... + [ 97%] Linking CXX executable minifi + [ 97%] Built target minifiexe + [ 98%] Building CXX object thirdparty/yaml-cpp-yaml-cpp-0.5.3/test/CMakeFiles/run-tests.dir/node/node_test.cpp.o + [100%] Linking CXX executable run-tests + [100%] Built target run-tests + + + +- Create a binary assembly located in your build directory with suffix -bin.tar.gz + + + ~/Development/code/apache/nifi-minifi-cpp/build + $ make package + Run CPack packaging tool for source... + CPack: Create package using TGZ + CPack: Install projects + CPack: - Install directory: ~/Development/code/apache/nifi-minifi-cpp + CPack: Create package + CPack: - package: ~/Development/code/apache/nifi-minifi-cpp/build/nifi-minifi-cpp-0.1.0-bin.tar.gz generated. + + +- Create a source assembly located in your build directory with suffix -source.tar.gz + + + ~/Development/code/apache/nifi-minifi-cpp/build + $ make package_source + Run CPack packaging tool for source... + CPack: Create package using TGZ + CPack: Install projects + CPack: - Install directory: ~/Development/code/apache/nifi-minifi-cpp + CPack: Create package + CPack: - package: ~/Development/code/apache/nifi-minifi-cpp/build/nifi-minifi-cpp-0.1.0-source.tar.gz generated. + ### Cleaning -Generated files and artifacts can be removed by performing a `make clean`. +Remove the build directory created above. # ~/Development/code/apache/nifi-minifi-cpp on git:master - $ make clean - rm -rf ./build - rm -rf ./target - rm -rf ./assemblies - make -C thirdparty/yaml-cpp-yaml-cpp-0.5.3 clean - rm -rf ./lib ./build - make -C thirdparty/uuid clean - rm -f *.o libuuid.a - find ./ -iname "*.o" -exec rm -f {} \; + $ rm -rf ./build ### Configuring The 'conf' directory in the root contains a template flow.yml document. diff --git a/inc/spdlog/async_logger.h b/include/spdlog/async_logger.h similarity index 99% rename from inc/spdlog/async_logger.h rename to include/spdlog/async_logger.h index 517ce92ff5..6f079215f2 100644 --- a/inc/spdlog/async_logger.h +++ b/include/spdlog/async_logger.h @@ -87,4 +87,4 @@ class async_logger :public logger } -#include "./details/async_logger_impl.h" +#include "details/async_logger_impl.h" diff --git a/inc/spdlog/common.h b/include/spdlog/common.h similarity index 100% rename from inc/spdlog/common.h rename to include/spdlog/common.h diff --git a/inc/spdlog/details/async_log_helper.h b/include/spdlog/details/async_log_helper.h similarity index 100% rename from inc/spdlog/details/async_log_helper.h rename to include/spdlog/details/async_log_helper.h diff --git a/inc/spdlog/details/async_logger_impl.h b/include/spdlog/details/async_logger_impl.h similarity index 100% rename from inc/spdlog/details/async_logger_impl.h rename to include/spdlog/details/async_logger_impl.h diff --git a/inc/spdlog/details/file_helper.h b/include/spdlog/details/file_helper.h similarity index 100% rename from inc/spdlog/details/file_helper.h rename to include/spdlog/details/file_helper.h diff --git a/inc/spdlog/details/format.cc b/include/spdlog/details/format.cc similarity index 100% rename from inc/spdlog/details/format.cc rename to include/spdlog/details/format.cc diff --git a/inc/spdlog/details/format.h b/include/spdlog/details/format.h similarity index 100% rename from inc/spdlog/details/format.h rename to include/spdlog/details/format.h diff --git a/inc/spdlog/details/line_logger.h b/include/spdlog/details/line_logger.h similarity index 100% rename from inc/spdlog/details/line_logger.h rename to include/spdlog/details/line_logger.h diff --git a/inc/spdlog/details/log_msg.h b/include/spdlog/details/log_msg.h similarity index 100% rename from inc/spdlog/details/log_msg.h rename to include/spdlog/details/log_msg.h diff --git a/inc/spdlog/details/logger_impl.h b/include/spdlog/details/logger_impl.h similarity index 100% rename from inc/spdlog/details/logger_impl.h rename to include/spdlog/details/logger_impl.h diff --git a/inc/spdlog/details/mpmc_bounded_q.h b/include/spdlog/details/mpmc_bounded_q.h similarity index 100% rename from inc/spdlog/details/mpmc_bounded_q.h rename to include/spdlog/details/mpmc_bounded_q.h diff --git a/inc/spdlog/details/null_mutex.h b/include/spdlog/details/null_mutex.h similarity index 100% rename from inc/spdlog/details/null_mutex.h rename to include/spdlog/details/null_mutex.h diff --git a/inc/spdlog/details/os.h b/include/spdlog/details/os.h similarity index 100% rename from inc/spdlog/details/os.h rename to include/spdlog/details/os.h diff --git a/inc/spdlog/details/pattern_formatter_impl.h b/include/spdlog/details/pattern_formatter_impl.h similarity index 100% rename from inc/spdlog/details/pattern_formatter_impl.h rename to include/spdlog/details/pattern_formatter_impl.h diff --git a/inc/spdlog/details/registry.h b/include/spdlog/details/registry.h similarity index 100% rename from inc/spdlog/details/registry.h rename to include/spdlog/details/registry.h diff --git a/inc/spdlog/details/spdlog_impl.h b/include/spdlog/details/spdlog_impl.h similarity index 100% rename from inc/spdlog/details/spdlog_impl.h rename to include/spdlog/details/spdlog_impl.h diff --git a/inc/spdlog/formatter.h b/include/spdlog/formatter.h similarity index 100% rename from inc/spdlog/formatter.h rename to include/spdlog/formatter.h diff --git a/inc/spdlog/logger.h b/include/spdlog/logger.h similarity index 99% rename from inc/spdlog/logger.h rename to include/spdlog/logger.h index 7a5a31a74e..7aefcc7711 100644 --- a/inc/spdlog/logger.h +++ b/include/spdlog/logger.h @@ -129,4 +129,4 @@ class logger }; } -#include "./details/logger_impl.h" +#include "details/logger_impl.h" diff --git a/inc/spdlog/sinks/base_sink.h b/include/spdlog/sinks/base_sink.h similarity index 100% rename from inc/spdlog/sinks/base_sink.h rename to include/spdlog/sinks/base_sink.h diff --git a/inc/spdlog/sinks/file_sinks.h b/include/spdlog/sinks/file_sinks.h similarity index 100% rename from inc/spdlog/sinks/file_sinks.h rename to include/spdlog/sinks/file_sinks.h diff --git a/inc/spdlog/sinks/null_sink.h b/include/spdlog/sinks/null_sink.h similarity index 100% rename from inc/spdlog/sinks/null_sink.h rename to include/spdlog/sinks/null_sink.h diff --git a/inc/spdlog/sinks/ostream_sink.h b/include/spdlog/sinks/ostream_sink.h similarity index 100% rename from inc/spdlog/sinks/ostream_sink.h rename to include/spdlog/sinks/ostream_sink.h diff --git a/inc/spdlog/sinks/sink.h b/include/spdlog/sinks/sink.h similarity index 100% rename from inc/spdlog/sinks/sink.h rename to include/spdlog/sinks/sink.h diff --git a/inc/spdlog/sinks/stdout_sinks.h b/include/spdlog/sinks/stdout_sinks.h similarity index 98% rename from inc/spdlog/sinks/stdout_sinks.h rename to include/spdlog/sinks/stdout_sinks.h index 5ad06c29bf..4ca16acf56 100644 --- a/inc/spdlog/sinks/stdout_sinks.h +++ b/include/spdlog/sinks/stdout_sinks.h @@ -27,7 +27,7 @@ #include #include #include "./ostream_sink.h" -#include "../details/null_mutex.h" +#include "spdlog/details/null_mutex.h" namespace spdlog { diff --git a/inc/spdlog/sinks/syslog_sink.h b/include/spdlog/sinks/syslog_sink.h similarity index 100% rename from inc/spdlog/sinks/syslog_sink.h rename to include/spdlog/sinks/syslog_sink.h diff --git a/inc/spdlog/spdlog.h b/include/spdlog/spdlog.h similarity index 100% rename from inc/spdlog/spdlog.h rename to include/spdlog/spdlog.h diff --git a/inc/spdlog/tweakme.h b/include/spdlog/tweakme.h similarity index 100% rename from inc/spdlog/tweakme.h rename to include/spdlog/tweakme.h diff --git a/libminifi/CMakeLists.txt b/libminifi/CMakeLists.txt new file mode 100644 index 0000000000..571b73d746 --- /dev/null +++ b/libminifi/CMakeLists.txt @@ -0,0 +1,51 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless qrequired by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +cmake_minimum_required (VERSION 2.6) + +set(PROJECT "apache-nifi-minifi-cpp") +set(VERSION "0.1.0") + +#### Establish Project Configuration #### +# Enable usage of the VERSION specifier +# https://cmake.org/cmake/help/v3.0/policy/CMP0048.html#policy:CMP0048 +cmake_policy(SET CMP0048 NEW) + +project(${PROJECT} + VERSION ${VERSION}) + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +include_directories(../include) +include_directories(include) + +file(GLOB SOURCES "src/*.cpp") + +add_library(spdlog INTERFACE) +add_library(minifi STATIC ${SOURCES}) + +# Include libxml2 +find_package (LibXml2) +if (LIBXML2_FOUND) + include_directories(${LIBXML2_INCLUDE_DIR}) + target_link_libraries (minifi ${LIBXML2_LIBRARIES}) +else () + # Build from our local version +endif (LIBXML2_FOUND) \ No newline at end of file diff --git a/inc/Configure.h b/libminifi/include/Configure.h similarity index 100% rename from inc/Configure.h rename to libminifi/include/Configure.h diff --git a/inc/Connection.h b/libminifi/include/Connection.h similarity index 100% rename from inc/Connection.h rename to libminifi/include/Connection.h diff --git a/inc/Exception.h b/libminifi/include/Exception.h similarity index 100% rename from inc/Exception.h rename to libminifi/include/Exception.h diff --git a/inc/FlowControlProtocol.h b/libminifi/include/FlowControlProtocol.h similarity index 100% rename from inc/FlowControlProtocol.h rename to libminifi/include/FlowControlProtocol.h diff --git a/inc/FlowController.h b/libminifi/include/FlowController.h similarity index 100% rename from inc/FlowController.h rename to libminifi/include/FlowController.h diff --git a/inc/FlowFileRecord.h b/libminifi/include/FlowFileRecord.h similarity index 100% rename from inc/FlowFileRecord.h rename to libminifi/include/FlowFileRecord.h diff --git a/inc/GenerateFlowFile.h b/libminifi/include/GenerateFlowFile.h similarity index 100% rename from inc/GenerateFlowFile.h rename to libminifi/include/GenerateFlowFile.h diff --git a/inc/GetFile.h b/libminifi/include/GetFile.h similarity index 100% rename from inc/GetFile.h rename to libminifi/include/GetFile.h diff --git a/inc/ListenSyslog.h b/libminifi/include/ListenSyslog.h similarity index 100% rename from inc/ListenSyslog.h rename to libminifi/include/ListenSyslog.h diff --git a/inc/LogAttribute.h b/libminifi/include/LogAttribute.h similarity index 100% rename from inc/LogAttribute.h rename to libminifi/include/LogAttribute.h diff --git a/inc/Logger.h b/libminifi/include/Logger.h similarity index 100% rename from inc/Logger.h rename to libminifi/include/Logger.h diff --git a/inc/ProcessContext.h b/libminifi/include/ProcessContext.h similarity index 100% rename from inc/ProcessContext.h rename to libminifi/include/ProcessContext.h diff --git a/inc/ProcessGroup.h b/libminifi/include/ProcessGroup.h similarity index 100% rename from inc/ProcessGroup.h rename to libminifi/include/ProcessGroup.h diff --git a/inc/ProcessSession.h b/libminifi/include/ProcessSession.h similarity index 100% rename from inc/ProcessSession.h rename to libminifi/include/ProcessSession.h diff --git a/inc/Processor.h b/libminifi/include/Processor.h similarity index 100% rename from inc/Processor.h rename to libminifi/include/Processor.h diff --git a/inc/Property.h b/libminifi/include/Property.h similarity index 100% rename from inc/Property.h rename to libminifi/include/Property.h diff --git a/inc/RealTimeDataCollector.h b/libminifi/include/RealTimeDataCollector.h similarity index 100% rename from inc/RealTimeDataCollector.h rename to libminifi/include/RealTimeDataCollector.h diff --git a/inc/Relationship.h b/libminifi/include/Relationship.h similarity index 100% rename from inc/Relationship.h rename to libminifi/include/Relationship.h diff --git a/inc/RemoteProcessorGroupPort.h b/libminifi/include/RemoteProcessorGroupPort.h similarity index 100% rename from inc/RemoteProcessorGroupPort.h rename to libminifi/include/RemoteProcessorGroupPort.h diff --git a/inc/ResourceClaim.h b/libminifi/include/ResourceClaim.h similarity index 100% rename from inc/ResourceClaim.h rename to libminifi/include/ResourceClaim.h diff --git a/inc/SchedulingAgent.h b/libminifi/include/SchedulingAgent.h similarity index 100% rename from inc/SchedulingAgent.h rename to libminifi/include/SchedulingAgent.h diff --git a/inc/Site2SiteClientProtocol.h b/libminifi/include/Site2SiteClientProtocol.h similarity index 100% rename from inc/Site2SiteClientProtocol.h rename to libminifi/include/Site2SiteClientProtocol.h diff --git a/inc/Site2SitePeer.h b/libminifi/include/Site2SitePeer.h similarity index 100% rename from inc/Site2SitePeer.h rename to libminifi/include/Site2SitePeer.h diff --git a/inc/TailFile.h b/libminifi/include/TailFile.h similarity index 100% rename from inc/TailFile.h rename to libminifi/include/TailFile.h diff --git a/inc/TimeUtil.h b/libminifi/include/TimeUtil.h similarity index 100% rename from inc/TimeUtil.h rename to libminifi/include/TimeUtil.h diff --git a/inc/TimerDrivenSchedulingAgent.h b/libminifi/include/TimerDrivenSchedulingAgent.h similarity index 100% rename from inc/TimerDrivenSchedulingAgent.h rename to libminifi/include/TimerDrivenSchedulingAgent.h diff --git a/src/Configure.cpp b/libminifi/src/Configure.cpp similarity index 100% rename from src/Configure.cpp rename to libminifi/src/Configure.cpp diff --git a/src/Connection.cpp b/libminifi/src/Connection.cpp similarity index 100% rename from src/Connection.cpp rename to libminifi/src/Connection.cpp diff --git a/src/FlowControlProtocol.cpp b/libminifi/src/FlowControlProtocol.cpp similarity index 100% rename from src/FlowControlProtocol.cpp rename to libminifi/src/FlowControlProtocol.cpp diff --git a/src/FlowController.cpp b/libminifi/src/FlowController.cpp similarity index 100% rename from src/FlowController.cpp rename to libminifi/src/FlowController.cpp diff --git a/src/FlowFileRecord.cpp b/libminifi/src/FlowFileRecord.cpp similarity index 100% rename from src/FlowFileRecord.cpp rename to libminifi/src/FlowFileRecord.cpp diff --git a/src/GenerateFlowFile.cpp b/libminifi/src/GenerateFlowFile.cpp similarity index 100% rename from src/GenerateFlowFile.cpp rename to libminifi/src/GenerateFlowFile.cpp diff --git a/src/GetFile.cpp b/libminifi/src/GetFile.cpp similarity index 100% rename from src/GetFile.cpp rename to libminifi/src/GetFile.cpp diff --git a/src/ListenSyslog.cpp b/libminifi/src/ListenSyslog.cpp similarity index 100% rename from src/ListenSyslog.cpp rename to libminifi/src/ListenSyslog.cpp diff --git a/src/LogAttribute.cpp b/libminifi/src/LogAttribute.cpp similarity index 100% rename from src/LogAttribute.cpp rename to libminifi/src/LogAttribute.cpp diff --git a/src/Logger.cpp b/libminifi/src/Logger.cpp similarity index 100% rename from src/Logger.cpp rename to libminifi/src/Logger.cpp diff --git a/src/ProcessGroup.cpp b/libminifi/src/ProcessGroup.cpp similarity index 100% rename from src/ProcessGroup.cpp rename to libminifi/src/ProcessGroup.cpp diff --git a/src/ProcessSession.cpp b/libminifi/src/ProcessSession.cpp similarity index 100% rename from src/ProcessSession.cpp rename to libminifi/src/ProcessSession.cpp diff --git a/src/Processor.cpp b/libminifi/src/Processor.cpp similarity index 100% rename from src/Processor.cpp rename to libminifi/src/Processor.cpp diff --git a/src/RealTimeDataCollector.cpp b/libminifi/src/RealTimeDataCollector.cpp similarity index 100% rename from src/RealTimeDataCollector.cpp rename to libminifi/src/RealTimeDataCollector.cpp diff --git a/src/RemoteProcessorGroupPort.cpp b/libminifi/src/RemoteProcessorGroupPort.cpp similarity index 100% rename from src/RemoteProcessorGroupPort.cpp rename to libminifi/src/RemoteProcessorGroupPort.cpp diff --git a/src/ResourceClaim.cpp b/libminifi/src/ResourceClaim.cpp similarity index 100% rename from src/ResourceClaim.cpp rename to libminifi/src/ResourceClaim.cpp diff --git a/src/SchedulingAgent.cpp b/libminifi/src/SchedulingAgent.cpp similarity index 100% rename from src/SchedulingAgent.cpp rename to libminifi/src/SchedulingAgent.cpp diff --git a/src/Site2SiteClientProtocol.cpp b/libminifi/src/Site2SiteClientProtocol.cpp similarity index 100% rename from src/Site2SiteClientProtocol.cpp rename to libminifi/src/Site2SiteClientProtocol.cpp diff --git a/src/Site2SitePeer.cpp b/libminifi/src/Site2SitePeer.cpp similarity index 100% rename from src/Site2SitePeer.cpp rename to libminifi/src/Site2SitePeer.cpp diff --git a/src/TailFile.cpp b/libminifi/src/TailFile.cpp similarity index 100% rename from src/TailFile.cpp rename to libminifi/src/TailFile.cpp diff --git a/src/TimerDrivenSchedulingAgent.cpp b/libminifi/src/TimerDrivenSchedulingAgent.cpp similarity index 100% rename from src/TimerDrivenSchedulingAgent.cpp rename to libminifi/src/TimerDrivenSchedulingAgent.cpp diff --git a/test/FlowFileRecordTest.cpp b/libminifi/test/FlowFileRecordTest.cpp similarity index 100% rename from test/FlowFileRecordTest.cpp rename to libminifi/test/FlowFileRecordTest.cpp diff --git a/test/Server.cpp b/libminifi/test/Server.cpp similarity index 100% rename from test/Server.cpp rename to libminifi/test/Server.cpp diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt new file mode 100644 index 0000000000..2f470a523f --- /dev/null +++ b/main/CMakeLists.txt @@ -0,0 +1,44 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +cmake_minimum_required(VERSION 2.6) + +cmake_policy(SET CMP0048 NEW) + +include_directories(../include ../libminifi/include ../thirdparty/yaml-cpp-yaml-cpp-0.5.3/include) + +# Include libxml2 +find_package(LibXml2) +if (LIBXML2_FOUND) + include_directories(${LIBXML2_INCLUDE_DIR}) +else () + # Build from our local version +endif (LIBXML2_FOUND) + +add_executable(minifiexe MiNiFiMain.cpp) + +# Link against minifi and yaml-cpp +target_link_libraries(minifiexe minifi yaml-cpp) +set_target_properties(minifiexe + PROPERTIES OUTPUT_NAME minifi) + +install(TARGETS minifiexe + RUNTIME + DESTINATION bin + COMPONENT bin) diff --git a/thirdparty/yaml-cpp-yaml-cpp-0.5.3/Makefile b/thirdparty/yaml-cpp-yaml-cpp-0.5.3/Makefile deleted file mode 100644 index f23f477959..0000000000 --- a/thirdparty/yaml-cpp-yaml-cpp-0.5.3/Makefile +++ /dev/null @@ -1,40 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License - -CFLAGS = -Wall -INCLUDES = -I./include - -CPP_FILES := $(wildcard src/*.cpp) -OBJ_FILES := $(addprefix build/,$(notdir $(CPP_FILES:.cpp=.o))) - -all: lib/libyaml-cpp.a - -lib: - mkdir -p ./lib - -build: - mkdir -p ./build - -lib/libyaml-cpp.a: $(OBJ_FILES) - mkdir -p ./lib - ar crs $@ $^ - -build/%.o: src/%.cpp - mkdir -p ./build - g++ -Os $(INCLUDES) $(CC_FLAGS) -c -o $@ $< - -clean: - rm -rf ./lib ./build From 253c7c42ba94f11720f276b024630af4765bbf44 Mon Sep 17 00:00:00 2001 From: Aldrin Piri Date: Thu, 6 Oct 2016 10:52:34 -0400 Subject: [PATCH 2/9] Updating .travis.yml to support CMake build system. --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b9c9d20983..864e520362 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,7 +20,9 @@ script: # Establish updated toolchain as default - sudo unlink /usr/bin/gcc && sudo ln -s /usr/bin/gcc-4.8 /usr/bin/gcc - sudo unlink /usr/bin/g++ && sudo ln -s /usr/bin/g++-4.8 /usr/bin/g++ - - make + - mkdir build + - cd build && cmake .. + - make -C build addons: apt: From 2251ecce3833d3ac134d7004bee1e07f67f9cbdd Mon Sep 17 00:00:00 2001 From: Aldrin Piri Date: Thu, 6 Oct 2016 16:41:34 -0400 Subject: [PATCH 3/9] Adjusting travis build. --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 864e520362..eb2baa5f1c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,9 +20,7 @@ script: # Establish updated toolchain as default - sudo unlink /usr/bin/gcc && sudo ln -s /usr/bin/gcc-4.8 /usr/bin/gcc - sudo unlink /usr/bin/g++ && sudo ln -s /usr/bin/g++-4.8 /usr/bin/g++ - - mkdir build - - cd build && cmake .. - - make -C build + - mkdir ./build && cd ./build && cmake .. && make addons: apt: From e519b16e6524a7e6dc734a1b995612307ef1c4f7 Mon Sep 17 00:00:00 2001 From: Andre F de Miranda Date: Fri, 7 Oct 2016 15:40:20 +1100 Subject: [PATCH 4/9] MINIFI-34 - Adjust CMake files to complete under travis --- CMakeLists.txt | 17 +++++++++++------ libminifi/CMakeLists.txt | 18 +++++++++++------- main/CMakeLists.txt | 4 +++- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1cc95c296e..705795752e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,20 +19,25 @@ cmake_minimum_required(VERSION 2.6) -set(PROJECT "nifi-minifi-cpp") -set(VERSION "0.1.0") +project(nifi-minifi-cpp) +set(PROJECT_NAME "nifi-minifi-cpp") +set(PROJECT_VERSION_MAJOR 0) +set(PROJECT_VERSION_MINOR 1) +set(PROJECT_VERSION_PATCH 0) #### Establish Project Configuration #### # Enable usage of the VERSION specifier # https://cmake.org/cmake/help/v3.0/policy/CMP0048.html#policy:CMP0048 -cmake_policy(SET CMP0048 NEW) - -project(${PROJECT} - VERSION ${VERSION}) +IF(POLICY CMP0048) + CMAKE_POLICY(SET CMP0048 OLD) +ENDIF(POLICY CMP0048) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) +# Search for threads +find_package(Threads REQUIRED) + # Provide custom modules for the project list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") diff --git a/libminifi/CMakeLists.txt b/libminifi/CMakeLists.txt index 571b73d746..a870f46fa3 100644 --- a/libminifi/CMakeLists.txt +++ b/libminifi/CMakeLists.txt @@ -19,16 +19,19 @@ cmake_minimum_required (VERSION 2.6) -set(PROJECT "apache-nifi-minifi-cpp") -set(VERSION "0.1.0") +project(nifi-libminifi) +set(PROJECT_NAME "nifi-libminifi") +set(PROJECT_VERSION_MAJOR 0) +set(PROJECT_VERSION_MINOR 1) +set(PROJECT_VERSION_PATCH 0) + #### Establish Project Configuration #### # Enable usage of the VERSION specifier # https://cmake.org/cmake/help/v3.0/policy/CMP0048.html#policy:CMP0048 -cmake_policy(SET CMP0048 NEW) - -project(${PROJECT} - VERSION ${VERSION}) +IF(POLICY CMP0048) + CMAKE_POLICY(SET CMP0048 OLD) +ENDIF(POLICY CMP0048) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -38,6 +41,7 @@ include_directories(include) file(GLOB SOURCES "src/*.cpp") +# @apiri - need to check this out add_library(spdlog INTERFACE) add_library(minifi STATIC ${SOURCES}) @@ -48,4 +52,4 @@ if (LIBXML2_FOUND) target_link_libraries (minifi ${LIBXML2_LIBRARIES}) else () # Build from our local version -endif (LIBXML2_FOUND) \ No newline at end of file +endif (LIBXML2_FOUND) diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index 2f470a523f..1707a89ece 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -19,7 +19,9 @@ cmake_minimum_required(VERSION 2.6) -cmake_policy(SET CMP0048 NEW) +IF(POLICY CMP0048) + CMAKE_POLICY(SET CMP0048 OLD) +ENDIF(POLICY CMP0048) include_directories(../include ../libminifi/include ../thirdparty/yaml-cpp-yaml-cpp-0.5.3/include) From 70edc3d49acee29814f964f4c3bf0dff3a10dad0 Mon Sep 17 00:00:00 2001 From: Andre F de Miranda Date: Fri, 7 Oct 2016 17:16:56 +1100 Subject: [PATCH 5/9] MINIFI-34 - prepare to the use of docker by moving travis build to Trusty Tahr (14.04) --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index eb2baa5f1c..1de076ba54 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,8 @@ # limitations under the License. sudo: required +dist: trusty + language: cpp script: From d07b99ec289f595328e5bdcfb972def615b287ac Mon Sep 17 00:00:00 2001 From: Andre F de Miranda Date: Fri, 7 Oct 2016 18:36:14 +1100 Subject: [PATCH 6/9] MINIFI-34 - Add uuid-dev dependency --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 1de076ba54..9eb124c3e4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,4 +33,5 @@ addons: - gcc-4.8 - g++-4.8 - libboost1.55-all-dev + - uuid-dev - libxml2-dev From bd408d31bfebb3bf141deae00d4578a589c10517 Mon Sep 17 00:00:00 2001 From: Andre F de Miranda Date: Fri, 7 Oct 2016 19:16:38 +1100 Subject: [PATCH 7/9] MINI-34 - Move commit ExecuteProcess to the CMake based file structure --- {inc => libminifi/include}/ExecuteProcess.h | 0 {src => libminifi/src}/ExecuteProcess.cpp | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename {inc => libminifi/include}/ExecuteProcess.h (100%) rename {src => libminifi/src}/ExecuteProcess.cpp (100%) diff --git a/inc/ExecuteProcess.h b/libminifi/include/ExecuteProcess.h similarity index 100% rename from inc/ExecuteProcess.h rename to libminifi/include/ExecuteProcess.h diff --git a/src/ExecuteProcess.cpp b/libminifi/src/ExecuteProcess.cpp similarity index 100% rename from src/ExecuteProcess.cpp rename to libminifi/src/ExecuteProcess.cpp From d597af999a9b8ba53c083fc55467e62d5cb1f4f0 Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 7 Oct 2016 23:30:01 +1100 Subject: [PATCH 8/9] MINIFI-34 - Further progress CMake envionment * Add missing include directories * Add dummy.cpp --- CMakeLists.txt | 11 +++++++++++ include/spdlog/dummy.cpp | 22 ++++++++++++++++++++++ libminifi/CMakeLists.txt | 8 +++++++- main/CMakeLists.txt | 2 +- 4 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 include/spdlog/dummy.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 705795752e..082e994879 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,17 @@ IF(POLICY CMP0048) CMAKE_POLICY(SET CMP0048 OLD) ENDIF(POLICY CMP0048) +include(CheckCXXCompilerFlag) +CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) +CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) +if(COMPILER_SUPPORTS_CXX11) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") +elseif(COMPILER_SUPPORTS_CXX0X) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") +else() + message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") +endif() + set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) diff --git a/include/spdlog/dummy.cpp b/include/spdlog/dummy.cpp new file mode 100644 index 0000000000..6b2d4ab6d7 --- /dev/null +++ b/include/spdlog/dummy.cpp @@ -0,0 +1,22 @@ +/** + * @file dummy.cpp + * MiNiFiMain implementation + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Dummy CPP file to work around Cmake limitation on header only libraries + diff --git a/libminifi/CMakeLists.txt b/libminifi/CMakeLists.txt index a870f46fa3..71fc523c68 100644 --- a/libminifi/CMakeLists.txt +++ b/libminifi/CMakeLists.txt @@ -37,12 +37,18 @@ set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) include_directories(../include) +include_directories(../thirdparty) +include_directories(../thirdparty/yaml-cpp-yaml-cpp-0.5.3/include) include_directories(include) file(GLOB SOURCES "src/*.cpp") +file(GLOB SPD_SOURCES "../include/spdlog/*") # @apiri - need to check this out -add_library(spdlog INTERFACE) + +# Workaround the limitations of having a +# header only library +add_library(spdlog STATIC ${SPD_SOURCES}) add_library(minifi STATIC ${SOURCES}) # Include libxml2 diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index 1707a89ece..28acbb159b 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -23,7 +23,7 @@ IF(POLICY CMP0048) CMAKE_POLICY(SET CMP0048 OLD) ENDIF(POLICY CMP0048) -include_directories(../include ../libminifi/include ../thirdparty/yaml-cpp-yaml-cpp-0.5.3/include) +include_directories(../include ../libminifi/include ../thirdparty/yaml-cpp-yaml-cpp-0.5.3/include ../thirdparty) # Include libxml2 find_package(LibXml2) From 8f579556116b66853ad4e1a760a1fe52f34da29e Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 8 Oct 2016 10:02:17 +1100 Subject: [PATCH 9/9] MINIFI-34 - CMake uses system libuuid instead of thrid parties --- .travis.yml | 4 ++-- libminifi/CMakeLists.txt | 1 - main/CMakeLists.txt | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9eb124c3e4..3866739be8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,10 +28,10 @@ addons: apt: sources: - ubuntu-toolchain-r-test - - boost-latest +# - boost-latest packages: - gcc-4.8 - g++-4.8 - - libboost1.55-all-dev + - libboost-all-dev - uuid-dev - libxml2-dev diff --git a/libminifi/CMakeLists.txt b/libminifi/CMakeLists.txt index 71fc523c68..118e6f806e 100644 --- a/libminifi/CMakeLists.txt +++ b/libminifi/CMakeLists.txt @@ -37,7 +37,6 @@ set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) include_directories(../include) -include_directories(../thirdparty) include_directories(../thirdparty/yaml-cpp-yaml-cpp-0.5.3/include) include_directories(include) diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index 28acbb159b..e740955bf1 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -35,8 +35,8 @@ endif (LIBXML2_FOUND) add_executable(minifiexe MiNiFiMain.cpp) -# Link against minifi and yaml-cpp -target_link_libraries(minifiexe minifi yaml-cpp) +# Link against minifi, yaml-cpp and uuid +target_link_libraries(minifiexe minifi yaml-cpp uuid) set_target_properties(minifiexe PROPERTIES OUTPUT_NAME minifi)