blob: e19097c4f42bbf9e3b956698b04a21d94c1f7afb [file] [log] [blame]
Antonio Maiorano9418b512020-04-08 23:18:13 -04001# 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
Ben Claytonac43aa72020-04-04 00:48:13 +010031 LRUCache.hpp
Antonio Maiorano9418b512020-04-08 23:18:13 -040032 Math.cpp
33 Math.hpp
34 Memory.cpp
35 Memory.hpp
36 SharedLibrary.hpp
37 Socket.cpp
38 Socket.hpp
39 Synchronization.hpp
Daniele Vettorel0a7fd302022-01-21 21:19:09 +000040 SwiftConfig.cpp
41 SwiftConfig.hpp
Antonio Maiorano9418b512020-04-08 23:18:13 -040042 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
Nicolas Capensff91ac52021-11-29 18:29:01 +000054set(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 )
Daniele Vettorel45f7fdc2022-02-04 20:09:08 +000059 # We use exit-time destructors for the global configuration.
60 SET_SOURCE_FILES_PROPERTIES("SwiftConfig.cpp" PROPERTIES COMPILE_FLAGS "-Wno-exit-time-destructors")
Nicolas Capensff91ac52021-11-29 18:29:01 +000061endif()
62
Antonio Maiorano9418b512020-04-08 23:18:13 -040063add_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"
Antonio Maiorano9418b512020-04-08 23:18:13 -040070)
71
72target_include_directories(vk_system
73 PUBLIC
74 ".."
75)
76
77target_compile_options(vk_system
Antonio Maiorano47d09cb2020-04-15 13:11:38 -040078 PRIVATE
Antonio Maiorano9418b512020-04-08 23:18:13 -040079 ${ROOT_PROJECT_COMPILE_OPTIONS}
Nicolas Capensff91ac52021-11-29 18:29:01 +000080 ${SYSTEM_COMPILE_OPTIONS}
Antonio Maiorano9418b512020-04-08 23:18:13 -040081)
Antonio Maiorano63aa9542020-04-20 17:52:01 -040082
Ben Claytonf2ab65b2020-11-20 15:12:27 +000083target_link_libraries(vk_system
84 PUBLIC
85 marl
86)
87
Antonio Maiorano63aa9542020-04-20 17:52:01 -040088target_link_options(vk_system
89 PUBLIC
90 ${SWIFTSHADER_LINK_FLAGS}
91)