1# Copyright 2020 The SwiftShader Authors. All Rights Reserved. 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15set(ROOT_PROJECT_COMPILE_OPTIONS 16 ${SWIFTSHADER_COMPILE_OPTIONS} 17 ${WARNINGS_AS_ERRORS} 18) 19 20set(SYSTEM_SRC_FILES 21 Build.cpp 22 Build.hpp 23 Configurator.cpp 24 Configurator.hpp 25 CPUID.cpp 26 CPUID.hpp 27 Debug.cpp 28 Debug.hpp 29 Half.cpp 30 Half.hpp 31 LRUCache.hpp 32 Math.cpp 33 Math.hpp 34 Memory.cpp 35 Memory.hpp 36 SharedLibrary.hpp 37 Socket.cpp 38 Socket.hpp 39 Synchronization.hpp 40 SwiftConfig.cpp 41 SwiftConfig.hpp 42 Timer.cpp 43 Timer.hpp 44 Types.hpp 45) 46 47if(LINUX OR ANDROID) 48 list(APPEND SYSTEM_SRC_FILES 49 Linux/MemFd.cpp 50 Linux/MemFd.hpp 51 ) 52endif() 53 54set(SYSTEM_COMPILE_OPTIONS "") 55if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") 56 list(APPEND SYSTEM_COMPILE_OPTIONS 57 "-Wexit-time-destructors" # declaration requires an exit-time destructor 58 ) 59 # We use exit-time destructors for the global configuration. 60 SET_SOURCE_FILES_PROPERTIES("SwiftConfig.cpp" PROPERTIES COMPILE_FLAGS "-Wno-exit-time-destructors") 61endif() 62 63add_library(vk_system EXCLUDE_FROM_ALL 64 ${SYSTEM_SRC_FILES} 65) 66 67set_target_properties(vk_system PROPERTIES 68 POSITION_INDEPENDENT_CODE 1 69 FOLDER "SwiftShader VK" 70) 71 72target_include_directories(vk_system 73 PUBLIC 74 ".." 75) 76 77target_compile_options(vk_system 78 PRIVATE 79 ${ROOT_PROJECT_COMPILE_OPTIONS} 80 ${SYSTEM_COMPILE_OPTIONS} 81) 82 83target_link_libraries(vk_system 84 PUBLIC 85 marl 86) 87 88target_link_options(vk_system 89 PUBLIC 90 ${SWIFTSHADER_LINK_FLAGS} 91) 92