Skip to content

Commit

Permalink
Add CONFIGURE_DEPENDS to CMake GLOB lists
Browse files Browse the repository at this point in the history
The addition of new source files will not ordinarily trigger them to be
added to the build due to how GLOBs are implemented in CMake.

CMake 3.12 added a new CONFIGURE_DEPENDS flag to enable CMake to
re-check GLOB results during build time and re-generate the build
scripts if necessary. The existing CMakeLists.txt already specifies a
minimum CMake version of 3.13 so this should always be available.
  • Loading branch information
georges-arm committed Oct 8, 2024
1 parent 49cb3f5 commit 2887203
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 22 deletions.
6 changes: 3 additions & 3 deletions source/App/vvencFFapp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
set( EXE_NAME vvencFFapp )

# get source files
file( GLOB SRC_FILES "*.cpp" )
file( GLOB SRC_FILES CONFIGURE_DEPENDS "*.cpp" )

# get include files
file( GLOB INC_FILES "*.h" )
file( GLOB INC_FILES CONFIGURE_DEPENDS "*.h" )

# get address sanitizer libs for gcc
if( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
Expand All @@ -17,7 +17,7 @@ endif()
# set resource file for MSVC compilers
if( MSVC )
set( RESOURCE_FILE ${EXE_NAME}.rc )
file( GLOB NATVIS_FILES "../../VisualStudio/*.natvis" )
file( GLOB NATVIS_FILES CONFIGURE_DEPENDS "../../VisualStudio/*.natvis" )
# extend the stack size on windows to 2MB
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:0x200000" )
endif()
Expand Down
4 changes: 2 additions & 2 deletions source/App/vvencapp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
set( EXE_NAME vvencapp )

# get source files
file( GLOB SRC_FILES "*.cpp" )
file( GLOB SRC_FILES CONFIGURE_DEPENDS "*.cpp" )

# get include files
file( GLOB INC_FILES "*.h" )
file( GLOB INC_FILES CONFIGURE_DEPENDS "*.h" )

# get address sanitizer libs for gcc
if( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
Expand Down
26 changes: 13 additions & 13 deletions source/Lib/vvenc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ else()
endif()

# get source files
file( GLOB BASE_SRC_FILES "*.cpp" "../CommonLib/*.cpp" "../Utilities/*.cpp" "../DecoderLib/*.cpp" "../EncoderLib/*.cpp" )
file( GLOB BASE_SRC_FILES CONFIGURE_DEPENDS "*.cpp" "../CommonLib/*.cpp" "../Utilities/*.cpp" "../DecoderLib/*.cpp" "../EncoderLib/*.cpp" )

# get include files
file( GLOB BASE_INC_FILES "*.h" "../CommonLib/*.h" "../Utilities/*.h" "../DecoderLib/*.h" "../EncoderLib/*.h" "../apputils/*.h" )
file( GLOB BASE_INC_FILES CONFIGURE_DEPENDS "*.h" "../CommonLib/*.h" "../Utilities/*.h" "../DecoderLib/*.h" "../EncoderLib/*.h" "../apputils/*.h" )


if( NOT DEFINED VVENC_ENABLE_X86_SIMD )
Expand All @@ -24,33 +24,33 @@ endif()

if( VVENC_ENABLE_X86_SIMD )
# get x86 source files
file( GLOB X86_SRC_FILES "../CommonLib/x86/*.cpp" )
file( GLOB X86_SRC_FILES CONFIGURE_DEPENDS "../CommonLib/x86/*.cpp" )

# get x86 include files
file( GLOB X86_INC_FILES "../CommonLib/x86/*.h" )
file( GLOB X86_INC_FILES CONFIGURE_DEPENDS "../CommonLib/x86/*.h" )

# get avx source files
file( GLOB AVX_SRC_FILES "../CommonLib/x86/avx/*.cpp" )
file( GLOB AVX_SRC_FILES CONFIGURE_DEPENDS "../CommonLib/x86/avx/*.cpp" )

# get avx2 source files
file( GLOB AVX2_SRC_FILES "../CommonLib/x86/avx2/*.cpp" )
file( GLOB AVX2_SRC_FILES CONFIGURE_DEPENDS "../CommonLib/x86/avx2/*.cpp" )

# get sse4.1 source files
file( GLOB SSE41_SRC_FILES "../CommonLib/x86/sse41/*.cpp" )
file( GLOB SSE41_SRC_FILES CONFIGURE_DEPENDS "../CommonLib/x86/sse41/*.cpp" )

# get sse4.2 source files
file( GLOB SSE42_SRC_FILES "../CommonLib/x86/sse42/*.cpp" )
file( GLOB SSE42_SRC_FILES CONFIGURE_DEPENDS "../CommonLib/x86/sse42/*.cpp" )
endif()

if( VVENC_ENABLE_ARM_SIMD )
file( GLOB ARM_SRC_FILES "../CommonLib/arm/*.cpp" )
file( GLOB ARM_INC_FILES "../CommonLib/arm/*.h" )
file( GLOB ARM_SRC_FILES CONFIGURE_DEPENDS "../CommonLib/arm/*.cpp" )
file( GLOB ARM_INC_FILES CONFIGURE_DEPENDS "../CommonLib/arm/*.h" )

file( GLOB ARM_NEON_SRC_FILES "../CommonLib/arm/neon/*.cpp" )
file( GLOB ARM_NEON_SRC_FILES CONFIGURE_DEPENDS "../CommonLib/arm/neon/*.cpp" )
endif()

# get public/extern include files
file( GLOB PUBLIC_INC_FILES "../../../include/${LIB_NAME}/*.h" )
file( GLOB PUBLIC_INC_FILES CONFIGURE_DEPENDS "../../../include/${LIB_NAME}/*.h" )

# get all private include files
set( PRIVATE_INC_FILES ${BASE_INC_FILES} ${X86_INC_FILES} ${ARM_INC_FILES} )
Expand All @@ -61,7 +61,7 @@ set( INC_FILES ${PRIVATE_INC_FILES} ${PUBLIC_INC_FILES} )

# NATVIS files for Visual Studio
if( MSVC )
file( GLOB NATVIS_FILES "../../VisualStudio/*.natvis" )
file( GLOB NATVIS_FILES CONFIGURE_DEPENDS "../../VisualStudio/*.natvis" )

# example: place header files in different folders
source_group( "Natvis Files" FILES ${NATVIS_FILES} )
Expand Down
4 changes: 2 additions & 2 deletions test/vvencinterfacetest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
set( EXE_NAME vvencinterfacetest )

# get source files
file( GLOB SRC_FILES "*.c" )
file( GLOB SRC_FILES CONFIGURE_DEPENDS "*.c" )

# get include files
file( GLOB INC_FILES "*.h" )
file( GLOB INC_FILES CONFIGURE_DEPENDS "*.h" )

# set resource file for MSVC compilers
if( MSVC )
Expand Down
4 changes: 2 additions & 2 deletions test/vvenclibtest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
set( EXE_NAME vvenclibtest )

# get source files
file( GLOB SRC_FILES "*.cpp" )
file( GLOB SRC_FILES CONFIGURE_DEPENDS "*.cpp" )

# get include files
file( GLOB INC_FILES "*.h" )
file( GLOB INC_FILES CONFIGURE_DEPENDS "*.h" )

# set resource file for MSVC compilers
if( MSVC )
Expand Down

0 comments on commit 2887203

Please sign in to comment.