Skip to content

Commit

Permalink
master: autotools: Visual Studio: fixed to get this to work.
Browse files Browse the repository at this point in the history
  • Loading branch information
bradbell committed Nov 13, 2018
1 parent 6b7f830 commit 65a00ba
Show file tree
Hide file tree
Showing 42 changed files with 228 additions and 157 deletions.
1 change: 1 addition & 0 deletions bin/check_define.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ do
then
sed -n -e "/^# *define /p" $file | sed \
-e "/^# *define *$include_guard/d" \
-e '/^# define NOMINMAX/d' \
-e "s/^# *define *\([A-Za-z0-9_]*\).*/\1/" >> check_define.1
fi
# undef
Expand Down
16 changes: 13 additions & 3 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ cppad_has_gettimeofday
cppad_cppadvector
is_pod_specialize_11
is_pod_specialize_98
cppad_compiler_is_gnucxx
compiler_has_conversion_warn
cppad_cplusplus_201100_ok
cppad_has_tmpnam_s
cppad_has_mkstemp
Expand Down Expand Up @@ -5924,15 +5924,15 @@ cppad_deprecated_01=0
cppad_has_colpack=0


cppad_has_mkstemp=1
cppad_has_mkstemp=0

cppad_has_tmpnam_s=0


cppad_cplusplus_201100_ok=0


cppad_compiler_is_gnucxx=0
compiler_has_conversion_warn=0


is_pod_specialize_98="
Expand Down Expand Up @@ -7221,6 +7221,8 @@ ipopt_prefix=${IPOPT_DIR}
ac_config_files="$ac_config_files cppad/configure.hpp cppad/local/is_pod.hpp cppad_ipopt/example/test.sh cppad_ipopt/speed/test.sh cppad_ipopt/test/test.sh example/ipopt_solve/test.sh pkgconfig/cppad.pc pkgconfig/cppad-uninstalled.pc makefile cppad_ipopt/src/makefile cppad_ipopt/example/makefile cppad_ipopt/speed/makefile cppad_ipopt/test/makefile example/general/makefile example/abs_normal/makefile example/atomic/makefile example/deprecated/makefile example/ipopt_solve/makefile example/optimize/makefile example/sparse/makefile example/utility/makefile example/get_started/makefile introduction/makefile example/multi_thread/makefile example/print_for/makefile speed/adolc/makefile speed/cppad/makefile speed/double/makefile speed/example/makefile speed/fadbad/makefile speed/profile/makefile speed/profile/gprof.sed speed/sacado/makefile speed/src/makefile test_more/compare_c/makefile test_more/general/makefile"


ac_config_commands="$ac_config_commands configure.hpp"

ac_config_commands="$ac_config_commands example_ipopt_solve_test.sh"

ac_config_commands="$ac_config_commands cppad_ipopt_example_test.sh"
Expand Down Expand Up @@ -8034,6 +8036,12 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# INIT-COMMANDS
#
AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
abs_top_srcdir=$abs_top_srcdir
Expand Down Expand Up @@ -8084,6 +8092,7 @@ do
"speed/src/makefile") CONFIG_FILES="$CONFIG_FILES speed/src/makefile" ;;
"test_more/compare_c/makefile") CONFIG_FILES="$CONFIG_FILES test_more/compare_c/makefile" ;;
"test_more/general/makefile") CONFIG_FILES="$CONFIG_FILES test_more/general/makefile" ;;
"configure.hpp") CONFIG_COMMANDS="$CONFIG_COMMANDS configure.hpp" ;;
"example_ipopt_solve_test.sh") CONFIG_COMMANDS="$CONFIG_COMMANDS example_ipopt_solve_test.sh" ;;
"cppad_ipopt_example_test.sh") CONFIG_COMMANDS="$CONFIG_COMMANDS cppad_ipopt_example_test.sh" ;;
"cppad_ipopt_speed_test.sh") CONFIG_COMMANDS="$CONFIG_COMMANDS cppad_ipopt_speed_test.sh" ;;
Expand Down Expand Up @@ -8610,6 +8619,7 @@ $as_echo X"$file" |
done
}
;;
"configure.hpp":C) cp cppad/configure.hpp $abs_top_srcdir/cppad/configure.hpp ;;
"example_ipopt_solve_test.sh":C) chmod +x example/ipopt_solve/test.sh ;;
"cppad_ipopt_example_test.sh":C) chmod +x cppad_ipopt/example/test.sh ;;
"cppad_ipopt_speed_test.sh":C) chmod +x cppad_ipopt/speed/test.sh ;;
Expand Down
18 changes: 13 additions & 5 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -491,16 +491,16 @@ AC_SUBST(cppad_deprecated_01, 0)
dnl autotools version does not colpack
AC_SUBST(cppad_has_colpack, 0)

dnl autotools version will assumes mkstemp is available.
AC_SUBST(cppad_has_mkstemp, 1)
dnl autotools version will not assume mkstemp or tmpnam_s are available.
AC_SUBST(cppad_has_mkstemp, 0)
AC_SUBST(cppad_has_tmpnam_s, 0)

dnl autotools version cannot use c++11 compiler
dnl so supress corresponding features
AC_SUBST(cppad_cplusplus_201100_ok, 0)

dnl autotools version does not check if using g++
AC_SUBST(cppad_compiler_is_gnucxx, 0)
AC_SUBST(compiler_has_conversion_warn, 0)

dnl autotools version sets is_pod without testing system, cmake is better
dnl for the Fundamental types
Expand Down Expand Up @@ -882,15 +882,23 @@ AC_CONFIG_FILES([
])
dnl END AC_CONFIG_FILES

dnl copy config.hpp to source directory
AC_CONFIG_COMMANDS(
[configure.hpp],
[cp cppad/configure.hpp $abs_top_srcdir/cppad/configure.hpp],
[abs_top_srcdir=$abs_top_srcdir]
)
dnl scripts that set library path before running test
AC_CONFIG_COMMANDS(
[example_ipopt_solve_test.sh],
[chmod +x example/ipopt_solve/test.sh],
) []
[]
)
AC_CONFIG_COMMANDS(
[cppad_ipopt_example_test.sh],
[chmod +x cppad_ipopt/example/test.sh],
) []
[]
)
AC_CONFIG_COMMANDS(
[cppad_ipopt_speed_test.sh],
[chmod +x cppad_ipopt/speed/test.sh],
Expand Down
33 changes: 26 additions & 7 deletions cppad/utility/elapsed_seconds.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@ Otherwise, $code std::clock()$$ will be used for timing.
is a $code double$$ equal to the
number of seconds since the first call to $code elapsed_seconds$$.
$head Microsoft Systems$$
It you are using $code ::GetSystemTime$$,
you will need to link in the external routine
called $cref microsoft_timer$$.
$children%
speed/example/elapsed_seconds.cpp
%$$
Expand Down Expand Up @@ -84,7 +79,8 @@ an example and test of this routine.
# if CPPAD_USE_CPLUSPLUS_2011
# include <chrono>
# elif _MSC_VER
extern double microsoft_timer(void);
# define NOMINMAX // so windows.h does not define min and max as macros
# include <windows.h>
# elif CPPAD_HAS_GETTIMEOFDAY
# include <sys/time.h>
# else
Expand Down Expand Up @@ -130,7 +126,30 @@ inline double elapsed_seconds(void)
}
// --------------------------------------------------------------------------
# elif _MSC_VER
{ return microsoft_timer(); }
{ CPPAD_ASSERT_FIRST_CALL_NOT_PARALLEL;
static bool first_ = true;
static SYSTEMTIME st_;
SYSTEMTIME st;

if( first_ )
{ ::GetSystemTime(&st_);
first_ = false;
return 0.;
}
::GetSystemTime(&st);

double hour = double(st.wHour) - double(st_.wHour);
double minute = double(st.wMinute) - double(st_.wMinute);
double second = double(st.wSecond) - double(st_.wSecond);
double milli = double(st.wMilliseconds) - double(st_.wMilliseconds);

double diff = 1e-3*milli + second + 60.*minute + 3600.*hour;
if( diff < 0. )
diff += 3600.*24.;
CPPAD_ASSERT_UNKNOWN( 0 <= diff && diff < 3600.*24. );

return diff;
}
// --------------------------------------------------------------------------
# elif CPPAD_HAS_GETTIMEOFDAY
{ CPPAD_ASSERT_FIRST_CALL_NOT_PARALLEL;
Expand Down
2 changes: 1 addition & 1 deletion cppad_ipopt/example/makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,8 @@ build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
compiler_has_conversion_warn = @compiler_has_conversion_warn@
cppad_boostvector = @cppad_boostvector@
cppad_compiler_is_gnucxx = @cppad_compiler_is_gnucxx@
cppad_cplusplus_201100_ok = @cppad_cplusplus_201100_ok@
cppad_cppadvector = @cppad_cppadvector@
cppad_cxx_flags = @cppad_cxx_flags@
Expand Down
2 changes: 1 addition & 1 deletion cppad_ipopt/speed/makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@ build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
compiler_has_conversion_warn = @compiler_has_conversion_warn@
cppad_boostvector = @cppad_boostvector@
cppad_compiler_is_gnucxx = @cppad_compiler_is_gnucxx@
cppad_cplusplus_201100_ok = @cppad_cplusplus_201100_ok@
cppad_cppadvector = @cppad_cppadvector@
cppad_cxx_flags = @cppad_cxx_flags@
Expand Down
2 changes: 1 addition & 1 deletion cppad_ipopt/src/makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,8 @@ build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
compiler_has_conversion_warn = @compiler_has_conversion_warn@
cppad_boostvector = @cppad_boostvector@
cppad_compiler_is_gnucxx = @cppad_compiler_is_gnucxx@
cppad_cplusplus_201100_ok = @cppad_cplusplus_201100_ok@
cppad_cppadvector = @cppad_cppadvector@
cppad_cxx_flags = @cppad_cxx_flags@
Expand Down
2 changes: 1 addition & 1 deletion cppad_ipopt/test/makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
compiler_has_conversion_warn = @compiler_has_conversion_warn@
cppad_boostvector = @cppad_boostvector@
cppad_compiler_is_gnucxx = @cppad_compiler_is_gnucxx@
cppad_cplusplus_201100_ok = @cppad_cplusplus_201100_ok@
cppad_cppadvector = @cppad_cppadvector@
cppad_cxx_flags = @cppad_cxx_flags@
Expand Down
2 changes: 1 addition & 1 deletion example/abs_normal/makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,8 @@ build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
compiler_has_conversion_warn = @compiler_has_conversion_warn@
cppad_boostvector = @cppad_boostvector@
cppad_compiler_is_gnucxx = @cppad_compiler_is_gnucxx@
cppad_cplusplus_201100_ok = @cppad_cplusplus_201100_ok@
cppad_cppadvector = @cppad_cppadvector@
cppad_cxx_flags = @cppad_cxx_flags@
Expand Down
4 changes: 2 additions & 2 deletions example/atomic/makefile.am
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# $Id$
# -----------------------------------------------------------------------------
# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-17 Bradley M. Bell
# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-18 Bradley M. Bell
#
# CppAD is distributed under multiple licenses. This distribution is under
# the terms of the
Expand Down Expand Up @@ -37,6 +36,7 @@ AM_CPPFLAGS = -I. \
atomic_SOURCES = \
$(EIGEN_SRC_FILES) \
atomic.cpp \
base2ad.cpp \
checkpoint.cpp \
extended_ode.cpp \
for_sparse_hes.cpp \
Expand Down
19 changes: 10 additions & 9 deletions example/atomic/makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,16 @@ mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__atomic_SOURCES_DIST = eigen_cholesky.cpp eigen_mat_inv.cpp \
eigen_mat_mul.cpp atomic.cpp checkpoint.cpp extended_ode.cpp \
for_sparse_hes.cpp for_sparse_jac.cpp forward.cpp \
get_started.cpp mat_mul.cpp mul_level.cpp norm_sq.cpp ode.cpp \
reciprocal.cpp rev_sparse_hes.cpp rev_sparse_jac.cpp \
reverse.cpp set_sparsity.cpp tangent.cpp
eigen_mat_mul.cpp atomic.cpp base2ad.cpp checkpoint.cpp \
extended_ode.cpp for_sparse_hes.cpp for_sparse_jac.cpp \
forward.cpp get_started.cpp mat_mul.cpp mul_level.cpp \
norm_sq.cpp ode.cpp reciprocal.cpp rev_sparse_hes.cpp \
rev_sparse_jac.cpp reverse.cpp set_sparsity.cpp tangent.cpp
@CppAD_EIGEN_DIR_TRUE@am__objects_1 = eigen_cholesky.$(OBJEXT) \
@CppAD_EIGEN_DIR_TRUE@ eigen_mat_inv.$(OBJEXT) \
@CppAD_EIGEN_DIR_TRUE@ eigen_mat_mul.$(OBJEXT)
am_atomic_OBJECTS = $(am__objects_1) atomic.$(OBJEXT) \
checkpoint.$(OBJEXT) extended_ode.$(OBJEXT) \
base2ad.$(OBJEXT) checkpoint.$(OBJEXT) extended_ode.$(OBJEXT) \
for_sparse_hes.$(OBJEXT) for_sparse_jac.$(OBJEXT) \
forward.$(OBJEXT) get_started.$(OBJEXT) mat_mul.$(OBJEXT) \
mul_level.$(OBJEXT) norm_sq.$(OBJEXT) ode.$(OBJEXT) \
Expand Down Expand Up @@ -202,9 +202,8 @@ CXX_FLAGS_EIGEN = @CXX_FLAGS_EIGEN@
CXX_FLAGS_FADBAD = @CXX_FLAGS_FADBAD@
CYGPATH_W = @CYGPATH_W@

# $Id$
# -----------------------------------------------------------------------------
# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-17 Bradley M. Bell
# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-18 Bradley M. Bell
#
# CppAD is distributed under multiple licenses. This distribution is under
# the terms of the
Expand Down Expand Up @@ -284,8 +283,8 @@ build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
compiler_has_conversion_warn = @compiler_has_conversion_warn@
cppad_boostvector = @cppad_boostvector@
cppad_compiler_is_gnucxx = @cppad_compiler_is_gnucxx@
cppad_cplusplus_201100_ok = @cppad_cplusplus_201100_ok@
cppad_cppadvector = @cppad_cppadvector@
cppad_cxx_flags = @cppad_cxx_flags@
Expand Down Expand Up @@ -371,6 +370,7 @@ AM_CPPFLAGS = -I. \
atomic_SOURCES = \
$(EIGEN_SRC_FILES) \
atomic.cpp \
base2ad.cpp \
checkpoint.cpp \
extended_ode.cpp \
for_sparse_hes.cpp \
Expand Down Expand Up @@ -436,6 +436,7 @@ distclean-compile:
-rm -f *.tab.c

@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atomic.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/base2ad.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/checkpoint.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eigen_cholesky.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eigen_mat_inv.Po@am__quote@
Expand Down
2 changes: 1 addition & 1 deletion example/deprecated/makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
compiler_has_conversion_warn = @compiler_has_conversion_warn@
cppad_boostvector = @cppad_boostvector@
cppad_compiler_is_gnucxx = @cppad_compiler_is_gnucxx@
cppad_cplusplus_201100_ok = @cppad_cplusplus_201100_ok@
cppad_cppadvector = @cppad_cppadvector@
cppad_cxx_flags = @cppad_cxx_flags@
Expand Down
20 changes: 10 additions & 10 deletions example/general/interface2c.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* --------------------------------------------------------------------------
CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-17 Bradley M. Bell
CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-18 Bradley M. Bell
CppAD is distributed under multiple licenses. This distribution is under
the terms of the
Expand Down Expand Up @@ -151,30 +151,30 @@ bool Interface2C(void)
// compare dyda to central difference approximation for deriative
for(i = 0; i < na; i++)
{ // local variables
float small, ai, yp, ym, dy_da;
float eps, ai, yp, ym, dy_da;

// We assume that the type float has at least 7 digits of
// precision, so we choose small to be about pow(10., -7./2.).
small = (float) 3e-4;
// precision, so we choose eps to be about pow(10., -7./2.).
eps = (float) 3e-4;

// value of this component of a
ai = a[i];

// evaluate F( a + small * ei )
a[i] = ai + small;
// evaluate F( a + eps * ei )
a[i] = ai + eps;
sumGauss(x, a, &yp, tmp, na);

// evaluate F( a - small * ei )
a[i] = ai - small;
// evaluate F( a - eps * ei )
a[i] = ai - eps;
sumGauss(x, a, &ym, tmp, na);

// evaluate central difference approximates for partial
dy_da = (yp - ym) / (2 * small);
dy_da = (yp - ym) / (2 * eps);

// restore this component of a
a[i] = ai;

ok &= NearEqual(dyda[i], dy_da, small, small);
ok &= NearEqual(dyda[i], dy_da, eps, eps);
}
return ok;
}
Expand Down
1 change: 1 addition & 0 deletions example/general/makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ general_SOURCES = \
$(ADOLC_SRC_FILES) \
\
abort_recording.cpp \
base2ad.cpp \
fabs.cpp \
acos.cpp \
acosh.cpp \
Expand Down
Loading

0 comments on commit 65a00ba

Please sign in to comment.