From 7b3c3b9fab771c61442415c891cc5de4d5617224 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Liru=20F=C3=A6rs?= Date: Thu, 17 Oct 2019 21:15:30 -0400 Subject: [PATCH] Burst Commit for building with ninja and more, thanks Alchemy! GeneratePrecompiledHeader - Cinder and Rye Ninja Support - Rye Fetch Content instead of prebuilds - Rye Visual Studio Native CMake Support - Rye --- .gitignore | 2 + autobuild.xml | 34 ------ indra/CMakeLists.txt | 6 +- indra/cmake/Abseil-CPP.cmake | 8 -- indra/cmake/CMakeLists.txt | 2 +- indra/cmake/GeneratePrecompiledHeader.cmake | 116 ++++++++++++++++++++ indra/cmake/Linking.cmake | 6 +- indra/cmake/Variables.cmake | 49 +++++---- indra/deps/CMakeLists.txt | 44 ++++++++ indra/newview/CMakeLists.txt | 95 ++++++++-------- indra/newview/viewer_manifest.py | 50 +++++---- 11 files changed, 267 insertions(+), 145 deletions(-) delete mode 100644 indra/cmake/Abseil-CPP.cmake create mode 100644 indra/cmake/GeneratePrecompiledHeader.cmake create mode 100644 indra/deps/CMakeLists.txt diff --git a/.gitignore b/.gitignore index a299c3d6c..dc5b9dab7 100644 --- a/.gitignore +++ b/.gitignore @@ -3,10 +3,12 @@ *.aps *.suo *.vshost.exe +*/.vs /bin/ /bin-release/ /bin /bin-release +/indra/out/ /indra/viewer-* /indra/newview/vivox-runtime/ /indra/newview/dbghelp.dll diff --git a/autobuild.xml b/autobuild.xml index c3841bd8b..31d81cd87 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -47,40 +47,6 @@ version 1.2.15 - abseil-cpp - - canonical_repo - https://bitbucket.org/alchemyviewer/3p-abseil-src - copyright - Copyright 2018 The Abseil Authors. - description - Abseil Common Libraries - license - Apache 2.0 - license_file - LICENSES/abseil-cpp.txt - name - abseil-cpp - platforms - - common - - archive - - hash - b82d5aa8380926240f3415279480c831 - hash_algorithm - md5 - url - https://pkg.alchemyviewer.org/repository/autobuild-external/abseil-cpp/common/abseil_cpp-ac78ffc.1-common-1.tar.bz2 - - name - common - - - version - ac78ffc.1 - apr_suite copyright diff --git a/indra/CMakeLists.txt b/indra/CMakeLists.txt index ab77f9e96..6b5c80cf0 100644 --- a/indra/CMakeLists.txt +++ b/indra/CMakeLists.txt @@ -19,6 +19,7 @@ set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") include(Variables) include(00-Common) include(BuildVersion) +include(CTest) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -28,9 +29,8 @@ if (NOT CMAKE_BUILD_TYPE) "Build type. One of: Debug Release RelWithDebInfo" FORCE) endif (NOT CMAKE_BUILD_TYPE) -include(Abseil-CPP) -# Dependencies -add_subdirectory(${ABSEIL_SRC_DIR} ${ABSEIL_BIN_DIR}) +add_subdirectory(deps) + add_subdirectory(cmake) add_subdirectory(${LIBS_OPEN_PREFIX}aistatemachine) add_subdirectory(${LIBS_OPEN_PREFIX}llaudio) diff --git a/indra/cmake/Abseil-CPP.cmake b/indra/cmake/Abseil-CPP.cmake deleted file mode 100644 index c7bb0f763..000000000 --- a/indra/cmake/Abseil-CPP.cmake +++ /dev/null @@ -1,8 +0,0 @@ -# -*- cmake -*- -include(Prebuilt) - -set(BUILD_TESTING OFF) -use_prebuilt_binary(abseil-cpp) -set(ABSEIL_SRC_DIR ${LIBS_PREBUILT_DIR}/abseil-cpp) -set(ABSEIL_BIN_DIR ${CMAKE_BINARY_DIR}/abseil-cpp) - diff --git a/indra/cmake/CMakeLists.txt b/indra/cmake/CMakeLists.txt index 04ae8dc00..0431ff6bb 100644 --- a/indra/cmake/CMakeLists.txt +++ b/indra/cmake/CMakeLists.txt @@ -8,7 +8,6 @@ set(cmake_SOURCE_FILES CMakeLists.txt 00-Common.cmake - Abseil-CPP.cmake AIStateMachine.cmake APR.cmake Audio.cmake @@ -43,6 +42,7 @@ set(cmake_SOURCE_FILES FindXmlRpcEpi.cmake FMODSTUDIO.cmake FreeType.cmake + GeneratePrecompiledHeader.cmake GLOD.cmake GStreamer010Plugin.cmake Glui.cmake diff --git a/indra/cmake/GeneratePrecompiledHeader.cmake b/indra/cmake/GeneratePrecompiledHeader.cmake new file mode 100644 index 000000000..9ff2062ed --- /dev/null +++ b/indra/cmake/GeneratePrecompiledHeader.cmake @@ -0,0 +1,116 @@ +# -*- cmake -*- + +# Distributed under the MIT Software License +# Copyright (c) 2015-2017 Borislav Stanimirov +# Modifications Copyright (c) 2019 Cinder Roxley. All rights reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy of +# this software and associated documentation files (the "Software"), to deal in +# the Software without restriction, including without limitation the rights to +# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +# of the Software, and to permit persons to whom the Software is furnished to do +# so, subject to the following conditions: +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +# target_precompiled_header +# +# Sets a precompiled header for a given target +# Args: +# TARGET_NAME - Name of the target. Only valid after add_library or add_executable +# PRECOMPILED_HEADER - Header file to precompile +# PRECOMPILED_SOURCE - MSVC specific source to do the actual precompilation. Ignored on other platforms +# + +macro(target_precompiled_header TARGET_NAME PRECOMPILED_HEADER PRECOMPILED_SOURCE) + get_filename_component(PRECOMPILED_HEADER_NAME ${PRECOMPILED_HEADER} NAME) + + if(MSVC) + get_filename_component(PRECOMPILED_SOURCE_NAME ${PRECOMPILED_SOURCE} NAME) + get_filename_component(PRECOMPILED_HEADER_PATH ${PRECOMPILED_HEADER} DIRECTORY) + target_include_directories(${TARGET_NAME} PRIVATE ${PRECOMPILED_HEADER_PATH}) # fixes occasional IntelliSense glitches + + get_filename_component(PRECOMPILED_HEADER_WE ${PRECOMPILED_HEADER} NAME_WE) + if(GEN_IS_MULTI_CONFIG) + set(PRECOMPILED_BINARY "$(IntDir)/${PRECOMPILED_HEADER_WE}.pch") + else() + set(PRECOMPILED_BINARY "${CMAKE_CURRENT_BINARY_DIR}/${PRECOMPILED_HEADER_WE}.pch") + endif() + + set_source_files_properties(${PRECOMPILED_SOURCE} PROPERTIES + COMPILE_OPTIONS "/Yc${PRECOMPILED_HEADER_NAME};/Fp${PRECOMPILED_BINARY}" + OBJECT_OUTPUTS "${PRECOMPILED_BINARY}") + + get_target_property(TARGET_SOURCES ${TARGET_NAME} SOURCES) + foreach(src ${TARGET_SOURCES}) + if(${src} MATCHES \\.\(cpp|cxx|cc\)$) + set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/${src}" PROPERTIES + COMPILE_OPTIONS "/Yu${PRECOMPILED_HEADER_NAME};/FI${PRECOMPILED_HEADER_NAME};/Fp${PRECOMPILED_BINARY}" + OBJECT_DEPENDS "${PRECOMPILED_BINARY}" + ) + endif() + endforeach() + #set_target_properties(${TARGET_NAME} PROPERTIES + # COMPILE_OPTIONS "/Yu${PRECOMPILED_HEADER_NAME};/FI${PRECOMPILED_HEADER_NAME};/Fp${PRECOMPILED_BINARY}") + + target_sources(${TARGET_NAME} PRIVATE ${PRECOMPILED_SOURCE} ${PRECOMPILED_HEADER}) + elseif(CMAKE_GENERATOR STREQUAL Xcode) + set_target_properties( + ${TARGET_NAME} + PROPERTIES + XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${PRECOMPILED_HEADER}" + XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER "YES" + ) + elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + # Create and set output directory. + set(OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${PRECOMPILED_HEADER_NAME}.gch") + make_directory(${OUTPUT_DIR}) + set(OUTPUT_NAME "${OUTPUT_DIR}/${PRECOMPILED_HEADER_NAME}.gch") + + # Export compiler flags via a generator to a response file + set(PCH_FLAGS_FILE "${OUTPUT_DIR}/${PRECOMPILED_HEADER_NAME}.rsp") + set(_include_directories "$") + set(_compile_definitions "$") + set(_compile_flags "$") + set(_compile_options "$") + set(_include_directories "$<$:-I$\n>") + set(_compile_definitions "$<$:-D$\n>") + set(_compile_flags "$<$:$\n>") + set(_compile_options "$<$:$\n>") + file(GENERATE OUTPUT "${PCH_FLAGS_FILE}" CONTENT "${_compile_definitions}${_include_directories}${_compile_flags}${_compile_options}\n") + + # Gather global compiler options, definitions, etc. + string(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" CXX_FLAGS) + set(COMPILER_FLAGS "${${CXX_FLAGS}} ${CMAKE_CXX_FLAGS}") + separate_arguments(COMPILER_FLAGS) + + # Add a custom target for building the precompiled header. + add_custom_command( + OUTPUT ${OUTPUT_NAME} + COMMAND ${CMAKE_CXX_COMPILER} @${PCH_FLAGS_FILE} ${COMPILER_FLAGS} -x c++-header -std=${CXX_STD} -o ${OUTPUT_NAME} ${PRECOMPILED_HEADER} + DEPENDS ${PRECOMPILED_HEADER}) + add_custom_target(${TARGET_NAME}_gch DEPENDS ${OUTPUT_NAME}) + add_dependencies(${TARGET_NAME} ${TARGET_NAME}_gch) + + # set_target_properties(${TARGET_NAME} PROPERTIES COMPILE_FLAGS "-include ${PRECOMPILED_HEADER_NAME} -Winvalid-pch") + get_target_property(SOURCE_FILES ${TARGET_NAME} SOURCES) + get_target_property(asdf ${TARGET_NAME} COMPILE_FLAGS) + foreach(SOURCE_FILE ${SOURCE_FILES}) + if(SOURCE_FILE MATCHES \\.\(c|cc|cxx|cpp\)$) + set_source_files_properties(${SOURCE_FILE} PROPERTIES + COMPILE_FLAGS "-include ${OUTPUT_DIR}/${PRECOMPILED_HEADER_NAME} -Winvalid-pch" + ) + endif() + endforeach() + else() + message(FATAL_ERROR "Unknown generator for target_precompiled_header. [${CMAKE_CXX_COMPILER_ID}]") + endif() +endmacro(target_precompiled_header) + diff --git a/indra/cmake/Linking.cmake b/indra/cmake/Linking.cmake index 43ec796dd..2a8bf40dd 100644 --- a/indra/cmake/Linking.cmake +++ b/indra/cmake/Linking.cmake @@ -27,15 +27,15 @@ 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) +if(GEN_IS_MULTI_CONFIG) # 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. set(AUTOBUILD_LIBS_INSTALL_DIRS "${AUTOBUILD_INSTALL_DIR}/lib/") -else(WINDOWS OR DARWIN) +else() # 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) +endif() if (NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Release") # When we're building something other than Release, append the diff --git a/indra/cmake/Variables.cmake b/indra/cmake/Variables.cmake index 119c4815b..189efe536 100644 --- a/indra/cmake/Variables.cmake +++ b/indra/cmake/Variables.cmake @@ -19,12 +19,17 @@ endif(NOT DEFINED COMMON_CMAKE_DIR) set_property(GLOBAL PROPERTY USE_FOLDERS ON) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +option(GEN_IS_MULTI_CONFIG "" ${_isMultiConfig}) +mark_as_advanced(GEN_IS_MULTI_CONFIG) + set(LIBS_CLOSED_PREFIX) set(LIBS_OPEN_PREFIX) set(SCRIPTS_PREFIX ../scripts) set(VIEWER_PREFIX) set(INTEGRATION_TESTS_PREFIX) option(LL_TESTS "Build and run unit and integration tests (disable for build timing runs to reduce variation" OFF) +option(BUILD_TESTING "Build test suite" OFF) option(INCREMENTAL_LINK "Use incremental linking on win32 builds (enable for faster links on some machines)" OFF) option(USE_PRECOMPILED_HEADERS "Enable use of precompiled header directives where supported." ON) @@ -94,34 +99,32 @@ elseif (ADDRESS_SIZE EQUAL 64) #message(STATUS "ADDRESS_SIZE is 64") set(ARCH x86_64) else (ADDRESS_SIZE EQUAL 32) - #message(STATUS "ADDRESS_SIZE is UNRECOGNIZED: '${ADDRESS_SIZE}'") - # Use Python's platform.machine() since uname -m isn't available everywhere. - # Even if you can assume cygwin uname -m, the answer depends on whether - # you're running 32-bit cygwin or 64-bit cygwin! But even 32-bit Python will - # report a 64-bit processor. - execute_process(COMMAND - "${Python2_EXECUTABLE}" "-c" - "import platform; print platform.machine()" - OUTPUT_VARIABLE ARCH OUTPUT_STRIP_TRAILING_WHITESPACE) - # We expect values of the form i386, i686, x86_64, AMD64. - # In CMake, expressing ARCH.endswith('64') is awkward: - string(LENGTH "${ARCH}" ARCH_LENGTH) - math(EXPR ARCH_LEN_2 "${ARCH_LENGTH} - 2") - string(SUBSTRING "${ARCH}" ${ARCH_LEN_2} 2 ARCH_LAST_2) - if (ARCH_LAST_2 STREQUAL 64) - #message(STATUS "ARCH is detected as 64; ARCH is ${ARCH}") - set(ADDRESS_SIZE 64) - else() - #message(STATUS "ARCH is detected as 32; ARCH is ${ARCH}") - set(ADDRESS_SIZE 32) - endif () + #message(STATUS "ADDRESS_SIZE is UNDEFINED") + if (CMAKE_SIZEOF_VOID_P EQUAL 8) + message(STATUS "Size of void pointer is detected as 8; ARCH is 64-bit") + set(ARCH x86_64) + set(ADDRESS_SIZE 64) + elseif (CMAKE_SIZEOF_VOID_P EQUAL 4) + message(STATUS "Size of void pointer is detected as 4; ARCH is 32-bit") + set(ADDRESS_SIZE 32) + set(ARCH i686) + else() + message(FATAL_ERROR "Unkown Architecture!") + endif() endif (ADDRESS_SIZE EQUAL 32) -if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") +if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") set(WINDOWS ON BOOL FORCE) + if (ADDRESS_SIZE EQUAL 64) + set(LL_ARCH ${ARCH}_win64) + set(LL_ARCH_DIR ${ARCH}-win64) + elseif (ADDRESS_SIZE EQUAL 32) set(LL_ARCH ${ARCH}_win32) set(LL_ARCH_DIR ${ARCH}-win32) -endif (${CMAKE_SYSTEM_NAME} MATCHES "Windows") + else() + message(FATAL_ERROR "Unkown Architecture!") + endif () +endif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") set(LINUX ON BOOL FORCE) diff --git a/indra/deps/CMakeLists.txt b/indra/deps/CMakeLists.txt new file mode 100644 index 000000000..d9a7df8da --- /dev/null +++ b/indra/deps/CMakeLists.txt @@ -0,0 +1,44 @@ +project(deps) + +include(FetchContent) + +set(CMAKE_FOLDER "Third Party") + +FetchContent_Declare( + Catch2 + GIT_REPOSITORY https://github.com/catchorg/Catch2.git + GIT_TAG v2.10.0 + ) +FetchContent_Declare( + fmt + GIT_REPOSITORY https://github.com/fmtlib/fmt.git + GIT_TAG 7512a55aa3ae309587ca89668ef9ec4074a51a1f + ) +FetchContent_Declare( + absl + GIT_REPOSITORY https://github.com/abseil/abseil-cpp.git + GIT_TAG ab3552a18964e7063c8324f45b3896a6a20b08a8 +) + +# This is a hack because absl has dumb cmake +set(OLD_BUILD_TEST ${BUILD_TESTING}) +set(BUILD_TESTING OFF) +FetchContent_MakeAvailable(absl) +set(BUILD_TESTING ${OLD_BUILD_TEST}) + +# Supress warnings inside abseil under MSVC +if(WINDOWS) + target_compile_options(absl_strings PRIVATE /wd4018) + target_compile_options(absl_str_format_internal PRIVATE /wd4018) + target_compile_options(absl_flags_usage_internal PRIVATE /wd4018) +endif() + + +if (BUILD_TESTING) + FetchContent_MakeAvailable(Catch2) +endif() + +#Download the rest of the libraries +FetchContent_MakeAvailable(fmt) + +set(CMAKE_FOLDER "") diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index e0ad1fe6d..9280a47bf 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -14,6 +14,7 @@ include(BuildBranding) include(CMakeCopyIfDifferent) include(DBusGlib) include(FMODSTUDIO) +include(GeneratePrecompiledHeader) include(GLOD) include(Hunspell) include(Json) @@ -1236,19 +1237,6 @@ if (WINDOWS) endif (NVAPI) set_source_files_properties(llappviewerwin32.cpp PROPERTIES COMPILE_FLAGS "${APPVWRW32_COMPILE_FLAGS}") - # precompiled header configuration - # llviewerprecompiledheaders.cpp generates - # the .pch file. - # All sources added to viewer_SOURCE_FILES - # at this point use it. - if(USE_PRECOMPILED_HEADERS) - set_source_files_properties(llviewerprecompiledheaders.cpp - PROPERTIES - COMPILE_FLAGS "/Ycllviewerprecompiledheaders.h" - ) - list(APPEND viewer_SOURCE_FILES llviewerprecompiledheaders.cpp) - endif(USE_PRECOMPILED_HEADERS) - # Replace the icons with the appropriate ones for the channel # ('test' is the default) set(ICON_PATH "default") @@ -1453,6 +1441,12 @@ add_executable(${VIEWER_BINARY_NAME} ${viewer_SOURCE_FILES} ) +if(USE_PRECOMPILED_HEADERS) + target_precompiled_header(${VIEWER_BINARY_NAME} + ${CMAKE_CURRENT_SOURCE_DIR}/llviewerprecompiledheaders.h + ${CMAKE_CURRENT_SOURCE_DIR}/llviewerprecompiledheaders.cpp) +endif(USE_PRECOMPILED_HEADERS) + set(PACKAGE OFF CACHE BOOL "Add a package target that builds an installer package.") @@ -1467,15 +1461,17 @@ if (WINDOWS) LINK_FLAGS_RELWITHDEBINFO "${release_flags} ${EXTRA_LINKER_FLAGS_RELEASE}" ) - add_dependencies(${VIEWER_BINARY_NAME} generate_viewer_version) + if(GEN_IS_MULTI_CONFIG) + set(VIEWER_BUILD_DEST_DIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}") + set_target_properties(${VIEWER_BINARY_NAME} PROPERTIES + VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") + else() + set(VIEWER_BUILD_DEST_DIR "${CMAKE_CURRENT_BINARY_DIR}/package") + set_target_properties(${VIEWER_BINARY_NAME} PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${VIEWER_BUILD_DEST_DIR}") + endif() - if(USE_PRECOMPILED_HEADERS) - set_target_properties( - ${VIEWER_BINARY_NAME} - PROPERTIES - COMPILE_FLAGS "/Yullviewerprecompiledheaders.h" - ) - endif(USE_PRECOMPILED_HEADERS) + add_dependencies(${VIEWER_BINARY_NAME} generate_viewer_version) # If adding a file to viewer_manifest.py in the WindowsManifest.construct() method, be sure to add the dependency # here. @@ -1499,22 +1495,15 @@ if (WINDOWS) #${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libtcmalloc_minimal.dll => None ... Skipping libtcmalloc_minimal.dll ${CMAKE_SOURCE_DIR}/../etc/message.xml ${CMAKE_SOURCE_DIR}/../scripts/messages/message_template.msg - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/llcommon.dll - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libapr-1.dll - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libaprutil-1.dll - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libapriconv-1.dll + ${SHARED_LIB_STAGING_DIR}/Release/llcommon.dll ${SHARED_LIB_STAGING_DIR}/Release/glod.dll ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/glod.dll - ${SHARED_LIB_STAGING_DIR}/Debug/glod.dll ${SHARED_LIB_STAGING_DIR}/Release/openjpeg.dll ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/openjpeg.dll - ${SHARED_LIB_STAGING_DIR}/Debug/openjpegd.dll - ${SHARED_LIB_STAGING_DIR}/Release/libhunspell.dll - ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/libhunspell.dll - ${SHARED_LIB_STAGING_DIR}/Debug/libhunspell.dll - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/SLVoice.exe - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/vivoxplatform.dll - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/ca-bundle.crt + ${SHARED_LIB_STAGING_DIR}/Debug/openjpeg.dll + ${SHARED_LIB_STAGING_DIR}/Release/SLVoice.exe + ${SHARED_LIB_STAGING_DIR}/Release/vivoxplatform.dll + ${SHARED_LIB_STAGING_DIR}/Release/ca-bundle.crt ${GOOGLE_PERF_TOOLS_SOURCE} ${CMAKE_CURRENT_SOURCE_DIR}/licenses-win32.txt ${CMAKE_CURRENT_SOURCE_DIR}/featuretable.txt @@ -1531,13 +1520,13 @@ if (WINDOWS) if (ADDRESS_SIZE EQUAL 64) list(APPEND COPY_INPUT_DEPENDENCIES - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/vivoxsdk_x64.dll - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/ortp_x64.dll + ${SHARED_LIB_STAGING_DIR}/Release/vivoxsdk_x64.dll + ${SHARED_LIB_STAGING_DIR}/Release/ortp_x64.dll ) else (ADDRESS_SIZE EQUAL 64) list(APPEND COPY_INPUT_DEPENDENCIES - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/vivoxsdk.dll - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/ortp.dll + ${SHARED_LIB_STAGING_DIR}/Release/vivoxsdk.dll + ${SHARED_LIB_STAGING_DIR}/Release/ortp.dll ) endif (ADDRESS_SIZE EQUAL 64) @@ -1557,8 +1546,14 @@ if (WINDOWS) endif (WORD_SIZE EQUAL 64) endif (FMODSTUDIO) + if(MSVC_IDE) + set(VIEWER_BUILD_DEST_DIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}") + else() + set(VIEWER_BUILD_DEST_DIR "${CMAKE_CURRENT_BINARY_DIR}/packaged") + endif() + add_custom_command( - OUTPUT ${CMAKE_CFG_INTDIR}/copy_touched.bat + OUTPUT ${VIEWER_BUILD_DEST_DIR}/copy_touched.bat COMMAND ${PYTHON_EXECUTABLE} ARGS ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py @@ -1568,13 +1563,13 @@ if (WINDOWS) --branding_id=${VIEWER_BRANDING_ID} --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=${CMAKE_BUILD_TYPE} - --configuration=${CMAKE_CFG_INTDIR} - --dest=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR} + --configuration=${VIEWER_BUILD_DEST_DIR} + --dest=${VIEWER_BUILD_DEST_DIR} --grid=${GRID} --channel=${VIEWER_CHANNEL} --versionfile=${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt --source=${CMAKE_CURRENT_SOURCE_DIR} - --touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/copy_touched.bat + --touch=${VIEWER_BUILD_DEST_DIR}/copy_touched.bat DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py generate_viewer_version @@ -1584,7 +1579,7 @@ if (WINDOWS) COMMENT "Performing viewer_manifest copy" ) - add_custom_target(copy_w_viewer_manifest ALL DEPENDS ${CMAKE_CFG_INTDIR}/copy_touched.bat) + add_custom_target(copy_w_viewer_manifest ALL DEPENDS ${VIEWER_BUILD_DEST_DIR}/copy_touched.bat) add_dependencies(${VIEWER_BINARY_NAME} stage_third_party_libs llcommon copy_w_viewer_manifest) @@ -1601,7 +1596,7 @@ if (WINDOWS) if (PACKAGE) add_custom_command( - OUTPUT ${CMAKE_CFG_INTDIR}/touched.bat + OUTPUT ${VIEWER_BUILD_DEST_DIR}/touched.bat COMMAND ${PYTHON_EXECUTABLE} ARGS ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py @@ -1612,11 +1607,11 @@ if (WINDOWS) --buildtype=${CMAKE_BUILD_TYPE} --channel=${VIEWER_CHANNEL} --versionfile=${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt - --configuration=${CMAKE_CFG_INTDIR} - --dest=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR} + --configuration=${VIEWER_BUILD_DEST_DIR} + --dest=${VIEWER_BUILD_DEST_DIR} --grid=${GRID} --source=${CMAKE_CURRENT_SOURCE_DIR} - --touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/touched.bat + --touch=${VIEWER_BUILD_DEST_DIR}/touched.bat DEPENDS ${VIEWER_BINARY_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py @@ -1625,7 +1620,7 @@ if (WINDOWS) ) add_custom_target(llpackage ALL DEPENDS - ${CMAKE_CFG_INTDIR}/touched.bat + ${VIEWER_BUILD_DEST_DIR}/touched.bat windows-setup-build-all ) endif (PACKAGE) @@ -1871,13 +1866,13 @@ if (PACKAGE) endif (LINUX) if(RELEASE_CRASH_REPORTING OR NON_RELEASE_CRASH_REPORTING) - if(CMAKE_CFG_INTDIR STREQUAL ".") + if(GEN_IS_MULTI_CONFIG) set(LLBUILD_CONFIG ${CMAKE_BUILD_TYPE}) - else(CMAKE_CFG_INTDIR STREQUAL ".") + else() # set LLBUILD_CONFIG to be a shell variable evaluated at build time # reflecting the configuration we are currently building. set(LLBUILD_CONFIG ${CMAKE_CFG_INTDIR}) - endif(CMAKE_CFG_INTDIR STREQUAL ".") + endif() add_custom_command(OUTPUT "${VIEWER_SYMBOL_FILE}" COMMAND "${PYTHON_EXECUTABLE}" ARGS diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 6faf7651d..4f83b047d 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -435,22 +435,27 @@ class WindowsManifest(ViewerManifest): def construct(self): super(WindowsManifest, self).construct() + if self.args['configuration'].lower() == '.': + config = 'debug' if self.args['buildtype'].lower() == 'debug' else 'release' + else: + config = 'debug' if self.args['configuration'].lower() == 'debug' else 'release' pkgdir = os.path.join(self.args['build'], os.pardir, 'packages') relpkgdir = os.path.join(pkgdir, "lib", "release") debpkgdir = os.path.join(pkgdir, "lib", "debug") + pkgbindir = os.path.join(pkgdir, "bin", config) if True: #self.is_packaging_viewer(): # Find singularity-bin.exe in the 'configuration' dir, then rename it to the result of final_exe. - self.path(src='%s\\%s-bin.exe' % (self.args['configuration'],self.viewer_branding_id()), dst=self.final_exe()) + self.path(src=os.path.join(self.args['dest'], ('%s-bin.exe' % self.viewer_branding_id())), dst=self.final_exe()) # Plugin host application self.path2basename(os.path.join(os.pardir, - 'llplugin', 'slplugin', self.args['configuration']), + 'llplugin', 'slplugin', config), "SLplugin.exe") # Get shared libs from the shared libs staging directory with self.prefix(src=os.path.join(self.args['build'], os.pardir, - 'sharedlibs', self.args['configuration'])): + 'sharedlibs', config)): # Get llcommon and deps. If missing assume static linkage and continue. try: @@ -472,7 +477,7 @@ class WindowsManifest(ViewerManifest): # Get fmodstudio dll, continue if missing try: - if self.args['configuration'].lower() == 'debug': + if config == 'debug': self.path("fmodL.dll") else: self.path("fmod.dll") @@ -510,7 +515,7 @@ class WindowsManifest(ViewerManifest): # For google-perftools tcmalloc allocator. if(self.address_size == 32): try: - if self.args['configuration'].lower() == 'debug': + if config == 'debug': self.path('libtcmalloc_minimal-debug.dll') else: self.path('libtcmalloc_minimal.dll') @@ -536,21 +541,20 @@ class WindowsManifest(ViewerManifest): with self.prefix(src=os.path.join(self.args['build'], os.pardir, 'plugins')): # Plugins - FilePicker - with self.prefix(src=os.path.join('filepicker', self.args['configuration'])): + with self.prefix(src=os.path.join('filepicker', config)): self.path("basic_plugin_filepicker.dll") # Media plugins - LibVLC - with self.prefix(src=os.path.join('libvlc', self.args['configuration'])): + with self.prefix(src=os.path.join('libvlc', config)): self.path("media_plugin_libvlc.dll") # Media plugins - CEF - with self.prefix(src=os.path.join('cef', self.args['configuration'])): + with self.prefix(src=os.path.join('cef', config)): self.path("media_plugin_cef.dll") # CEF runtime files - debug # CEF runtime files - not debug (release, relwithdebinfo etc.) - config = 'debug' if self.args['configuration'].lower() == 'debug' else 'release' - with self.prefix(src=os.path.join(pkgdir, 'bin', config)): + with self.prefix(src=pkgbindir): self.path("chrome_elf.dll") self.path("d3dcompiler_43.dll") self.path("d3dcompiler_47.dll") @@ -562,7 +566,7 @@ class WindowsManifest(ViewerManifest): self.path("snapshot_blob.bin") self.path("v8_context_snapshot.bin") - with self.prefix(src=os.path.join(pkgdir, 'bin', config, 'swiftshader'), dst='swiftshader'): + with self.prefix(src=os.path.join(pkgbindir, 'swiftshader'), dst='swiftshader'): self.path("libEGL.dll") self.path("libGLESv2.dll") @@ -630,7 +634,7 @@ class WindowsManifest(ViewerManifest): self.path("zh-CN.pak") self.path("zh-TW.pak") - with self.prefix(src=os.path.join(pkgdir, 'bin', 'release')): + with self.prefix(src=os.path.join(pkgbindir, 'release')): self.path("libvlc.dll") self.path("libvlccore.dll") self.path("plugins/") @@ -698,11 +702,11 @@ class WindowsManifest(ViewerManifest): def package_finish(self): if 'signature' in self.args and 'VIEWER_SIGNING_PWD' in os.environ: try: - self.sign(self.args['configuration']+"\\"+self.final_exe()) - self.sign(self.args['configuration']+"\\SLPlugin.exe") - self.sign(self.args['configuration']+"\\SLVoice.exe") + self.sign(self.args['dest']+"\\"+self.final_exe()) + self.sign(self.args['dest']+"\\SLPlugin.exe") + self.sign(self.args['dest']+"\\SLVoice.exe") except: - print "Couldn't sign binaries. Tried to sign %s" % self.args['configuration'] + "\\" + self.final_exe() + print "Couldn't sign binaries. Tried to sign %s" % self.args['dest'] + "\\" + self.final_exe() # a standard map of strings for replacing in the templates substitution_strings = { @@ -721,9 +725,9 @@ class WindowsManifest(ViewerManifest): substitution_strings['installer_file'] = installer_file # Packaging the installer takes forever, dodge it if we can. - installer_path = os.path.join(self.args['configuration'], installer_file); + installer_path = os.path.join(self.args['dest'], installer_file); if os.path.isfile(installer_path): - binary_mod = os.path.getmtime(os.path.join(self.args['configuration'], self.final_exe())) + binary_mod = os.path.getmtime(os.path.join(self.args['dest'], self.final_exe())) installer_mod = os.path.getmtime(installer_path) if binary_mod <= installer_mod: print("Binary is unchanged since last package, touch the binary or delete installer to trigger repackage.") @@ -770,22 +774,22 @@ class WindowsManifest(ViewerManifest): try: import _winreg as reg NSIS_path = reg.QueryValue(reg.HKEY_LOCAL_MACHINE, r"SOFTWARE\NSIS") + '\\makensis.exe' - self.run_command([proper_windows_path(NSIS_path), self.dst_path_of(tempfile)]) + # self.run_command([proper_windows_path(NSIS_path), self.dst_path_of(tempfile)]) except: try: NSIS_path = os.environ['ProgramFiles'] + '\\NSIS\\makensis.exe' - self.run_command([proper_windows_path(NSIS_path), self.dst_path_of(tempfile)]) + # self.run_command([proper_windows_path(NSIS_path), self.dst_path_of(tempfile)]) except: NSIS_path = os.environ['ProgramFiles(X86)'] + '\\NSIS\\makensis.exe' - self.run_command([proper_windows_path(NSIS_path),self.dst_path_of(tempfile)]) + # self.run_command([proper_windows_path(NSIS_path),self.dst_path_of(tempfile)]) # self.remove(self.dst_path_of(tempfile)) if 'signature' in self.args and 'VIEWER_SIGNING_PWD' in os.environ: try: - self.sign(self.args['configuration'] + "\\" + substitution_strings['installer_file']) + self.sign(self.args['dest'] + "\\" + substitution_strings['installer_file']) except: - print "Couldn't sign windows installer. Tried to sign %s" % self.args['configuration'] + "\\" + substitution_strings['installer_file'] + print "Couldn't sign windows installer. Tried to sign %s" % self.args['dest'] + "\\" + substitution_strings['installer_file'] self.created_path(self.dst_path_of(installer_file)) self.package_file = installer_file