Changeset 3632


Ignore:
Timestamp:
Feb 3, 2015 8:57:08 AM (5 years ago)
Author:
bradbell
Message:

merge to branch: trunk
from repository: https://github.com/coin-or/CppAD
start hash code: 0b3fffdf3f2e526733a5f3912a5b2cdc68187113
end hash code: 7b37fbf0edb9d6ff11efec836f52d1246b4370e5

commit 7b37fbf0edb9d6ff11efec836f52d1246b4370e5
Author: Brad Bell <bradbell@…>
Date: Tue Feb 3 06:54:51 2015 -0700

Improve the search for the boost multi-threading library.
CMakeLists.txt: Remove cpapd_install_libdir (no longer used).

commit 792f0be799e6339a1dc07427058928079a7fc091
Author: Brad Bell <bradbell@…>
Date: Tue Feb 3 05:36:37 2015 -0700

CMakeLists.txt: remove cppad_install_includedir (no longer used).

commit ac7791e4e1bab33261b42d315f73ce71a3448845
Author: Brad Bell <bradbell@…>
Date: Tue Feb 3 05:18:38 2015 -0700

CMakeLists.txt: remove white space at end of lines.

commit 3ad9195c25350c5a3cb7027d3017e8de40ebec51
Author: Brad Bell <bradbell@…>
Date: Tue Feb 3 05:14:32 2015 -0700

CMakeLists.txt: Set cppad_abs_<middle_name> cases in a loop instead of separate.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/CMakeLists.txt

    r3630 r3632  
    11# $Id$
    22# -----------------------------------------------------------------------------
    3 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-14 Bradley M. Bell
     3# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
    44#
    55# CppAD is distributed under multiple licenses. This distribution is under
    6 # the terms of the 
     6# the terms of the
    77#                     Eclipse Public License Version 1.0.
    88#
     
    2222
    2323
    24 # Set name of this project and create the variables 
    25 # cppad_BINARY_DIR and cppad_SOURCE_DIR. 
     24# Set name of this project and create the variables
     25# cppad_BINARY_DIR and cppad_SOURCE_DIR.
    2626# project(projectname [CXX] [C] [Java])
    2727PROJECT(cppad)
     
    3939# CHECK_CXX_SOURCE_COMPILES(source variable)
    4040# Checks whether the code given in source will compile, link and run and
    41 # return zero status. You can set 
    42 # CMAKE_REQUIRED_LIBRARIES, CMAKE_REQUIRED_FLAGS and CMAKE_REQUIRED_INCLUDES 
    43 # accordingly if additional libraries or compiler flags are required. 
     41# return zero status. You can set
     42# CMAKE_REQUIRED_LIBRARIES, CMAKE_REQUIRED_FLAGS and CMAKE_REQUIRED_INCLUDES
     43# accordingly if additional libraries or compiler flags are required.
    4444INCLUDE(CheckCXXSourceRuns)
    4545
     
    4949# dos_path_to_unix(dos_path unix_path)
    5050INCLUDE(cmake/dos_path_to_unix.cmake)
    51 # 
     51#
    5252# add_to_list(variable_list constant_value)
    5353INCLUDE(cmake/add_to_list.cmake)
     
    7171# =============================================================================
    7272# cmake_install_datadir
    73 command_line_arg(cmake_install_datadir share STRING 
     73command_line_arg(cmake_install_datadir share STRING
    7474        "directory, below prefix, where cmake installs cppad data files"
    7575)
    7676# -----------------------------------------------------------------------------
    7777# cmake_install_docdir
    78 command_line_arg(cmake_install_docdir NOTFOUND STRING 
     78command_line_arg(cmake_install_docdir NOTFOUND STRING
    7979        "directory, below prefix, where cmake installs cppad documentation files"
    8080)
    8181# -----------------------------------------------------------------------------
    8282# cmake_install_includedirs
    83 command_line_arg(cmake_install_includedirs include STRING 
     83command_line_arg(cmake_install_includedirs include STRING
    8484        "directories, below prefix, where cmake installs include files"
    8585)
    8686# -----------------------------------------------------------------------------
    8787# cmake_install_libdirs
    88 command_line_arg(cmake_install_libdirs lib STRING 
     88command_line_arg(cmake_install_libdirs lib STRING
    8989        "directories, below prefix, where cmake installs library files"
    9090)
    9191# -----------------------------------------------------------------------------
    9292# cmake_install_prefix
    93 command_line_arg(cmake_install_prefix /usr PATH 
     93command_line_arg(cmake_install_prefix /usr PATH
    9494        "cppad install prefix"
    9595)
    96 SET(CMAKE_INSTALL_PREFIX "${cmake_install_prefix}" 
     96SET(CMAKE_INSTALL_PREFIX "${cmake_install_prefix}"
    9797        CACHE PATH "value copied from cmake_install_prefix" FORCE
    9898)
    9999# -----------------------------------------------------------------------------
    100100# cmake_install_postfix
    101 command_line_arg(cmake_install_postfix NOTFOUND STRING 
     101command_line_arg(cmake_install_postfix NOTFOUND STRING
    102102        "cppad install postfix"
    103103)
    104104# -----------------------------------------------------------------------------
    105105# cppad_cxx_flags
    106 command_line_arg(cppad_cxx_flags NOTFOUND STRING 
     106command_line_arg(cppad_cxx_flags NOTFOUND STRING
    107107        "extra flags used with cppad source (besides debug and release flags)"
    108108)
     
    138138# automated system configuration
    139139# =============================================================================
    140 # cppad_install_includedir
    141 SET(cppad_install_includedir NOTFOUND)
    142 FOREACH(dir ${cmake_install_includedirs})
    143         IF( NOT cppad_install_includedir )
    144                 SET(cppad_install_includedir ${dir})
    145         ENDIF( NOT cppad_install_includedir )
    146 ENDFOREACH(dir ${cmake_install_includedirs})
    147 # -----------------------------------------------------------------------------
    148 # cppad_install_libdir
    149 SET(cppad_install_libdir NOTFOUND)
    150 FOREACH(dir ${cmake_install_libdirs})
    151         IF( NOT cppad_install_libdir )
    152                 SET(cppad_install_libdir ${dir})
    153         ENDIF( NOT cppad_install_libdir )
    154 ENDFOREACH(dir ${cmake_install_libdirs})
    155 # -----------------------------------------------------------------------------
    156140# cppad_cxx_flags_sacado
    157141IF( ${cppad_cxx_flags} MATCHES ".*-std=c[+][+]11.*" )
     
    165149# -----------------------------------------------------------------------------
    166150# cppad_cxx_flags_eigen
    167 STRING(REGEX REPLACE 
    168         "(.*)-Wshadow(.*)"         "\\1-Wno-shadow\\2" 
     151STRING(REGEX REPLACE
     152        "(.*)-Wshadow(.*)"         "\\1-Wno-shadow\\2"
    169153        cppad_cxx_flags_eigen "${cppad_cxx_flags}"
    170154)
     
    174158# -----------------------------------------------------------------------------
    175159# cppad_cxx_flags_fadbad
    176 STRING(REGEX REPLACE 
    177         "(.*)-Wshadow(.*)"         "\\1-Wno-shadow\\2" 
     160STRING(REGEX REPLACE
     161        "(.*)-Wshadow(.*)"         "\\1-Wno-shadow\\2"
    178162        cppad_cxx_flags_fadbad "${cppad_cxx_flags}"
    179163)
     
    182166ENDIF( fadbad_prefix )
    183167# -----------------------------------------------------------------------------
    184 # cppad_abs_includedir, cppad_abs_libdir, cppad_abs_datadir, cppad_abs_docdir
    185 #
    186 # cppad_abs_docdir is not used if cmake_install_docdir is ""
    187 #
    188 IF ( cmake_install_postfix )
    189         SET(cppad_abs_includedir
    190 "${cmake_install_prefix}/${cppad_install_includedir}/${cmake_install_postfix}"
    191                 CACHE INTERNAL "cppad install include file directory" FORCE
    192         )
    193         SET(cppad_abs_libdir
    194 "${cmake_install_prefix}/${cppad_install_libdir}/${cmake_install_postfix}"
    195                 CACHE INTERNAL "cppad install library file directory" FORCE
    196         )
    197         SET(cppad_abs_datadir
    198 "${cmake_install_prefix}/${cmake_install_datadir}/${cmake_install_postfix}"
    199                 CACHE INTERNAL "cppad install data file directory" FORCE
    200         )
    201         SET(cppad_abs_docdir
    202 "${cmake_install_prefix}/${cmake_install_docdir}/${cmake_install_postfix}"
    203                 CACHE INTERNAL "cppad install data file directory" FORCE
    204         )
    205 ELSE ( cmake_install_postfix )
    206         SET(cppad_abs_includedir
    207                 "${cmake_install_prefix}/${cppad_install_includedir}"
    208                 CACHE INTERNAL "cppad install include file directory" FORCE
    209         )
    210         SET(cppad_abs_libdir
    211                 "${cmake_install_prefix}/${cppad_install_libdir}"
    212                 CACHE INTERNAL "cppad install library file directory" FORCE
    213         )
    214         SET(cppad_abs_datadir
    215                 "${cmake_install_prefix}/${cmake_install_datadir}"
    216                 CACHE INTERNAL "cppad install data file directory" FORCE
    217         )
    218         SET(cppad_abs_docdir
    219                 "${cmake_install_prefix}/${cmake_install_docdir}"
    220                 CACHE INTERNAL "cppad install data file directory" FORCE
    221         )
    222 ENDIF ( cmake_install_postfix )
     168# set cppad_abs_${middle_name} for middle_name equal to:
     169#       includedir, liddir, datadir, docdir
     170FOREACH(middle_names includedirs libdirs datadir docdir)
     171        STRING(REGEX REPLACE "dirs" "dir" middle_name ${middle_names})
     172        SET(middle_value NOTFOUND)
     173        FOREACH(dir ${cmake_install_${middle_names}})
     174                IF( NOT middle_value )
     175                        SET(middle_value ${dir})
     176                ENDIF( NOT middle_value )
     177        ENDFOREACH(dir ${cmake_install_${middle_names}})
     178        #
     179        SET(tmp "${cmake_install_prefix}/${middle_value}" )
     180        IF ( cmake_install_postfix )
     181                SET(cppad_abs_${middle_name} ${tmp}/${cmake_install_postfix})
     182        ELSE ( cmake_install_postfix )
     183                SET(cppad_abs_${middle_name} ${tmp})
     184        ENDIF ( cmake_install_postfix )
     185ENDFOREACH(middle_names includedirs libdirs datadir docdir)
    223186# -----------------------------------------------------------------------------
    224187# boost_prefix
     
    237200        #
    238201        # extract part before last backslash
    239         STRING(REGEX REPLACE 
    240                 "([^ ]*)/[^/ ]*" "\\1" 
    241                 boost_prefix "${boost_include_dir}" 
    242         ) 
     202        STRING(REGEX REPLACE
     203                "([^ ]*)/[^/ ]*" "\\1"
     204                boost_prefix "${boost_include_dir}"
     205        )
    243206        MESSAGE(STATUS "boost_prefix = ${boost_prefix}")
    244207        #
     
    279242        pkg_check_modules(ipopt ipopt)
    280243        IF( NOT ipopt_FOUND )
    281                 MESSAGE(FATAL_ERROR 
     244                MESSAGE(FATAL_ERROR
    282245"For all directories dir in cmake_install_libdirs, cannot find the file
    283         ipopt_prefix/dir/pkgconfig/ipopt.pc 
     246        ipopt_prefix/dir/pkgconfig/ipopt.pc
    284247where
    285248        ipopt_prefix = ${ipopt_prefix}
     
    292255# Currently building tests as normal executables
    293256# =============================================================================
    294 # The CMakeLists.txt file in the specified source directory is processed 
     257# The CMakeLists.txt file in the specified source directory is processed
    295258# before the current input file continues beyond this command.
    296259# add_subdirectory(source_dir [binary_dir] [EXCLUDE_FROM_ALL])
     
    345308# name during the copy.
    346309#
    347 # During install copy all the cppad include files to 
    348 # ${cppad_abs_includedir}/cppad 
    349 INSTALL( 
    350         DIRECTORY "cppad/" 
     310# During install copy all the cppad include files to
     311# ${cppad_abs_includedir}/cppad
     312INSTALL(
     313        DIRECTORY "cppad/"
    351314        DESTINATION ${cppad_abs_includedir}/cppad
    352315        FILES_MATCHING PATTERN "*.h"
    353316)
    354 INSTALL( 
    355         DIRECTORY "cppad/" 
     317INSTALL(
     318        DIRECTORY "cppad/"
    356319        DESTINATION ${cppad_abs_includedir}/cppad
    357320        FILES_MATCHING PATTERN "*.hpp"
    358321)
    359322IF( colpack_prefix )
    360         INSTALL( 
     323        INSTALL(
    361324                FILES "cppad/local/cppad_colpack.cpp"
    362325                DESTINATION ${cppad_abs_datadir}/cppad
  • trunk/multi_thread/CMakeLists.txt

    r3120 r3632  
    4949ENDIF ( pthread_lib_path )
    5050
    51 # If boost threads found, set
    52 # bthread_lib, bthread_lib_path and process its subdir
    53 #
    54 # FIND_PACKAGE(Boost) was done by ../CMakeLists.txt
     51# IF we find a boost multi-threadding library, define the corresponding
     52# bthread_lib, bthread_lib_path, and process the bthread subdirectory.
    5553IF ( Boost_FOUND )
    56         #
    57         SET(CMAKE_REQUIRED_INCLUDES  "${boost_prefix}/${cmake_install_includdir}")
    58         #
    59         SET(bthread_lib               "boost_thread" )
    60         SET(CMAKE_REQUIRED_LIBRARIES "${bthread_lib}" )
    61         #
    62         SET(bthread_lib_path "${boost_prefix}/${cppad_install_libdir}" )
    63         SET(CMAKE_REQUIRED_FLAGS     "-L${bthread_lib_path}" )
    64         #
    65         # CHECK_CXX_SOURCE_RUNS(source variable)
    66         SET(source "
     54        SET(bthread_lib NOTFOUND)
     55        FOREACH(idir ${cmake_install_includedirs})
     56                FOREACH(ldir ${cmake_install_libdirs})
     57                        FOREACH(lname boost_thread-mt boost_thread )
     58                                # abort this search when find a match
     59                                IF( NOT bthread_lib )
     60                                        #
     61                                        SET(CMAKE_REQUIRED_INCLUDES  "${boost_prefix}/${idir}")
     62                                        SET(CMAKE_REQUIRED_LIBRARIES "${lname}" )
     63                                        SET(lpath                    "${boost_prefix}/${ldir}" )
     64                                        SET(CMAKE_REQUIRED_FLAGS     "-L${lpath}" )
     65                                        # CHECK_CXX_SOURCE_RUNS(source variable)
     66                                        SET(source "
    6767# include <boost/thread.hpp>
    6868int main(void)
    6969{       boost::barrier wait(1);
    7070        return 0;
    71 }"      )
    72         CHECK_CXX_SOURCE_RUNS("${source}" bthread_ok)
     71}"                                      )
     72                                        SET(flag ${idir}_${ldir}_${lname}_ok )
     73                                        CHECK_CXX_SOURCE_RUNS("${source}" ${flag} )
     74                                        IF ( ${flag} )
     75                                                SET(bthread_lib      ${lname} )
     76                                                SET(bthread_lib_path ${lpath} )
     77                                        ENDIF ( ${flag} )
     78                                ENDIF( NOT bthread_lib )
     79                        ENDFOREACH(lname boost_thread boost_thread-mt)
     80                ENDFOREACH(ldir ${cmake_install_liddirs})
     81        ENDFOREACH(idir ${cmake_install_includedirs})
    7382        #
    74         IF ( NOT bthread_ok )
    75                 SET(bthread_lib               "boost_thread-mt" )
    76                 SET(CMAKE_REQUIRED_LIBRARIES "${bthread_lib}" )
    77                 CHECK_CXX_SOURCE_RUNS("${source}" bthread_mt_ok)
    78         ENDIF ( NOT bthread_ok )
    79         IF ( bthread_ok OR bthread_mt_ok )
     83        IF( bthread_lib )
    8084                ADD_SUBDIRECTORY(bthread)
    8185                add_to_list(check_depends check_multi_thread_bthread)
    82         ENDIF ( bthread_ok OR bthread_mt_ok )
     86                MESSAGE(STATUS
     87                "boost multi-threading library = ${bthread_lib_path}/${bthread_lib}"
     88                )
     89        ELSE( bthread_lib )
     90                MESSAGE(STATUS "Could not find boost multi-threading library")
     91        ENDIF( bthread_lib )
    8392ENDIF ( Boost_FOUND )
    8493
  • trunk/omh/whats_new/whats_new_15.omh

    r3631 r3632  
    3838The purpose of this section is to
    3939assist you in learning about changes between various versions of CppAD.
     40
     41$head 02-03$$
     42Improved the searching for the boost multi-threading library
     43which is used for by the $cref team_bthread.cpp$$ case of the
     44$cref thread_test.cpp$$ example and test.
     45
    4046
    4147$head 02-02$$
Note: See TracChangeset for help on using the changeset viewer.