Pārlūkot izejas kodu

Merge branch 'compiler_support' of public/ls-standard-library into development

Lynar Studios - Public Repositories 2 gadi atpakaļ
vecāks
revīzija
2f18510429

+ 42 - 127
CMakeLists.txt

@@ -36,24 +36,31 @@ set(TARGET_COUNTER 0)
 
 if (${LS_STD_BUILD_STATIC})
     math(EXPR TARGET_COUNTER "${TARGET_COUNTER} + 1")
-    message("${PROJECT_NAME}: [Goal] static library")
+    set(GOAL "static library")
 endif ()
 
 if (${LS_STD_BUILD_SHARED})
     math(EXPR TARGET_COUNTER "${TARGET_COUNTER} + 1")
-    message("${PROJECT_NAME}: [Goal] shared library")
+    set(GOAL "shared library")
 endif ()
 
 if (${LS_STD_BUILD_MODULE})
     math(EXPR TARGET_COUNTER "${TARGET_COUNTER} + 1")
-    message("${PROJECT_NAME}: [Goal] module library")
+    set(GOAL "module library")
 endif ()
 
+message("${PROJECT_NAME}: [Goal] ${GOAL}")
+
 if (TARGET_COUNTER GREATER 1)
     message("${PROJECT_NAME}: [Error] only one goal supported at the same time!")
     return()
 endif ()
 
+if (TARGET_COUNTER EQUAL 0)
+    message("${PROJECT_NAME}: [Error] no goal selected!")
+    return()
+endif ()
+
 ##########################################################
 # Compiler Settings
 ##########################################################
@@ -63,6 +70,33 @@ set(CMAKE_CXX_STANDARD 11)
 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
 
+##########################################################
+# Compiler Support
+##########################################################
+
+# define supported compilers
+
+if (${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC OR ${CMAKE_CXX_COMPILER_ID} STREQUAL GNU)
+    message("${PROJECT_NAME}: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION} is supported...")
+else()
+    message("${PROJECT_NAME}: [Error] ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION} is not supported... terminated!")
+    return()
+endif ()
+
+# define which goals can run tests
+
+if (${LS_STD_BUILD_WITH_TESTS} AND ${LS_STD_BUILD_SHARED} OR ${LS_STD_BUILD_MODULE})
+    message("${PROJECT_NAME}: [Error] building \"${GOAL}\" with tests is not supported... terminated!")
+    return()
+endif ()
+
+# define which compilers are supported for shared or module goal
+
+if (${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC AND ${LS_STD_BUILD_SHARED} OR ${LS_STD_BUILD_MODULE})
+    message("${PROJECT_NAME}: [Error] building \"${GOAL}\" with ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION} is not supported... terminated!")
+    return()
+endif ()
+
 ######################################################
 # Include Directories
 ######################################################
@@ -346,6 +380,7 @@ endif ()
 
 if (${LS_STD_BUILD_SHARED})
     add_library("${MODULE_NAME_BOXING}" SHARED ${SOURCE_FILES_BOXING})
+    target_link_libraries("${MODULE_NAME_BOXING}" ${MODULE_NAME_CORE})
     set_target_properties("${MODULE_NAME_BOXING}" PROPERTIES DEBUG_POSTFIX "_d")
 endif ()
 
@@ -409,6 +444,7 @@ endif ()
 
 if (${LS_STD_BUILD_SHARED})
     add_library("${MODULE_NAME_EVENT}" SHARED ${SOURCE_FILES_EVENT})
+    target_link_libraries("${MODULE_NAME_EVENT}" ${MODULE_NAME_CORE})
     set_target_properties("${MODULE_NAME_EVENT}" PROPERTIES DEBUG_POSTFIX "_d")
 endif ()
 
@@ -430,6 +466,7 @@ endif ()
 
 if (${LS_STD_BUILD_SHARED})
     add_library("${MODULE_NAME_IO}" SHARED ${SOURCE_FILES_IO})
+    target_link_libraries("${MODULE_NAME_IO}" ${MODULE_NAME_CORE})
     set_target_properties("${MODULE_NAME_IO}" PROPERTIES DEBUG_POSTFIX "_d")
 endif ()
 
@@ -451,6 +488,7 @@ endif ()
 
 if (${LS_STD_BUILD_SHARED})
     add_library("${MODULE_NAME_LOGIC}" SHARED ${SOURCE_FILES_LOGIC})
+    target_link_libraries("${MODULE_NAME_LOGIC}" ${MODULE_NAME_CORE})
     set_target_properties("${MODULE_NAME_LOGIC}" PROPERTIES DEBUG_POSTFIX "_d")
 endif ()
 
@@ -472,6 +510,7 @@ endif ()
 
 if (${LS_STD_BUILD_SHARED})
     add_library("${MODULE_NAME_TIME}" SHARED ${SOURCE_FILES_TIME})
+    target_link_libraries("${MODULE_NAME_TIME}" ${MODULE_NAME_CORE})
     set_target_properties("${MODULE_NAME_TIME}" PROPERTIES DEBUG_POSTFIX "_d")
 endif ()
 
@@ -603,127 +642,3 @@ if (${LS_STD_BUILD_WITH_TESTS} AND ${LS_STD_BUILD_STATIC})
             "${MODULE_NAME_LOGIC}"
             "${MODULE_NAME_TIME}")
 endif ()
-
-####################################################################################################################
-####################################################################################################################
-####################################################################################################################
-# Test Suite: Dynamic Linking
-####################################################################################################################
-####################################################################################################################
-####################################################################################################################
-
-##########################################################
-# Dynamic Linking (boxing)
-##########################################################
-
-if (${LS_STD_BUILD_WITH_TESTS} AND ${LS_STD_BUILD_SHARED})
-    message("${MODULE_NAME_BOXING}: Linking libraries for test application...")
-    target_link_libraries(${MODULE_NAME_BOXING}_test
-            gtest
-            gmock
-            gtest_main
-            "${MODULE_NAME_BOXING}"
-            "${MODULE_NAME_CORE}")
-endif ()
-
-##########################################################
-# Dynamic Linking (core)
-##########################################################
-
-if (${LS_STD_BUILD_WITH_TESTS} AND ${LS_STD_BUILD_SHARED})
-    message("${MODULE_NAME_CORE}: Linking libraries for test application...")
-    target_link_libraries(${MODULE_NAME_CORE}_test
-            gtest
-            gmock
-            gtest_main
-            "${MODULE_NAME_CORE}")
-endif ()
-
-##########################################################
-# Dynamic Linking (encoding)
-##########################################################
-
-if (${LS_STD_BUILD_WITH_TESTS} AND ${LS_STD_BUILD_SHARED})
-    message("${MODULE_NAME_ENCODING}: Linking libraries for test application...")
-    target_link_libraries(${MODULE_NAME_ENCODING}_test
-            gtest
-            gmock
-            gtest_main
-            "${MODULE_NAME_ENCODING}"
-            "${MODULE_NAME_CORE}")
-endif ()
-
-##########################################################
-# Dynamic Linking (event)
-##########################################################
-
-if (${LS_STD_BUILD_WITH_TESTS} AND ${LS_STD_BUILD_SHARED})
-    message("${MODULE_NAME_EVENT}: Linking libraries for test application...")
-    target_link_libraries(${MODULE_NAME_EVENT}_test
-            gtest
-            gmock
-            gtest_main
-            "${MODULE_NAME_EVENT}"
-            "${MODULE_NAME_CORE}")
-endif ()
-
-##########################################################
-# Dynamic Linking (io)
-##########################################################
-
-if (${LS_STD_BUILD_WITH_TESTS} AND ${LS_STD_BUILD_SHARED})
-    message("${MODULE_NAME_IO}: Linking libraries for test application...")
-    target_link_libraries(${MODULE_NAME_IO}_test
-            gtest
-            gmock
-            gtest_main
-            "${MODULE_NAME_IO}"
-            "${MODULE_NAME_CORE}")
-endif ()
-
-##########################################################
-# Dynamic Linking (logic)
-##########################################################
-
-if (${LS_STD_BUILD_WITH_TESTS} AND ${LS_STD_BUILD_SHARED})
-    message("${MODULE_NAME_LOGIC}: Linking libraries for test application...")
-    target_link_libraries(${MODULE_NAME_LOGIC}_test
-            gtest
-            gmock
-            gtest_main
-            "${MODULE_NAME_LOGIC}"
-            "${MODULE_NAME_CORE}")
-endif ()
-
-##########################################################
-# Dynamic Linking (time)
-##########################################################
-
-if (${LS_STD_BUILD_WITH_TESTS} AND ${LS_STD_BUILD_SHARED})
-    message("${MODULE_NAME_TIME}: Linking libraries for test application...")
-    target_link_libraries(${MODULE_NAME_TIME}_test
-            gtest
-            gmock
-            gtest_main
-            "${MODULE_NAME_TIME}"
-            "${MODULE_NAME_CORE}")
-endif ()
-
-##########################################################
-# Dynamic Linking (all)
-##########################################################
-
-if (${LS_STD_BUILD_WITH_TESTS} AND ${LS_STD_BUILD_SHARED})
-    message("${PROJECT_NAME}: Linking libraries for test application...")
-    target_link_libraries(${PROJECT_NAME}_test
-            gtest
-            gmock
-            gtest_main
-            "${MODULE_NAME_CORE}"
-            "${MODULE_NAME_BOXING}"
-            "${MODULE_NAME_ENCODING}"
-            "${MODULE_NAME_EVENT}"
-            "${MODULE_NAME_IO}"
-            "${MODULE_NAME_LOGIC}"
-            "${MODULE_NAME_TIME}")
-endif ()

+ 2 - 1
include/ls_std/boxing/Boolean.hpp

@@ -3,7 +3,7 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2020-08-09
- * Changed:         2022-05-19
+ * Changed:         2022-05-21
  *
  * */
 
@@ -11,6 +11,7 @@
 #define LS_STD_BOOLEAN_HPP
 
 #include <memory>
+#include <sstream>
 #include <ls_std/core/Class.hpp>
 #include <ls_std/core/interface/IBoxing.hpp>
 

+ 4 - 1
source/ls_std/io/logging/Logger.cpp

@@ -3,13 +3,16 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2020-08-20
- * Changed:         2022-05-20
+ * Changed:         2022-05-21
  *
  * */
 
 #include <ls_std/io/logging/Logger.hpp>
 #include <ctime>
 #include <iomanip>
+#ifdef _MSC_VER
+#include <sstream>
+#endif
 #include <ls_std/io/NewLine.hpp>
 #include <ls_std/core/exception/IllegalArgumentException.hpp>
 

+ 3 - 1
test/TestHelper.hpp

@@ -3,7 +3,7 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2020-08-15
- * Changed:         2022-05-19
+ * Changed:         2022-05-21
  *
  * */
 
@@ -16,7 +16,9 @@
 #include <algorithm>
 #include <sstream>
 #include <climits>
+#if defined(unix) || defined(__APPLE__)
 #include <unistd.h>
+#endif
 #include <fstream>
 
 namespace ls_std_test