1if (WIN32) 2endif() 3 4set(gfxstream-base-common-sources 5 AlignedBuf.cpp 6 CompressingStream.cpp 7 CpuTime.cpp 8 DecompressingStream.cpp 9 FileUtils.cpp 10 FunctorThread.cpp 11 GLObjectCounter.cpp 12 LayoutResolver.cpp 13 MemStream.cpp 14 StdioStream.cpp 15 MemoryTracker.cpp 16 MessageChannel.cpp 17 PathUtils.cpp 18 ring_buffer.cpp 19 SharedLibrary.cpp 20 StringFormat.cpp 21 Stream.cpp 22 StreamSerializing.cpp 23 SubAllocator.cpp 24 System.cpp 25 Tracing.cpp) 26set(gfxstream-base-posix-sources 27 SharedMemory_posix.cpp 28 Thread_pthread.cpp) 29set(gfxstream-base-windows-sources 30 msvc.cpp 31 SharedMemory_win32.cpp 32 Thread_win32.cpp 33 Win32UnicodeString.cpp) 34 35if (APPLE) 36 set(gfxstream-platform-sources 37 ${gfxstream-base-posix-sources} 38 system-native-mac.mm) 39elseif (WIN32) 40 set(gfxstream-platform-sources 41 ${gfxstream-base-windows-sources}) 42else() 43 set(gfxstream-platform-sources 44 ${gfxstream-base-posix-sources}) 45endif() 46 47add_library( 48 gfxstream-base 49 ${gfxstream-base-common-sources} 50 ${gfxstream-platform-sources}) 51 52target_link_libraries( 53 gfxstream-base PRIVATE lz4 perfetto-tracing-only) 54target_include_directories( 55 gfxstream-base PUBLIC ${GFXSTREAM_REPO_ROOT}) 56if (NOT MSVC) 57 target_compile_options( 58 gfxstream-base PRIVATE -fvisibility=default) 59endif() 60 61if (APPLE) 62 set(gfxstream-base-platform-test-sources "") 63elseif (WIN32) 64 set(gfxstream-base-platform-test-sources Win32UnicodeString_unittest.cpp) 65else() 66 set(gfxstream-base-platform-test-sources "") 67endif() 68 69# Tests 70add_library( 71 gfxstream-base-testing-support 72 testing/file_io.cpp) 73target_include_directories( 74 gfxstream-base-testing-support 75 PRIVATE 76 ${GFXSTREAM_REPO_ROOT} 77 PUBLIC 78 ${GFXSTREAM_REPO_ROOT}/base/testing) 79target_link_libraries( 80 gfxstream-base-testing-support 81 PRIVATE 82 gfxstream-base 83 gtest 84 gmock) 85add_executable( 86 gfxstream-base_unittests 87 AlignedBuf_unittest.cpp 88 ArraySize_unittest.cpp 89 LayoutResolver_unittest.cpp 90 Optional_unittest.cpp 91 ring_buffer_unittest.cpp 92 StringFormat_unittest.cpp 93 SubAllocator_unittest.cpp 94 TypeTraits_unittest.cpp 95 ${gfxstream-base-platform-test-sources}) 96target_link_libraries( 97 gfxstream-base_unittests 98 PRIVATE 99 gfxstream-base 100 gfxstream-base-testing-support 101 gtest_main) 102