-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding configuration class framework
- Loading branch information
Showing
202 changed files
with
28,187 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Biicode configuration file | ||
|
||
[paths] | ||
/ | ||
|
||
[dependencies] | ||
xmltest.cpp + resources/*.xml |
Oops, something went wrong.