1# ~~~
2# Copyright (c) 2021 Valve Corporation
3# Copyright (c) 2021 LunarG, Inc.
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9#     http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16# ~~~
17
18add_library(shim-common STATIC shim_common.cpp)
19target_link_libraries(shim-common PUBLIC testing_framework_util)
20target_include_directories(shim-common PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
21
22if (WIN32)
23    # need adapters.h which is in the loader folder
24    target_include_directories(shim-common PUBLIC ${CMAKE_SOURCE_DIR}/loader)
25    target_link_libraries(shim-common PRIVATE cfgmgr32)
26
27    add_library(shim-library SHARED windows_shim.cpp)
28    target_link_libraries(shim-library PRIVATE detours cfgmgr32)
29
30elseif(UNIX)
31    if(APPLE)
32        add_library(shim-library SHARED unix_shim.cpp)
33        target_link_libraries(shim-library PRIVATE "-framework CoreFoundation")
34    else()
35        add_library(shim-library STATIC unix_shim.cpp)
36    endif()
37endif()
38#common attributes
39target_link_libraries(shim-library PUBLIC shim-common)
40