From cc5f8686feee4efea124d582b99990dd987e1e98 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Mon, 15 Oct 2012 17:36:51 +0000 Subject: Speeding up cmake configuration, especially on linux. Re-arranged llrender/llwindow cmake source a bit --- indra/cmake/00-Common.cmake | 4 ++ indra/cmake/Havok.cmake | 134 +++++++++++++++++++++++++++++------------- indra/cmake/Linking.cmake | 5 ++ indra/cmake/Prebuilt.cmake | 5 ++ indra/cmake/Variables.cmake | 4 ++ indra/llrender/CMakeLists.txt | 10 ++-- indra/llwindow/CMakeLists.txt | 20 +++---- 7 files changed, 126 insertions(+), 56 deletions(-) diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 87fa4cf55a..da0920d048 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -2,6 +2,9 @@ # # Compilation options shared by all Second Life components. +if(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED) +set(${CMAKE_CURRENT_LIST_FILE}_INCLUDED "YES") + include(Variables) # Portable compilation flags. @@ -234,3 +237,4 @@ else (STANDALONE) ) endif (STANDALONE) +endif(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED) diff --git a/indra/cmake/Havok.cmake b/indra/cmake/Havok.cmake index 5c0768abfa..44f81ce332 100644 --- a/indra/cmake/Havok.cmake +++ b/indra/cmake/Havok.cmake @@ -1,6 +1,10 @@ # -*- cmake -*- +if(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED) +set(${CMAKE_CURRENT_LIST_FILE}_INCLUDED "YES") + 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) @@ -8,14 +12,14 @@ 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) + 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) + set(HAVOK_RELWITHDEBINFO_LIBRARY_PATH ${LIBS_PREBUILT_DIR}/lib/release/havok) endif (LL_DEBUG_HAVOK) set(HAVOK_LIBS @@ -45,39 +49,89 @@ unset(HK_DEBUG_LIBRARIES) unset(HK_RELEASE_LIBRARIES) unset(HK_RELWITHDEBINFO_LIBRARIES) +# *TODO: Figure out why we need to extract like this... 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) + 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(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}") + + # Try to avoid extracting havok library each time we run cmake. + if("${havok_${HAVOK_LIB}_extracted}" STREQUAL "" AND EXISTS "${CMAKE_BINARY_DIR}/temp/havok_${HAVOK_LIB}_extracted") + file(READ ${CMAKE_BINARY_DIR}/temp/havok_${HAVOK_LIB}_extracted "havok_${HAVOK_LIB}_extracted") + if(DEBUG_PREBUILT) + message(STATUS "havok_${HAVOK_LIB}_extracted: \"${havok_${HAVOK_LIB}_extracted}\"") + endif(DEBUG_PREBUILT) + endif("${havok_${HAVOK_LIB}_extracted}" STREQUAL "" AND EXISTS "${CMAKE_BINARY_DIR}/temp/havok_${HAVOK_LIB}_extracted") + + if(${CMAKE_BINARY_DIR}/temp/havok-source_installed IS_NEWER_THAN ${CMAKE_BINARY_DIR}/temp/havok_${HAVOK_LIB}_extracted OR NOT ${havok_${HAVOK_LIB}_extracted} EQUAL 0) + if(DEBUG_PREBUILT) + MESSAGE(STATUS "Extracting ${HAVOK_LIB}...") + endif(DEBUG_PREBUILT) + set(cmd "mkdir") + + if(DEBUG_PREBUILT) + MESSAGE(STATUS "${cmd} ${debug_dir}") + endif(DEBUG_PREBUILT) + exec_program( ${cmd} ${HAVOK_DEBUG_LIBRARY_PATH} ARGS ${debug_dir} OUTPUT_VARIABLE rv) + + if(DEBUG_PREBUILT) + MESSAGE(STATUS "${cmd} ${release_dir}") + endif(DEBUG_PREBUILT) + exec_program( ${cmd} ${HAVOK_RELEASE_LIBRARY_PATH} ARGS ${release_dir} OUTPUT_VARIABLE rv) + + if(DEBUG_PREBUILT) + MESSAGE(STATUS "${cmd} ${relwithdebinfo_dir}") + endif(DEBUG_PREBUILT) + 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") + if(DEBUG_PREBUILT) + MESSAGE(STATUS "cd ${debug_dir} && ${cmd} ${arg}") + endif(DEBUG_PREBUILT) + exec_program( ${cmd} ${debug_dir} ARGS ${arg} OUTPUT_VARIABLE rv) + + if(DEBUG_PREBUILT) + MESSAGE(STATUS "cd ${release_dir} && ${cmd} ${arg}") + endif(DEBUG_PREBUILT) + exec_program( ${cmd} ${release_dir} ARGS ${arg} OUTPUT_VARIABLE rv) + + if(DEBUG_PREBUILT) + MESSAGE(STATUS "cd ${relwithdebinfo_dir} && ${cmd} ${arg}") + endif(DEBUG_PREBUILT) + exec_program( ${cmd} ${relwithdebinfo_dir} ARGS ${arg} OUTPUT_VARIABLE rv) + + # Just assume success for now. + set(havok_${HAVOK_LIB}_extracted 0) + file(WRITE ${CMAKE_BINARY_DIR}/temp/havok_${HAVOK_LIB}_extracted "${havok_${HAVOK_LIB}_extracted}") + + endif(${CMAKE_BINARY_DIR}/temp/havok-source_installed IS_NEWER_THAN ${CMAKE_BINARY_DIR}/temp/havok_${HAVOK_LIB}_extracted OR NOT ${havok_${HAVOK_LIB}_extracted} EQUAL 0) + + file(GLOB extracted_debug "${debug_dir}/*.o") + file(GLOB extracted_release "${release_dir}/*.o") + file(GLOB extracted_relwithdebinfo "${relwithdebinfo_dir}/*.o") + + if(DEBUG_PREBUILT) + MESSAGE(STATUS "extracted_debug ${debug_dir}/*.o") + MESSAGE(STATUS "extracted_release ${release_dir}/*.o") + MESSAGE(STATUS "extracted_relwithdebinfo ${relwithdebinfo_dir}/*.o") + endif(DEBUG_PREBUILT) + + 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) +endif(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED) diff --git a/indra/cmake/Linking.cmake b/indra/cmake/Linking.cmake index c3e3a80fd0..b9c9e531fc 100644 --- a/indra/cmake/Linking.cmake +++ b/indra/cmake/Linking.cmake @@ -1,5 +1,8 @@ # -*- cmake -*- +if(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED) +set(${CMAKE_CURRENT_LIST_FILE}_INCLUDED "YES") + include(Variables) set(ARCH_PREBUILT_DIRS ${AUTOBUILD_INSTALL_DIR}/lib) @@ -69,3 +72,5 @@ else (WINDOWS) endif (WINDOWS) mark_as_advanced(DL_LIBRARY PTHREAD_LIBRARY WINDOWS_LIBRARIES) + +endif(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED) diff --git a/indra/cmake/Prebuilt.cmake b/indra/cmake/Prebuilt.cmake index dbb4dfc46c..ac0cbde253 100644 --- a/indra/cmake/Prebuilt.cmake +++ b/indra/cmake/Prebuilt.cmake @@ -1,5 +1,8 @@ # -*- cmake -*- +if(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED) +set(${CMAKE_CURRENT_LIST_FILE}_INCLUDED "YES") + include(FindAutobuild) if(INSTALL_PROPRIETARY) include(FindSCP) @@ -51,3 +54,5 @@ macro (use_prebuilt_binary _binary) endif (NOT ${_binary}_installed EQUAL 0) endif (NOT STANDALONE_${_binary}) endmacro (use_prebuilt_binary _binary) + +endif(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED) diff --git a/indra/cmake/Variables.cmake b/indra/cmake/Variables.cmake index 405d80aeb0..6efe738197 100644 --- a/indra/cmake/Variables.cmake +++ b/indra/cmake/Variables.cmake @@ -12,6 +12,9 @@ # Relative and absolute paths to subtrees. +if(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED) +set(${CMAKE_CURRENT_LIST_FILE}_INCLUDED "YES") + if(NOT DEFINED COMMON_CMAKE_DIR) set(COMMON_CMAKE_DIR "${CMAKE_SOURCE_DIR}/cmake") endif(NOT DEFINED COMMON_CMAKE_DIR) @@ -167,3 +170,4 @@ set(USE_PRECOMPILED_HEADERS ON CACHE BOOL "Enable use of precompiled header dire source_group("CMake Rules" FILES CMakeLists.txt) +endif(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED) diff --git a/indra/llrender/CMakeLists.txt b/indra/llrender/CMakeLists.txt index 26b5ac17fe..669b70aa43 100644 --- a/indra/llrender/CMakeLists.txt +++ b/indra/llrender/CMakeLists.txt @@ -32,18 +32,21 @@ include_directories(SYSTEM set(llrender_SOURCE_FILES llcubemap.cpp + llfontbitmapcache.cpp llfontfreetype.cpp llfontgl.cpp - llfontbitmapcache.cpp llfontregistry.cpp + llgl.cpp llgldbg.cpp llglslshader.cpp llgltexture.cpp llimagegl.cpp llpostprocess.cpp + llrender.cpp llrender2dutils.cpp llrendernavprim.cpp llrendersphere.cpp + llrendertarget.cpp llshadermgr.cpp lltexture.cpp lluiimage.cpp @@ -82,11 +85,6 @@ set_source_files_properties(${llrender_HEADER_FILES} list(APPEND llrender_SOURCE_FILES ${llrender_HEADER_FILES}) -list(APPEND llrender_SOURCE_FILES - llgl.cpp - llrender.cpp - llrendertarget.cpp - ) if (BUILD_HEADLESS) add_library (llrenderheadless ${llrender_SOURCE_FILES} diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt index 4610b7a234..ad010164eb 100644 --- a/indra/llwindow/CMakeLists.txt +++ b/indra/llwindow/CMakeLists.txt @@ -80,6 +80,15 @@ if (LINUX) fontconfig # For FCInit and other FC* functions. ) + list(APPEND viewer_SOURCE_FILES + llkeyboardsdl.cpp + llwindowsdl.cpp + ) + list(APPEND viewer_HEADER_FILES + llkeyboardsdl.h + llwindowsdl.h + ) + if (BUILD_HEADLESS) set(llwindowheadless_LINK_LIBRARIES ${LLCOMMON_LIBRARIES} @@ -92,6 +101,7 @@ if (LINUX) fontconfig # For FCInit and other FC* functions. ) endif (BUILD_HEADLESS) + endif (LINUX) if (DARWIN) @@ -115,16 +125,6 @@ if (DARWIN) ) endif (DARWIN) -if (LINUX) - list(APPEND viewer_SOURCE_FILES - llkeyboardsdl.cpp - llwindowsdl.cpp - ) - list(APPEND viewer_HEADER_FILES - llkeyboardsdl.h - llwindowsdl.h - ) -endif (LINUX) if (WINDOWS) list(APPEND llwindow_SOURCE_FILES -- cgit v1.2.3