From 588a8405b45bf6266141d9c7f3f7e086d00a2012 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Tue, 19 Jul 2011 01:15:21 +1000 Subject: Fix up gcrypt and gpg-error compiling and linking. Much cleaner now,and Windows might work again. --- linden/indra/CMakeLists.txt | 2 -- linden/indra/cmake/libgcrypt.cmake | 4 +-- linden/indra/cmake/libgpg-error.cmake | 4 +-- linden/indra/cmake/libotr.cmake | 2 +- linden/indra/libgcrypt/CMakeLists.txt | 53 +++++++++----------------------- linden/indra/libgpg-error/CMakeLists.txt | 45 ++++++++------------------- linden/indra/libotr/CMakeLists.txt | 31 +++++++++---------- linden/indra/newview/CMakeLists.txt | 10 +++--- 8 files changed, 51 insertions(+), 100 deletions(-) diff --git a/linden/indra/CMakeLists.txt b/linden/indra/CMakeLists.txt index e3643d3..d30e376 100644 --- a/linden/indra/CMakeLists.txt +++ b/linden/indra/CMakeLists.txt @@ -38,8 +38,6 @@ add_subdirectory(cmake) # [$PLOTR$] if (WINDOWS) add_subdirectory(${LIBS_OPEN_PREFIX}gpg.vs) - add_subdirectory(${LIBS_OPEN_PREFIX}libgpg-error) - add_subdirectory(${LIBS_OPEN_PREFIX}libgcrypt) endif (WINDOWS) # if ON will cause linux to link in static OTR like windows does diff --git a/linden/indra/cmake/libgcrypt.cmake b/linden/indra/cmake/libgcrypt.cmake index 057addf..4d19467 100644 --- a/linden/indra/cmake/libgcrypt.cmake +++ b/linden/indra/cmake/libgcrypt.cmake @@ -1,10 +1,10 @@ # -*- cmake -*- set(LIBGCRYPT_INCLUDE_DIRS - ${CMAKE_CURRENT_SOURCE_DIR}/../libgcrypt/libgcrypt-1.2.2/include + ${CMAKE_BINARY_DIR}/libgcrypt/include ) set(LIBGCRYPT_LIBRARIES - gcrypt + ${CMAKE_BINARY_DIR}/libgcrypt/lib/libgcrypt.a ) diff --git a/linden/indra/cmake/libgpg-error.cmake b/linden/indra/cmake/libgpg-error.cmake index b83adee..417ad19 100644 --- a/linden/indra/cmake/libgpg-error.cmake +++ b/linden/indra/cmake/libgpg-error.cmake @@ -1,10 +1,10 @@ # -*- cmake -*- set(LIBGPG-ERROR_INCLUDE_DIRS - ${CMAKE_CURRENT_SOURCE_DIR}/../libgpg-error/libgpg-error-1.0/include + ${CMAKE_BINARY_DIR}/libgpg-error/include ) set(LIBGPG-ERROR_LIBRARIES - gpg-error + ${CMAKE_BINARY_DIR}/libgpg-error/lib/libgpg-error.a ) diff --git a/linden/indra/cmake/libotr.cmake b/linden/indra/cmake/libotr.cmake index 3c07be2..30544f8 100644 --- a/linden/indra/cmake/libotr.cmake +++ b/linden/indra/cmake/libotr.cmake @@ -4,5 +4,5 @@ set(LIBOTR_INCLUDE_DIRS ) set(LIBOTR_LIBRARIES - libotr + otr ) diff --git a/linden/indra/libgcrypt/CMakeLists.txt b/linden/indra/libgcrypt/CMakeLists.txt index 1b6794c..9235a70 100644 --- a/linden/indra/libgcrypt/CMakeLists.txt +++ b/linden/indra/libgcrypt/CMakeLists.txt @@ -1,12 +1,12 @@ # -*- cmake -*- -project(libgcrypt) - include(00-Common) include(libgpg-error) include(libgcrypt) include(Linking) +project(gcrypt) + if (WINDOWS) include_directories( ../gpg.vs/inc.vs @@ -17,7 +17,7 @@ if (WINDOWS) libgcrypt-1.2.2/mpi/generic ) -set(libgcrypt_SOURCE_FILES +set(gcrypt_SOURCE_FILES libgcrypt-1.2.2/src/ath.c libgcrypt-1.2.2/src/global.c libgcrypt-1.2.2/src/misc.c @@ -83,7 +83,7 @@ set(libgcrypt_SOURCE_FILES libgcrypt-1.2.2/mpi/generic/udiv-w-sdiv.c ) -set(libgcrypt_HEADER_FILES +set(gcrypt_HEADER_FILES CMakeLists.txt libgcrypt-1.2.2/src/ath.h @@ -108,53 +108,30 @@ set(libgcrypt_HEADER_FILES libgcrypt-1.2.2/mpi/generic/mpi-asm-defs.h ) -set_source_files_properties(${libgcrypt_HEADER_FILES} +set_source_files_properties(${gcrypt_HEADER_FILES} PROPERTIES HEADER_FILE_ONLY TRUE) -list(APPEND libgcrypt_SOURCE_FILES ${libgcrypt_HEADER_FILES}) +list(APPEND gcrypt_SOURCE_FILES ${gcrypt_HEADER_FILES}) -add_library (libgcrypt ${libgcrypt_SOURCE_FILES}) +add_library (gcrypt ${gcrypt_SOURCE_FILES}) +target_link_libraries( + gcrypt + ) else (WINDOWS) include(ExternalProject) - include_directories( - ${LIBGPG-ERROR_INCLUDE_DIRS} - libgcrypt-1.2.2/src - libgcrypt-1.2.2/mpi - libgcrypt-1.2.2/mpi/generic - libgcrypt-1.2.2 - ) - # Gotta fake a DOWNLOAD_COMMAND to work around a bug in cmake before 2.8.3. -externalproject_add(EP_libgcrypt - DEPENDS EP_libgpg-error +externalproject_add(gcrypt + DEPENDS gpg-error DOWNLOAD_COMMAND "" - PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/../libgcrypt/libgcrypt-1.2.2 - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../libgcrypt/libgcrypt-1.2.2 - CONFIGURE_COMMAND /configure -prefix= --with-gpg-error-prefix=${CMAKE_CURRENT_SOURCE_DIR}/../libgpg-error/libgpg-error-1.0 - BUILD_COMMAND ${MAKE} - BUILD_IN_SOURCE 1 + PREFIX ${CMAKE_BINARY_DIR}/libgcrypt + SOURCE_DIR ${CMAKE_SOURCE_DIR}/libgcrypt/libgcrypt-1.2.2 + CONFIGURE_COMMAND /configure -prefix= --with-gpg-error-prefix=${CMAKE_BINARY_DIR}/libgpg-error INSTALL_COMMAND make install ) -link_directories(${LIBGCRYPT_LIBRARIES}) -include_directories(${LIBGCRYPT_INCLUDE_DIRS}) - -add_library(libgcrypt STATIC IMPORTED) - -# Happy this is not needed, but leaving it around for reference. -#set_target_properties(libgcrypt PROPERTIES -# IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/../libgcrypt/libgcrypt-1.2.2/lib/libgcrypt.a -# ) - -# This wont work until 2.8.4 sigh -#add_dependencies(libgcrypt EP_libgcrypt) - endif (WINDOWS) -target_link_libraries( - libgcrypt - ) diff --git a/linden/indra/libgpg-error/CMakeLists.txt b/linden/indra/libgpg-error/CMakeLists.txt index b3db72e..a0e6202 100644 --- a/linden/indra/libgpg-error/CMakeLists.txt +++ b/linden/indra/libgpg-error/CMakeLists.txt @@ -1,13 +1,13 @@ # -*- cmake -*- -project(libgpg-error) - include(00-Common) include(libgpg-error) include(Linking) if (WINDOWS) +project(gpg-error) + include_directories( ../gpg.vs/inc.vs ../gpg.vs/libgpg-error-1.1.vs/custom @@ -25,7 +25,7 @@ set(libgpg-error_SOURCE_FILES libgpg-error-1.0/src/strsource.c ) -set(libgpg-error_HEADER_FILES +set(gpg-error_HEADER_FILES CMakeLists.txt libgpg-error-1.0/src/err-codes.h @@ -34,49 +34,28 @@ set(libgpg-error_HEADER_FILES libgpg-error-1.0/src/gpg-error.h ) -set_source_files_properties(${libgpg-error_HEADER_FILES} +set_source_files_properties(${gpg-error_HEADER_FILES} PROPERTIES HEADER_FILE_ONLY TRUE) -list(APPEND libgpg-error_SOURCE_FILES ${libgpg-error_HEADER_FILES}) +list(APPEND gpg-error_SOURCE_FILES ${gpg-error_HEADER_FILES}) -add_library (libgpg-error ${libgpg-error_SOURCE_FILES}) +add_library (gpg-error ${gpg-error_SOURCE_FILES}) +target_link_libraries( + gpg-error + ) else (WINDOWS) include(ExternalProject) - include_directories( - libgpg-error-1.0/src - libgpg-error-1.0 - ) - # Gotta fake a DOWNLOAD_COMMAND to work around a bug in cmake before 2.8.3. -externalproject_add(EP_libgpg-error +externalproject_add(gpg-error DOWNLOAD_COMMAND "" - PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/../libgpg-error/libgpg-error-1.0 - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../libgpg-error/libgpg-error-1.0 + PREFIX ${CMAKE_BINARY_DIR}/libgpg-error + SOURCE_DIR ${CMAKE_SOURCE_DIR}/libgpg-error/libgpg-error-1.0 CONFIGURE_COMMAND /configure -prefix= - BUILD_COMMAND ${MAKE} - BUILD_IN_SOURCE 1 INSTALL_COMMAND make install ) -link_directories(${LIBGPG-ERROR_LIBRARIES}) -include_directories(${LIBGPG-ERROR_INCLUDE_DIRS}) - -add_library(libgpg-error STATIC IMPORTED) - -# Happy this is not needed, but leaving it around for reference. -#set_target_properties(libgpg-error PROPERTIES -# IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/../libgpg-error/libgpg-error-1.0/lib/libgpg-error.a -# ) - -# This wont work until 2.8.4 sigh -#add_dependencies(libgpg-error EP_libgpg-error) - endif (WINDOWS) -target_link_libraries( - libgpg-error - ) - diff --git a/linden/indra/libotr/CMakeLists.txt b/linden/indra/libotr/CMakeLists.txt index f0561d8..ca818a1 100644 --- a/linden/indra/libotr/CMakeLists.txt +++ b/linden/indra/libotr/CMakeLists.txt @@ -1,8 +1,11 @@ # -*- cmake -*- -project(libgpg-error) -project(libgcrypt) -project(libotr) +project(otr) + +include(00-Common) +include(libgpg-error) +include(libgcrypt) +include(Linking) if (WINDOWS) include_directories( @@ -16,11 +19,10 @@ else (WINDOWS) include_directories( ${LIBGPG-ERROR_INCLUDE_DIRS} ${LIBGCRYPT_INCLUDE_DIRS} - ../libgcrypt/libgcrypt-1.2.2/src ) endif (WINDOWS) -set(libotr_SOURCE_FILES +set(otr_SOURCE_FILES libotr-3.2.0/src/auth.c libotr-3.2.0/src/b64.c libotr-3.2.0/src/context.c @@ -34,7 +36,7 @@ set(libotr_SOURCE_FILES libotr-3.2.0/src/userstate.c ) -set(libotr_HEADER_FILES +set(otr_HEADER_FILES CMakeLists.txt libotr-3.2.0/src/auth.h @@ -53,19 +55,16 @@ set(libotr_HEADER_FILES libotr-3.2.0/src/version.h ) -set_source_files_properties(${libotr_HEADER_FILES} +set_source_files_properties(${otr_HEADER_FILES} PROPERTIES HEADER_FILE_ONLY TRUE) -list(APPEND libotr_SOURCE_FILES ${libotr_HEADER_FILES}) +list(APPEND libotr_SOURCE_FILES ${otr_HEADER_FILES}) -add_library (libotr ${libotr_SOURCE_FILES}) -target_link_libraries(libotr - gcrypt - gpg-error +add_library (otr ${otr_SOURCE_FILES}) +target_link_libraries(otr + ${LIBGCRYPT_LIBRARIES} + ${LIBGPG-ERROR_LIBRARIES} ) -# Not sure if either or both are needed, does not seem to hurt. -# Still does not make things build in the right sequence. sigh -add_dependencies(libotr EP_libgcrpt) -add_dependencies(libotr libgcrypt) +add_dependencies(otr gcrypt) diff --git a/linden/indra/newview/CMakeLists.txt b/linden/indra/newview/CMakeLists.txt index fa306a5..84efa1e 100644 --- a/linden/indra/newview/CMakeLists.txt +++ b/linden/indra/newview/CMakeLists.txt @@ -93,8 +93,8 @@ if (WINDOWS) ) endif (WINDOWS) include_directories( - ../libgpg-error/libgpg-error-1.0/src - ../libgcrypt/libgcrypt-1.2.2/src + ${LIBGPG-ERROR_INCLUDE_DIRS} + ${LIBGCRYPT_INCLUDE_DIRS} ../libotr/libotr-3.2.0/src ) # [/$PLOTR$] @@ -1074,8 +1074,8 @@ if (LINUX) if (STATIC_LIBOTR_ETC) # defined in .../linden/indra/CMakeLists.txt set(viewer_LIBRARIES Xinerama - #gpg-error - #gcrypt # to build libotr from source and statically link in libgcrypt and libgpg-error + ${LIBGPG-ERROR_LDBRARIES} + ${LIBGCRYPT-ERROR_LDBRARIES} ) else (STATIC_LIBOTR_ETC) # below for dynamically linked, unmodified libotr set(viewer_LIBRARIES @@ -1446,8 +1446,6 @@ if (WINDOWS) else (WINDOWS) if (STATIC_LIBOTR_ETC) set(otr_link_libs ${LIBOTR_LIBRARIES} - ${LIBGCRYPT_LIBRARIES} - ${LIBGPG-ERROR_LIBRARIES} ) # statically linked libotr, built from source else (STATIC_LIBOTR_ETC) set(otr_link_libs ${OTR_LIBRARY} -- cgit v1.1