CMakeLists.txt 27 KB

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