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(MAIN_SRC_FILES
21    Config.cpp
22    Config.hpp
23    FrameBuffer.cpp
24    FrameBuffer.hpp
25    SwiftConfig.cpp
26    SwiftConfig.hpp
27)
28
29if(WIN32)
30    list(APPEND MAIN_SRC_FILES
31        FrameBufferDD.cpp
32        FrameBufferDD.hpp
33        FrameBufferGDI.cpp
34        FrameBufferGDI.hpp
35        FrameBufferWin.cpp
36        FrameBufferWin.hpp
37    )
38elseif(LINUX)
39    list(APPEND MAIN_SRC_FILES
40        FrameBufferX11.cpp
41        FrameBufferX11.hpp
42        libX11.cpp
43        libX11.hpp
44    )
45elseif(APPLE)
46    list(APPEND MAIN_SRC_FILES
47        FrameBufferOSX.mm
48        FrameBufferOSX.hpp
49    )
50elseif(ANDROID)
51    list(APPEND MAIN_SRC_FILES
52        FrameBufferAndroid.cpp
53        FrameBufferAndroid.hpp
54    )
55endif()
56
57add_library(gl_main EXCLUDE_FROM_ALL
58    ${MAIN_SRC_FILES}
59)
60
61set_target_properties(gl_main PROPERTIES
62    POSITION_INDEPENDENT_CODE 1
63    FOLDER "SwiftShader GL"
64)
65
66target_include_directories(gl_main
67    PUBLIC
68        ".."
69    PRIVATE
70        ${SWIFTSHADER_DIR}/include # For EGL
71)
72
73target_compile_definitions(gl_main
74    PRIVATE
75        "NO_SANITIZE_FUNCTION="
76)
77
78target_compile_options(gl_main
79    PRIVATE
80        ${ROOT_PROJECT_COMPILE_OPTIONS}
81)
82
83target_link_options(gl_main
84    PUBLIC
85        ${SWIFTSHADER_LINK_FLAGS}
86)
87
88target_link_libraries(gl_main
89    PUBLIC
90        gl_common
91        ${Reactor}
92)
93