Cleanup: CMake: Modernize bf_intern_utfconv dependencies

- Remove any bf_intern_utfconv paths from INC
- Add a dependency though LIB when missing
- an empty target is created for non windows builds, so we don't have to
if(WIN32) this all over the place

context: https://devtalk.blender.org/t/cmake-cleanup/30260
Pull Request: https://projects.blender.org/blender/blender/pulls/115373
This commit is contained in:
Ray molenkamp
2023-11-28 01:11:15 +01:00
parent e67a0b9350
commit 94817f64b9
7 changed files with 13 additions and 14 deletions

View File

@@ -43,10 +43,7 @@ if(WITH_BULLET)
add_subdirectory(rigidbody)
endif()
# only windows needs utf16 converter
if(WIN32)
add_subdirectory(utfconv)
endif()
add_subdirectory(utfconv)
if(WITH_MOD_FLUID)
add_subdirectory(mantaflow)

View File

@@ -3,7 +3,7 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(INC
.
PUBLIC .
)
set(INC_SYS
@@ -19,14 +19,16 @@ set(SRC
set(LIB
)
# This is odd but leave it for now...
# Why have win32 check here? - this is only used for windows.
# ... because one day we might want to use it on other platforms.
# This library is currently windows only, for the other platforms an empty target is created this
# way we don't have to clutter if(WIN32) ... endif() all over the place to use this library.
if(WIN32)
list(APPEND SRC
utf_winfunc.cc
utf_winfunc.hh
)
blender_add_lib(bf_intern_utfconv "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
else()
add_library(bf_intern_utfconv INTERFACE)
endif()
blender_add_lib(bf_intern_utfconv "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
add_library(bf::intern::utfconv ALIAS bf_intern_utfconv)

View File

@@ -7,7 +7,6 @@ set(INC
..
../..
../../../blenkernel
../../../../../intern/utfconv
)
set(INC_SYS
@@ -27,6 +26,7 @@ set(LIB
PRIVATE bf::blenlib
PRIVATE bf::dna
PRIVATE bf::intern::guardedalloc
PRIVATE bf::intern::utfconv
)
if(WITH_PUGIXML)

View File

@@ -7,7 +7,6 @@ set(INC
..
../..
../../../blenkernel
../../../../../intern/utfconv
)
set(INC_SYS
@@ -23,6 +22,7 @@ set(LIB
PRIVATE bf::blenlib
PRIVATE bf::dna
PRIVATE bf::intern::guardedalloc
PRIVATE bf::intern::utfconv
)
if(WITH_IMAGE_OPENEXR)

View File

@@ -12,7 +12,6 @@ set(INC
../../editors/include
../../makesrna
../../windowmanager
../../../../intern/utfconv
)
set(INC_SYS
@@ -92,6 +91,7 @@ set(LIB
PRIVATE bf::dna
PRIVATE bf::intern::clog
PRIVATE bf::intern::guardedalloc
PRIVATE bf::intern::utfconv
bf_io_common
${ALEMBIC_LIBRARIES}

View File

@@ -13,7 +13,6 @@ set(INC
../../makesrna
../../windowmanager
../../../../intern/guardedalloc
../../../../intern/utfconv
)
set(INC_SYS
@@ -40,6 +39,7 @@ set(LIB
PRIVATE bf::extern::nanosvg
PRIVATE bf::intern::clog
PRIVATE bf::intern::guardedalloc
PRIVATE bf::intern::utfconv
bf_io_common
)

View File

@@ -66,7 +66,6 @@ set(INC
../../nodes
../../python/intern
../../windowmanager
../../../../intern/utfconv
# RNA_prototypes.h
${CMAKE_BINARY_DIR}/source/blender/makesrna
)
@@ -186,6 +185,7 @@ set(LIB
PRIVATE bf::imbuf
PRIVATE bf::intern::clog
PRIVATE bf::intern::guardedalloc
PRIVATE bf::intern::utfconv
bf_io_common
)