source: trunk/cppad/CMakeLists.txt @ 3680

Last change on this file since 3680 was 3680, checked in by bradbell, 5 years ago

merge to branch: trunk
from repository: https://github.com/coin-or/CppAD
start hash code: 071875a4beba3363e5fa9752426aec4762cd1caa
end hash code: 0bef506513a519e1073c6279d5c4cba9e5c3b180

commit 0bef506513a519e1073c6279d5c4cba9e5c3b180
Author: Brad Bell <bradbell@…>
Date: Thu May 7 12:14:32 2015 -0700

Add the acosh function (as an atomic operation when defined by compiler).

commit b3264fa17b2f65b65800423a0e243c9c3ccfe06a
Author: Brad Bell <bradbell@…>
Date: Wed May 6 20:25:38 2015 -0700

CMakeLists.txt: Change so test only check for compliation.

commit dcbac4d4f20cc383f2bd9edb02036659df40b791
Author: Brad Bell <bradbell@…>
Date: Wed May 6 15:06:28 2015 -0700

asinh.cpp: check higher orders, relax accuracy on test.

commit 5f8881993fedd18cccc3c74831133a8f8a9d17b0
Author: Brad Bell <bradbell@…>
Date: Wed May 6 14:36:18 2015 -0700

Change Acos to acos.
acos.cpp: remove trailing white space.

commit e828fa1f7c4c3848c727f14b1b7a8030071ee705
Author: Brad Bell <bradbell@…>
Date: Wed May 6 12:07:35 2015 -0700

Change Acos to acos.
acos.cpp: remove redundant index commands, remove trailing with space.

commit 3d16e5b9fe1bdafa4ad01d1d466bb72b792650fa
Author: Brad Bell <bradbell@…>
Date: Wed May 6 11:30:49 2015 -0700

op_code.hpp: Minor edits to AcosOp? commnets.

commit 58beaaad149b4ac29fae44589d7f8900bf8f4c40
Author: Brad Bell <bradbell@…>
Date: Wed May 6 10:51:43 2015 -0700

for_jac_sweep.hpp: Add missing AsinhOp? case.

commit 623c134870c522ae5e80bcf0f89d230902594c80
Author: Brad Bell <bradbell@…>
Date: Wed May 6 10:27:39 2015 -0700

Fix comment about AsinhOp? operator.

commit 226b14f6f4810f5abf1ca247aae541963efaf4d6
Author: Brad Bell <bradbell@…>
Date: Wed May 6 10:14:08 2015 -0700

Add derivative of F to make order zero case clearer.
acos_reverse.omh: Fix some sign errors.
asin_reverse.omh: Fix typo.
acos_forward.omh: Simplify by distributing minus sign.

commit 4682f4ee73e33b600b180086576e986f636a24dc
Author: Brad Bell <bradbell@…>
Date: Wed May 6 08:15:50 2015 -0700

acos_forward.omh: fix sign that depends on acos versus acosh.

commit 906ae10adf019ddda7f57dd165aab08fc55289c4
Author: Brad Bell <bradbell@…>
Date: Wed May 6 07:09:47 2015 -0700

  1. Fix inclusion of some temporary files in package (e.g., git_commit.sh).
  2. Simplify and improve using git ls-files and ls bin/check_*.
  3. Remove trailing white space.

commit 5096f4706a547bd76caa3766aa2c62802ef7f0bf
Author: Brad Bell <bradbell@…>
Date: Wed May 6 06:41:20 2015 -0700

Combine base type documentation for erf, asinh
(will add more functions to this list list).

commit b3535db5ad95bee90672abcaa686032d23bce2fc
Author: Brad Bell <bradbell@…>
Date: Tue May 5 18:01:11 2015 -0700

  1. Change Arc Cosine/Sine? to Inverse Cosine/Sine?.
  2. Change arcsin-> asin and arccos->acos.
  3. Remove index commands that are duplicates of words in titles.


acos_reverse.omh: Add acosh case to this page.

  • Property svn:keywords set to Id
File size: 8.5 KB
Line 
1# $Id: CMakeLists.txt 3680 2015-05-07 19:17:37Z bradbell $
2# -----------------------------------------------------------------------------
3# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
4#
5# CppAD is distributed under multiple licenses. This distribution is under
6# the terms of the
7#                     Eclipse Public License Version 1.0.
8#
9# A copy of this license is included in the COPYING file of this distribution.
10# Please visit http://www.coin-or.org/CppAD/ for information on other licenses.
11# -----------------------------------------------------------------------------
12# Build the cppad/configure.hpp file.
13# Inherit environment from ../CMakeLists.txt
14# -----------------------------------------------------------------------------
15MACRO(check_match match_variable match_constant output_variable)
16        STRING(COMPARE EQUAL ${${match_variable}} ${match_constant} match_flag )
17        IF( match_flag )
18                SET(${output_variable} 1)
19        ELSE( match_flag )
20                SET(${output_variable} 0)
21        ENDIF( match_flag )
22        MESSAGE(STATUS "${output_variable} = ${${output_variable}}" )
23ENDMACRO(check_match)
24# -----------------------------------------------------------------------------
25# command line arguments
26#
27# cppad_testvector
28command_line_arg(cppad_testvector cppad STRING
29"Namespace of vector used for testing, one of: boost, cppad, eigen, std"
30)
31#
32# cppad_max_num_threads
33command_line_arg(cppad_max_num_threads 48 STRING
34        "maximum number of threads that CppAD can use use"
35)
36# cppad_sparse_list
37command_line_arg(cppad_sparse_list YES BOOL
38        "use sparse list for internal sparse set representation"
39)
40#
41# cppad_tape_id_type
42command_line_arg(cppad_tape_id_type "unsigned int" STRING
43        "type used to identify different tapes, size must be <= sizeof(size_t)"
44)
45#
46# cppad_tape_addr_type
47command_line_arg(cppad_tape_addr_type "unsigned int" STRING
48"type used to identify variables on one tape, size must be <= sizeof(size_t)"
49)
50#
51# cppad_implicit_ctor_from_any_type
52command_line_arg(cppad_implicit_ctor_from_any_type NO BOOL
53        "implicit (instead of explicit) conversion from any type to AD<Base>"
54)
55# -----------------------------------------------------------------------------
56# cppad_explicit_ctor
57IF( cppad_implicit_ctor_from_any_type )
58        SET(cppad_implicit_ctor_from_any_type 1)
59ELSE( cppad_implicit_ctor_from_any_type )
60        SET(cppad_implicit_ctor_from_any_type 0)
61ENDIF( cppad_implicit_ctor_from_any_type )
62# -----------------------------------------------------------------------------
63# cppad_internal_sparse_set
64#
65IF( cppad_sparse_list )
66        SET(cppad_internal_sparse_set  sparse_list )
67ELSE( cppad_sparse_list )
68        SET(cppad_internal_sparse_set  sparse_set )
69ENDIF( cppad_sparse_list )
70MESSAGE(STATUS "cppad_internal_sparse_set = ${cppad_internal_sparse_set}" )
71#
72# -----------------------------------------------------------------------------
73# cppad_boostvector, cppad_cppadvector, cppad_eigenvector, cppad_stdvector
74#
75check_match(cppad_testvector boost cppad_boostvector)
76check_match(cppad_testvector cppad cppad_cppadvector)
77check_match(cppad_testvector eigen cppad_eigenvector)
78check_match(cppad_testvector std   cppad_stdvector)
79IF( NOT cppad_boostvector )
80IF( NOT cppad_cppadvector )
81IF( NOT cppad_eigenvector )
82IF( NOT cppad_stdvector )
83MESSAGE(FATAL_ERROR
84"cppad_testvector not one of following: boost, cppad, eigen, std."
85)
86ENDIF( NOT cppad_stdvector )
87ENDIF( NOT cppad_eigenvector )
88ENDIF( NOT cppad_cppadvector )
89ENDIF( NOT cppad_boostvector )
90
91IF( cppad_boostvector )
92        # FIND_PACKAGE(Boost) done by ../CMakeLists.txt
93        IF( NOT Boost_FOUND )
94                MESSAGE(FATAL_ERROR
95"cppad_testvector == boost but cannot find boost include files"
96                )
97        ENDIF( NOT Boost_FOUND )
98ENDIF( cppad_boostvector )
99#
100IF( cppad_eigenvector )
101        IF( NOT eigen_prefix )
102                MESSAGE(FATAL_ERROR
103"cppad_testvector == eigen but eigen_prefix is not specified"
104                )
105        ENDIF( NOT eigen_prefix )
106ENDIF( cppad_eigenvector )
107
108# =============================================================================
109# Begin C++11 features
110# -----------------------------------------------------------------------------
111# cppad_has_rvalue
112#
113SET(source "
114int main(void)
115{       int&& value = 1 + 2;
116        if( value != 3 )
117                return 1;
118        return 0;
119}"
120)
121check_source_runs("${source}" cppad_has_rvalue)
122# -----------------------------------------------------------------------------
123# cppad_has_nullptr
124#
125SET(source "
126int main(void)
127{       char *c = nullptr;
128        return 0;
129}"
130)
131check_source_runs("${source}" cppad_has_nullptr)
132# -----------------------------------------------------------------------------
133# cppad_has_cstdint_8_to_64
134#
135SET(source "
136# include <cstdint>
137template <class T> inline bool is_pod(void)               { return false; }
138template <>        inline bool is_pod<uint8_t>(void)      { return true;  }
139template <>        inline bool is_pod<uint16_t>(void)     { return true;  }
140template <>        inline bool is_pod<uint32_t>(void)     { return true;  }
141template <>        inline bool is_pod<uint64_t>(void)     { return true;  }
142int main(void)
143{       return 0; }
144"
145)
146check_source_runs("${source}" cppad_has_cstdint_8_to_64)
147# -----------------------------------------------------------------------------
148# cppad_compiler_has_erf
149# cppad_compiler_has_acosh
150# cppad_compiler_has_asinh
151#
152SET(source_template "
153# include <cmath>
154int main(void)
155{       std::c11_function(0.0);
156        return 0;
157}
158"
159)
160FOREACH(c11_function erf acosh asinh)
161        STRING(REPLACE "c11_function" ${c11_function} source "${source_template}" )
162        # really only checking if program compiles
163        check_source_runs("${source}" cppad_compiler_has_${c11_function} )
164ENDFOREACH(c11_function erf acosh asinh)
165# -----------------------------------------------------------------------------
166# cppad_has_high_resolution_clock
167#
168SET(source "
169# include <chrono>
170int main(void)
171{       std::chrono::time_point<std::chrono::high_resolution_clock> start, end;
172    start = std::chrono::high_resolution_clock::now();
173    end   = std::chrono::high_resolution_clock::now();
174    std::chrono::duration<double> difference = end - start;
175        double elapsed_seconds = difference.count();
176        if( elapsed_seconds > 0.0 )
177                return 0;
178        return 1;
179}
180"
181)
182check_source_runs("${source}" cppad_has_high_resolution_clock)
183# =============================================================================
184# End C++11 features
185# -----------------------------------------------------------------------------
186# cppad_has_gettimeofday
187#
188SET(source "
189# include<sys/time.h>
190int main(void)
191{       struct timeval time;
192        gettimeofday(&time, 0);
193        return 0;
194}"
195)
196check_source_runs("${source}" cppad_has_gettimeofday)
197# -----------------------------------------------------------------------------
198# cppad_size_t_not_unsigned_int
199#
200SET(source "
201# include <cstring>
202template <class T> inline bool is_pod(void)               { return false; }
203template <>        inline bool is_pod<unsigned int>(void) { return true;  }
204template <>        inline bool is_pod<size_t>(void)       { return true;  }
205int main(void)
206{       return 0; }
207"
208)
209check_source_runs("${source}" cppad_size_t_not_unsigned_int)
210# -----------------------------------------------------------------------------
211# cppad_tape_addr_type, cppad_tape_id_type
212#
213FOREACH(cmake_var cppad_tape_id_type cppad_tape_addr_type )
214        SET(source "
215# include <limits>
216int main(void)
217{       bool is_unsigned = ! std::numeric_limits<${${cmake_var}}>::is_signed;
218        return int(! is_unsigned);
219}
220"
221        )
222        check_source_runs("${source}" ${cmake_var}_is_unsigned)
223        IF( ${cmake_var}_is_unsigned STREQUAL 0  )
224                MESSAGE(STATUS
225"Warning: using a signed ${cmake_var} is for CppAD developers only !"
226        )
227        ENDIF( ${cmake_var}_is_unsigned STREQUAL 0  )
228ENDFOREACH( cmake_var )
229# -----------------------------------------------------------------------------
230# cppad_max_num_threads
231#
232SET(CMAKE_REQUIRED_INCLUDES  "")
233SET(CMAKE_REQUIRED_LIBRARIES "")
234SET(CMAKE_REQUIRED_FLAGS     )
235SET(source "
236int main(void)
237{       const char* number = \"${cppad_max_num_threads}\";
238        int value = 0;
239        while( *number == ' ' )
240                number++;
241        while( '0' <= *number && *number <= '9' )
242        {       value = 10 * value + (int)(*number - '0');
243                number++;
244        }
245        while( *number == ' ' )
246                number++;
247        if( *number != char(0) )
248                return 1;
249        if( value < 4 )
250                return 1;
251        return 0;
252}
253" )
254CHECK_CXX_SOURCE_RUNS("${source}" cppad_max_num_threads_is_integer_ge_4)
255IF( NOT cppad_max_num_threads_is_integer_ge_4 )
256        MESSAGE(FATAL_ERROR
257        "cppad_max_num_threads is not an integer greater than or equal 4"
258        )
259ENDIF( NOT cppad_max_num_threads_is_integer_ge_4 )
260
261# -----------------------------------------------------------------------------
262# Copy a file to another location and modify its contents.
263# configure_file(InputFile OutputFile [COPYONLY] [ESCAPE_QUOTES] [@ONLY])
264CONFIGURE_FILE(
265        ${CMAKE_CURRENT_SOURCE_DIR}/configure.hpp.in
266        ${CMAKE_CURRENT_SOURCE_DIR}/configure.hpp
267)
Note: See TracBrowser for help on using the repository browser.