9494 endif ()
9595endif (WIN32 )
9696
97- add_library (Diligent-BuildSettings INTERFACE )
97+ add_library (Diligent-PublicBuildSettings INTERFACE )
9898
9999if (PLATFORM_WIN32)
100100 if (MSVC )
@@ -111,21 +111,21 @@ if(PLATFORM_WIN32)
111111
112112 set (GL_SUPPORTED TRUE CACHE INTERNAL "OpenGL is supported on Win32 platform" )
113113 set (VULKAN_SUPPORTED TRUE CACHE INTERNAL "Vulkan is supported on Win32 platform" )
114- target_compile_definitions (Diligent-BuildSettings INTERFACE PLATFORM_WIN32=1)
114+ target_compile_definitions (Diligent-PublicBuildSettings INTERFACE PLATFORM_WIN32=1)
115115elseif (PLATFORM_UNIVERSAL_WINDOWS)
116116 set (D3D11_SUPPORTED TRUE CACHE INTERNAL "D3D11 is supported on Universal Windows platform" )
117117 if (CMAKE_SYSTEM_VERSION VERSION_GREATER_EQUAL "10.0" )
118118 set (D3D12_SUPPORTED TRUE CACHE INTERNAL "D3D12 is supported on Universal Windows platform" )
119119 endif ()
120- target_compile_definitions (Diligent-BuildSettings INTERFACE PLATFORM_UNIVERSAL_WINDOWS=1)
120+ target_compile_definitions (Diligent-PublicBuildSettings INTERFACE PLATFORM_UNIVERSAL_WINDOWS=1)
121121elseif (PLATFORM_ANDROID)
122122 set (GLES_SUPPORTED TRUE CACHE INTERNAL "OpenGLES is supported on Android platform" )
123123 set (VULKAN_SUPPORTED TRUE CACHE INTERNAL "Vulkan is supported on Android platform" )
124- target_compile_definitions (Diligent-BuildSettings INTERFACE PLATFORM_ANDROID=1)
124+ target_compile_definitions (Diligent-PublicBuildSettings INTERFACE PLATFORM_ANDROID=1)
125125elseif (PLATFORM_LINUX)
126126 set (GL_SUPPORTED TRUE CACHE INTERNAL "OpenGL is supported on Linux platform" )
127127 set (VULKAN_SUPPORTED TRUE CACHE INTERNAL "Vulkan is supported on Linux platform" )
128- target_compile_definitions (Diligent-BuildSettings INTERFACE PLATFORM_LINUX=1)
128+ target_compile_definitions (Diligent-PublicBuildSettings INTERFACE PLATFORM_LINUX=1)
129129elseif (PLATFORM_MACOS)
130130 set (GL_SUPPORTED TRUE CACHE INTERNAL "OpenGL is supported on MacOS platform" )
131131 if (${DILIGENT_CORE_PRO_EXISTS} )
@@ -134,7 +134,7 @@ elseif(PLATFORM_MACOS)
134134 message ("DiligentCorePro module is not found. Metal backend will be disabled" )
135135 endif ()
136136 set (VULKAN_SUPPORTED TRUE CACHE INTERNAL "Vulkan is enabled through MoltenVK on MacOS platform" )
137- target_compile_definitions (Diligent-BuildSettings INTERFACE PLATFORM_MACOS=1)
137+ target_compile_definitions (Diligent-PublicBuildSettings INTERFACE PLATFORM_MACOS=1)
138138elseif (PLATFORM_IOS)
139139 set (GLES_SUPPORTED TRUE CACHE INTERNAL "OpenGLES is supported on iOS platform" )
140140 if (${DILIGENT_CORE_PRO_EXISTS} )
@@ -156,7 +156,7 @@ elseif(PLATFORM_IOS)
156156 else ()
157157 message ("VULKAN_SDK or MoltenVK_FRAMEWORK is not defined. Vulkan backend will be disabled." )
158158 endif ()
159- target_compile_definitions (Diligent-BuildSettings INTERFACE PLATFORM_IOS=1)
159+ target_compile_definitions (Diligent-PublicBuildSettings INTERFACE PLATFORM_IOS=1)
160160else ()
161161 message (FATAL_ERROR "No PLATFORM_XXX variable defined. Make sure that 'DiligentCore' folder is processed first" )
162162endif ()
@@ -207,8 +207,8 @@ message("GLES_SUPPORTED: " ${GLES_SUPPORTED})
207207message ("VULKAN_SUPPORTED: " ${VULKAN_SUPPORTED} )
208208message ("METAL_SUPPORTED: " ${METAL_SUPPORTED} )
209209
210- target_compile_definitions (Diligent-BuildSettings
211- INTERFACE
210+ target_compile_definitions (Diligent-PublicBuildSettings
211+ INTERFACE
212212 D3D11_SUPPORTED=$<BOOL :${D3D11_SUPPORTED} >
213213 D3D12_SUPPORTED=$<BOOL :${D3D12_SUPPORTED} >
214214 GL_SUPPORTED=$<BOOL :${GL_SUPPORTED} >
@@ -217,6 +217,28 @@ INTERFACE
217217 METAL_SUPPORTED=$<BOOL :${METAL_SUPPORTED} >
218218)
219219
220+ foreach (DBG_CONFIG ${DEBUG_CONFIGURATIONS} )
221+ target_compile_definitions (Diligent-PublicBuildSettings INTERFACE "$<$<CONFIG:${DBG_CONFIG} >:DILIGENT_DEVELOPMENT;DILIGENT_DEBUG>" )
222+ endforeach ()
223+
224+ if (DILIGENT_DEVELOPMENT)
225+ foreach (REL_CONFIG ${RELEASE_CONFIGURATIONS} )
226+ target_compile_definitions (Diligent-PublicBuildSettings INTERFACE "$<$<CONFIG:${REL_CONFIG} >:DILIGENT_DEVELOPMENT>" )
227+ endforeach ()
228+ endif ()
229+
230+
231+ add_library (Diligent-BuildSettings INTERFACE )
232+ target_link_libraries (Diligent-BuildSettings INTERFACE Diligent-PublicBuildSettings)
233+
234+ foreach (DBG_CONFIG ${DEBUG_CONFIGURATIONS} )
235+ target_compile_definitions (Diligent-BuildSettings INTERFACE "$<$<CONFIG:${DBG_CONFIG} >:_DEBUG;DEBUG>" )
236+ endforeach ()
237+
238+ foreach (REL_CONFIG ${RELEASE_CONFIGURATIONS} )
239+ target_compile_definitions (Diligent-BuildSettings INTERFACE "$<$<CONFIG:${REL_CONFIG} >:NDEBUG>" )
240+ endforeach ()
241+
220242
221243if (MSVC )
222244 # For msvc, enable level 4 warnings and treat warnings as errors, except for
@@ -247,23 +269,9 @@ if(MSVC)
247269 # For instance, this way
248270 # target_compile_options(Diligent-BuildSettings INTERFACE "$<$<CONFIG:RELEASE>:/Ot>")
249271 # does not work as expected
250-
251- set (DEBUG_MACROS DILIGENT_DEVELOPMENT DILIGENT_DEBUG)
252- target_compile_definitions (Diligent-BuildSettings INTERFACE "$<$<CONFIG:DEBUG>:${DEBUG_MACROS} >" )
253272else ()
254273 # Todo: use __attribute__((always_inline)), but it needs to be defined in a header file
255274 target_compile_definitions (Diligent-BuildSettings INTERFACE __forceinline=inline)
256-
257- set (DEBUG_MACROS _DEBUG DEBUG DILIGENT_DEVELOPMENT DILIGENT_DEBUG)
258- set (RELEASE_MACROS NDEBUG)
259-
260- foreach (DBG_CONFIG ${DEBUG_CONFIGURATIONS} )
261- target_compile_definitions (Diligent-BuildSettings INTERFACE "$<$<CONFIG:${DBG_CONFIG} >:${DEBUG_MACROS} >" )
262- endforeach ()
263-
264- foreach (REL_CONFIG ${RELEASE_CONFIGURATIONS} )
265- target_compile_definitions (Diligent-BuildSettings INTERFACE "$<$<CONFIG:${REL_CONFIG} >:${RELEASE_MACROS} >" )
266- endforeach ()
267275endif (MSVC )
268276
269277
@@ -295,12 +303,6 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
295303 target_compile_options (Diligent-BuildSettings INTERFACE $<$<NOT :$<CONFIG:Debug>>:${CLANG_RELEASE_OPTIONS} >)
296304endif ()
297305
298- if (DILIGENT_DEVELOPMENT)
299- foreach (REL_CONFIG ${RELEASE_CONFIGURATIONS} )
300- target_compile_definitions (Diligent-BuildSettings INTERFACE "$<$<CONFIG:${REL_CONFIG} >:DILIGENT_DEVELOPMENT>" )
301- endforeach ()
302- endif ()
303-
304306if (PLATFORM_MACOS)
305307 find_library (APP_KIT AppKit)
306308 if (NOT APP_KIT)
0 commit comments