blob: 0f4e4afaa83fa4fc47b602a0883eab184bf6453d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
# FindEffects11
# -------
# Finds the Effects11 library
#
# This will define the following target:
#
# windows::Effects11 - The Effects11 library
if(NOT TARGET windows::Effects11)
include(cmake/scripts/common/ModuleHelpers.cmake)
macro(buildEffects11)
set(patches "${CMAKE_SOURCE_DIR}/tools/depends/target/${MODULE_LC}/01-win-debugpostfix.patch")
generate_patchcommand("${patches}")
# Effects 11 cant be built using /permissive-
# strip and manually set the rest of the build flags
string(REPLACE "/permissive-" "" EFFECTS_CXX_FLAGS ${CMAKE_CXX_FLAGS} )
set(CMAKE_ARGS
"-DCMAKE_CXX_FLAGS=${EFFECTS_CXX_FLAGS} $<$<CONFIG:Debug>:${CMAKE_CXX_FLAGS_DEBUG}> $<$<CONFIG:Release>:${CMAKE_CXX_FLAGS_RELEASE}>"
"-DCMAKE_EXE_LINKER_FLAGS=${CMAKE_EXE_LINKER_FLAGS} $<$<CONFIG:Debug>:${CMAKE_EXE_LINKER_FLAGS_DEBUG}> $<$<CONFIG:Release>:${CMAKE_EXE_LINKER_FLAGS_RELEASE}>")
set(EFFECTS11_DEBUG_POSTFIX d)
set(WIN_DISABLE_PROJECT_FLAGS ON)
BUILD_DEP_TARGET()
set(EFFECTS11_VERSION ${${MODULE}_VER})
# Make INCLUDE_DIR match cmake config output
string(APPEND EFFECTS11_INCLUDE_DIR "/Effects11")
file(MAKE_DIRECTORY ${EFFECTS11_INCLUDE_DIR})
endmacro()
set(MODULE_LC effects11)
SETUP_BUILD_VARS()
find_package(effects11 CONFIG QUIET
HINTS ${DEPENDS_PATH}/share
${${CORE_PLATFORM_NAME_LC}_SEARCH_CONFIG})
if(effects11_VERSION VERSION_LESS ${${MODULE}_VER})
buildEffects11()
else()
get_target_property(_EFFECTS_CONFIGURATIONS Microsoft::Effects11 IMPORTED_CONFIGURATIONS)
foreach(_effects_config IN LISTS _EFFECTS_CONFIGURATIONS)
# Some non standard config (eg None on Debian)
# Just set to RELEASE var so select_library_configurations can continue to work its magic
string(TOUPPER ${_effects_config} _effects_config_UPPER)
if((NOT ${_effects_config_UPPER} STREQUAL "RELEASE") AND
(NOT ${_effects_config_UPPER} STREQUAL "DEBUG"))
get_target_property(EFFECTS11_LIBRARY_RELEASE Microsoft::Effects11 IMPORTED_LOCATION_${_effects_config_UPPER})
else()
get_target_property(EFFECTS11_LIBRARY_${_effects_config_UPPER} Microsoft::Effects11 IMPORTED_LOCATION_${_effects_config_UPPER})
endif()
endforeach()
get_target_property(EFFECTS11_INCLUDE_DIR Microsoft::Effects11 INTERFACE_INCLUDE_DIRECTORIES)
set(EFFECTS11_VERSION ${effects11_VERSION})
endif()
include(SelectLibraryConfigurations)
select_library_configurations(EFFECTS11)
unset(EFFECTS11_LIBRARIES)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Effects11
REQUIRED_VARS EFFECTS11_LIBRARY EFFECTS11_INCLUDE_DIR
VERSION_VAR EFFECTS11_VERSION)
if(Effects11_FOUND)
if(TARGET Microsoft::Effects11 AND NOT TARGET effects11)
add_library(windows::Effects11 ALIAS Microsoft::Effects11)
else()
add_library(windows::Effects11 UNKNOWN IMPORTED)
set_target_properties(windows::Effects11 PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${EFFECTS11_INCLUDE_DIR}")
if(EFFECTS11_LIBRARY_RELEASE)
set_target_properties(windows::Effects11 PROPERTIES
IMPORTED_CONFIGURATIONS RELEASE
IMPORTED_LOCATION_RELEASE "${EFFECTS11_LIBRARY_RELEASE}")
endif()
if(EFFECTS11_LIBRARY_DEBUG)
set_target_properties(windows::Effects11 PROPERTIES
IMPORTED_CONFIGURATIONS DEBUG
IMPORTED_LOCATION_DEBUG "${EFFECTS11_LIBRARY_DEBUG}")
endif()
endif()
if(TARGET effects11)
add_dependencies(windows::Effects11 effects11)
endif()
# Add internal build target when a Multi Config Generator is used
# We cant add a dependency based off a generator expression for targeted build types,
# https://gitlab.kitware.com/cmake/cmake/-/issues/19467
# therefore if the find heuristics only find the library, we add the internal build
# target to the project to allow user to manually trigger for any build type they need
# in case only a specific build type is actually available (eg Release found, Debug Required)
# This is mainly targeted for windows who required different runtime libs for different
# types, and they arent compatible
if(_multiconfig_generator)
if(NOT TARGET effects11)
buildEffects11()
set_target_properties(effects11 PROPERTIES EXCLUDE_FROM_ALL TRUE)
endif()
add_dependencies(build_internal_depends effects11)
endif()
set_property(GLOBAL APPEND PROPERTY INTERNAL_DEPS_PROP windows::Effects11)
else()
if(Effects11_FIND_REQUIRED)
message(FATAL_ERROR "Could NOT find or build Effects11 library.")
endif()
endif()
endif()
|