-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
217 lines (188 loc) · 6.33 KB
/
CMakeLists.txt
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
cmake_minimum_required( VERSION 3.24.0 )
if( APPLE )
# Must be set before `project(...)`
# Minimum target is "Big Sur" MacOS 11.0
set( CMAKE_OSX_DEPLOYMENT_TARGET "11.0" CACHE STRING "Minimum OSX Platform Version" )
endif()
project( Vulkanator )
set( CMAKE_CXX_STANDARD 20 )
set( LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin )
set( CMAKE_COLOR_MAKEFILE ON )
set( CMAKE_VERBOSE_MAKEFILE ON )
if( WIN32 )
add_compile_options(
/MP # Parallel builds
/permissive- # Stricter C++ conformance
# Warnings
/W3
# Consider these warnings as errors
/we4018 # 'expression': signed/unsigned mismatch
/we4062 # Enumerator 'identifier' in a switch of enum 'enumeration' is not handled
/we4101 # 'identifier': unreferenced local variable
/we4265 # 'class': class has virtual functions, but destructor is not virtual
/we4305 # 'context': truncation from 'type1' to 'type2'
/we4388 # 'expression': signed/unsigned mismatch
/we4389 # 'operator': signed/unsigned mismatch
/we4456 # Declaration of 'identifier' hides previous local declaration
/we4457 # Declaration of 'identifier' hides function parameter
/we4458 # Declaration of 'identifier' hides class member
/we4459 # Declaration of 'identifier' hides global declaration
/we4505 # 'function': unreferenced local function has been removed
/we4547 # 'operator': operator before comma has no effect; expected operator with side-effect
/we4549 # 'operator1': operator before comma has no effect; did you intend 'operator2'?
/we4555 # Expression has no effect; expected expression with side-effect
/we4715 # 'function': not all control paths return a value
/we4834 # Discarding return value of function with 'nodiscard' attribute
/we5038 # data member 'member1' will be initialized after data member 'member2'
/we5245 # 'function': unreferenced function with internal linkage has been removed
)
elseif( APPLE )
# Create Universal Binary
set( CMAKE_OSX_ARCHITECTURES "arm64;x86_64" )
# Warnings
add_compile_options(
-Wall
-Warray-bounds
-Wextra
-Wimplicit-fallthrough
-Wmissing-declarations
-Wmissing-declarations
-Wmissing-field-initializers
-Wno-attributes
-Wno-invalid-offsetof
-Wno-unused-parameter
-Wreorder
-Wshadow
-Wsign-compare
-Wswitch
-Wuninitialized
-Wunused-function
-Wunused-result
-Wunused-variable
)
# Disable warnings
add_compile_options(
-Wno-pragma-pack
)
endif()
# Libraries
find_package(
Vulkan REQUIRED
COMPONENTS
glslangValidator
)
add_subdirectory( extern )
add_subdirectory( shaders )
add_library(
${PROJECT_NAME}
MODULE
source/VulkanUtils.cpp
source/Vulkanator.cpp
)
target_include_directories(
${PROJECT_NAME}
PRIVATE
include
)
if( WIN32 )
set(
PLUGIN_FOLDER
"C:/Program Files/Adobe/Adobe After Effects 2022/Support Files/Plug-ins"
CACHE
STRING
"After Effects Plugin folder"
)
#cl /I "..\extern\Adobe After Effects SDK\Headers" /EP "%(Filename).r" > "$(IntDir)%(Filename).rr"
#"$(ProjectDir)..\extern\Adobe After Effects SDK\Resources\PiPLTool" "$(IntDir)%(Filename).rr" "$(IntDir)%(Filename).rrc"
#cl /D "MSWindows" /EP $(IntDir)%(Filename).rrc > "$(ProjectDir)"\\"%(Filename)".rc
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.rr
COMMAND
cl /I \"${AESDK_ROOT}/Headers\" /EP \"${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.r\" > ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.rr
)
add_custom_command(
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.rr
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.rrc
COMMAND ${AFX_REZ} ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.rr ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.rrc
)
add_custom_command(
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.rrc
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.rc
COMMAND cl /D "MSWindows" /EP ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.rrc > ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.rc
)
target_sources(
${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.rc
)
elseif( APPLE )
set(
PLUGIN_FOLDER
"/Applications/Adobe After Effects 2022/Plug-ins/"
CACHE
STRING
"After Effects Plugin folder"
)
set( ${PIPL_INCLUDES} "" )
foreach( INC ${AESDK_INCLUDE} )
list( APPEND PIPL_INCLUDES -i ${INC} )
endforeach()
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.rsrc
COMMAND ${AFX_REZ}
ARGS ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.r
-o ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.rsrc
-useDF
${PIPL_INCLUDES}
-D __MACH__
)
set_source_files_properties(
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.rsrc
PROPERTIES
MACOSX_PACKAGE_LOCATION Resources/
)
target_sources( ${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.rsrc )
endif()
cmrc_add_resource_library(
${PROJECT_NAME}-Resources
ALIAS Resource::${PROJECT_NAME}
NAMESPACE ${PROJECT_NAME}
WHENCE ${CMAKE_BINARY_DIR}
"${CMAKE_BINARY_DIR}/shaders/Vulkanator.vert.spv"
"${CMAKE_BINARY_DIR}/shaders/Vulkanator.frag.spv"
)
add_dependencies( ${PROJECT_NAME}-Resources Shaders)
target_link_libraries(
${PROJECT_NAME}
AESDK
glm
Vulkan::Vulkan
Resource::${PROJECT_NAME}
)
install(
TARGETS ${PROJECT_NAME}
DESTINATION ${PLUGIN_FOLDER}
)
if( WIN32 )
set_target_properties(${PROJECT_NAME} PROPERTIES SUFFIX ".aex")
elseif( APPLE )
set_target_properties( ${PROJECT_NAME} PROPERTIES PREFIX "" )
set_target_properties( ${PROJECT_NAME} PROPERTIES SUFFIX "" )
set_target_properties( ${PROJECT_NAME} PROPERTIES BUNDLE ON )
set_target_properties( ${PROJECT_NAME} PROPERTIES BUNDLE_EXTENSION "plugin" )
set( MACOSX_BUNDLE_INFO_STRING "${PROJECT_NAME}" )
set( MACOSX_BUNDLE_GUI_IDENTIFIER "com.adobe.AfterEffects.${PROJECT_NAME}" )
set( MACOSX_BUNDLE_BUNDLE_NAME ${PROJECT_NAME} )
string( TIMESTAMP BUILD_YEAR "%Y" )
set( MACOSX_BUNDLE_COPYRIGHT "Copyright Wunkolo ${BUILD_YEAR}. All Rights Reserved." )
#PkgInfo
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/PkgInfo
COMMAND echo "eFKTFXTC" >> ${CMAKE_CURRENT_BINARY_DIR}/PkgInfo
)
set_source_files_properties(
${CMAKE_CURRENT_BINARY_DIR}/PkgInfo
PROPERTIES
MACOSX_PACKAGE_LOCATION ""
)
target_sources( ${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/PkgInfo )
endif()