Build: fix gtest build flags affecting actual library

Switch to target_ functions to avoid this.
This commit is contained in:
Brecht Van Lommel
2022-09-18 07:41:13 +02:00
parent 6bf5cc62e0
commit 0ffd288fab
14 changed files with 116 additions and 111 deletions

View File

@@ -7,6 +7,7 @@ endif()
set(INC
.
..
# ../blenkernel # don't add this back!
../makesdna
../../../intern/atomic

View File

@@ -4,6 +4,10 @@
set(INC
.
..
../..
../../../makesdna
../../../../../intern/guardedalloc
../../../../../intern/atomic
)
include_directories(${INC})

View File

@@ -4,7 +4,7 @@
# -----------------------------------------------------------------------------
# Build msgfmt executable
blender_include_dirs(
set(INC
../../../../intern/guardedalloc
../../blenlib
)
@@ -13,21 +13,20 @@ set(SRC
msgfmt.c
)
set(LIB
bf_blenlib
bf_intern_guardedalloc
${ZLIB_LIBRARIES}
${PLATFORM_LINKLIBS})
add_cc_flags_custom_test(msgfmt)
if(WIN32)
string(APPEND CMAKE_EXE_LINKER_FLAGS_DEBUG " /nodefaultlib:MSVCRT.lib")
list(APPEND LIB bf_intern_utfconv)
endif()
add_executable(msgfmt ${SRC})
setup_platform_linker_flags(msgfmt)
target_link_libraries(msgfmt bf_blenlib)
target_link_libraries(msgfmt bf_intern_guardedalloc)
if(WIN32)
target_link_libraries(msgfmt bf_intern_utfconv)
endif()
target_link_libraries(msgfmt ${ZLIB_LIBRARIES})
target_link_libraries(msgfmt ${PLATFORM_LINKLIBS})
blender_target_include_dirs(msgfmt ${INC})
target_link_libraries(msgfmt ${LIB})

View File

@@ -75,7 +75,7 @@ set(LIB
)
if(WITH_PYTHON)
blender_include_dirs(../../python)
list(APPEND INC ../../python)
add_definitions(-DWITH_PYTHON)
endif()

View File

@@ -3,6 +3,22 @@
# message(STATUS "Configuring makesdna")
set(INC
..
../../blenlib
../../imbuf
../../../../intern/atomic
../../../../intern/guardedalloc
${CMAKE_CURRENT_BINARY_DIR}
)
set(INC_SYS
)
set(LIB
)
add_definitions(-DWITH_DNA_GHASH)
# Needed for `mallocn.c`.
@@ -10,14 +26,6 @@ if(HAVE_MALLOC_STATS_H)
add_definitions(-DHAVE_MALLOC_STATS_H)
endif()
blender_include_dirs(
../../../../intern/atomic
../../../../intern/guardedalloc
../../blenlib
../../imbuf
..
)
set(dna_header_include_file "${CMAKE_CURRENT_BINARY_DIR}/dna_includes_all.h")
set(dna_header_string_file "${CMAKE_CURRENT_BINARY_DIR}/dna_includes_as_strings.h")
@@ -57,6 +65,8 @@ add_cc_flags_custom_test(makesdna)
add_executable(makesdna ${SRC} ${SRC_DNA_INC})
setup_platform_linker_flags(makesdna)
blender_target_include_dirs(makesdna ${INC})
blender_target_include_dirs_sys(makesdna ${INC_SYS})
if(WIN32 AND NOT UNIX)
target_link_libraries(makesdna ${PTHREADS_LIBRARIES})
@@ -80,14 +90,6 @@ add_custom_command(
# -----------------------------------------------------------------------------
# Build bf_dna library
set(INC
${CMAKE_CURRENT_BINARY_DIR}
)
set(INC_SYS
)
set(SRC
dna_defaults.c
dna_genfile.c
@@ -101,9 +103,6 @@ set(SRC
dna_utils.h
)
set(LIB
)
set_source_files_properties(
${CMAKE_CURRENT_BINARY_DIR}/dna.c
${CMAKE_CURRENT_BINARY_DIR}/dna_type_offsets.h
@@ -117,7 +116,10 @@ blender_add_lib(bf_dna "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
# -----------------------------------------------------------------------------
# Build bf_dna_blenlib library
set(INC
../../blenlib
../../makesdna
../../../../intern/atomic
../../../../intern/guardedalloc
)
set(INC_SYS

View File

@@ -185,10 +185,33 @@ set(SRC
)
set(INC
../../../../intern/clog
# Needed for defaults forward declarations.
.
..
../../blenfont
../../blenkernel
../../blenlib
../../blenloader
../../blentranslation
../../bmesh
../../depsgraph
../../draw
../../gpu
../../ikplugin
../../imbuf
../../makesdna
../../modifiers
../../nodes/
../../sequencer
../../simulation
../../windowmanager
../../editors/include
../../render
../../../../intern/clog
../../../../intern/cycles/blender
../../../../intern/atomic
../../../../intern/guardedalloc
../../../../intern/memutil
../../../../intern/mantaflow/extern
${CMAKE_BINARY_DIR}/source/blender/makesdna/intern
@@ -369,38 +392,12 @@ if(WITH_GMP)
endif()
# Build makesrna executable
blender_include_dirs(
.
..
../../blenfont
../../blenkernel
../../blenlib
../../blentranslation
../../bmesh
../../depsgraph
../../draw
../../gpu
../../ikplugin
../../imbuf
../../makesdna
../../modifiers
../../nodes/
../../sequencer
../../simulation
../../windowmanager
../../editors/include
../../render
../../../../intern/cycles/blender
../../../../intern/atomic
../../../../intern/guardedalloc
../../../../intern/memutil
../../../../intern/mantaflow/extern
)
add_cc_flags_custom_test(makesrna)
add_executable(makesrna ${SRC} ${SRC_RNA_INC} ${SRC_DNA_INC})
setup_platform_linker_flags(makesrna)
blender_target_include_dirs(makesrna ${INC})
blender_target_include_dirs_sys(makesrna ${INC_SYS})
target_link_libraries(makesrna bf_dna)
target_link_libraries(makesrna bf_dna_blenlib)

View File

@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright 2006 Blender Foundation. All rights reserved.
blender_include_dirs(
set(INC
../../intern/clog
../../intern/guardedalloc
../blender/blenkernel
@@ -35,17 +35,17 @@ if(WITH_TBB)
endif()
if(WIN32)
blender_include_dirs(../../intern/utfconv)
list(APPEND INC ../../intern/utfconv)
endif()
if(WITH_LIBMV)
blender_include_dirs(../../intern/libmv)
list(APPEND INC ../../intern/libmv)
add_definitions(-DWITH_LIBMV)
endif()
if(WITH_CYCLES)
if(WITH_CYCLES_LOGGING)
blender_include_dirs(../../intern/cycles/blender)
list(APPEND INC ../../intern/cycles/blender)
add_definitions(-DWITH_CYCLES_LOGGING)
endif()
endif()
@@ -55,7 +55,7 @@ if(WITH_CODEC_FFMPEG)
endif()
if(WITH_TBB)
blender_include_dirs(${TBB_INCLUDE_DIRS})
list(APPEND INC ${TBB_INCLUDE_DIRS})
if(WIN32)
# For `pragma` that links `tbbmalloc_proxy.lib`.
link_directories(${LIBDIR}/tbb/lib)
@@ -64,7 +64,7 @@ endif()
if(WITH_PYTHON)
blender_include_dirs(../blender/python)
list(APPEND INC ../blender/python)
add_definitions(-DWITH_PYTHON)
if(WITH_PYTHON_SECURITY)
@@ -78,19 +78,19 @@ endif()
if(WITH_SDL)
if(WITH_SDL_DYNLOAD)
blender_include_dirs(../../extern/sdlew/include)
list(APPEND INC ../../extern/sdlew/include)
add_definitions(-DWITH_SDL_DYNLOAD)
endif()
add_definitions(-DWITH_SDL)
endif()
if(WITH_BINRELOC)
blender_include_dirs(${BINRELOC_INCLUDE_DIRS})
list(APPEND INC ${BINRELOC_INCLUDE_DIRS})
add_definitions(-DWITH_BINRELOC)
endif()
if(WITH_FREESTYLE)
blender_include_dirs(../blender/freestyle)
list(APPEND INC ../blender/freestyle)
add_definitions(-DWITH_FREESTYLE)
endif()
@@ -99,7 +99,7 @@ if(WITH_XR_OPENXR)
endif()
if(WITH_GMP)
blender_include_dirs(${GMP_INCLUDE_DIRS})
list(APPEND INC ${GMP_INCLUDE_DIRS})
add_definitions(-DWITH_GMP)
endif()
@@ -1285,6 +1285,7 @@ if(DEFINED PLATFORM_SYMBOLS_MAP)
set_target_properties(blender PROPERTIES LINK_DEPENDS ${PLATFORM_SYMBOLS_MAP})
endif()
blender_target_include_dirs(blender ${INC})
# -----------------------------------------------------------------------------
# USD registry.