Skip to content

Commit

Permalink
Cleanup: CMake: Modernize bf_intern_utfconv dependencies
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
Ray molenkamp committed Nov 28, 2023
1 parent e67a0b9 commit 94817f6
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 14 deletions.
5 changes: 1 addition & 4 deletions intern/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 7 additions & 5 deletions intern/utfconv/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: GPL-2.0-or-later

set(INC
.
PUBLIC .
)

set(INC_SYS
Expand All @@ -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)
2 changes: 1 addition & 1 deletion source/blender/imbuf/intern/oiio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ set(INC
..
../..
../../../blenkernel
../../../../../intern/utfconv
)

set(INC_SYS
Expand All @@ -27,6 +26,7 @@ set(LIB
PRIVATE bf::blenlib
PRIVATE bf::dna
PRIVATE bf::intern::guardedalloc
PRIVATE bf::intern::utfconv
)

if(WITH_PUGIXML)
Expand Down
2 changes: 1 addition & 1 deletion source/blender/imbuf/intern/openexr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ set(INC
..
../..
../../../blenkernel
../../../../../intern/utfconv
)

set(INC_SYS
Expand All @@ -23,6 +22,7 @@ set(LIB
PRIVATE bf::blenlib
PRIVATE bf::dna
PRIVATE bf::intern::guardedalloc
PRIVATE bf::intern::utfconv
)

if(WITH_IMAGE_OPENEXR)
Expand Down
2 changes: 1 addition & 1 deletion source/blender/io/alembic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ set(INC
../../editors/include
../../makesrna
../../windowmanager
../../../../intern/utfconv
)

set(INC_SYS
Expand Down Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion source/blender/io/gpencil/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ set(INC
../../makesrna
../../windowmanager
../../../../intern/guardedalloc
../../../../intern/utfconv
)

set(INC_SYS
Expand All @@ -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
)

Expand Down
2 changes: 1 addition & 1 deletion source/blender/io/usd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ set(INC
../../nodes
../../python/intern
../../windowmanager
../../../../intern/utfconv
# RNA_prototypes.h
${CMAKE_BINARY_DIR}/source/blender/makesrna
)
Expand Down Expand Up @@ -186,6 +185,7 @@ set(LIB
PRIVATE bf::imbuf
PRIVATE bf::intern::clog
PRIVATE bf::intern::guardedalloc
PRIVATE bf::intern::utfconv
bf_io_common
)

Expand Down

0 comments on commit 94817f6

Please sign in to comment.