Antonio Maiorano | 9418b51 | 2020-04-08 23:18:13 -0400 | [diff] [blame] | 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 | |
| 15 | set(ROOT_PROJECT_COMPILE_OPTIONS |
| 16 | ${SWIFTSHADER_COMPILE_OPTIONS} |
| 17 | ${WARNINGS_AS_ERRORS} |
| 18 | ) |
| 19 | |
| 20 | set(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 |
Ben Clayton | ac43aa7 | 2020-04-04 00:48:13 +0100 | [diff] [blame] | 31 | LRUCache.hpp |
Antonio Maiorano | 9418b51 | 2020-04-08 23:18:13 -0400 | [diff] [blame] | 32 | Math.cpp |
| 33 | Math.hpp |
| 34 | Memory.cpp |
| 35 | Memory.hpp |
| 36 | SharedLibrary.hpp |
| 37 | Socket.cpp |
| 38 | Socket.hpp |
| 39 | Synchronization.hpp |
Daniele Vettorel | 0a7fd30 | 2022-01-21 21:19:09 +0000 | [diff] [blame] | 40 | SwiftConfig.cpp |
| 41 | SwiftConfig.hpp |
Antonio Maiorano | 9418b51 | 2020-04-08 23:18:13 -0400 | [diff] [blame] | 42 | Timer.cpp |
| 43 | Timer.hpp |
| 44 | Types.hpp |
| 45 | ) |
| 46 | |
| 47 | if(LINUX OR ANDROID) |
| 48 | list(APPEND SYSTEM_SRC_FILES |
| 49 | Linux/MemFd.cpp |
| 50 | Linux/MemFd.hpp |
| 51 | ) |
| 52 | endif() |
| 53 | |
Nicolas Capens | ff91ac5 | 2021-11-29 18:29:01 +0000 | [diff] [blame] | 54 | set(SYSTEM_COMPILE_OPTIONS "") |
| 55 | if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") |
| 56 | list(APPEND SYSTEM_COMPILE_OPTIONS |
| 57 | "-Wexit-time-destructors" # declaration requires an exit-time destructor |
| 58 | ) |
Daniele Vettorel | 45f7fdc | 2022-02-04 20:09:08 +0000 | [diff] [blame] | 59 | # We use exit-time destructors for the global configuration. |
| 60 | SET_SOURCE_FILES_PROPERTIES("SwiftConfig.cpp" PROPERTIES COMPILE_FLAGS "-Wno-exit-time-destructors") |
Nicolas Capens | ff91ac5 | 2021-11-29 18:29:01 +0000 | [diff] [blame] | 61 | endif() |
| 62 | |
Antonio Maiorano | 9418b51 | 2020-04-08 23:18:13 -0400 | [diff] [blame] | 63 | add_library(vk_system EXCLUDE_FROM_ALL |
| 64 | ${SYSTEM_SRC_FILES} |
| 65 | ) |
| 66 | |
| 67 | set_target_properties(vk_system PROPERTIES |
| 68 | POSITION_INDEPENDENT_CODE 1 |
| 69 | FOLDER "SwiftShader VK" |
Antonio Maiorano | 9418b51 | 2020-04-08 23:18:13 -0400 | [diff] [blame] | 70 | ) |
| 71 | |
| 72 | target_include_directories(vk_system |
| 73 | PUBLIC |
| 74 | ".." |
| 75 | ) |
| 76 | |
| 77 | target_compile_options(vk_system |
Antonio Maiorano | 47d09cb | 2020-04-15 13:11:38 -0400 | [diff] [blame] | 78 | PRIVATE |
Antonio Maiorano | 9418b51 | 2020-04-08 23:18:13 -0400 | [diff] [blame] | 79 | ${ROOT_PROJECT_COMPILE_OPTIONS} |
Nicolas Capens | ff91ac5 | 2021-11-29 18:29:01 +0000 | [diff] [blame] | 80 | ${SYSTEM_COMPILE_OPTIONS} |
Antonio Maiorano | 9418b51 | 2020-04-08 23:18:13 -0400 | [diff] [blame] | 81 | ) |
Antonio Maiorano | 63aa954 | 2020-04-20 17:52:01 -0400 | [diff] [blame] | 82 | |
Ben Clayton | f2ab65b | 2020-11-20 15:12:27 +0000 | [diff] [blame] | 83 | target_link_libraries(vk_system |
| 84 | PUBLIC |
| 85 | marl |
| 86 | ) |
| 87 | |
Antonio Maiorano | 63aa954 | 2020-04-20 17:52:01 -0400 | [diff] [blame] | 88 | target_link_options(vk_system |
| 89 | PUBLIC |
| 90 | ${SWIFTSHADER_LINK_FLAGS} |
| 91 | ) |