Changeset 656

Show
Ignore:
Timestamp:
03/23/07 01:20:19 (17 months ago)
Author:
hyriand
Message:

Bumped NewNet revision. Upper->lower casing for CMakeLists.txt and various other build tweaks.

Location:
branches/newnet/museekd
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • branches/newnet/museekd

    • Property svn:externals
      •  

        old new  
        1 NewNet -r669 https://svn.thegraveyard.org:8043/repos/NewNet/trunk/NewNet 
         1NewNet -r673 https://svn.thegraveyard.org:8043/repos/NewNet/trunk/NewNet 
  • branches/newnet/museekd/CMakeLists.txt

    r655 r656  
    1 PROJECT(museekd) 
     1project(museekd) 
     2 
     3# Include some cmake checks. 
     4include(CheckIncludeFiles) 
     5include(CheckTypeSize) 
     6include(CheckFunctionExists) 
     7include(CheckLibraryExists) 
     8include(CheckCXXSourceCompiles) 
    29 
    310# Enable NewNet's smart-pointer debugging capabilities. 
    4 ADD_DEFINITIONS(-DNN_PTR_DEBUG -DNN_PTR_DEBUG_ASSERT) 
     11add_definitions(-DNN_PTR_DEBUG -DNN_PTR_DEBUG_ASSERT) 
    512 
    6 INCLUDE_DIRECTORIES(.) 
     13# Add top source directory to the include path. 
     14include_directories(.) 
    715 
    8 INCLUDE(CheckIncludeFiles) 
    9 INCLUDE(CheckTypeSize) 
    10 INCLUDE(CheckFunctionExists) 
    11 INCLUDE(CheckLibraryExists) 
    12 INCLUDE(CheckCXXSourceCompiles) 
    13  
    14 # Check for common include files 
    15 CHECK_INCLUDE_FILES(stdlib.h HAVE_STDLIB_H) 
    16 CHECK_INCLUDE_FILES(stdint.h HAVE_STDINT_H) 
    17 CHECK_INCLUDE_FILES(stddef.h HAVE_STDDEF_H) 
    18 CHECK_INCLUDE_FILES(unistd.h HAVE_UNISTD_H) 
    19 CHECK_INCLUDE_FILES(string.h HAVE_STRING_H) 
    20 CHECK_INCLUDE_FILES(errno.h HAVE_ERRNO_H) 
    21 CHECK_INCLUDE_FILES(fcntl.h HAVE_FCNTL_H) 
    22 CHECK_INCLUDE_FILES(netdb.h HAVE_NETDB_H) 
    23 CHECK_INCLUDE_FILES(sys/types.h HAVE_SYS_TYPES_H) 
    24 CHECK_INCLUDE_FILES(sys/time.h HAVE_SYS_TIME_H) 
    25 CHECK_INCLUDE_FILES(sys/select.h HAVE_SYS_SELECT_H) 
    26 CHECK_INCLUDE_FILES(sys/socket.h HAVE_SYS_SOCKET_H) 
    27 CHECK_INCLUDE_FILES(sys/un.h HAVE_SYS_UN_H) 
    28 CHECK_INCLUDE_FILES(sys/stat.h HAVE_SYS_STAT_H) 
    29 CHECK_INCLUDE_FILES(netinet/in.h HAVE_NETINET_IN_H) 
    30 CHECK_INCLUDE_FILES(netinet/tcp.h HAVE_NETINET_TCP_H) 
    31 CHECK_INCLUDE_FILES(windows.h HAVE_WINDOWS_H) 
    32 CHECK_INCLUDE_FILES(winsock.h HAVE_WINSOCK_H) 
     16# Check for common include files. 
     17check_include_files(stdlib.h HAVE_STDLIB_H) 
     18check_include_files(stdint.h HAVE_STDINT_H) 
     19check_include_files(stddef.h HAVE_STDDEF_H) 
     20check_include_files(unistd.h HAVE_UNISTD_H) 
     21check_include_files(string.h HAVE_STRING_H) 
     22check_include_files(errno.h HAVE_ERRNO_H) 
     23check_include_files(fcntl.h HAVE_FCNTL_H) 
     24check_include_files(netdb.h HAVE_NETDB_H) 
     25check_include_files(sys/types.h HAVE_SYS_TYPES_H) 
     26check_include_files(sys/time.h HAVE_SYS_TIME_H) 
     27check_include_files(sys/select.h HAVE_SYS_SELECT_H) 
     28check_include_files(sys/socket.h HAVE_SYS_SOCKET_H) 
     29check_include_files(sys/un.h HAVE_SYS_UN_H) 
     30check_include_files(sys/stat.h HAVE_SYS_STAT_H) 
     31check_include_files(netinet/in.h HAVE_NETINET_IN_H) 
     32check_include_files(netinet/tcp.h HAVE_NETINET_TCP_H) 
     33check_include_files(windows.h HAVE_WINDOWS_H) 
     34check_include_files(winsock.h HAVE_WINSOCK_H) 
    3335 
    3436# Check for some standard types and type sizes 
    35 CHECK_TYPE_SIZE("unsigned char" UNSIGNED_CHAR) 
    36 CHECK_TYPE_SIZE("unsigned short" UNSIGNED_SHORT) 
    37 CHECK_TYPE_SIZE("unsigned int" UNSIGNED_INT) 
    38 CHECK_TYPE_SIZE("unsigned long" UNSIGNED_LONG) 
    39 CHECK_TYPE_SIZE("unsigned long long" UNSIGNED_LONG_LONG) 
    40 CHECK_TYPE_SIZE("uint" UINT) 
    41 CHECK_TYPE_SIZE("uint32" UINT32) 
     37check_type_size("unsigned char" UNSIGNED_CHAR) 
     38check_type_size("unsigned short" UNSIGNED_SHORT) 
     39check_type_size("unsigned int" UNSIGNED_INT) 
     40check_type_size("unsigned long" UNSIGNED_LONG) 
     41check_type_size("unsigned long long" UNSIGNED_LONG_LONG) 
     42check_type_size("uint" UINT) 
     43check_type_size("uint32" UINT32) 
    4244 
    4345# Determine the type to use as uint32. 
    44 IF(HAVE_UINT32) 
    45   SET(UINT32_TYPE uint32) 
    46 ELSEIF(UNSIGNED_CHAR EQUAL 4) 
    47   SET(UINT32_TYPE "unsigned char") 
    48 ELSEIF(UNSIGNED_SHORT EQUAL 4) 
    49   SET(UINT32_TYPE "unsigned short") 
    50 ELSEIF(UNSIGNED_INT EQUAL 4) 
    51   SET(UINT32_TYPE "unsigned int") 
    52 ELSEIF(UNSIGNED_LONG EQUAL 4) 
    53   SET(UINT32_TYPE "unsigned long") 
    54 ELSEIF(UNSIGNED_LONG_LONG EQUAL 4) 
    55   SET(UINT32_TYPE "unsigned long long") 
    56 ELSE(UNSIGNED_LONG_LONG EQUAL 4) 
    57   FATAL_ERROR("Couldn't determine 32bit unsigned interger type.") 
    58 ENDIF(HAVE_UINT32) 
     46if(HAVE_UINT32) 
     47  set(UINT32_TYPE uint32) 
     48elseif(UNSIGNED_CHAR EQUAL 4) 
     49  set(UINT32_TYPE "unsigned char") 
     50elseif(UNSIGNED_SHORT EQUAL 4) 
     51  set(UINT32_TYPE "unsigned short") 
     52elseif(UNSIGNED_INT EQUAL 4) 
     53  set(UINT32_TYPE "unsigned int") 
     54elseif(UNSIGNED_LONG EQUAL 4) 
     55  set(UINT32_TYPE "unsigned long") 
     56elseif(UNSIGNED_LONG_LONG EQUAL 4) 
     57  set(UINT32_TYPE "unsigned long long") 
     58else(UNSIGNED_LONG_LONG EQUAL 4) 
     59  message(FATAL_ERROR "Couldn't determine 32bit unsigned interger type.") 
     60endif(HAVE_UINT32) 
    5961 
    6062# Check for iconv.h 
    61 CHECK_INCLUDE_FILES(iconv.h HAVE_ICONV_H) 
    62 IF(NOT HAVE_ICONV_H) 
    63   FATAL_ERROR("Could not find iconv.h.") 
    64 ENDIF(NOT HAVE_ICONV_H) 
     63check_include_files(iconv.h HAVE_ICONV_H) 
     64if(NOT HAVE_ICONV_H) 
     65  MESSAGE(FATAL_ERROR "Could not find iconv.h.") 
     66endif(NOT HAVE_ICONV_H) 
    6567 
    6668# Check for iconv library (if we need it) 
    67 CHECK_FUNCTION_EXISTS(iconv HAVE_ICONV_BUILTIN) 
    68 IF(HAVE_ICONV_BUILTIN) 
    69   SET(ICONV_LIBRARIES "") 
    70 ELSE(HAVE_ICONV_BUILTIN) 
    71   FIND_LIBRARY(ICONV_LIBRARIES NAMES iconv PATHS /usr/lib /usr/local/lib) 
    72   IF(NOT ICONV_LIBRARIES) 
    73     MESSAGE(FATAL_ERROR "Couldn't find iconv library.") 
    74   ENDIF(NOT ICONV_LIBRARIES) 
    75 ENDIF(HAVE_ICONV_BUILTIN) 
     69check_function_exists(iconv HAVE_ICONV_BUILTIN) 
     70if(HAVE_ICONV_BUILTIN) 
     71  set(ICONV_LIBRARIES "") 
     72else(HAVE_ICONV_BUILTIN) 
     73  find_library(ICONV_LIBRARIES NAMES iconv PATHS /usr/lib /usr/local/lib) 
     74  if(NOT ICONV_LIBRARIES) 
     75    message(FATAL_ERROR "Couldn't find iconv library.") 
     76  endif(NOT ICONV_LIBRARIES) 
     77endif(HAVE_ICONV_BUILTIN) 
    7678 
    77 # Check if iconv() takes const char ** 
    78 SET(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES}) 
    79 CHECK_CXX_SOURCE_COMPILES(" 
     79# Use the iconv library (if any) for the following tests. 
     80set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES}) 
     81 
     82# Check if iconv() takes const char **. 
     83check_cxx_source_compiles(" 
    8084  #include <iconv.h> 
    81   int main() 
    82   { 
    83     return iconv(0, (const char **)0, 0, (char**)0, 0); 
    84   } 
     85  int main(int argc, char ** argv) 
     86  { return iconv(0, (const char **)0, 0, (char**)0, 0); } 
    8587" ICONV_CONST) 
    8688 
    87 # Check if iconv() takes char ** 
    88 CHECK_CXX_SOURCE_COMPILES(" 
     89# Check if iconv() takes char **. 
     90check_cxx_source_compiles(" 
    8991  #include <iconv.h> 
    90   int main() 
    91   { 
    92     return iconv(0, (char **)0, 0, (char**)0, 0); 
    93   } 
     92  int main(int argc, char ** argv) 
     93  { return iconv(0, (char **)0, 0, (char**)0, 0); } 
    9494" ICONV_NON_CONST) 
    9595 
    96 # Not const char ** AND not char **? Uhh.. 
    97 IF(NOT ICONV_CONST AND NOT ICONV_NON_CONST) 
    98   FATAL_ERROR("Problem with iconv: could not determine iconv() input type.") 
    99 ENDIF(NOT ICONV_CONST AND NOT ICONV_NON_CONST) 
    100 SET(CMAKE_REQUIRED_LIBRARIES) 
     96# Not const char ** AND not char **? Uhh.. That's bad mmkay. 
     97if(NOT ICONV_CONST AND NOT ICONV_NON_CONST) 
     98  message(FATAL_ERROR "Problem with iconv: could not determine iconv() input type.") 
     99endif(NOT ICONV_CONST AND NOT ICONV_NON_CONST) 
     100 
     101# Clean up after iconv tests. 
     102set(CMAKE_REQUIRED_LIBRARIES) 
    101103 
    102104# Process config.h.cmake to config.h. 
    103 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) 
     105configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) 
    104106# Add -DHAVE_CONFIG_H. 
    105 ADD_DEFINITIONS(-DHAVE_CONFIG_H) 
     107add_definitions(-DHAVE_CONFIG_H) 
    106108# Make sure config.h can be found. 
    107 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) 
     109include_directories(${CMAKE_CURRENT_BINARY_DIR}) 
    108110 
    109 # Check for some OS specific libraries 
    110 IF(WIN32) 
    111   SET(OS_LIBRARIES ole32 shell32 wsock32) 
    112 ELSE(WIN32) 
    113   SET(OS_LIBRARIES "") 
    114 ENDIF(WIN32) 
     111# Set up new net libraries variable. 
     112set(NEWNET_LIBRARIES NewNet) 
     113if(WIN32 AND NOT CYGWIN) 
     114  set(NEWNET_LIBRARIES ${NEWNET_LIBRARIES} wsock32) 
     115endif(WIN32 AND NOT CYGWIN) 
    115116 
    116117# Where the wild things are... 
    117 SUBDIRS(NewNet Mucipher museekd) 
     118add_subdirectory(NewNet) 
     119add_subdirectory(Mucipher) 
     120add_subdirectory(museekd) 
  • branches/newnet/museekd/Mucipher/CMakeLists.txt

    r653 r656  
    1 PROJECT(Mucipher C) 
    2 SET(MUCIPHER_SRCS 
     1project(Mucipher C) 
     2set(MUCIPHER_SOURCES 
    33  aes.c 
    44  hexdigest.c 
     
    77  sha256.c 
    88) 
    9 ADD_LIBRARY(Mucipher STATIC ${MUCIPHER_SRCS}) 
     9add_library(Mucipher STATIC ${MUCIPHER_SOURCES}) 
  • branches/newnet/museekd/museekd/CMakeLists.txt

    r655 r656  
    1 PROJECT(museekd CXX) 
     1project(museekd CXX) 
    22 
    3 FIND_PACKAGE(ZLIB REQUIRED) 
    4 FIND_PACKAGE(LibXml2 REQUIRED) 
     3# Find ZLib 
     4find_package(ZLIB REQUIRED) 
     5include_directories(${ZLIB_INCLUDE_DIR}) 
    56 
    6 INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR} ${LIBXML2_INCLUDE_DIR}) 
    7 ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) 
     7# Find LibXml2 
     8find_package(LibXml2 REQUIRED) 
     9include_directories(${LIBXML2_INCLUDE_DIR}) 
     10add_definitions(${LIBXML2_DEFINITIONS}) 
    811 
    9 SET(MUSEEKD_SRCS 
     12# Check for some OS specific libraries 
     13set(OS_LIBRARIES "") 
     14if(WIN32 AND NOT CYGWIN) 
     15  set(OS_LIBRARIES ${OS_LIBRARIES} ole32 shell32) 
     16endif(WIN32 AND NOT CYGWIN) 
     17 
     18# Select some source files. 
     19set(MUSEEKD_SOURCES 
    1020  codesetmanager.cpp  ifacemanager.cpp     peermanager.cpp 
    1121  configmanager.cpp   ifacesocket.cpp      peersocket.cpp 
     
    1525  handshakesocket.cpp networkmessage.cpp   usersocket.cpp 
    1626) 
    17 ADD_EXECUTABLE(museekd ${MUSEEKD_SRCS}) 
    18 TARGET_LINK_LIBRARIES(museekd Mucipher NewNet ${ZLIB_LIBRARIES} ${LIBXML2_LIBRARIES} ${ICONV_LIBRARIES} ${OS_LIBRARIES}) 
    19 INSTALL(TARGETS museekd DESTINATION bin) 
     27 
     28# Build the museekd binary. 
     29add_executable(museekd ${MUSEEKD_SOURCES}) 
     30 
     31# Link the museekd binary to some libraries. 
     32target_link_libraries( 
     33  museekd 
     34  Mucipher 
     35  ${NEWNET_LIBRARIES} 
     36  ${ZLIB_LIBRARIES} 
     37  ${LIBXML2_LIBRARIES} 
     38  ${ICONV_LIBRARIES} 
     39  ${OS_LIBRARIES} 
     40) 
     41 
     42# Install the museekd binary to the 'bin' directory. 
     43install( 
     44  TARGETS museekd 
     45  DESTINATION bin 
     46)