CMakeLists.txt 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626
  1. ####################################################################################################################
  2. ####################################################################################################################
  3. ####################################################################################################################
  4. # General
  5. ####################################################################################################################
  6. ####################################################################################################################
  7. ####################################################################################################################
  8. ##########################################################
  9. # Basic
  10. ##########################################################
  11. cmake_minimum_required(VERSION 3.17)
  12. project(ls-std VERSION 2023.1.0)
  13. set(MODULE_NAME_BOXING ls-std-boxing)
  14. set(MODULE_NAME_CORE ls-std-core)
  15. set(MODULE_NAME_ENCODING ls-std-encoding)
  16. set(MODULE_NAME_EVENT ls-std-event)
  17. set(MODULE_NAME_IO ls-std-io)
  18. set(MODULE_NAME_TIME ls-std-time)
  19. set(GOOGLE_TEST_MODULE googletest-1.11.0)
  20. ##########################################################
  21. # Options
  22. ##########################################################
  23. option(LS_STD_BUILD_WITH_TESTS "Build project with tests..." OFF)
  24. option(LS_STD_BUILD_WITH_SUPPORTED_COMPILER "Build project with supported compiler only..." ON)
  25. option(LS_STD_BUILD_STATIC "Build ls-std static library..." ON)
  26. option(LS_STD_BUILD_SHARED "Build ls-std shared library..." OFF)
  27. option(LS_STD_BUILD_MODULE "Build ls-std module library..." OFF)
  28. set(TARGET_COUNTER 0)
  29. if (${LS_STD_BUILD_STATIC})
  30. math(EXPR TARGET_COUNTER "${TARGET_COUNTER} + 1")
  31. set(GOAL "static library")
  32. endif ()
  33. if (${LS_STD_BUILD_SHARED})
  34. math(EXPR TARGET_COUNTER "${TARGET_COUNTER} + 1")
  35. set(GOAL "shared library")
  36. endif ()
  37. if (${LS_STD_BUILD_MODULE})
  38. math(EXPR TARGET_COUNTER "${TARGET_COUNTER} + 1")
  39. set(GOAL "module library")
  40. endif ()
  41. message("${PROJECT_NAME}: [Goal] ${GOAL}")
  42. if (TARGET_COUNTER GREATER 1)
  43. message("${PROJECT_NAME}: [Error] only one goal supported at the same time!")
  44. return()
  45. endif ()
  46. if (TARGET_COUNTER EQUAL 0)
  47. message("${PROJECT_NAME}: [Error] no goal selected!")
  48. return()
  49. endif ()
  50. ##########################################################
  51. # Compiler Settings
  52. ##########################################################
  53. message("${PROJECT_NAME}: Setting compiler flags...")
  54. set(CMAKE_CXX_STANDARD 17)
  55. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
  56. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
  57. ##########################################################
  58. # Compiler Support
  59. ##########################################################
  60. if(${LS_STD_BUILD_WITH_SUPPORTED_COMPILER})
  61. message("${PROJECT_NAME}: build with compiler support...")
  62. # define supported compilers
  63. if (${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC OR
  64. ${CMAKE_CXX_COMPILER_ID} STREQUAL GNU OR
  65. ${CMAKE_CXX_COMPILER_ID} STREQUAL Clang OR
  66. ${CMAKE_CXX_COMPILER_ID} STREQUAL AppleClang)
  67. message("${PROJECT_NAME}: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION} is supported...")
  68. else()
  69. message("${PROJECT_NAME}: [Error] ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION} is not supported... terminated!")
  70. return()
  71. endif ()
  72. # define which compilers are supported for shared or module goal
  73. if (${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC AND ${LS_STD_BUILD_MODULE})
  74. message("${PROJECT_NAME}: [Error] building \"${GOAL}\" with ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION} is not supported... terminated!")
  75. return()
  76. endif ()
  77. endif()
  78. # define which goals can run tests
  79. if (${LS_STD_BUILD_WITH_TESTS} AND ${LS_STD_BUILD_MODULE})
  80. message("${PROJECT_NAME}: [Error] building \"${GOAL}\" with tests is not supported... terminated!")
  81. return()
  82. endif ()
  83. ######################################################
  84. # Include Directories
  85. ######################################################
  86. message("${PROJECT_NAME}: Adding include directories...")
  87. if (${LS_STD_BUILD_WITH_TESTS})
  88. include_directories(${CMAKE_CURRENT_SOURCE_DIR}/test)
  89. include_directories(${CMAKE_CURRENT_LIST_DIR}/test/lib/${GOOGLE_TEST_MODULE}/googletest/include)
  90. include_directories(${CMAKE_CURRENT_LIST_DIR}/test/lib/${GOOGLE_TEST_MODULE}/googlemock/include)
  91. endif ()
  92. include_directories(${CMAKE_CURRENT_LIST_DIR}/include)
  93. ######################################################
  94. # Add Other CMake Dependencies
  95. ######################################################
  96. message("${PROJECT_NAME}: Adding additional cmake dependencies...")
  97. if (${LS_STD_BUILD_WITH_TESTS})
  98. add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/test/lib/${GOOGLE_TEST_MODULE})
  99. endif ()
  100. ####################################################################################################################
  101. ####################################################################################################################
  102. ####################################################################################################################
  103. # Source Files Modularization
  104. ####################################################################################################################
  105. ####################################################################################################################
  106. ####################################################################################################################
  107. set(SOURCE_FILES_BOXING
  108. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/boxing/Boolean.cpp
  109. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/boxing/Double.cpp
  110. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/boxing/Float.cpp
  111. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/boxing/Integer.cpp
  112. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/boxing/Long.cpp
  113. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/boxing/String.cpp)
  114. set(SOURCE_FILES_CORE
  115. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/exception/EventNotHandledException.cpp
  116. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/exception/EventNotSubscribedException.cpp
  117. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/exception/FileNotFoundException.cpp
  118. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/exception/FileOperationException.cpp
  119. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/exception/IllegalArgumentException.cpp
  120. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/exception/IllegalArithmeticOperationException.cpp
  121. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/exception/IncompleteJsonException.cpp
  122. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/exception/NullPointerException.cpp
  123. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/interface/IBoxing.cpp
  124. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/interface/IEncoding.cpp
  125. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/interface/IEventSubscriber.cpp
  126. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/interface/IListener.cpp
  127. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/interface/IReader.cpp
  128. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/interface/ISerializable.cpp
  129. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/interface/IStorable.cpp
  130. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/interface/IWriter.cpp
  131. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/utils/RegexUtils.cpp
  132. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/Class.cpp
  133. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/LibraryVersion.cpp
  134. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/Version.cpp)
  135. set(SOURCE_FILES_ENCODING
  136. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/encoding/Base64.cpp)
  137. set(SOURCE_FILES_EVENT
  138. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/event/serialization/SerializableJsonEvent.cpp
  139. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/event/Event.cpp
  140. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/event/EventHandler.cpp
  141. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/event/EventManager.cpp
  142. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/event/Narrator.cpp)
  143. set(SOURCE_FILES_IO
  144. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/kv/KvDocument.cpp
  145. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/kv/KvFileReader.cpp
  146. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/kv/KvPair.cpp
  147. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/kv/KvParseParameter.cpp
  148. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/kv/KvParser.cpp
  149. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/logging/Logger.cpp
  150. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/logging/LogLevel.cpp
  151. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/xml/XmlAttribute.cpp
  152. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/xml/XmlDeclaration.cpp
  153. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/xml/XmlDocument.cpp
  154. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/xml/XmlNode.cpp
  155. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/xml/XmlParseParameter.cpp
  156. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/xml/XmlParser.cpp
  157. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/xml/XmlReader.cpp
  158. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/File.cpp
  159. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/FileOutputStream.cpp
  160. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/FilePathSeparator.cpp
  161. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/FilePathSeparatorMatch.cpp
  162. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/FileReader.cpp
  163. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/FileWriter.cpp
  164. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/NewLine.cpp
  165. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/StandardOutputWriter.cpp
  166. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/StorableFile.cpp)
  167. set(SOURCE_FILES_TIME
  168. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/time/Date.cpp)
  169. ####################################################################################################################
  170. ####################################################################################################################
  171. ####################################################################################################################
  172. # Test Files Modularization
  173. ####################################################################################################################
  174. ####################################################################################################################
  175. ####################################################################################################################
  176. if (${LS_STD_BUILD_WITH_TESTS})
  177. set(TEST_FILES_BOXING
  178. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/boxing/BooleanTest.cpp
  179. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/boxing/DoubleTest.cpp
  180. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/boxing/FloatTest.cpp
  181. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/boxing/IntegerTest.cpp
  182. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/boxing/LongTest.cpp
  183. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/boxing/StringTest.cpp)
  184. set(TEST_FILES_CORE
  185. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/exception/EventNotHandledExceptionTest.cpp
  186. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/exception/EventNotSubscribedExceptionTest.cpp
  187. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/exception/FileNotFoundExceptionTest.cpp
  188. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/exception/FileOperationExceptionTest.cpp
  189. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/exception/IllegalArgumentExceptionTest.cpp
  190. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/exception/IllegalArithmeticOperationExceptionTest.cpp
  191. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/exception/IncompleteJsonExceptionTest.cpp
  192. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/exception/NullPointerExceptionTest.cpp
  193. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/utils/RegexUtilsTest.cpp
  194. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/utils/StlUtilsTest.cpp
  195. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/ClassTest.cpp
  196. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/LibraryVersionTest.cpp
  197. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/VersionTest.cpp
  198. ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/core/ClassWrapper.cpp)
  199. set(TEST_FILES_ENCODING
  200. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/encoding/Base64Test.cpp)
  201. set(TEST_FILES_EVENT
  202. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/event/serialization/SerializableJsonEventTest.cpp
  203. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/event/EventHandlerTest.cpp
  204. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/event/EventManagerTest.cpp
  205. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/event/EventTest.cpp
  206. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/event/NarratorTest.cpp
  207. ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/event/Colour.cpp
  208. ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/event/DailyNewsAgency.cpp
  209. ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/event/GossipNewsAgency.cpp
  210. ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/event/GossipNewsEvent.cpp
  211. ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/event/NewsAgency.cpp
  212. ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/event/SeriousNewsEvent.cpp
  213. ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/event/TestDataCar.cpp
  214. ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/event/TestDataMercedesCar.cpp)
  215. set(TEST_FILES_IO
  216. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/kv/KvDocumentTest.cpp
  217. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/kv/KvFileReaderTest.cpp
  218. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/kv/KvPairTest.cpp
  219. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/kv/KvParseParameterTest.cpp
  220. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/kv/KvParserTest.cpp
  221. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/logging/LoggerTest.cpp
  222. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/logging/LogLevelTest.cpp
  223. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XmlAttributeTest.cpp
  224. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XmlDeclarationTest.cpp
  225. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XmlDocumentTest.cpp
  226. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XmlNodeTest.cpp
  227. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XmlParseParameterTest.cpp
  228. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XmlParserTest.cpp
  229. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XmlParserTestWrapperTest.cpp
  230. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XmlReaderTest.cpp
  231. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/FileOutputStreamTest.cpp
  232. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/FileReaderTest.cpp
  233. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/FileTest.cpp
  234. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/FileWriterTest.cpp
  235. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/StandardOutputWriterTest.cpp
  236. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/StorableFileTest.cpp
  237. ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/io/xml/TestDataFactory.cpp
  238. ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/io/xml/XmlParserTestWrapper.cpp)
  239. set(TEST_FILES_SERIALIZATION
  240. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/serialization/JsonTest.cpp)
  241. set(TEST_FILES_TIME
  242. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/time/DateTest.cpp)
  243. endif ()
  244. ####################################################################################################################
  245. ####################################################################################################################
  246. ####################################################################################################################
  247. # Test Suite Builds
  248. ####################################################################################################################
  249. ####################################################################################################################
  250. ####################################################################################################################
  251. ##########################################################
  252. # Build Tests (boxing)
  253. ##########################################################
  254. if (${LS_STD_BUILD_WITH_TESTS})
  255. message("${MODULE_NAME_BOXING}: Building tests...")
  256. add_executable(${MODULE_NAME_BOXING}-test ${TEST_FILES_BOXING})
  257. endif ()
  258. ##########################################################
  259. # Build Tests (core)
  260. ##########################################################
  261. if (${LS_STD_BUILD_WITH_TESTS})
  262. message("${MODULE_NAME_CORE}: Building tests...")
  263. add_executable(${MODULE_NAME_CORE}-test ${TEST_FILES_CORE})
  264. endif ()
  265. ##########################################################
  266. # Build Tests (encoding)
  267. ##########################################################
  268. if (${LS_STD_BUILD_WITH_TESTS})
  269. message("${MODULE_NAME_ENCODING}: Building tests...")
  270. add_executable(${MODULE_NAME_ENCODING}-test ${TEST_FILES_ENCODING})
  271. endif ()
  272. ##########################################################
  273. # Build Tests (event)
  274. ##########################################################
  275. if (${LS_STD_BUILD_WITH_TESTS})
  276. message("${MODULE_NAME_EVENT}: Building tests...")
  277. add_executable(${MODULE_NAME_EVENT}-test ${TEST_FILES_EVENT})
  278. endif ()
  279. ##########################################################
  280. # Build Tests (io)
  281. ##########################################################
  282. if (${LS_STD_BUILD_WITH_TESTS})
  283. message("${MODULE_NAME_IO}: Building tests...")
  284. add_executable(${MODULE_NAME_IO}-test
  285. ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/TestHelper.cpp
  286. ${TEST_FILES_IO})
  287. endif ()
  288. ##########################################################
  289. # Build Tests (time)
  290. ##########################################################
  291. if (${LS_STD_BUILD_WITH_TESTS})
  292. message("${MODULE_NAME_TIME}: Building tests...")
  293. add_executable(${MODULE_NAME_TIME}-test ${TEST_FILES_TIME})
  294. endif ()
  295. ##########################################################
  296. # Build Tests (all)
  297. ##########################################################
  298. if (${LS_STD_BUILD_WITH_TESTS})
  299. message("${PROJECT_NAME}: Building tests...")
  300. add_executable(${PROJECT_NAME}-test
  301. ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/TestHelper.cpp
  302. ${TEST_FILES_BOXING}
  303. ${TEST_FILES_CORE}
  304. ${TEST_FILES_ENCODING}
  305. ${TEST_FILES_EVENT}
  306. ${TEST_FILES_IO}
  307. ${TEST_FILES_SERIALIZATION}
  308. ${TEST_FILES_TIME})
  309. endif ()
  310. ####################################################################################################################
  311. ####################################################################################################################
  312. ####################################################################################################################
  313. # Build Library Binaries
  314. ####################################################################################################################
  315. ####################################################################################################################
  316. ####################################################################################################################
  317. ##########################################################
  318. # Build Library (boxing)
  319. ##########################################################
  320. message("${PROJECT_NAME}: Building ${MODULE_NAME_BOXING} library version ${PROJECT_VERSION}...")
  321. if (${LS_STD_BUILD_STATIC})
  322. add_library("${MODULE_NAME_BOXING}" STATIC ${SOURCE_FILES_BOXING})
  323. set_target_properties("${MODULE_NAME_BOXING}" PROPERTIES DEBUG_POSTFIX "-d")
  324. endif ()
  325. if (${LS_STD_BUILD_SHARED})
  326. add_library("${MODULE_NAME_BOXING}" SHARED ${SOURCE_FILES_BOXING})
  327. target_link_libraries("${MODULE_NAME_BOXING}" ${MODULE_NAME_CORE})
  328. set_target_properties("${MODULE_NAME_BOXING}" PROPERTIES DEBUG_POSTFIX "-d")
  329. endif ()
  330. if (${LS_STD_BUILD_MODULE})
  331. add_library("${MODULE_NAME_BOXING}" MODULE ${SOURCE_FILES_BOXING})
  332. set_target_properties("${MODULE_NAME_BOXING}" PROPERTIES DEBUG_POSTFIX "-d")
  333. endif ()
  334. ##########################################################
  335. # Build Library (core)
  336. ##########################################################
  337. message("${PROJECT_NAME}: Building ${MODULE_NAME_CORE} library version ${PROJECT_VERSION}...")
  338. if (${LS_STD_BUILD_STATIC})
  339. add_library("${MODULE_NAME_CORE}" STATIC ${SOURCE_FILES_CORE})
  340. set_target_properties("${MODULE_NAME_CORE}" PROPERTIES DEBUG_POSTFIX "-d")
  341. endif ()
  342. if (${LS_STD_BUILD_SHARED})
  343. add_library("${MODULE_NAME_CORE}" SHARED ${SOURCE_FILES_CORE})
  344. set_target_properties("${MODULE_NAME_CORE}" PROPERTIES DEBUG_POSTFIX "-d")
  345. endif ()
  346. if (${LS_STD_BUILD_MODULE})
  347. add_library("${MODULE_NAME_CORE}" MODULE ${SOURCE_FILES_CORE})
  348. set_target_properties("${MODULE_NAME_CORE}" PROPERTIES DEBUG_POSTFIX "-d")
  349. endif ()
  350. ##########################################################
  351. # Build Library (encoding)
  352. ##########################################################
  353. message("${PROJECT_NAME}: Building ${MODULE_NAME_ENCODING} library version ${PROJECT_VERSION}...")
  354. if (${LS_STD_BUILD_STATIC})
  355. add_library("${MODULE_NAME_ENCODING}" STATIC ${SOURCE_FILES_ENCODING})
  356. set_target_properties("${MODULE_NAME_ENCODING}" PROPERTIES DEBUG_POSTFIX "-d")
  357. endif ()
  358. if (${LS_STD_BUILD_SHARED})
  359. add_library("${MODULE_NAME_ENCODING}" SHARED ${SOURCE_FILES_ENCODING})
  360. set_target_properties("${MODULE_NAME_ENCODING}" PROPERTIES DEBUG_POSTFIX "-d")
  361. endif ()
  362. if (${LS_STD_BUILD_MODULE})
  363. add_library("${MODULE_NAME_ENCODING}" MODULE ${SOURCE_FILES_ENCODING})
  364. set_target_properties("${MODULE_NAME_ENCODING}" PROPERTIES DEBUG_POSTFIX "-d")
  365. endif ()
  366. # CLI base64
  367. add_executable(cli-base64
  368. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/LibraryVersion.cpp
  369. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/Version.cpp
  370. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/interface/IEncoding.cpp
  371. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/interface/ISerializable.cpp
  372. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/encoding/Base64.cpp
  373. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/encoding/cli/cli-base64-main.cpp)
  374. ##########################################################
  375. # Build Library (event)
  376. ##########################################################
  377. message("${PROJECT_NAME}: Building ${MODULE_NAME_EVENT} library version ${PROJECT_VERSION}...")
  378. if (${LS_STD_BUILD_STATIC})
  379. add_library("${MODULE_NAME_EVENT}" STATIC ${SOURCE_FILES_EVENT})
  380. set_target_properties("${MODULE_NAME_EVENT}" PROPERTIES DEBUG_POSTFIX "-d")
  381. endif ()
  382. if (${LS_STD_BUILD_SHARED})
  383. add_library("${MODULE_NAME_EVENT}" SHARED ${SOURCE_FILES_EVENT})
  384. target_link_libraries("${MODULE_NAME_EVENT}" ${MODULE_NAME_CORE})
  385. set_target_properties("${MODULE_NAME_EVENT}" PROPERTIES DEBUG_POSTFIX "-d")
  386. endif ()
  387. if (${LS_STD_BUILD_MODULE})
  388. add_library("${MODULE_NAME_EVENT}" MODULE ${SOURCE_FILES_EVENT})
  389. set_target_properties("${MODULE_NAME_EVENT}" PROPERTIES DEBUG_POSTFIX "-d")
  390. endif ()
  391. ##########################################################
  392. # Build Library (io)
  393. ##########################################################
  394. message("${PROJECT_NAME}: Building ${MODULE_NAME_IO} library version ${PROJECT_VERSION}...")
  395. if (${LS_STD_BUILD_STATIC})
  396. add_library("${MODULE_NAME_IO}" STATIC ${SOURCE_FILES_IO})
  397. set_target_properties("${MODULE_NAME_IO}" PROPERTIES DEBUG_POSTFIX "-d")
  398. endif ()
  399. if (${LS_STD_BUILD_SHARED})
  400. add_library("${MODULE_NAME_IO}" SHARED ${SOURCE_FILES_IO})
  401. target_link_libraries("${MODULE_NAME_IO}" ${MODULE_NAME_CORE})
  402. set_target_properties("${MODULE_NAME_IO}" PROPERTIES DEBUG_POSTFIX "-d")
  403. endif ()
  404. if (${LS_STD_BUILD_MODULE})
  405. add_library("${MODULE_NAME_IO}" MODULE ${SOURCE_FILES_IO})
  406. set_target_properties("${MODULE_NAME_IO}" PROPERTIES DEBUG_POSTFIX "-d")
  407. endif ()
  408. ##########################################################
  409. # Build Library (time)
  410. ##########################################################
  411. message("${PROJECT_NAME}: Building ${MODULE_NAME_TIME} library version ${PROJECT_VERSION}...")
  412. if (${LS_STD_BUILD_STATIC})
  413. add_library("${MODULE_NAME_TIME}" STATIC ${SOURCE_FILES_TIME})
  414. set_target_properties("${MODULE_NAME_TIME}" PROPERTIES DEBUG_POSTFIX "-d")
  415. endif ()
  416. if (${LS_STD_BUILD_SHARED})
  417. add_library("${MODULE_NAME_TIME}" SHARED ${SOURCE_FILES_TIME})
  418. target_link_libraries("${MODULE_NAME_TIME}" ${MODULE_NAME_CORE})
  419. set_target_properties("${MODULE_NAME_TIME}" PROPERTIES DEBUG_POSTFIX "-d")
  420. endif ()
  421. if (${LS_STD_BUILD_MODULE})
  422. add_library("${MODULE_NAME_TIME}" MODULE ${SOURCE_FILES_TIME})
  423. set_target_properties("${MODULE_NAME_TIME}" PROPERTIES DEBUG_POSTFIX "-d")
  424. endif ()
  425. ####################################################################################################################
  426. ####################################################################################################################
  427. ####################################################################################################################
  428. # Test Suite: Linking
  429. ####################################################################################################################
  430. ####################################################################################################################
  431. ####################################################################################################################
  432. ##########################################################
  433. # Linking (boxing)
  434. ##########################################################
  435. if (${LS_STD_BUILD_WITH_TESTS})
  436. message("${MODULE_NAME_BOXING}: Linking libraries for test application...")
  437. target_link_libraries(${MODULE_NAME_BOXING}-test
  438. gtest
  439. gmock
  440. gtest_main
  441. "${MODULE_NAME_BOXING}"
  442. "${MODULE_NAME_CORE}")
  443. endif ()
  444. ##########################################################
  445. # Linking (core)
  446. ##########################################################
  447. if (${LS_STD_BUILD_WITH_TESTS})
  448. message("${MODULE_NAME_CORE}: Linking libraries for test application...")
  449. target_link_libraries(${MODULE_NAME_CORE}-test
  450. gtest
  451. gmock
  452. gtest_main
  453. "${MODULE_NAME_CORE}")
  454. endif ()
  455. ##########################################################
  456. # Linking (encoding)
  457. ##########################################################
  458. if (${LS_STD_BUILD_WITH_TESTS})
  459. message("${MODULE_NAME_ENCODING}: Linking libraries for test application...")
  460. target_link_libraries(${MODULE_NAME_ENCODING}-test
  461. gtest
  462. gmock
  463. gtest_main
  464. "${MODULE_NAME_ENCODING}"
  465. "${MODULE_NAME_CORE}")
  466. endif ()
  467. ##########################################################
  468. # Linking (event)
  469. ##########################################################
  470. if (${LS_STD_BUILD_WITH_TESTS})
  471. message("${MODULE_NAME_EVENT}: Linking libraries for test application...")
  472. target_link_libraries(${MODULE_NAME_EVENT}-test
  473. gtest
  474. gmock
  475. gtest_main
  476. "${MODULE_NAME_EVENT}"
  477. "${MODULE_NAME_CORE}")
  478. endif ()
  479. ##########################################################
  480. # Linking (io)
  481. ##########################################################
  482. if (${LS_STD_BUILD_WITH_TESTS})
  483. message("${MODULE_NAME_IO}: Linking libraries for test application...")
  484. target_link_libraries(${MODULE_NAME_IO}-test
  485. gtest
  486. gmock
  487. gtest_main
  488. "${MODULE_NAME_IO}"
  489. "${MODULE_NAME_CORE}")
  490. endif ()
  491. ##########################################################
  492. # Linking (time)
  493. ##########################################################
  494. if (${LS_STD_BUILD_WITH_TESTS})
  495. message("${MODULE_NAME_TIME}: Linking libraries for test application...")
  496. target_link_libraries(${MODULE_NAME_TIME}-test
  497. gtest
  498. gmock
  499. gtest_main
  500. "${MODULE_NAME_TIME}"
  501. "${MODULE_NAME_CORE}")
  502. endif ()
  503. ##########################################################
  504. # Linking (all)
  505. ##########################################################
  506. if (${LS_STD_BUILD_WITH_TESTS})
  507. message("${PROJECT_NAME}: Linking libraries for test application...")
  508. target_link_libraries(${PROJECT_NAME}-test
  509. gtest
  510. gmock
  511. gtest_main
  512. "${MODULE_NAME_BOXING}"
  513. "${MODULE_NAME_ENCODING}"
  514. "${MODULE_NAME_EVENT}"
  515. "${MODULE_NAME_IO}"
  516. "${MODULE_NAME_TIME}"
  517. "${MODULE_NAME_CORE}")
  518. endif ()