diff options
Diffstat (limited to 'indra/cmake')
33 files changed, 415 insertions, 126 deletions
diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 0266239454..00baf626d2 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -46,7 +46,7 @@ if (WINDOWS) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Od /Zi /MDd /MP -D_SCL_SECURE_NO_WARNINGS=1" CACHE STRING "C++ compiler debug options" FORCE) set(CMAKE_CXX_FLAGS_RELWITHDEBINFO - "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Od /Zi /MD /MP /Ob2 -D_SECURE_STL=0" + "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Od /Zi /MD /MP /Ob0 -D_SECURE_STL=0" CACHE STRING "C++ compiler release-with-debug options" FORCE) set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${LL_CXX_FLAGS} /O2 /Zi /MD /MP /Ob2 -D_SECURE_STL=0 -D_HAS_ITERATOR_DEBUGGING=0" @@ -62,13 +62,14 @@ if (WINDOWS) /D_UNICODE /GS /TP - /W2 + /W3 /c /Zc:forScope /nologo /Oy- /Zc:wchar_t- /arch:SSE2 + /fp:fast ) # Are we using the crummy Visual Studio KDU build workaround? diff --git a/indra/cmake/CMakeLists.txt b/indra/cmake/CMakeLists.txt index 279d577a27..569034a6fb 100644 --- a/indra/cmake/CMakeLists.txt +++ b/indra/cmake/CMakeLists.txt @@ -37,12 +37,12 @@ set(cmake_SOURCE_FILES GLOD.cmake GStreamer010Plugin.cmake GooglePerfTools.cmake + Hunspell.cmake JPEG.cmake LLAddBuildTest.cmake LLAudio.cmake LLCharacter.cmake LLCommon.cmake - LLConvexDecomposition.cmake LLCrashLogger.cmake LLDatabase.cmake LLImage.cmake @@ -53,6 +53,7 @@ set(cmake_SOURCE_FILES LLMessage.cmake LLPlugin.cmake LLPrimitive.cmake + LLPhysicsExtensions.cmake LLRender.cmake LLScene.cmake LLTestCommand.cmake diff --git a/indra/cmake/Copy3rdPartyLibs.cmake b/indra/cmake/Copy3rdPartyLibs.cmake index d9efc8f40d..9f05c4cff2 100644 --- a/indra/cmake/Copy3rdPartyLibs.cmake +++ b/indra/cmake/Copy3rdPartyLibs.cmake @@ -40,7 +40,8 @@ if(WINDOWS) ssleay32.dll libeay32.dll libcollada14dom22-d.dll - glod.dll + glod.dll + libhunspell.dll ) set(release_src_dir "${ARCH_PREBUILT_DIRS_RELEASE}") @@ -53,12 +54,13 @@ if(WINDOWS) libeay32.dll libcollada14dom22.dll glod.dll + libhunspell.dll ) - if(USE_GOOGLE_PERFTOOLS) + if(USE_TCMALLOC) set(debug_files ${debug_files} libtcmalloc_minimal-debug.dll) set(release_files ${release_files} libtcmalloc_minimal.dll) - endif(USE_GOOGLE_PERFTOOLS) + endif(USE_TCMALLOC) if (FMOD) set(debug_files ${debug_files} fmod.dll) @@ -71,7 +73,7 @@ if(WINDOWS) if (MSVC80) FIND_PATH(debug_msvc8_redist_path msvcr80d.dll PATHS - ${MSVC_DEBUG_REDIST_PATH} + ${MSVC_DEBUG_REDIST_PATH} [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir]/redist/Debug_NonRedist/x86/Microsoft.VC80.DebugCRT NO_DEFAULT_PATH NO_DEFAULT_PATH @@ -96,7 +98,7 @@ if (MSVC80) FIND_PATH(release_msvc8_redist_path msvcr80.dll PATHS - ${MSVC_REDIST_PATH} + ${MSVC_REDIST_PATH} [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir]/redist/x86/Microsoft.VC80.CRT NO_DEFAULT_PATH NO_DEFAULT_PATH @@ -212,11 +214,12 @@ elseif(DARWIN) libexpat.1.5.2.dylib libexpat.dylib libGLOD.dylib - libllqtwebkit.dylib - libminizip.a + libllqtwebkit.dylib + libminizip.a libndofdev.dylib + libhunspell-1.3.0.dylib libexception_handler.dylib - libcollada14dom.dylib + libcollada14dom.dylib ) # fmod is statically linked on darwin @@ -252,29 +255,33 @@ elseif(LINUX) libaprutil-1.so.0 libatk-1.0.so libbreakpad_client.so.0 - libcollada14dom.so + libcollada14dom.so libcrypto.so.1.0.0 libdb-5.1.so libexpat.so libexpat.so.1 - libglod.so + libglod.so libgmock_main.so libgmock.so.0 libgmodule-2.0.so libgobject-2.0.so libgtest_main.so libgtest.so.0 - libminizip.so + libhunspell-1.3.so.0.0.0 + libminizip.so libopenal.so libopenjpeg.so libssl.so - libtcmalloc_minimal.so libuuid.so.16 libuuid.so.16.0.22 libssl.so.1.0.0 libfontconfig.so.1.4.4 ) + if (USE_TCMALLOC) + set(release_files ${release_files} "libtcmalloc_minimal.so") + endif (USE_TCMALLOC) + if (FMOD) set(release_files ${release_files} "libfmod-3.75.so") endif (FMOD) diff --git a/indra/cmake/FMOD.cmake b/indra/cmake/FMOD.cmake index cb5124812d..3586c1160a 100644 --- a/indra/cmake/FMOD.cmake +++ b/indra/cmake/FMOD.cmake @@ -16,15 +16,15 @@ if (FMOD) include(FindFMOD) else (STANDALONE) if (FMOD_LIBRARY AND FMOD_INCLUDE_DIR) - # If the path have been specified in the arguments, use that + # If the path have been specified in the arguments, use that set(FMOD_LIBRARIES ${FMOD_LIBRARY}) - MESSAGE(STATUS "Using FMOD path: ${FMOD_LIBRARIES}, ${FMOD_INCLUDE_DIR}") + MESSAGE(STATUS "Using FMOD path: ${FMOD_LIBRARIES}, ${FMOD_INCLUDE_DIR}") else (FMOD_LIBRARY AND FMOD_INCLUDE_DIR) - # If not, we're going to try to get the package listed in autobuild.xml - # Note: if you're not using INSTALL_PROPRIETARY, the package URL should be local (file:/// URL) - # as accessing the private LL location will fail if you don't have the credential - include(Prebuilt) - use_prebuilt_binary(fmod) + # If not, we're going to try to get the package listed in autobuild.xml + # Note: if you're not using INSTALL_PROPRIETARY, the package URL should be local (file:/// URL) + # as accessing the private LL location will fail if you don't have the credential + include(Prebuilt) + use_prebuilt_binary(fmod) if (WINDOWS) set(FMOD_LIBRARY fmod) elseif (DARWIN) diff --git a/indra/cmake/FindAutobuild.cmake b/indra/cmake/FindAutobuild.cmake index 45db2b6ed0..4b5fd484ae 100644 --- a/indra/cmake/FindAutobuild.cmake +++ b/indra/cmake/FindAutobuild.cmake @@ -21,10 +21,10 @@ IF (NOT AUTOBUILD_EXECUTABLE) AUTOBUILD_EXECUTABLE NAMES ${AUTOBUILD_EXE_NAMES} PATHS - ENV PATH - ${CMAKE_SOURCE_DIR}/.. - ${CMAKE_SOURCE_DIR}/../.. - ${CMAKE_SOURCE_DIR}/../../.. + ENV PATH + ${CMAKE_SOURCE_DIR}/.. + ${CMAKE_SOURCE_DIR}/../.. + ${CMAKE_SOURCE_DIR}/../../.. PATH_SUFFIXES "/autobuild/bin/" ) @@ -33,7 +33,7 @@ IF (NOT AUTOBUILD_EXECUTABLE) MESSAGE(STATUS "Using autobuild at: ${AUTOBUILD_EXECUTABLE}") ELSE (AUTOBUILD_EXECUTABLE) IF (AUTOBUILD_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could not find autobuild executable") + MESSAGE(FATAL_ERROR "Could not find autobuild executable") ENDIF (AUTOBUILD_FIND_REQUIRED) ENDIF (AUTOBUILD_EXECUTABLE) diff --git a/indra/cmake/FindGLH.cmake b/indra/cmake/FindGLH.cmake new file mode 100644 index 0000000000..3d16adaf03 --- /dev/null +++ b/indra/cmake/FindGLH.cmake @@ -0,0 +1,30 @@ +# -*- cmake -*- + +# - Find GLH +# Find the Graphic Library Helper includes. +# This module defines +# GLH_INCLUDE_DIR, where to find glh/glh_linear.h. +# GLH_FOUND, If false, do not try to use GLH. + +find_path(GLH_INCLUDE_DIR glh/glh_linear.h + NO_SYSTEM_ENVIRONMENT_PATH + ) + +if (GLH_INCLUDE_DIR) + set(GLH_FOUND "YES") +else (GLH_INCLUDE_DIR) + set(GLH_FOUND "NO") +endif (GLH_INCLUDE_DIR) + +if (GLH_FOUND) + if (NOT GLH_FIND_QUIETLY) + message(STATUS "Found GLH: ${GLH_INCLUDE_DIR}") + set(GLH_FIND_QUIETLY TRUE) # Only alert us the first time + endif (NOT GLH_FIND_QUIETLY) +else (GLH_FOUND) + if (GLH_FIND_REQUIRED) + message(FATAL_ERROR "Could not find GLH") + endif (GLH_FIND_REQUIRED) +endif (GLH_FOUND) + +mark_as_advanced(GLH_INCLUDE_DIR) diff --git a/indra/cmake/FindHUNSPELL.cmake b/indra/cmake/FindHUNSPELL.cmake new file mode 100644 index 0000000000..6faf22959c --- /dev/null +++ b/indra/cmake/FindHUNSPELL.cmake @@ -0,0 +1,38 @@ +# -*- cmake -*- + +# - Find HUNSPELL +# This module defines +# HUNSPELL_INCLUDE_DIR, where to find libhunspell.h, etc. +# HUNSPELL_LIBRARY, the library needed to use HUNSPELL. +# HUNSPELL_FOUND, If false, do not try to use HUNSPELL. + +find_path(HUNSPELL_INCLUDE_DIR hunspell.h + PATH_SUFFIXES hunspell + ) + +set(HUNSPELL_NAMES ${HUNSPELL_NAMES} libhunspell-1.3.0 libhunspell) +find_library(HUNSPELL_LIBRARY + NAMES ${HUNSPELL_NAMES} + ) + +if (HUNSPELL_LIBRARY AND HUNSPELL_INCLUDE_DIR) + set(HUNSPELL_FOUND "YES") +else (HUNSPELL_LIBRARY AND HUNSPELL_INCLUDE_DIR) + set(HUNSPELL_FOUND "NO") +endif (HUNSPELL_LIBRARY AND HUNSPELL_INCLUDE_DIR) + + +if (HUNSPELL_FOUND) + if (NOT HUNSPELL_FIND_QUIETLY) + message(STATUS "Found Hunspell: Library in '${HUNSPELL_LIBRARY}' and header in '${HUNSPELL_INCLUDE_DIR}' ") + endif (NOT HUNSPELL_FIND_QUIETLY) +else (HUNSPELL_FOUND) + if (HUNSPELL_FIND_REQUIRED) + message(FATAL_ERROR " * * *\nCould not find HUNSPELL library! * * *") + endif (HUNSPELL_FIND_REQUIRED) +endif (HUNSPELL_FOUND) + +mark_as_advanced( + HUNSPELL_LIBRARY + HUNSPELL_INCLUDE_DIR + ) diff --git a/indra/cmake/FindJsonCpp.cmake b/indra/cmake/FindJsonCpp.cmake index cf84b309c1..0b056ada58 100644 --- a/indra/cmake/FindJsonCpp.cmake +++ b/indra/cmake/FindJsonCpp.cmake @@ -24,8 +24,8 @@ EXEC_PROGRAM(${CMAKE_CXX_COMPILER} # Try to find a library that was compiled with the same compiler version as we currently use. SET(JSONCPP_NAMES ${JSONCPP_NAMES} libjson_linux-gcc-${_gcc_COMPILER_VERSION}_libmt.so) IF (STANDALONE) - # On standalone, assume that the system installed library was compiled with the used compiler. - SET(JSONCPP_NAMES ${JSONCPP_NAMES} libjson.so) + # On standalone, assume that the system installed library was compiled with the used compiler. + SET(JSONCPP_NAMES ${JSONCPP_NAMES} libjson.so) ENDIF (STANDALONE) FIND_LIBRARY(JSONCPP_LIBRARY NAMES ${JSONCPP_NAMES} diff --git a/indra/cmake/FindLLQtWebkit.cmake b/indra/cmake/FindLLQtWebkit.cmake index 4bf5f5cb73..2f666d3bf0 100644 --- a/indra/cmake/FindLLQtWebkit.cmake +++ b/indra/cmake/FindLLQtWebkit.cmake @@ -35,7 +35,7 @@ find_path(LLQTWEBKIT_INCLUDE_DIR llqtwebkit.h NO_SYSTEM_ENVIRONMENT_PATH HINTS $ find_library(LLQTWEBKIT_LIBRARY NAMES llqtwebkit NO_SYSTEM_ENVIRONMENT_PATH HINTS ${LLQTWEBKIT_LIBRARY_DIRS}) -if (NOT PKG_CONFIG_FOUND OR NOT LLQTWEBKIT_FOUND) # If pkg-config couldn't find it, pretend we don't have pkg-config. +if (NOT PKG_CONFIG_FOUND OR NOT LLQTWEBKIT_FOUND) # If pkg-config couldn't find it, pretend we don't have pkg-config. set(LLQTWEBKIT_LIBRARIES llqtwebkit) get_filename_component(LLQTWEBKIT_LIBRARY_DIRS ${LLQTWEBKIT_LIBRARY} PATH) endif (NOT PKG_CONFIG_FOUND OR NOT LLQTWEBKIT_FOUND) diff --git a/indra/cmake/FindZLIB.cmake b/indra/cmake/FindZLIB.cmake index 6d630f1ba9..03a7db9d6f 100644 --- a/indra/cmake/FindZLIB.cmake +++ b/indra/cmake/FindZLIB.cmake @@ -30,12 +30,12 @@ endif (ZLIB_LIBRARY AND ZLIB_INCLUDE_DIR) if (ZLIB_FOUND) if (NOT ZLIB_FIND_QUIETLY) - message(STATUS "Found ZLIB: ${ZLIB_LIBRARIES}") - SET(ZLIB_FIND_QUIETLY TRUE) + message(STATUS "Found ZLIB: ${ZLIB_LIBRARIES}") + SET(ZLIB_FIND_QUIETLY TRUE) endif (NOT ZLIB_FIND_QUIETLY) else (ZLIB_FOUND) if (ZLIB_FIND_REQUIRED) - message(FATAL_ERROR "Could not find ZLIB library") + message(FATAL_ERROR "Could not find ZLIB library") endif (ZLIB_FIND_REQUIRED) endif (ZLIB_FOUND) diff --git a/indra/cmake/GLH.cmake b/indra/cmake/GLH.cmake new file mode 100644 index 0000000000..911dbe4017 --- /dev/null +++ b/indra/cmake/GLH.cmake @@ -0,0 +1,11 @@ +# -*- cmake -*- +include(Prebuilt) + +set(GLH_FIND_REQUIRED TRUE) +set(GLH_FIND_QUIETLY TRUE) + +if (STANDALONE) + include(FindGLH) +else (STANDALONE) + use_prebuilt_binary(glh_linear) +endif (STANDALONE) diff --git a/indra/cmake/GoogleMock.cmake b/indra/cmake/GoogleMock.cmake index 06d6d847a0..c4c96a9af7 100644 --- a/indra/cmake/GoogleMock.cmake +++ b/indra/cmake/GoogleMock.cmake @@ -8,7 +8,7 @@ set(GOOGLEMOCK_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) if (LINUX) - # VWR-24366: gmock is underlinked, it needs gtest. + # VWR-24366: gmock is underlinked, it needs gtest. set(GOOGLEMOCK_LIBRARIES gmock -Wl,--no-as-needed gtest -Wl,--as-needed) diff --git a/indra/cmake/GooglePerfTools.cmake b/indra/cmake/GooglePerfTools.cmake index 8740e36753..09501e0406 100644 --- a/indra/cmake/GooglePerfTools.cmake +++ b/indra/cmake/GooglePerfTools.cmake @@ -1,20 +1,34 @@ # -*- cmake -*- include(Prebuilt) +# If you want to enable or disable TCMALLOC in viewer builds, this is the place. +# set ON or OFF as desired. +set (USE_TCMALLOC ON) + if (STANDALONE) include(FindGooglePerfTools) else (STANDALONE) if (WINDOWS) - use_prebuilt_binary(tcmalloc) - set(TCMALLOC_LIBRARIES - debug libtcmalloc_minimal-debug - optimized libtcmalloc_minimal) + if (USE_TCMALLOC) + use_prebuilt_binary(tcmalloc) + set(TCMALLOC_LIBRARIES + debug libtcmalloc_minimal-debug + optimized libtcmalloc_minimal) + set(TCMALLOC_LINK_FLAGS "/INCLUDE:__tcmalloc") + else (USE_TCMALLOC) + set(TCMALLOC_LIBRARIES) + set(TCMALLOC_LINK_FLAGS) + endif (USE_TCMALLOC) set(GOOGLE_PERFTOOLS_FOUND "YES") endif (WINDOWS) if (LINUX) - use_prebuilt_binary(tcmalloc) - set(TCMALLOC_LIBRARIES - tcmalloc) + if (USE_TCMALLOC) + use_prebuilt_binary(tcmalloc) + set(TCMALLOC_LIBRARIES + tcmalloc) + else (USE_TCMALLOC) + set(TCMALLOC_LIBRARIES) + endif (USE_TCMALLOC) set(PROFILER_LIBRARIES profiler) set(GOOGLE_PERFTOOLS_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include) @@ -29,13 +43,19 @@ if (GOOGLE_PERFTOOLS_FOUND) endif (GOOGLE_PERFTOOLS_FOUND) if (WINDOWS) - set(USE_GOOGLE_PERFTOOLS ON) + set(USE_GOOGLE_PERFTOOLS ON) endif (WINDOWS) if (USE_GOOGLE_PERFTOOLS) - set(TCMALLOC_FLAG -ULL_USE_TCMALLOC=1) + if (USE_TCMALLOC) + set(TCMALLOC_FLAG -DLL_USE_TCMALLOC=1) + else (USE_TCMALLOC) + set(TCMALLOC_FLAG -ULL_USE_TCMALLOC) + endif (USE_TCMALLOC) +endif (USE_GOOGLE_PERFTOOLS) + +if (USE_GOOGLE_PERFTOOLS) include_directories(${GOOGLE_PERFTOOLS_INCLUDE_DIR}) set(GOOGLE_PERFTOOLS_LIBRARIES ${TCMALLOC_LIBRARIES} ${STACKTRACE_LIBRARIES} ${PROFILER_LIBRARIES}) else (USE_GOOGLE_PERFTOOLS) - set(TCMALLOC_FLAG -ULL_USE_TCMALLOC) endif (USE_GOOGLE_PERFTOOLS) diff --git a/indra/cmake/Havok.cmake b/indra/cmake/Havok.cmake new file mode 100644 index 0000000000..5c0768abfa --- /dev/null +++ b/indra/cmake/Havok.cmake @@ -0,0 +1,83 @@ +# -*- cmake -*- + +use_prebuilt_binary(havok-source) +set(Havok_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/havok/Source) +list(APPEND Havok_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/havok/Demo) + +set(HAVOK_DEBUG_LIBRARY_PATH ${LIBS_PREBUILT_DIR}/lib/debug/havok-fulldebug) +set(HAVOK_RELEASE_LIBRARY_PATH ${LIBS_PREBUILT_DIR}/lib/release/havok) + +if (LL_DEBUG_HAVOK) + if (WIN32) + # Always link relwithdebinfo to havok-hybrid on windows. + set(HAVOK_RELWITHDEBINFO_LIBRARY_PATH ${LIBS_PREBUILT_DIR}/lib/debug/havok-hybrid) + else (WIN32) + set(HAVOK_RELWITHDEBINFO_LIBRARY_PATH ${LIBS_PREBUILT_DIR}/lib/debug/havok-fulldebug) + endif (WIN32) +else (LL_DEBUG_HAVOK) + set(HAVOK_RELWITHDEBINFO_LIBRARY_PATH ${LIBS_PREBUILT_DIR}/lib/release/havok) +endif (LL_DEBUG_HAVOK) + +set(HAVOK_LIBS + hkBase + hkCompat + hkGeometryUtilities + hkInternal + hkSerialize + hkSceneData + hkpCollide + hkpUtilities + hkpConstraintSolver + hkpDynamics + hkpInternal + hkaiInternal + hkaiPathfinding + hkaiAiPhysicsBridge + hkcdInternal + hkcdCollide + hkpVehicle + hkVisualize + hkaiVisualize + hkgpConvexDecomposition +) + +unset(HK_DEBUG_LIBRARIES) +unset(HK_RELEASE_LIBRARIES) +unset(HK_RELWITHDEBINFO_LIBRARIES) + +foreach(HAVOK_LIB ${HAVOK_LIBS}) + find_library(HAVOK_DEBUG_LIB_${HAVOK_LIB} ${HAVOK_LIB} PATHS ${HAVOK_DEBUG_LIBRARY_PATH}) + find_library(HAVOK_RELEASE_LIB_${HAVOK_LIB} ${HAVOK_LIB} PATHS ${HAVOK_RELEASE_LIBRARY_PATH}) + find_library(HAVOK_RELWITHDEBINFO_LIB_${HAVOK_LIB} ${HAVOK_LIB} PATHS ${HAVOK_RELWITHDEBINFO_LIBRARY_PATH}) + + if(LINUX) + set(cmd "mkdir") + set(debug_dir "${HAVOK_DEBUG_LIBRARY_PATH}/${HAVOK_LIB}") + set(release_dir "${HAVOK_RELEASE_LIBRARY_PATH}/${HAVOK_LIB}") + set(relwithdebinfo_dir "${HAVOK_RELWITHDEBINFO_LIBRARY_PATH}/${HAVOK_LIB}") + + exec_program( ${cmd} ${HAVOK_DEBUG_LIBRARY_PATH} ARGS ${debug_dir} OUTPUT_VARIABLE rv) + exec_program( ${cmd} ${HAVOK_RELEASE_LIBRARY_PATH} ARGS ${release_dir} OUTPUT_VARIABLE rv) + exec_program( ${cmd} ${HAVOK_RELWITHDEBINFO_LIBRARY_PATH} ARGS ${relwithdebinfo_dir} OUTPUT_VARIABLE rv) + + set(cmd "ar") + set(arg " -xv") + set(arg "${arg} ../lib${HAVOK_LIB}.a") + exec_program( ${cmd} ${debug_dir} ARGS ${arg} OUTPUT_VARIABLE rv) + exec_program( ${cmd} ${release_dir} ARGS ${arg} OUTPUT_VARIABLE rv) + exec_program( ${cmd} ${relwithdebinfo_dir} ARGS ${arg} OUTPUT_VARIABLE rv) + + file(GLOB extracted_debug "${debug_dir}/*.o") + file(GLOB extracted_release "${release_dir}/*.o") + file(GLOB extracted_relwithdebinfo "${relwithdebinfo_dir}/*.o") + list(APPEND HK_DEBUG_LIBRARIES ${extracted_debug}) + list(APPEND HK_RELEASE_LIBRARIES ${extracted_release}) + list(APPEND HK_RELWITHDEBINFO_LIBRARIES ${extracted_relwithdebinfo}) + else(LINUX) + # Win32 + list(APPEND HK_DEBUG_LIBRARIES ${HAVOK_DEBUG_LIB_${HAVOK_LIB}}) + list(APPEND HK_RELEASE_LIBRARIES ${HAVOK_RELEASE_LIB_${HAVOK_LIB}}) + list(APPEND HK_RELWITHDEBINFO_LIBRARIES ${HAVOK_RELWITHDEBINFO_LIB_${HAVOK_LIB}}) + endif (LINUX) +endforeach(HAVOK_LIB) + diff --git a/indra/cmake/Hunspell.cmake b/indra/cmake/Hunspell.cmake new file mode 100644 index 0000000000..0c9cf93316 --- /dev/null +++ b/indra/cmake/Hunspell.cmake @@ -0,0 +1,22 @@ +# -*- cmake -*- +include(Prebuilt) + +set(HUNSPELL_FIND_QUIETLY ON) +set(HUNSPELL_FIND_REQUIRED ON) + +if (STANDALONE) + include(FindHUNSPELL) +else (STANDALONE) + use_prebuilt_binary(libhunspell) + if (WINDOWS) + set(HUNSPELL_LIBRARY libhunspell) + elseif(DARWIN) + set(HUNSPELL_LIBRARY hunspell-1.3.0) + elseif(LINUX) + set(HUNSPELL_LIBRARY hunspell-1.3) + else() + message(FATAL_ERROR "Invalid platform") + endif() + set(HUNSPELL_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/hunspell) + use_prebuilt_binary(dictionaries) +endif (STANDALONE) diff --git a/indra/cmake/JsonCpp.cmake b/indra/cmake/JsonCpp.cmake index 499b00fb44..7ad73e5683 100644 --- a/indra/cmake/JsonCpp.cmake +++ b/indra/cmake/JsonCpp.cmake @@ -18,5 +18,5 @@ else (STANDALONE) elseif (LINUX) set(JSONCPP_LIBRARIES libjson_linux-gcc-4.1.3_libmt.a) endif (WINDOWS) - set(JSONCPP_INCLUDE_DIRS "${LIBS_PREBUILT_DIR}/include/jsoncpp" "${LIBS_PREBUILT_DIR}/include/json") + set(JSONCPP_INCLUDE_DIR "${LIBS_PREBUILT_DIR}/include/jsoncpp" "${LIBS_PREBUILT_DIR}/include/json") endif (STANDALONE) diff --git a/indra/cmake/LLAddBuildTest.cmake b/indra/cmake/LLAddBuildTest.cmake index 08feab6e36..a6f69a09e9 100644 --- a/indra/cmake/LLAddBuildTest.cmake +++ b/indra/cmake/LLAddBuildTest.cmake @@ -205,6 +205,15 @@ FUNCTION(LL_ADD_INTEGRATION_TEST SET_TARGET_PROPERTIES(INTEGRATION_TEST_${testname} PROPERTIES COMPILE_FLAGS -I"${TUT_INCLUDE_DIR}") endif(STANDALONE) + if (WINDOWS) + SET_TARGET_PROPERTIES(INTEGRATION_TEST_${testname} + PROPERTIES + LINK_FLAGS "/debug /NODEFAULTLIB:LIBCMT /SUBSYSTEM:WINDOWS ${TCMALLOC_LINK_FLAGS}" + LINK_FLAGS_DEBUG "/NODEFAULTLIB:\"LIBCMT;LIBCMTD;MSVCRT\" /INCREMENTAL:NO" + LINK_FLAGS_RELEASE "" + ) + endif (WINDOWS) + # Add link deps to the executable if(TEST_DEBUG) message(STATUS "TARGET_LINK_LIBRARIES(INTEGRATION_TEST_${testname} ${libraries})") diff --git a/indra/cmake/LLConvexDecomposition.cmake b/indra/cmake/LLConvexDecomposition.cmake deleted file mode 100644 index 8e44504782..0000000000 --- a/indra/cmake/LLConvexDecomposition.cmake +++ /dev/null @@ -1,12 +0,0 @@ -# -*- cmake -*- -include(Prebuilt) - -set(LLCONVEXDECOMP_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) - -if (INSTALL_PROPRIETARY AND NOT STANDALONE) - use_prebuilt_binary(llconvexdecomposition) - set(LLCONVEXDECOMP_LIBRARY llconvexdecomposition) -else (INSTALL_PROPRIETARY AND NOT STANDALONE) - use_prebuilt_binary(llconvexdecompositionstub) - set(LLCONVEXDECOMP_LIBRARY llconvexdecompositionstub) -endif (INSTALL_PROPRIETARY AND NOT STANDALONE) diff --git a/indra/cmake/LLPhysicsExtensions.cmake b/indra/cmake/LLPhysicsExtensions.cmake new file mode 100644 index 0000000000..e6afee762e --- /dev/null +++ b/indra/cmake/LLPhysicsExtensions.cmake @@ -0,0 +1,35 @@ +# -*- cmake -*- +include(Prebuilt) + +# There are three possible solutions to provide the llphysicsextensions: +# - The full source package, selected by -DHAVOK:BOOL=ON +# - The stub source package, selected by -DHAVOK:BOOL=OFF +# - The prebuilt package available to those with sublicenses, selected by -DHAVOK_TPV:BOOL=ON + +if (INSTALL_PROPRIETARY) + set(HAVOK ON CACHE BOOL "Use Havok physics library") +endif (INSTALL_PROPRIETARY) + + +# Note that the use_prebuilt_binary macros below do not in fact include binaries; +# the llphysicsextensions_* packages are source only and are built here. +# The source package and the stub package both build libraries of the same name. + +if (HAVOK) + include(Havok) + use_prebuilt_binary(llphysicsextensions_source) + set(LLPHYSICSEXTENSIONS_SRC_DIR ${LIBS_PREBUILT_DIR}/llphysicsextensions/src) + set(LLPHYSICSEXTENSIONS_LIBRARIES llphysicsextensions) + +elseif (HAVOK_TPV) + use_prebuilt_binary(llphysicsextensions_tpv) + set(LLPHYSICSEXTENSIONS_LIBRARIES llphysicsextensions_tpv) + +else (HAVOK) + use_prebuilt_binary(llphysicsextensions_stub) + set(LLPHYSICSEXTENSIONS_SRC_DIR ${LIBS_PREBUILT_DIR}/llphysicsextensions/stub) + set(LLPHYSICSEXTENSIONS_LIBRARIES llphysicsextensionsstub) + +endif (HAVOK) + +set(LLPHYSICSEXTENSIONS_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/llphysicsextensions) diff --git a/indra/cmake/LLPlugin.cmake b/indra/cmake/LLPlugin.cmake index 7ee404b9bd..399cb332dd 100644 --- a/indra/cmake/LLPlugin.cmake +++ b/indra/cmake/LLPlugin.cmake @@ -8,7 +8,7 @@ set(LLPLUGIN_INCLUDE_DIRS if (LINUX) # In order to support using ld.gold on linux, we need to explicitely # specify all libraries that llplugin uses. - set(LLPLUGIN_LIBRARIES llplugin pthread) + set(LLPLUGIN_LIBRARIES llplugin pthread) else (LINUX) - set(LLPLUGIN_LIBRARIES llplugin) + set(LLPLUGIN_LIBRARIES llplugin) endif (LINUX) diff --git a/indra/cmake/LLPrimitive.cmake b/indra/cmake/LLPrimitive.cmake index e68d16ed08..f15a2c2649 100644 --- a/indra/cmake/LLPrimitive.cmake +++ b/indra/cmake/LLPrimitive.cmake @@ -10,7 +10,7 @@ set(LLPRIMITIVE_INCLUDE_DIRS ${LIBS_OPEN_DIR}/llprimitive ) if (WINDOWS) - set(LLPRIMITIVE_LIBRARIES + set(LLPRIMITIVE_LIBRARIES debug llprimitive optimized llprimitive debug libcollada14dom22-d diff --git a/indra/cmake/LLRender.cmake b/indra/cmake/LLRender.cmake index c47e8878e9..8427928151 100644 --- a/indra/cmake/LLRender.cmake +++ b/indra/cmake/LLRender.cmake @@ -1,9 +1,11 @@ # -*- cmake -*- include(FreeType) +include(GLH) set(LLRENDER_INCLUDE_DIRS ${LIBS_OPEN_DIR}/llrender + ${GLH_INCLUDE_DIR} ) if (SERVER AND LINUX) diff --git a/indra/cmake/LLSharedLibs.cmake b/indra/cmake/LLSharedLibs.cmake index e29076c738..14dd67f32f 100644 --- a/indra/cmake/LLSharedLibs.cmake +++ b/indra/cmake/LLSharedLibs.cmake @@ -38,18 +38,17 @@ endmacro(ll_deploy_sharedlibs_command) # ll_stage_sharedlib # Performs config and adds a copy command for a sharedlib target. macro(ll_stage_sharedlib DSO_TARGET) - if(SHARED_LIB_STAGING_DIR) - # target gets written to the DLL staging directory. - # Also this directory is shared with RunBuildTest.cmake, y'know, for the tests. - set_target_properties(${DSO_TARGET} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${SHARED_LIB_STAGING_DIR}) - if(NOT WINDOWS) - get_target_property(DSO_PATH ${DSO_TARGET} LOCATION) - get_filename_component(DSO_FILE ${DSO_PATH} NAME) - if(DARWIN) - set(SHARED_LIB_STAGING_DIR_CONFIG ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/Resources) - else(DARWIN) - set(SHARED_LIB_STAGING_DIR_CONFIG ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}) - endif(DARWIN) + # target gets written to the DLL staging directory. + # Also this directory is shared with RunBuildTest.cmake, y'know, for the tests. + set_target_properties(${DSO_TARGET} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${SHARED_LIB_STAGING_DIR}) + if(NOT WINDOWS) + get_target_property(DSO_PATH ${DSO_TARGET} LOCATION) + get_filename_component(DSO_FILE ${DSO_PATH} NAME) + if(DARWIN) + set(SHARED_LIB_STAGING_DIR_CONFIG ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/Resources) + else(DARWIN) + set(SHARED_LIB_STAGING_DIR_CONFIG ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}) + endif(DARWIN) # *TODO - maybe make this a symbolic link? -brad add_custom_command( @@ -63,7 +62,6 @@ macro(ll_stage_sharedlib DSO_TARGET) COMMENT "Copying llcommon to the staging folder." ) endif(NOT WINDOWS) - endif(SHARED_LIB_STAGING_DIR) if (DARWIN) set_target_properties(${DSO_TARGET} PROPERTIES diff --git a/indra/cmake/LLTestCommand.cmake b/indra/cmake/LLTestCommand.cmake index b5a0580a90..f75c23a5de 100644 --- a/indra/cmake/LLTestCommand.cmake +++ b/indra/cmake/LLTestCommand.cmake @@ -9,6 +9,9 @@ MACRO(LL_TEST_COMMAND OUTVAR LD_LIBRARY_PATH) FOREACH(dir ${LD_LIBRARY_PATH}) LIST(APPEND value "-l${dir}") ENDFOREACH(dir) + # Enough different tests want to be able to find CMake's PYTHON_EXECUTABLE + # that we should just pop it into the environment for everybody. + LIST(APPEND value "-DPYTHON=${PYTHON_EXECUTABLE}") LIST(APPEND value ${ARGN}) SET(${OUTVAR} ${value}) ##IF(LL_TEST_VERBOSE) diff --git a/indra/cmake/LScript.cmake b/indra/cmake/LScript.cmake index 86bfcb7440..21e78fc2c0 100644 --- a/indra/cmake/LScript.cmake +++ b/indra/cmake/LScript.cmake @@ -13,4 +13,4 @@ set(LSCRIPT_LIBRARIES lscript_library ) -set(LSCRIPT_EXECUTE_MONO_LIBRARIES lscript_execute_mono)
\ No newline at end of file +set(LSCRIPT_EXECUTE_MONO_LIBRARIES lscript_execute_mono) diff --git a/indra/cmake/Linking.cmake b/indra/cmake/Linking.cmake index 07db6ab257..c3e3a80fd0 100644 --- a/indra/cmake/Linking.cmake +++ b/indra/cmake/Linking.cmake @@ -2,22 +2,19 @@ include(Variables) - -if (NOT STANDALONE) - set(ARCH_PREBUILT_DIRS ${AUTOBUILD_INSTALL_DIR}/lib) - set(ARCH_PREBUILT_DIRS_RELEASE ${AUTOBUILD_INSTALL_DIR}/lib/release) - set(ARCH_PREBUILT_DIRS_DEBUG ${AUTOBUILD_INSTALL_DIR}/lib/debug) - if (WINDOWS) - set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs) - set(EXE_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs) - elseif (LINUX) - set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs/lib) - set(EXE_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs/bin) - elseif (DARWIN) - set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs) - set(EXE_STAGING_DIR "${CMAKE_BINARY_DIR}/sharedlibs/\$(CONFIGURATION)") - endif (WINDOWS) -endif (NOT STANDALONE) +set(ARCH_PREBUILT_DIRS ${AUTOBUILD_INSTALL_DIR}/lib) +set(ARCH_PREBUILT_DIRS_RELEASE ${AUTOBUILD_INSTALL_DIR}/lib/release) +set(ARCH_PREBUILT_DIRS_DEBUG ${AUTOBUILD_INSTALL_DIR}/lib/debug) +if (WINDOWS) + set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs) + set(EXE_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs) +elseif (LINUX) + set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs/lib) + set(EXE_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs/bin) +elseif (DARWIN) + set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs) + set(EXE_STAGING_DIR "${CMAKE_BINARY_DIR}/sharedlibs") +endif (WINDOWS) # Autobuild packages must provide 'release' versions of libraries, but may provide versions for # specific build types. AUTOBUILD_LIBS_INSTALL_DIRS lists first the build type directory and then @@ -36,7 +33,13 @@ else(WINDOWS OR DARWIN) set(AUTOBUILD_LIBS_INSTALL_DIRS ${AUTOBUILD_INSTALL_DIR}/lib/${CMAKE_BUILD_TYPE_LOWER}) endif(WINDOWS OR DARWIN) -list(APPEND AUTOBUILD_LIBS_INSTALL_DIRS ${ARCH_PREBUILT_DIRS_RELEASE}) +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}) if (LINUX) diff --git a/indra/cmake/NDOF.cmake b/indra/cmake/NDOF.cmake index 7a463d1190..be6fe415f2 100644 --- a/indra/cmake/NDOF.cmake +++ b/indra/cmake/NDOF.cmake @@ -5,19 +5,19 @@ set(NDOF ON CACHE BOOL "Use NDOF space navigator joystick library.") if (NDOF) if (STANDALONE) - set(NDOF_FIND_REQUIRED ON) - include(FindNDOF) + set(NDOF_FIND_REQUIRED ON) + include(FindNDOF) else (STANDALONE) - use_prebuilt_binary(ndofdev) + use_prebuilt_binary(ndofdev) - if (WINDOWS) - set(NDOF_LIBRARY libndofdev) - elseif (DARWIN OR LINUX) - set(NDOF_LIBRARY ndofdev) - endif (WINDOWS) + if (WINDOWS) + set(NDOF_LIBRARY libndofdev) + elseif (DARWIN OR LINUX) + set(NDOF_LIBRARY ndofdev) + endif (WINDOWS) - set(NDOF_INCLUDE_DIR ${ARCH_PREBUILT_DIRS}/include/ndofdev) - set(NDOF_FOUND 1) + set(NDOF_INCLUDE_DIR ${ARCH_PREBUILT_DIRS}/include/ndofdev) + set(NDOF_FOUND 1) endif (STANDALONE) endif (NDOF) diff --git a/indra/cmake/OpenSSL.cmake b/indra/cmake/OpenSSL.cmake index 5982ee9a49..2704912eb5 100644 --- a/indra/cmake/OpenSSL.cmake +++ b/indra/cmake/OpenSSL.cmake @@ -11,7 +11,7 @@ else (STANDALONE) if (WINDOWS) set(OPENSSL_LIBRARIES ssleay32 libeay32) else (WINDOWS) - set(OPENSSL_LIBRARIES ssl) + set(OPENSSL_LIBRARIES ssl crypto) endif (WINDOWS) set(OPENSSL_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) endif (STANDALONE) diff --git a/indra/cmake/Variables.cmake b/indra/cmake/Variables.cmake index 4cbf7aa043..56ced20abf 100644 --- a/indra/cmake/Variables.cmake +++ b/indra/cmake/Variables.cmake @@ -101,8 +101,8 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") # To support a different SDK update these Xcode settings: set(CMAKE_OSX_DEPLOYMENT_TARGET 10.5) - set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.5.sdk) - set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "4.0") + set(CMAKE_OSX_SYSROOT macosx10.6) + set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.llvmgcc42") set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT dwarf-with-dsym) # NOTE: To attempt an i386/PPC Universal build, add this on the configure line: diff --git a/indra/cmake/ViewerMiscLibs.cmake b/indra/cmake/ViewerMiscLibs.cmake index df013b1665..5b00c989a4 100644 --- a/indra/cmake/ViewerMiscLibs.cmake +++ b/indra/cmake/ViewerMiscLibs.cmake @@ -2,15 +2,9 @@ include(Prebuilt) if (NOT STANDALONE) + use_prebuilt_binary(libhunspell) use_prebuilt_binary(libuuid) use_prebuilt_binary(slvoice) use_prebuilt_binary(fontconfig) endif(NOT STANDALONE) -if(VIEWER AND NOT STANDALONE) - if(EXISTS ${CMAKE_SOURCE_DIR}/newview/res/have_artwork_bundle.marker) - message(STATUS "We seem to have an artwork bundle in the tree - brilliant.") - else(EXISTS ${CMAKE_SOURCE_DIR}/newview/res/have_artwork_bundle.marker) - message(FATAL_ERROR "Didn't find an artwork bundle - this needs to be downloaded separately and unpacked into this tree. You can probably get it from the same place you got your viewer source. Thanks!") - endif(EXISTS ${CMAKE_SOURCE_DIR}/newview/res/have_artwork_bundle.marker) -endif(VIEWER AND NOT STANDALONE) diff --git a/indra/cmake/VisualLeakDetector.cmake b/indra/cmake/VisualLeakDetector.cmake new file mode 100644 index 0000000000..d3ba554e46 --- /dev/null +++ b/indra/cmake/VisualLeakDetector.cmake @@ -0,0 +1,15 @@ +# -*- cmake -*- + +if (VIEWER) + + set(INCLUDE_VLD_CMAKE OFF CACHE BOOL "Build the Windows viewer with Visual Leak Detector turned on or off") + + if (INCLUDE_VLD_CMAKE) + + if (WINDOWS) + add_definitions(-DINCLUDE_VLD=1) + endif (WINDOWS) + + endif (INCLUDE_VLD_CMAKE) + +endif (VIEWER) diff --git a/indra/cmake/WebKitLibPlugin.cmake b/indra/cmake/WebKitLibPlugin.cmake index 7131445464..d9df78bfc8 100644 --- a/indra/cmake/WebKitLibPlugin.cmake +++ b/indra/cmake/WebKitLibPlugin.cmake @@ -8,21 +8,21 @@ if (STANDALONE) include(${QT_USE_FILE}) set(QTDIR $ENV{QTDIR}) if (QTDIR AND NOT "${QT_BINARY_DIR}" STREQUAL "${QTDIR}/bin") - message(FATAL_ERROR "\"${QT_BINARY_DIR}\" is unequal \"${QTDIR}/bin\"; " - "Qt is found by looking for qmake in your PATH. " - "Please set your PATH such that 'qmake' is found in \$QTDIR/bin, " - "or unset QTDIR if the found Qt is correct.") - endif (QTDIR AND NOT "${QT_BINARY_DIR}" STREQUAL "${QTDIR}/bin") + message(FATAL_ERROR "\"${QT_BINARY_DIR}\" is unequal \"${QTDIR}/bin\"; " + "Qt is found by looking for qmake in your PATH. " + "Please set your PATH such that 'qmake' is found in \$QTDIR/bin, " + "or unset QTDIR if the found Qt is correct.") + endif (QTDIR AND NOT "${QT_BINARY_DIR}" STREQUAL "${QTDIR}/bin") find_package(LLQtWebkit REQUIRED QUIET) # Add the plugins. set(QT_PLUGIN_LIBRARIES) foreach(qlibname qgif qjpeg) - find_library(QT_PLUGIN_${qlibname} ${qlibname} PATHS ${QT_PLUGINS_DIR}/imageformats NO_DEFAULT_PATH) - if (QT_PLUGIN_${qlibname}) - list(APPEND QT_PLUGIN_LIBRARIES ${QT_PLUGIN_${qlibname}}) - else (QT_PLUGIN_${qtlibname}) - message(FATAL_ERROR "Could not find the Qt plugin ${qlibname} in \"${QT_PLUGINS_DIR}/imageformats\"!") - endif (QT_PLUGIN_${qlibname}) + find_library(QT_PLUGIN_${qlibname} ${qlibname} PATHS ${QT_PLUGINS_DIR}/imageformats NO_DEFAULT_PATH) + if (QT_PLUGIN_${qlibname}) + list(APPEND QT_PLUGIN_LIBRARIES ${QT_PLUGIN_${qlibname}}) + else (QT_PLUGIN_${qtlibname}) + message(FATAL_ERROR "Could not find the Qt plugin ${qlibname} in \"${QT_PLUGINS_DIR}/imageformats\"!") + endif (QT_PLUGIN_${qlibname}) endforeach(qlibname) # qjpeg depends on libjpeg list(APPEND QT_PLUGIN_LIBRARIES jpeg) @@ -70,9 +70,10 @@ elseif (LINUX) QtNetwork QtGui QtCore - qgif - qjpeg - jpeg + jscore +# qgif +# qjpeg +# jpeg fontconfig X11 Xrender diff --git a/indra/cmake/run_build_test.py b/indra/cmake/run_build_test.py index ce2d1e0386..a2ef61c8fd 100644 --- a/indra/cmake/run_build_test.py +++ b/indra/cmake/run_build_test.py @@ -46,6 +46,7 @@ $/LicenseInfo$ import os import sys +import signal import subprocess def main(command, libpath=[], vars={}): @@ -113,6 +114,33 @@ def main(command, libpath=[], vars={}): sys.stdout.flush() return subprocess.call(command) +# swiped from vita, sigh, seems like a Bad Idea to introduce dependency +def translate_rc(rc): + """ + Accept an rc encoded as for subprocess.Popen.returncode: + None means still running + int >= 0 means terminated voluntarily with specified rc + int < 0 means terminated by signal (-rc) + + Return a string explaining the outcome. In case of a signal, try to + name the corresponding symbol from the 'signal' module. + """ + if rc is None: + return "still running" + + if rc >= 0: + return "terminated with rc %s" % rc + + # Negative rc means the child was terminated by signal -rc. + rc = -rc + for attr in dir(signal): + if attr.startswith('SIG') and getattr(signal, attr) == rc: + strc = attr + break + else: + strc = str(rc) + return "terminated by signal %s" % strc + if __name__ == "__main__": from optparse import OptionParser parser = OptionParser(usage="usage: %prog [options] command args...") @@ -140,5 +168,5 @@ if __name__ == "__main__": vars=dict([(pair.split('=', 1) + [""])[:2] for pair in opts.vars])) if rc not in (None, 0): print >>sys.stderr, "Failure running: %s" % " ".join(args) - print >>sys.stderr, "Error: %s" % rc + print >>sys.stderr, "Error %s: %s" % (rc, translate_rc(rc)) sys.exit((rc < 0) and 255 or rc) |