Ver código fonte

Merged in dev (pull request #3)

Dev
Patrick-Christopher Mattulat 4 anos atrás
pai
commit
5278f6e707
2 arquivos alterados com 81 adições e 68 exclusões
  1. 79 61
      CMakeLists.txt
  2. 2 7
      README.md

+ 79 - 61
CMakeLists.txt

@@ -4,7 +4,8 @@
 
 cmake_minimum_required(VERSION 3.17)
 set(PROJECT_NAME ls_std)
-set(RELEASE_VERSION 2020.3.0)
+set(RELEASE_VERSION 2020.3.1)
+set(BUILD_WITH_TESTS FALSE)
 project(${PROJECT_NAME})
 
 ##########################################################
@@ -22,8 +23,11 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
 
 message("${PROJECT_NAME}: Adding include directories...")
 
-include_directories(${CMAKE_CURRENT_SOURCE_DIR}/test)
-include_directories(${CMAKE_CURRENT_LIST_DIR}/test/lib/googletest-1.8.1/googletest/include)
+if (${BUILD_WITH_TESTS})
+    include_directories(${CMAKE_CURRENT_SOURCE_DIR}/test)
+    include_directories(${CMAKE_CURRENT_LIST_DIR}/test/lib/googletest-1.8.1/googletest/include)
+endif ()
+
 include_directories(${CMAKE_CURRENT_LIST_DIR}/include)
 
 ######################################################
@@ -31,7 +35,10 @@ include_directories(${CMAKE_CURRENT_LIST_DIR}/include)
 ######################################################
 
 message("${PROJECT_NAME}: Adding additional cmake dependencies...")
-add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/test/lib/googletest-1.8.1)
+
+if (${BUILD_WITH_TESTS})
+    add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/test/lib/googletest-1.8.1)
+endif ()
 
 ##########################################################
 # Source Files
@@ -80,66 +87,75 @@ set(SOURCE_FILES
         ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/event/EventHandler.cpp
         ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/event/EventManager.cpp)
 
-set(TEST_FILES
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/boxing/IntegerTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/boxing/BooleanTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/boxing/FloatTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/boxing/DoubleTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/boxing/StringTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/time/DateTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/FileTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/TestHelper.hpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/base/ClassTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/utils/STLUtilsTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/boxing/LongTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/FileWriterTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/FileReaderTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/utils/RegexUtilsTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/StorableFileTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/FileOutputStreamTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/logging/LoggerTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/serialization/json/JSONTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/serialization/json/boxing/SerializableJSONIntegerTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/serialization/json/boxing/SerializableJSONLongTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/serialization/json/boxing/SerializableJSONStringTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/serialization/json/boxing/SerializableJSONFloatTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/serialization/json/boxing/SerializableJSONDoubleTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/serialization/json/boxing/SerializableJSONBooleanTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/logic/StateTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/logic/StateMachineTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/logic/StateConnectionTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/serialization/json/logic/SerializableJSONStateConnectionTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/serialization/json/logic/SerializableJSONStateTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/serialization/json/logic/SerializableJSONStateMachineTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/TestDataFactory.hpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/TestDataFactory.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XMLAttributeTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XMLNodeTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/base/VersionTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XMLDeclarationTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XMLDocumentTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XMLReaderTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XMLParserMockTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/observer/TestDataCar.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/observer/TestDataMercedesCar.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/logic/NarratorTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XMLParserTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/event/EventTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/event/NewsAgency.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/event/DailyNewsAgency.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/event/SeriousNewsEvent.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/event/GossipNewsEvent.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/event/GossipNewsAgency.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/event/EventHandlerTest.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/event/EventManagerTest.cpp)
+if (${BUILD_WITH_TESTS})
+    set(TEST_FILES
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/boxing/IntegerTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/boxing/BooleanTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/boxing/FloatTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/boxing/DoubleTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/boxing/StringTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/time/DateTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/FileTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/TestHelper.hpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/base/ClassTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/utils/STLUtilsTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/boxing/LongTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/FileWriterTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/FileReaderTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/utils/RegexUtilsTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/StorableFileTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/FileOutputStreamTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/logging/LoggerTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/serialization/json/JSONTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/serialization/json/boxing/SerializableJSONIntegerTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/serialization/json/boxing/SerializableJSONLongTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/serialization/json/boxing/SerializableJSONStringTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/serialization/json/boxing/SerializableJSONFloatTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/serialization/json/boxing/SerializableJSONDoubleTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/serialization/json/boxing/SerializableJSONBooleanTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/logic/StateTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/logic/StateMachineTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/logic/StateConnectionTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/serialization/json/logic/SerializableJSONStateConnectionTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/serialization/json/logic/SerializableJSONStateTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/serialization/json/logic/SerializableJSONStateMachineTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/TestDataFactory.hpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/TestDataFactory.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XMLAttributeTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XMLNodeTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/base/VersionTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XMLDeclarationTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XMLDocumentTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XMLReaderTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XMLParserMockTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/observer/TestDataCar.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/observer/TestDataMercedesCar.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/logic/NarratorTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XMLParserTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/event/EventTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/event/NewsAgency.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/event/DailyNewsAgency.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/event/SeriousNewsEvent.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/event/GossipNewsEvent.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/event/GossipNewsAgency.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/event/EventHandlerTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/event/EventManagerTest.cpp)
+endif ()
 
 ##########################################################
-# Build
+# Build Tests
 ##########################################################
 
-message("${PROJECT_NAME}: Building version ${RELEASE_VERSION}...")
+if (${BUILD_WITH_TESTS})
+    message("${PROJECT_NAME}: Building tests...")
+    add_executable(${PROJECT_NAME}_test ${TEST_FILES})
+endif ()
+
+##########################################################
+# Build Library
+##########################################################
 
-add_executable(${PROJECT_NAME}_test ${TEST_FILES})
+message("${PROJECT_NAME}: Building library version ${RELEASE_VERSION}...")
 
 add_library("${PROJECT_NAME}_${RELEASE_VERSION}_static" STATIC ${SOURCE_FILES})
 set_target_properties("${PROJECT_NAME}_${RELEASE_VERSION}_static" PROPERTIES DEBUG_POSTFIX "_d")
@@ -154,5 +170,7 @@ set_target_properties("${PROJECT_NAME}_${RELEASE_VERSION}_module" PROPERTIES DEB
 # Linking
 ##########################################################
 
-message("${PROJECT_NAME}: Linking...")
-target_link_libraries(${PROJECT_NAME}_test gtest gtest_main "${PROJECT_NAME}_${RELEASE_VERSION}_static")
+if (${BUILD_WITH_TESTS})
+    message("${PROJECT_NAME}: Linking libraries for test application...")
+    target_link_libraries(${PROJECT_NAME}_test gtest gtest_main "${PROJECT_NAME}_${RELEASE_VERSION}_static")
+endif ()

+ 2 - 7
README.md

@@ -1,4 +1,4 @@
-# Lynar Studios - Standard Library 2020.3.0 #
+# Lynar Studios - Standard Library 2020.3.1 #
 
 This is a cross-platform standard library written in C++ which provides basic functionality and implementation, like:
  
@@ -17,12 +17,7 @@ It has been tested on __Windows__, __Linux__ and __MacOS__ systems.
 
 ### Changelog ###
 
-- added event handling functionality
-- added observer pattern classes
-- added xml parser class by reducing complexity of xml reader class
-- ls_std::Class is now polymorphic
-- fixed some include directives 
-- made existing serialization classes flyweight classes
+- improved CMakeLists.txt file by adding functionality to build project with or without tests
 
 ### Documentation ###