CMakeLists.txt (2817B)
1 add_library(common 2 align.h 3 assert.cpp 4 assert.h 5 binary_reader_writer.cpp 6 binary_reader_writer.h 7 bitfield.h 8 bitutils.h 9 build_timestamp.h 10 crash_handler.cpp 11 crash_handler.h 12 dimensional_array.h 13 dynamic_library.cpp 14 dynamic_library.h 15 error.cpp 16 error.h 17 fastjmp.cpp 18 fastjmp.h 19 fifo_queue.h 20 file_system.cpp 21 file_system.h 22 gsvector.cpp 23 gsvector.h 24 gsvector_formatter.h 25 gsvector_neon.h 26 gsvector_nosimd.h 27 gsvector_sse.h 28 intrin.h 29 hash_combine.h 30 heap_array.h 31 heterogeneous_containers.h 32 layered_settings_interface.cpp 33 layered_settings_interface.h 34 log.cpp 35 log.h 36 memmap.cpp 37 memmap.h 38 md5_digest.cpp 39 md5_digest.h 40 memory_settings_interface.cpp 41 memory_settings_interface.h 42 minizip_helpers.h 43 path.h 44 perf_scope.cpp 45 perf_scope.h 46 progress_callback.cpp 47 progress_callback.h 48 scoped_guard.h 49 settings_interface.h 50 sha1_digest.cpp 51 sha1_digest.h 52 small_string.cpp 53 small_string.h 54 string_util.cpp 55 string_util.h 56 thirdparty/SmallVector.cpp 57 thirdparty/SmallVector.h 58 threading.cpp 59 threading.h 60 timer.cpp 61 timer.h 62 types.h 63 ) 64 65 target_include_directories(common PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/..") 66 target_include_directories(common PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..") 67 target_link_libraries(common PUBLIC fmt Threads::Threads fast_float) 68 target_link_libraries(common PRIVATE "${CMAKE_DL_LIBS}") 69 70 if(WIN32) 71 target_sources(common PRIVATE 72 thirdparty/StackWalker.cpp 73 thirdparty/StackWalker.h 74 windows_headers.h 75 ) 76 target_link_libraries(common PRIVATE OneCore.lib) 77 endif() 78 79 if(MSVC) 80 if(CPU_ARCH_X64) 81 enable_language(ASM_MASM) 82 target_sources(common PRIVATE fastjmp_x86.asm) 83 set_source_files_properties(fastjmp_x86.asm PROPERTIES COMPILE_FLAGS "/D_M_X86_64") 84 elseif(CPU_ARCH_ARM32 OR CPU_ARCH_ARM64) 85 enable_language(ASM_MARMASM) 86 target_sources(common PRIVATE fastjmp_arm.asm) 87 endif() 88 endif() 89 90 if(APPLE) 91 set(MAC_SOURCES 92 cocoa_tools.h 93 cocoa_tools.mm 94 ) 95 target_sources(common PRIVATE ${MAC_SOURCES}) 96 set_source_files_properties(${MAC_SOURCES} PROPERTIES SKIP_PRECOMPILE_HEADERS TRUE) 97 find_library(COCOA_LIBRARY Cocoa REQUIRED) 98 target_link_libraries(common PRIVATE ${COCOA_LIBRARY}) 99 endif() 100 101 if(NOT WIN32 AND NOT ANDROID AND NOT APPLE) 102 target_link_libraries(common PRIVATE libbacktrace::libbacktrace) 103 endif() 104 105 if(ANDROID) 106 target_link_libraries(common PRIVATE log) 107 endif() 108 109 if(LINUX) 110 # We need -lrt for shm_unlink 111 target_link_libraries(common PRIVATE rt) 112 endif() 113 114 # If the host size was detected, we need to set it as a macro. 115 if(HOST_PAGE_SIZE) 116 target_compile_definitions(common PUBLIC "-DOVERRIDE_HOST_PAGE_SIZE=${HOST_PAGE_SIZE}") 117 endif() 118 if(HOST_CACHE_LINE_SIZE) 119 target_compile_definitions(common PUBLIC "-DOVERRIDE_HOST_CACHE_LINE_SIZE=${HOST_CACHE_LINE_SIZE}") 120 endif()