From dffdf95bbfa5b071063a43281a330e741cf60e8c Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Wed, 13 Jul 2011 19:22:52 -0700 Subject: Ported SSE2 build target from Singularity, patch by Shyotl. Note that the package project still currently only supports 'Release' --- linden/indra/CMakeLists.txt | 2 +- linden/indra/cmake/00-Common.cmake | 41 +++++++++++++--- linden/indra/cmake/CopyWinLibs.cmake | 94 +++++++++++++++++++++++++++++------- linden/indra/develop.py | 5 +- 4 files changed, 115 insertions(+), 27 deletions(-) (limited to 'linden') diff --git a/linden/indra/CMakeLists.txt b/linden/indra/CMakeLists.txt index 64e0079..ae1ca5f 100644 --- a/linden/indra/CMakeLists.txt +++ b/linden/indra/CMakeLists.txt @@ -26,7 +26,7 @@ endif (DARWIN) if (NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING - "Build type. One of: Debug Release RelWithDebInfo" FORCE) + "Build type. One of: Debug Release ReleaseSSE2 RelWithDebInfo" FORCE) endif (NOT CMAKE_BUILD_TYPE) # For the library installation process; diff --git a/linden/indra/cmake/00-Common.cmake b/linden/indra/cmake/00-Common.cmake index 1a24a41..7d50f25 100644 --- a/linden/indra/cmake/00-Common.cmake +++ b/linden/indra/cmake/00-Common.cmake @@ -1,6 +1,6 @@ # -*- cmake -*- # -# Compilation options shared by all Second Life components. +# Compilation options shared by all viewer components. include(Variables) @@ -10,6 +10,8 @@ include(Variables) set(CMAKE_CXX_FLAGS_DEBUG "-D_DEBUG -DLL_DEBUG=1") set(CMAKE_CXX_FLAGS_RELEASE "-DLL_RELEASE=1 -DLL_RELEASE_FOR_DOWNLOAD=1 -D_SECURE_SCL=0 -DLL_SEND_CRASH_REPORTS=1 -DNDEBUG") +set(CMAKE_CXX_FLAGS_RELEASESSE2 + "-DLL_RELEASE=1 -DLL_RELEASE_FOR_DOWNLOAD=1 -D_SECURE_SCL=0 -DLL_SEND_CRASH_REPORTS=1 -DNDEBUG") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-DLL_RELEASE=1 -D_SECURE_SCL=0 -DLL_SEND_CRASH_REPORTS=0 -DNDEBUG -DLL_RELEASE_WITH_DEBUG_INFO=1") @@ -17,7 +19,7 @@ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO # Available build types / configurations. # Add our current build type first, to coax Xcode into selecting it by default. -set(TYPES ${CMAKE_BUILD_TYPE} RelWithDebInfo Release Debug) +set(TYPES ${CMAKE_BUILD_TYPE} RelWithDebInfo Release ReleaseSSE2 Debug) list(REMOVE_DUPLICATES TYPES) set(CMAKE_CONFIGURATION_TYPES ${TYPES} CACHE STRING "Supported build types." FORCE) unset(TYPES) @@ -44,12 +46,18 @@ if (WINDOWS) CACHE STRING "C++ compiler release-with-debug options" FORCE) if (MSVC80) set(CMAKE_CXX_FLAGS_RELEASE - "${CMAKE_CXX_FLAGS_RELEASE} /O2 /Ob2 /Oi /Ot /GT /Zi /MD" - CACHE STRING "C++ compiler release options" FORCE) + "${CMAKE_CXX_FLAGS_RELEASE} /O2 /Ob2 /Oi /Ot /GT /Zi /MD" + CACHE STRING "C++ compiler release options" FORCE) + set(CMAKE_CXX_FLAGS_RELEASESSE2 + "${CMAKE_CXX_FLAGS_RELEASESSE2} /O2 /Ob2 /Oi /Ot /GT /Zi /MD /arch:SSE2" + CACHE STRING "C++ compiler release (SSE2 optimized) options" FORCE) else (MSVC80) set(CMAKE_CXX_FLAGS_RELEASE - "${CMAKE_CXX_FLAGS_RELEASE} ${LL_CXX_FLAGS} /O2 /Zi /MD" - CACHE STRING "C++ compiler release options" FORCE) + "${CMAKE_CXX_FLAGS_RELEASE} ${LL_CXX_FLAGS} /O2 /Zi /MD" + CACHE STRING "C++ compiler release options" FORCE) + set(CMAKE_CXX_FLAGS_RELEASESSE2 + "${CMAKE_CXX_FLAGS_RELEASESSE2} ${LL_CXX_FLAGS} /O2 /Zi /MD /arch:SSE2" + CACHE STRING "C++ compiler release (SSE2 optimized) options" FORCE) endif (MSVC80) set(CMAKE_CXX_STANDARD_LIBRARIES "") @@ -73,6 +81,9 @@ if (WINDOWS) set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -D_SECURE_STL=0 -D_HAS_ITERATOR_DEBUGGING=0" CACHE STRING "C++ compiler release options" FORCE) + set(CMAKE_CXX_FLAGS_RELEASESSE2 + "${CMAKE_CXX_FLAGS_RELEASESSE2} -D_SECURE_STL=0 -D_HAS_ITERATOR_DEBUGGING=0" + CACHE STRING "C++ compiler release (SSE2 optimized) options" FORCE) add_definitions( /Zc:wchar_t- @@ -186,10 +197,12 @@ if (LINUX) add_definitions(-DLINUX64=1 -pipe) set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fomit-frame-pointer -mmmx -msse -mfpmath=sse -msse2 -ffast-math -ftree-vectorize -fweb -fexpensive-optimizations -frename-registers") endif (${ARCH} STREQUAL "x86_64") + set(CMAKE_CXX_FLAGS_RELEASESSE2 "${CMAKE_CXX_FLAGS_RELEASESSE2} -mfpmath=sse2 -msse2") endif (VIEWER) set(CMAKE_CXX_FLAGS_DEBUG "-fno-inline ${CMAKE_CXX_FLAGS_DEBUG}") set(CMAKE_CXX_FLAGS_RELEASE "-O2 ${CMAKE_CXX_FLAGS_RELEASE}") + set(CMAKE_CXX_FLAGS_RELEASESSE2 "-O2 ${CMAKE_CXX_FLAGS_RELEASESSE2}") endif (LINUX) @@ -203,6 +216,8 @@ if (DARWIN) # NOTE: it's critical to have both CXX_FLAGS and C_FLAGS covered. set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O0 ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O0 ${CMAKE_C_FLAGS_RELWITHDEBINFO}") + set(CMAKE_CXX_FLAGS_RELEASESSE2 "-msse2 -mfpmath=sse ${CMAKE_CXX_FLAGS_RELEASESSE2}") + set(CMAKE_C_FLAGS_RELEASESSE2 "-msse2 -mfpmath=sse ${CMAKE_C_FLAGS_RELEASESSE2}") endif (DARWIN) @@ -255,3 +270,17 @@ endif (STANDALONE) if(SERVER) include_directories(${LIBS_PREBUILT_DIR}/include/havok) endif(SERVER) + +SET(CMAKE_EXE_LINKER_FLAGS_RELEASESSE2 + "${CMAKE_EXE_LINKER_FLAGS_RELEASE}" CACHE STRING + "Flags used for linking binaries under SSE2 optimized build." + FORCE ) +SET(CMAKE_SHARED_LINKER_FLAGS_RELEASESSE2 + "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}" CACHE STRING + "Flags used by the shared libraries linker under SSE2 optimized build." + FORCE ) +MARK_AS_ADVANCED( + CMAKE_CXX_FLAGS_RELEASESSE2 + CMAKE_C_FLAGS_RELEASESSE2 + CMAKE_EXE_LINKER_FLAGS_RELEASESSE2 + CMAKE_SHARED_LINKER_FLAGS_RELEASESSE2 ) diff --git a/linden/indra/cmake/CopyWinLibs.cmake b/linden/indra/cmake/CopyWinLibs.cmake index 78c7c96..e03f542 100644 --- a/linden/indra/cmake/CopyWinLibs.cmake +++ b/linden/indra/cmake/CopyWinLibs.cmake @@ -177,6 +177,15 @@ copy_if_different( ) set(all_targets ${all_targets} ${out_targets}) + + copy_if_different( + ${plugintest_release_src_dir} + "${CMAKE_CURRENT_BINARY_DIR}/../test_apps/llplugintest/ReleaseSSE2" + out_targets + ${plugintest_release_files} + ) +set(all_targets ${all_targets} ${out_targets}) + # Release & ReleaseDebInfo config runtime files required for the plugin test mule (Qt image format plugins) set(plugintest_release_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/release/imageformats") set(plugintest_release_files @@ -205,6 +214,14 @@ set(all_targets ${all_targets} ${out_targets}) copy_if_different( ${plugintest_release_src_dir} + "${CMAKE_CURRENT_BINARY_DIR}/../test_apps/llplugintest/ReleaseSSE2/imageformats" + out_targets + ${plugintest_release_files} + ) +set(all_targets ${all_targets} ${out_targets}) + +copy_if_different( + ${plugintest_release_src_dir} "${CMAKE_CURRENT_BINARY_DIR}/Release/llplugin/imageformats" out_targets ${plugintest_release_files} @@ -219,6 +236,14 @@ copy_if_different( ) set(all_targets ${all_targets} ${out_targets}) +copy_if_different( + ${plugintest_release_src_dir} + "${CMAKE_CURRENT_BINARY_DIR}/ReleaseSSE2/llplugin/imageformats" + out_targets + ${plugintest_release_files} + ) +set(all_targets ${all_targets} ${out_targets}) + # Debug config runtime files required for the plugins set(plugins_debug_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/debug") set(plugins_debug_files @@ -267,6 +292,14 @@ copy_if_different( ) set(all_targets ${all_targets} ${out_targets}) +copy_if_different( + ${plugins_release_src_dir} + "${CMAKE_CURRENT_BINARY_DIR}/ReleaseSSE2/llplugin" + out_targets + ${plugins_release_files} + ) +set(all_targets ${all_targets} ${out_targets}) + set(release_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/release") set(release_files alut.dll @@ -364,14 +397,15 @@ copy_if_different( set(all_targets ${all_targets} ${out_targets}) copy_if_different( - ${vivox_src_dir} - "${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo" + ${release_src_dir} + "${CMAKE_CURRENT_BINARY_DIR}/ReleaseSSE2" out_targets - ${vivox_files} + ${release_files} ) set(all_targets ${all_targets} ${out_targets}) + # Copy MS C runtime dlls, required for packaging. # We always need the VS 2005 redist. # *TODO - Adapt this to support VC9 @@ -442,6 +476,14 @@ if(EXISTS ${release_msvc8_redist_path}) ) set(all_targets ${all_targets} ${out_targets}) + copy_if_different( + ${release_msvc8_redist_path} + "${CMAKE_CURRENT_BINARY_DIR}/ReleaseSSE2" + out_targets + ${release_msvc8_files} + ) + set(all_targets ${all_targets} ${out_targets}) + set(release_appconfig_file ${CMAKE_CURRENT_BINARY_DIR}/Release/${VIEWER_BINARY_NAME}.exe.config) add_custom_command( OUTPUT ${release_appconfig_file} @@ -455,25 +497,41 @@ if(EXISTS ${release_msvc8_redist_path}) COMMENT "Creating release app config file" ) - set(relwithdebinfo_appconfig_file ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/${VIEWER_BINARY_NAME}.exe.config) - add_custom_command( - OUTPUT ${relwithdebinfo_appconfig_file} - COMMAND ${PYTHON_EXECUTABLE} - ARGS - ${CMAKE_CURRENT_SOURCE_DIR}/build_win32_appConfig.py - ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/Microsoft.VC80.CRT.manifest - ${CMAKE_CURRENT_SOURCE_DIR}/Imprudence.exe.config - ${relwithdebinfo_appconfig_file} - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/Microsoft.VC80.CRT.manifest - COMMENT "Creating relwithdebinfo app config file" - ) - -endif (EXISTS ${release_msvc8_redist_path}) + + set(releasesse2_appconfig_file ${CMAKE_CURRENT_BINARY_DIR}/ReleaseSSE2/${VIEWER_BINARY_NAME}.exe.config) + add_custom_command( + OUTPUT ${releasesse2_appconfig_file} + COMMAND ${PYTHON_EXECUTABLE} + ARGS + ${CMAKE_CURRENT_SOURCE_DIR}/build_win32_appConfig.py + ${CMAKE_CURRENT_BINARY_DIR}/ReleaseSSE2/Microsoft.VC80.CRT.manifest + ${CMAKE_CURRENT_SOURCE_DIR}/Imprudence.exe.config + ${releasesse2_appconfig_file} + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ReleaseSSE2/Microsoft.VC80.CRT.manifest + COMMENT "Creating release (SSE2 optimized) app config file" + ) + + set(relwithdebinfo_appconfig_file ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/${VIEWER_BINARY_NAME}.exe.config) + add_custom_command( + OUTPUT ${relwithdebinfo_appconfig_file} + COMMAND ${PYTHON_EXECUTABLE} + ARGS + ${CMAKE_CURRENT_SOURCE_DIR}/build_win32_appConfig.py + ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/Microsoft.VC80.CRT.manifest + ${CMAKE_CURRENT_SOURCE_DIR}/Imprudence.exe.config + ${relwithdebinfo_appconfig_file} + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/Microsoft.VC80.CRT.manifest + COMMENT "Creating relwithdebinfo app config file" + ) + + endif (EXISTS ${release_msvc8_redist_path}) +endif (MSVC80) add_custom_target(copy_win_libs ALL DEPENDS ${all_targets} - ${release_appconfig_file} + ${release_appconfig_file} + ${releasesse2_appconfig_file} ${relwithdebinfo_appconfig_file} ${debug_appconfig_file} ) diff --git a/linden/indra/develop.py b/linden/indra/develop.py index 094ce3b..69542da 100755 --- a/linden/indra/develop.py +++ b/linden/indra/develop.py @@ -70,7 +70,7 @@ def quote(opts): class PlatformSetup(object): generator = None build_types = {} - for t in ('Debug', 'Release', 'RelWithDebInfo'): + for t in ('Debug', 'Release', 'ReleaseSSE2', 'RelWithDebInfo'): build_types[t.lower()] = t build_type = build_types['relwithdebinfo'] @@ -698,7 +698,8 @@ Options: --unattended build unattended, do not invoke any tools requiring a human response --universal build a universal binary on Mac OS X (unsupported) - -t | --type=NAME build type ("Debug", "Release", or "RelWithDebInfo") + -t | --type=NAME build type ("Debug", "Release", "ReleaseSSE2", or "RelWithDebInfo") + -m32 | -m64 build architecture (32-bit or 64-bit) -N | --no-distcc disable use of distcc -G | --generator=NAME generator name Windows: VC71 or VS2003 (default), VC80 (VS2005) or -- cgit v1.1