Simplify cmake files by uaing generator expressions and be more

configuration specific, rather than staging files to Release and
RelWithdebInfo all the time
master
Nicky 2022-05-01 13:37:44 +02:00
parent 283c2a20cc
commit 756a10eeac
5 changed files with 27 additions and 62 deletions

View File

@ -16,12 +16,8 @@ include(FMODSTUDIO)
# Pass FROM_DIR, TARGETS and the files to copy. TO_DIR is implicit.
# to_staging_dirs diverges from copy_if_different in that it appends to TARGETS.
MACRO(to_staging_dirs from_dir targets)
foreach(staging_dir
"${SHARED_LIB_STAGING_DIR_RELEASE}"
"${SHARED_LIB_STAGING_DIR_RELWITHDEBINFO}")
copy_if_different("${from_dir}" "${staging_dir}" out_targets ${ARGN})
copy_if_different("${from_dir}" "${SHARED_LIB_STAGING_DIR}/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,>" out_targets ${ARGN})
list(APPEND "${targets}" "${out_targets}")
endforeach()
ENDMACRO(to_staging_dirs from_dir to_dir targets)
###################################################################

View File

@ -3,7 +3,7 @@ include(Prebuilt)
add_library( ll::dbus INTERFACE IMPORTED)
# Only define this when using conan, lls prebuild is brokenb
# Only define this when using conan, lls prebuild is broken
if( USE_CONAN )
target_compile_definitions( ll::dbus INTERFACE LL_DBUS_ENABLED )
endif()

View File

@ -30,30 +30,8 @@ endif (WINDOWS)
# windows) and CMAKE_BUILD_TYPE on Makefile based generators (like linux). The reason for this is
# that CMAKE_BUILD_TYPE is essentially meaningless at configuration time for IDE generators and
# CMAKE_CFG_INTDIR is meaningless at build time for Makefile generators
if(WINDOWS OR DARWIN)
# the cmake xcode and VS generators implicitly append ${CMAKE_CFG_INTDIR} to the library paths for us
# fortunately both windows and darwin are case insensitive filesystems so this works.
# Ninja on the other hand needs the the full path
if( ${CMAKE_GENERATOR} STREQUAL "Ninja")
string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_LOWER)
set(AUTOBUILD_LIBS_INSTALL_DIRS ${AUTOBUILD_INSTALL_DIR}/lib/${CMAKE_BUILD_TYPE_LOWER})
else()
set(AUTOBUILD_LIBS_INSTALL_DIRS "${AUTOBUILD_INSTALL_DIR}/lib/")
endif()
else(WINDOWS OR DARWIN)
# else block is for linux and any other makefile based generators
string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_LOWER)
set(AUTOBUILD_LIBS_INSTALL_DIRS ${AUTOBUILD_INSTALL_DIR}/lib/${CMAKE_BUILD_TYPE_LOWER})
endif(WINDOWS OR DARWIN)
if (NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Release")
# When we're building something other than Release, append the
# packages/lib/release directory to deal with autobuild packages that don't
# provide (e.g.) lib/debug libraries.
list(APPEND AUTOBUILD_LIBS_INSTALL_DIRS ${ARCH_PREBUILT_DIRS_RELEASE})
endif (NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Release")
link_directories(${AUTOBUILD_LIBS_INSTALL_DIRS})
link_directories(${AUTOBUILD_INSTALL_DIR}/lib/$<LOWER_CASE:$<CONFIG>>)
add_library( ll::oslibraries INTERFACE IMPORTED )

View File

@ -217,3 +217,5 @@ set(USE_PRECOMPILED_HEADERS ON CACHE BOOL "Enable use of precompiled header dire
source_group("CMake Rules" FILES CMakeLists.txt)
get_property(LL_GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
MESSAGE( "Multi config generator: ${LL_GENERATOR_IS_MULTI_CONFIG}" )

View File

@ -1686,24 +1686,14 @@ if (WINDOWS)
# stores a list in the variable myfile in which each item is a line from the input file."
# And of course it's straightforward to read a text file in Python.
if( ${CMAKE_GENERATOR} STREQUAL "Ninja")
set(LL_INTDIR ${CMAKE_BUILD_TYPE})
else()
set(LL_INTDIR ${CMAKE_CFG_INTDIR})
endif()
set(COPY_INPUT_DEPENDENCIES
# The following commented dependencies are determined at variably at build time. Can't do this here.
${CMAKE_SOURCE_DIR}/../etc/message.xml
${CMAKE_SOURCE_DIR}/../scripts/messages/message_template.msg
${SHARED_LIB_STAGING_DIR}/Release/glod.dll
${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/glod.dll
${SHARED_LIB_STAGING_DIR}/Release/openjpeg.dll
${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/openjpeg.dll
${SHARED_LIB_STAGING_DIR}/Release/libhunspell.dll
${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/libhunspell.dll
${SHARED_LIB_STAGING_DIR}/Release/uriparser.dll
${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/uriparser.dll
${SHARED_LIB_STAGING_DIR}/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,>/glod.dll
${SHARED_LIB_STAGING_DIR}/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,>/openjpeg.dll
${SHARED_LIB_STAGING_DIR}/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,>/libhunspell.dll
${SHARED_LIB_STAGING_DIR}/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,>/uriparser.dll
#${SHARED_LIB_STAGING_DIR}/${LL_INTDIR}/SLVoice.exe
#${SHARED_LIB_STAGING_DIR}/${LL_INTDIR}/libsndfile-1.dll
#${SHARED_LIB_STAGING_DIR}/${LL_INTDIR}/vivoxoal.dll
@ -1718,33 +1708,32 @@ if (WINDOWS)
)
if (ADDRESS_SIZE EQUAL 64)
list(APPEND COPY_INPUT_DEPENDENCIES
${SHARED_LIB_STAGING_DIR}/${LL_INTDIR}/vivoxsdk_x64.dll
${SHARED_LIB_STAGING_DIR}/${LL_INTDIR}/ortp_x64.dll
${ARCH_PREBUILT_DIRS_RELEASE}/libcrypto-1_1-x64.dll
${ARCH_PREBUILT_DIRS_RELEASE}/libssl-1_1-x64.dll
)
list(APPEND COPY_INPUT_DEPENDENCIES
${SHARED_LIB_STAGING_DIR}/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,>/vivoxsdk_x64.dll
${SHARED_LIB_STAGING_DIR}/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,>/ortp_x64.dll
${ARCH_PREBUILT_DIRS_RELEASE}/libcrypto-1_1-x64.dll
${ARCH_PREBUILT_DIRS_RELEASE}/libssl-1_1-x64.dll
)
else (ADDRESS_SIZE EQUAL 64)
list(APPEND COPY_INPUT_DEPENDENCIES
${SHARED_LIB_STAGING_DIR}/${LL_INTDIR}/vivoxsdk.dll
${SHARED_LIB_STAGING_DIR}/${LL_INTDIR}/ortp.dll
${ARCH_PREBUILT_DIRS_RELEASE}/libcrypto-1_1.dll
${ARCH_PREBUILT_DIRS_RELEASE}/libssl-1_1.dll
)
list(APPEND COPY_INPUT_DEPENDENCIES
${SHARED_LIB_STAGING_DIR}/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,>/vivoxsdk.dll
${SHARED_LIB_STAGING_DIR}/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,>/ortp.dll
${ARCH_PREBUILT_DIRS_RELEASE}/libcrypto-1_1.dll
${ARCH_PREBUILT_DIRS_RELEASE}/libssl-1_1.dll
)
endif (ADDRESS_SIZE EQUAL 64)
if (TARGET ll::fmodstudio)
list(APPEND COPY_INPUT_DEPENDENCIES
${SHARED_LIB_STAGING_DIR}/Release/fmod.dll
${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/fmod.dll
${SHARED_LIB_STAGING_DIR}/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,>/fmod.dll
${SHARED_LIB_STAGING_DIR}/Debug/fmodL.dll
)
endif ()
if (TARGET ll::openal)
list(APPEND COPY_INPUT_DEPENDENCIES
${SHARED_LIB_STAGING_DIR}/${LL_INTDIR}/OpenAL32.dll
${SHARED_LIB_STAGING_DIR}/${LL_INTDIR}/alut.dll
${SHARED_LIB_STAGING_DIR}/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,>/OpenAL32.dll
${SHARED_LIB_STAGING_DIR}/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,>/alut.dll
)
endif ()
@ -1760,13 +1749,13 @@ if (WINDOWS)
"--fmodstudio=${USE_FMODSTUDIO}"
"--openal=${USE_OPENAL}"
--build=${CMAKE_CURRENT_BINARY_DIR}
--buildtype=${CMAKE_BUILD_TYPE}
--buildtype=$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,>
"--channel=${VIEWER_CHANNEL}"
--configuration=${CMAKE_CFG_INTDIR}
--dest=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}
--dest=${CMAKE_CURRENT_BINARY_DIR}/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,>
--grid=${GRID}
--source=${CMAKE_CURRENT_SOURCE_DIR}
--touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/copy_touched.bat
--touch=${CMAKE_CURRENT_BINARY_DIR}/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,>/copy_touched.bat
--versionfile=${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt
DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py