CMakeLists.txt 28 KB

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