Skip to content

Commit

Permalink
Adding configuration class framework
Browse files Browse the repository at this point in the history
  • Loading branch information
grf14003 committed Feb 5, 2020
1 parent 9ddca58 commit 5112b4f
Show file tree
Hide file tree
Showing 202 changed files with 28,187 additions and 45 deletions.
10 changes: 10 additions & 0 deletions breadcrumbs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ message("Executable directory: ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
message("Library directory: ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
message("Header file directory: ${INCLUSDES_DIRECTORY}")

# Including all tools
file(GLOB TOOL_INCLUDES CONFIGURE_DEPENDS "${PROJECT_SOURCE_DIR}/tools/*")

foreach(X IN LISTS TOOL_INCLUDES)
message("Including library with ${X}")
add_subdirectory(${X})
endforeach()


# Configure a header file to pass some of the CMake settings to the source code
set (Bfs_ALGORITHM_SERVER_PORT \"27634\")

Expand Down Expand Up @@ -54,4 +63,5 @@ foreach(X IN LISTS EXECS)
get_filename_component(N ${X} NAME_WE)
message(STATUS "Generating Executable: ${N}.exe Main File: ${X}"})
add_executable(${N} ${X} ${ALGOS} ${COMMS} ${CONFIG} ${LOG})
target_link_libraries(${N} tinyxml2)
endforeach()
13 changes: 13 additions & 0 deletions breadcrumbs/include/Config.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@


#ifndef CONFIG_HPP
#define CONFIG_HPP

#include "tinyxml2.h"

class Configuration
{

};

#endif
47 changes: 2 additions & 45 deletions breadcrumbs/src/config/config.cpp
Original file line number Diff line number Diff line change
@@ -1,45 +1,2 @@
/*
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <map>
#include <string>
#include <vector>
#include <sstream>
class Config {
std::string filename;
public:
std::map<std::string, std::string, std::string> attributes;
int logLevel;
};
Config createNewConfig(std::string filename) {
Config c;
std::ifstream myfile;
std::string line;
std::vector<std::string> lineArray;
myfile.open(filename);
if(myfile.is_open()) {
while(!myfile.eof()) {
getline(myfile, line);
std::istringstream iss(line);
for(std::string line; iss >> line; ) {
lineArray.push_back(line);
}
c.attributes[lineArray[1]] = lineArray[0], lineArray[2];
}
}
return c;
};
int main() {
Config c = createNewConfig("config.txt");
std::cout << c.attributes["i"];
return 0;
}
*/

#include "Config.hpp"
1 change: 1 addition & 0 deletions breadcrumbs/src/main/Breadcrumbs.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

#include <stdio.h>

#include "Config.hpp"
#include "AlgoBreadcrumbs.hpp"
#include "VirtualOutputProcessor.hpp"

Expand Down
20 changes: 20 additions & 0 deletions breadcrumbs/tools/tinyxml/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# intermediate files
Win32/
x64/
ipch/
resources/out/
tinyxml2/tinyxml2-cbp/bin/
tinyxml2/tinyxml2-cbp/obj/
tinyxml2/bin/
tinyxml2/temp/
.artifacts/
.projects/
*.sdf
*.suo
*.opensdf
*.user
*.depend
*.layout
*.o
*.vc.db
*.vc.opendb
15 changes: 15 additions & 0 deletions breadcrumbs/tools/tinyxml/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
language: cpp

os:
- linux
- osx

compiler:
- g++
- clang

before_script: cmake .

script:
- make -j3
- make test
143 changes: 143 additions & 0 deletions breadcrumbs/tools/tinyxml/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
IF(BIICODE)
ADD_BIICODE_TARGETS()
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/resources)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/resources DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
ENDIF()
RETURN()
ENDIF(BIICODE)
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
cmake_policy(VERSION 2.6)
if(POLICY CMP0063)
cmake_policy(SET CMP0063 OLD)
endif()

project(tinyxml2)
include(GNUInstallDirs)
include(CTest)
#enable_testing()

#CMAKE_BUILD_TOOL

################################
# set lib version here

set(GENERIC_LIB_VERSION "7.1.0")
set(GENERIC_LIB_SOVERSION "7")

################################
# Add definitions

################################
# Add targets
# By Default shared library is being built
# To build static libs also - Do cmake . -DBUILD_STATIC_LIBS:BOOL=ON
# User can choose not to build shared library by using cmake -DBUILD_SHARED_LIBS:BOOL=OFF
# To build only static libs use cmake . -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_STATIC_LIBS:BOOL=ON
# To build the tests, use cmake . -DBUILD_TESTS:BOOL=ON
# To disable the building of the tests, use cmake . -DBUILD_TESTS:BOOL=OFF

option(BUILD_SHARED_LIBS "build as shared library" ON)
option(BUILD_TESTS "build xmltest (deprecated: Use BUILD_TESTING)" ON)

# To allow using tinyxml in another shared library
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)

# to distinguish between debug and release lib
set(CMAKE_DEBUG_POSTFIX "d")

add_library(tinyxml2 tinyxml2.cpp tinyxml2.h)

set_target_properties(tinyxml2 PROPERTIES
COMPILE_DEFINITIONS "TINYXML2_EXPORT"
VERSION "${GENERIC_LIB_VERSION}"
SOVERSION "${GENERIC_LIB_SOVERSION}")

target_compile_definitions(tinyxml2 PUBLIC $<$<CONFIG:Debug>:TINYXML2_DEBUG>)

if(DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11")
target_include_directories(tinyxml2 PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)

if(MSVC)
target_compile_definitions(tinyxml2 PUBLIC -D_CRT_SECURE_NO_WARNINGS)
endif(MSVC)
else()
include_directories(${PROJECT_SOURCE_DIR})

if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif(MSVC)
endif()

# export targets for find_package config mode
export(TARGETS tinyxml2
FILE ${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}Targets.cmake)

install(TARGETS tinyxml2
EXPORT ${CMAKE_PROJECT_NAME}Targets
RUNTIME
DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT tinyxml2_runtime
LIBRARY
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT tinyxml2_libraries
ARCHIVE
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT tinyxml2_libraries)

if(BUILD_TESTING AND BUILD_TESTS)
add_executable(xmltest xmltest.cpp)
add_dependencies(xmltest tinyxml2)
target_link_libraries(xmltest tinyxml2)

# Copy test resources and create test output directory
add_custom_command(TARGET xmltest POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/resources $<TARGET_FILE_DIR:xmltest>/resources
COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:xmltest>/resources/out
COMMENT "Configuring xmltest resources directory: ${CMAKE_CURRENT_BINARY_DIR}/resources"
)

add_test(NAME xmltest COMMAND xmltest WORKING_DIRECTORY $<TARGET_FILE_DIR:xmltest>)
endif()

install(FILES tinyxml2.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT tinyxml2_headers)

configure_file(tinyxml2.pc.in tinyxml2.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tinyxml2.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig COMPONENT tinyxml2_config)

# uninstall target
if(NOT TARGET uninstall)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)

add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif()

include(CMakePackageConfigHelpers)
set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
configure_package_config_file(
"Config.cmake.in"
"${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${CMAKE_PROJECT_NAME}"
)
write_basic_package_version_file(
"${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}ConfigVersion.cmake"
VERSION ${GENERIC_LIB_VERSION}
COMPATIBILITY SameMajorVersion
)
install(FILES
${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}Config.cmake
${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}ConfigVersion.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${CMAKE_PROJECT_NAME}
COMPONENT tinyxml2_config)

install(EXPORT ${CMAKE_PROJECT_NAME}Targets NAMESPACE tinyxml2::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${CMAKE_PROJECT_NAME}
COMPONENT tinyxml2_config)
4 changes: 4 additions & 0 deletions breadcrumbs/tools/tinyxml/Config.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@PACKAGE_INIT@

include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake")
check_required_components("@PROJECT_NAME@")
18 changes: 18 additions & 0 deletions breadcrumbs/tools/tinyxml/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.

Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation
would be appreciated but is not required.

2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source
distribution.
75 changes: 75 additions & 0 deletions breadcrumbs/tools/tinyxml/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# For GNU conventions and targets see https://www.gnu.org/prep/standards/standards.html
# Using GNU standards makes it easier for some users to keep doing what they are used to.

# 'mkdir -p' is non-portable, but it is widely supported. A portable solution
# is elusive due to race conditions on testing the directory and creating it.
# Anemic toolchain users can sidestep the problem using MKDIR="mkdir".

AR = ar
ARFLAGS = cr
RM = rm -f
RANLIB = ranlib
MKDIR = mkdir -p
CXXFLAGS = -fPIC

INSTALL = install
INSTALL_PROGRAM = $(INSTALL)
INSTALL_DATA = $(INSTALL) -m 644

prefix = /usr/local
bindir = $(prefix)/bin
libdir = $(prefix)/lib
includedir = $(prefix)/include

all: xmltest staticlib

rebuild: clean all

xmltest: xmltest.cpp libtinyxml2.a

effc:
gcc -Werror -Wall -Wextra -Wshadow -Wpedantic -Wformat-nonliteral \
-Wformat-security -Wswitch-default -Wuninitialized -Wundef \
-Wpointer-arith -Woverloaded-virtual -Wctor-dtor-privacy \
-Wnon-virtual-dtor -Woverloaded-virtual -Wsign-promo \
-Wno-unused-parameter -Weffc++ xmltest.cpp tinyxml2.cpp -o xmltest

clean:
-$(RM) *.o xmltest libtinyxml2.a

# Standard GNU target
distclean:
-$(RM) *.o xmltest libtinyxml2.a

test: clean xmltest
./xmltest

# Standard GNU target
check: clean xmltest
./xmltest

staticlib: libtinyxml2.a

libtinyxml2.a: tinyxml2.o
$(AR) $(ARFLAGS) $@ $^
$(RANLIB) $@

tinyxml2.o: tinyxml2.cpp tinyxml2.h

directories:
$(MKDIR) $(DESTDIR)$(prefix)
$(MKDIR) $(DESTDIR)$(bindir)
$(MKDIR) $(DESTDIR)$(libdir)
$(MKDIR) $(DESTDIR)$(includedir)

# Standard GNU target.
install: xmltest staticlib directories
$(INSTALL_PROGRAM) xmltest $(DESTDIR)$(bindir)/xmltest
$(INSTALL_DATA) tinyxml2.h $(DESTDIR)$(includedir)/tinyxml2.h
$(INSTALL_DATA) libtinyxml2.a $(DESTDIR)$(libdir)/libtinyxml2.a

# Standard GNU target
uninstall:
$(RM) $(DESTDIR)$(bindir)/xmltest
$(RM) $(DESTDIR)$(includedir)/tinyxml2.h
$(RM) $(DESTDIR)$(libdir)/libtinyxml2.a
Binary file added breadcrumbs/tools/tinyxml/TinyXML2_small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions breadcrumbs/tools/tinyxml/appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
before_build:
- cmake .

build_script:
- msbuild tinyxml2.sln /m /p:Configuration=Debug /t:ALL_BUILD
- msbuild tinyxml2.sln /m /p:Configuration=Release /t:ALL_BUILD
- cd %APPVEYOR_BUILD_FOLDER%\Debug
- xmltest.exe
- cd %APPVEYOR_BUILD_FOLDER%\Release
- xmltest.exe
7 changes: 7 additions & 0 deletions breadcrumbs/tools/tinyxml/biicode.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Biicode configuration file

[paths]
/

[dependencies]
xmltest.cpp + resources/*.xml
Loading

0 comments on commit 5112b4f

Please sign in to comment.