Skip to content

Commit cedcb91

Browse files
Rye Cogtailrohvani
authored andcommitted
Fix multi-config cmake generators only including one config of build-variables and various small cleanup
1 parent 77f41ef commit cedcb91

File tree

6 files changed

+37
-26
lines changed

6 files changed

+37
-26
lines changed

indra/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ include(BuildVersion)
3737

3838
if (NOT CMAKE_BUILD_TYPE)
3939
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
40-
"Build type. One of: Debug Release RelWithDebInfo" FORCE)
40+
"Build type. One of: Release RelWithDebInfo" FORCE)
4141
endif (NOT CMAKE_BUILD_TYPE)
4242

4343
add_subdirectory(cmake)

indra/cmake/00-Common.cmake

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,20 @@
1111
#
1212
# Also realize that CMAKE_CXX_FLAGS may already be partially populated on
1313
# entry to this file.
14+
#
15+
# Additionally CMAKE_C_FLAGS is prepended to CMAKE_CXX_FLAGS_RELEASE and
16+
# CMAKE_CXX_FLAGS_RELWITHDEBINFO which risks having flags overriden by cmake
17+
# inserting additional options that are part of the build config type.
1418
#*****************************************************************************
1519
include_guard()
1620

1721
include(Variables)
1822
include(Linker)
1923

2024
# We go to some trouble to set LL_BUILD to the set of relevant compiler flags.
21-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} $ENV{LL_BUILD}")
25+
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} $ENV{LL_BUILD_RELEASE}")
26+
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} $ENV{LL_BUILD_RELWITHDEBINFO}")
27+
2228
# Given that, all the flags you see added below are flags NOT present in
2329
# https://bitbucket.org/lindenlab/viewer-build-variables/src/tip/variables.
2430
# Before adding new ones here, it's important to ask: can this flag really be

indra/cmake/Audio.cmake

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,10 @@ target_include_directories( ll::vorbis SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/inc
1111

1212
if (WINDOWS)
1313
target_link_libraries(ll::vorbis INTERFACE
14-
optimized ${ARCH_PREBUILT_DIRS_RELEASE}/libogg.lib
15-
debug ${ARCH_PREBUILT_DIRS_DEBUG}/libogg.lib
16-
optimized ${ARCH_PREBUILT_DIRS_RELEASE}/libvorbisenc.lib
17-
debug ${ARCH_PREBUILT_DIRS_DEBUG}/libvorbisenc.lib
18-
optimized ${ARCH_PREBUILT_DIRS_RELEASE}/libvorbisfile.lib
19-
debug ${ARCH_PREBUILT_DIRS_DEBUG}/libvorbisfile.lib
20-
optimized ${ARCH_PREBUILT_DIRS_RELEASE}/libvorbis.lib
21-
debug ${ARCH_PREBUILT_DIRS_DEBUG}/libvorbis.lib
14+
${ARCH_PREBUILT_DIRS_RELEASE}/libogg.lib
15+
${ARCH_PREBUILT_DIRS_RELEASE}/libvorbisenc.lib
16+
${ARCH_PREBUILT_DIRS_RELEASE}/libvorbisfile.lib
17+
${ARCH_PREBUILT_DIRS_RELEASE}/libvorbis.lib
2218
)
2319
else (WINDOWS)
2420
target_link_libraries(ll::vorbis INTERFACE vorbisfile vorbis ogg vorbisenc )

indra/cmake/EXPAT.cmake

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@ use_prebuilt_binary(expat)
99
if (WINDOWS)
1010
target_compile_definitions( ll::expat INTERFACE XML_STATIC=1)
1111
target_link_libraries( ll::expat INTERFACE
12-
debug ${ARCH_PREBUILT_DIRS_DEBUG}/libexpatd.lib
13-
optimized ${ARCH_PREBUILT_DIRS_RELEASE}/libexpat.lib)
12+
${ARCH_PREBUILT_DIRS_RELEASE}/libexpat.lib)
1413
else ()
1514
target_link_libraries( ll::expat INTERFACE
16-
debug ${ARCH_PREBUILT_DIRS_DEBUG}/libexpat.a
17-
optimized ${ARCH_PREBUILT_DIRS_RELEASE}/libexpat.a)
15+
${ARCH_PREBUILT_DIRS_RELEASE}/libexpat.a)
1816
endif ()
1917
target_include_directories( ll::expat SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include )

indra/cmake/Linking.cmake

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ set(ARCH_PREBUILT_DIRS_PLUGINS ${AUTOBUILD_INSTALL_DIR}/plugins)
88
set(ARCH_PREBUILT_DIRS_RELEASE ${AUTOBUILD_INSTALL_DIR}/lib/release)
99
set(ARCH_PREBUILT_DIRS_DEBUG ${AUTOBUILD_INSTALL_DIR}/lib/debug)
1010

11-
if (WINDOWS OR DARWIN )
11+
if (LL_GENERATOR_IS_MULTI_CONFIG)
1212
# Kludge for older cmake versions, 3.20+ is needed to use a genex in add_custom_command( OUTPUT <var> ... )
1313
# Using this will work okay-ish, as Debug is not supported anyway. But for property multi config and also
1414
# ninja support the genex version is preferred.
@@ -23,15 +23,16 @@ if (WINDOWS OR DARWIN )
2323
set(SYMBOLS_STAGING_DIR ${CMAKE_BINARY_DIR}/symbols/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,>/${VIEWER_CHANNEL})
2424
endif()
2525

26-
if( DARWIN )
27-
set( SHARED_LIB_STAGING_DIR ${SHARED_LIB_STAGING_DIR}/Resources)
28-
endif()
2926
set(EXE_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,>)
30-
elseif (LINUX)
27+
else ()
3128
set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs/lib)
3229
set(EXE_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs/bin)
3330
endif ()
3431

32+
if( DARWIN )
33+
set( SHARED_LIB_STAGING_DIR ${SHARED_LIB_STAGING_DIR}/Resources)
34+
endif()
35+
3536
# Autobuild packages must provide 'release' versions of libraries, but may provide versions for
3637
# specific build types. AUTOBUILD_LIBS_INSTALL_DIRS lists first the build type directory and then
3738
# the 'release' directory (as a default fallback).

indra/cmake/Variables.cmake

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,24 @@
1212
# Switches set here and in 00-Common.cmake must agree with
1313
# https://bitbucket.org/lindenlab/viewer-build-variables/src/tip/variables
1414
# Reading $LL_BUILD is an attempt to directly use those switches.
15-
if ("$ENV{LL_BUILD}" STREQUAL "" AND "${LL_BUILD_ENV}" STREQUAL "" )
16-
message(FATAL_ERROR "Environment variable LL_BUILD must be set")
17-
elseif("$ENV{LL_BUILD}" STREQUAL "")
18-
set( ENV{LL_BUILD} "${LL_BUILD_ENV}" )
19-
message( "Setting ENV{LL_BUILD} to cached variable ${LL_BUILD_ENV}" )
15+
if ("$ENV{LL_BUILD_RELEASE}" STREQUAL "" AND "${LL_BUILD_RELEASE_ENV}" STREQUAL "" )
16+
message(FATAL_ERROR "Environment variable LL_BUILD_RELEASE must be set")
17+
elseif("$ENV{LL_BUILD_RELEASE}" STREQUAL "")
18+
set( ENV{LL_BUILD_RELEASE} "${LL_BUILD_RELEASE_ENV}" )
19+
message( "Setting ENV{LL_BUILD_RELEASE} to cached variable ${LL_BUILD_RELEASE_ENV}" )
2020
else()
21-
set( LL_BUILD_ENV "$ENV{LL_BUILD}" CACHE STRING "Save environment" FORCE )
21+
set( LL_BUILD_RELEASE_ENV "$ENV{LL_BUILD_RELEASE}" CACHE STRING "Save environment RELEASE" FORCE )
2222
endif ()
23+
24+
if ("$ENV{LL_BUILD_RELWITHDEBINFO}" STREQUAL "" AND "${LL_BUILD_RELWITHDEBINFO_ENV}" STREQUAL "" )
25+
message(FATAL_ERROR "Environment variable LL_BUILD_RELWITHDEBINFO must be set")
26+
elseif("$ENV{LL_BUILD_RELWITHDEBINFO}" STREQUAL "")
27+
set( ENV{LL_BUILD_RELWITHDEBINFO} "${LL_BUILD_RELWITHDEBINFO_ENV}" )
28+
message( "Setting ENV{LL_BUILD_RELWITHDEBINFO} to cached variable ${LL_BUILD_RELWITHDEBINFO_ENV}" )
29+
else()
30+
set( LL_BUILD_RELWITHDEBINFO_ENV "$ENV{LL_BUILD_RELWITHDEBINFO}" CACHE STRING "Save environment RELWITHDEBINFO" FORCE )
31+
endif ()
32+
2333
include_guard()
2434

2535
# Relative and absolute paths to subtrees.
@@ -67,7 +77,7 @@ set(TEMPLATE_VERIFIER_MASTER_URL "https://github.com/secondlife/master-message-t
6777

6878
if (NOT CMAKE_BUILD_TYPE)
6979
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
70-
"Build type. One of: Debug Release RelWithDebInfo" FORCE)
80+
"Build type. One of: Release RelWithDebInfo" FORCE)
7181
endif (NOT CMAKE_BUILD_TYPE)
7282

7383
# If someone has specified an address size, use that to determine the

0 commit comments

Comments
 (0)