-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
107 lines (91 loc) · 3.58 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
cmake_minimum_required(VERSION 3.13)
project(tulz)
set(CMAKE_CXX_STANDARD 20)
option(TULZ_ENABLE_TESTS "Turn it off in order to disable tests" ON)
set(TULZ_OBSERVER_SOURCES
include/tulz/observer/Observer.h
include/tulz/observer/Subject.h
include/tulz/observer/Subscription.h
include/tulz/observer/Observable.h
include/tulz/observer/USubscription.h
src/observer/routing/RoutingKey.cpp
include/tulz/observer/routing/RoutingKey.h
src/observer/routing/RoutingLevelView.cpp
include/tulz/observer/routing/RoutingLevelView.h
src/observer/routing/RoutingKeyBuilder.cpp
include/tulz/observer/routing/RoutingKeyBuilder.h
include/tulz/observer/routing/RoutingKeyLevel.h
src/observer/routing/SubjectRouter.cpp
include/tulz/observer/routing/SubjectRouter.h
include/tulz/observer/routing/ConcurrentSubjectRouter.h
include/tulz/observer/ObserverAutoPtr.h
include/tulz/observer/EternalObserver.h
include/tulz/observer/detail/ObserverFactory.h
include/tulz/observer/EternalObserverFactory.h
include/tulz/observer/EternalObserverAutoPtr.h)
set(TULZ_THREADING_SOURCES
include/tulz/threading/Runnable.h
src/threading/Runnable.cpp
include/tulz/threading/Thread.h
src/threading/Thread.cpp
include/tulz/threading/ThreadPool.h
src/threading/ThreadPool.cpp
src/threading/rwp/Resource.cpp
include/tulz/threading/rwp/Resource.h
include/tulz/threading/rwp/ReadLock.h
include/tulz/threading/rwp/WriteLock.h)
set(TULZ_CONTAINER_SOURCES
include/tulz/container/Array.h
include/tulz/container/RingBuffer.h
include/tulz/container/RandomAccessIndexIterator.h)
set(TULZ_DLL_SOURCES
include/tulz/DynamicLibrary.h src/DynamicLibrary.cpp)
set(TULZ_UTIL_SOURCES
include/tulz/util/macros.h
include/tulz/util/static_initializer.h
include/tulz/util/noncopyable.h
include/tulz/util/nonmovable.h
include/tulz/util/overloaded.h)
set(TULZ_GENERAL_SOURCES
include/tulz/Path.h src/Path.cpp
include/tulz/File.h src/File.cpp
include/tulz/Exception.h src/Exception.cpp
include/tulz/DirectoryVisitor.h src/DirectoryVisitor.cpp
src/LocaleInfo.cpp include/tulz/LocaleInfo.h
include/tulz/demangler.h
src/demangler.cpp
include/tulz/export.h)
if (ANDROID)
set(TULZ_ANDROID_SOURCES
android/src/assets/AssetManager.cpp android/include/tulz/assets/AssetManager.h
android/src/assets/Asset.cpp android/include/tulz/assets/Asset.h
android/src/assets/AssetDir.cpp android/include/tulz/assets/AssetDir.h)
endif()
add_library(tulz
${TULZ_OBSERVER_SOURCES}
${TULZ_THREADING_SOURCES}
${TULZ_CONTAINER_SOURCES}
${TULZ_DLL_SOURCES}
${TULZ_UTIL_SOURCES}
${TULZ_GENERAL_SOURCES}
${TULZ_ANDROID_SOURCES})
# https://learn.microsoft.com/en-us/cpp/cpp/dllexport-dllimport
# https://learn.microsoft.com/en-us/cpp/cpp/using-dllimport-and-dllexport-in-cpp-classes
if (WIN32)
target_compile_definitions(tulz PUBLIC TULZ_BUILD_DLL)
endif()
if (UNIX AND NOT ANDROID)
set(LINK_LIBRARIES ${LINK_LIBRARIES} pthread)
endif()
if (ANDROID)
set(LINK_LIBRARIES ${LINK_LIBRARIES} android)
endif()
target_link_libraries(tulz PUBLIC ${LINK_LIBRARIES})
target_include_directories(tulz PUBLIC include)
if (ANDROID)
target_include_directories(tulz PUBLIC android/include)
endif()
if (TULZ_ENABLE_TESTS)
enable_testing()
add_subdirectory(tests)
endif()