aboutsummaryrefslogtreecommitdiff
path: root/src/base/CMakeLists.txt
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2024-10-06 13:57:39 +0800
committercrupest <crupest@outlook.com>2024-10-06 13:57:39 +0800
commitdfe62dcf8bcefc523b466e127c3edc4dc2756629 (patch)
tree1c751a14ba0da07ca2ff805633f97568060aa4c9 /src/base/CMakeLists.txt
parentf51eb955e188858272230a990565931e7403f23b (diff)
downloadcru-dfe62dcf8bcefc523b466e127c3edc4dc2756629.tar.gz
cru-dfe62dcf8bcefc523b466e127c3edc4dc2756629.tar.bz2
cru-dfe62dcf8bcefc523b466e127c3edc4dc2756629.zip
Rename common to base.
Diffstat (limited to 'src/base/CMakeLists.txt')
-rw-r--r--src/base/CMakeLists.txt80
1 files changed, 80 insertions, 0 deletions
diff --git a/src/base/CMakeLists.txt b/src/base/CMakeLists.txt
new file mode 100644
index 00000000..19feddba
--- /dev/null
+++ b/src/base/CMakeLists.txt
@@ -0,0 +1,80 @@
+add_library(CruBase
+ Base.cpp
+ Buffer.cpp
+ Exception.cpp
+ Format.cpp
+ PropertyTree.cpp
+ String.cpp
+ StringToNumberConverter.cpp
+ StringUtil.cpp
+ SubProcess.cpp
+ io/AutoReadStream.cpp
+ io/BufferStream.cpp
+ io/CFileStream.cpp
+ io/Stream.cpp
+ io/ProxyStream.cpp
+ io/Resource.cpp
+ io/MemoryStream.cpp
+ log/Logger.cpp
+ log/StdioLogTarget.cpp
+ platform/Exception.cpp
+)
+target_compile_definitions(CruBase PRIVATE CRU_BASE_EXPORT_API)
+target_include_directories(CruBase PUBLIC ${CRU_INCLUDE_DIR})
+target_compile_definitions(CruBase PUBLIC $<$<CONFIG:Debug>:CRU_DEBUG>)
+
+if (UNIX AND NOT EMSCRIPTEN)
+ target_sources(CruBase PRIVATE
+ platform/unix/PosixSpawnSubProcess.cpp
+ platform/unix/UnixFileStream.cpp
+ platform/unix/UnixPipe.cpp
+ )
+
+ if (NOT APPLE)
+ target_link_libraries(CruBase PUBLIC pthread)
+ endif()
+endif()
+
+if (APPLE)
+ find_library(CORE_FOUNDATION CoreFoundation REQUIRED)
+ target_link_libraries(CruBase PUBLIC ${CORE_FOUNDATION})
+
+ target_sources(CruBase PRIVATE
+ platform/osx/Convert.cpp
+ platform/osx/Exception.cpp
+ )
+endif()
+
+if (EMSCRIPTEN)
+ target_compile_options(CruBase PUBLIC "-fwasm-exceptions")
+ target_link_options(CruBase PUBLIC "-fwasm-exceptions")
+
+ target_sources(CruBase PRIVATE
+ platform/web/WebException.cpp
+ )
+endif()
+
+if (WIN32)
+ target_sources(CruBase PRIVATE
+ platform/win/BridgeComStream.cpp
+ platform/win/ComAutoInit.cpp
+ platform/win/DebugLogTarget.cpp
+ platform/win/Exception.cpp
+ platform/win/StreamConvert.cpp
+ platform/win/Win32FileStream.cpp
+ )
+
+ target_link_libraries(CruBase PUBLIC Shlwapi.lib)
+endif()
+
+if (WIN32)
+ target_compile_definitions(CruBase PUBLIC CRU_PLATFORM_WINDOWS)
+elseif(APPLE)
+ target_compile_definitions(CruBase PUBLIC CRU_PLATFORM_OSX)
+elseif(EMSCRIPTEN)
+ target_compile_definitions(CruBase PUBLIC CRU_PLATFORM_EMSCRIPTEN)
+else()
+ target_compile_definitions(CruBase PUBLIC CRU_PLATFORM_LINUX)
+endif()
+
+target_link_libraries(CruBase PUBLIC double-conversion)