Skip to content

Commit

Permalink
to_c: add missing links to cppad_lib to CMakeLists.txt, add some miss…
Browse files Browse the repository at this point in the history
…ing files to makefile.am.
  • Loading branch information
bradbell committed Jun 17, 2022
1 parent d24b64e commit 6f82dd3
Show file tree
Hide file tree
Showing 33 changed files with 211 additions and 44 deletions.
3 changes: 2 additions & 1 deletion cppad_lib/makefile.am
Expand Up @@ -26,7 +26,8 @@ libcppad_lib_a_SOURCES = \
csrc_writer.cpp \
json_lexer.cpp \
json_parser.cpp \
json_writer.cpp
json_writer.cpp \
temp_file.cpp
# END_SORT_THIS_LINE_MINUS_1

# autotools version of install does not support CppADCodeGen but need source
Expand Down
10 changes: 7 additions & 3 deletions cppad_lib/makefile.in
Expand Up @@ -136,7 +136,7 @@ libcppad_lib_a_LIBADD =
am_libcppad_lib_a_OBJECTS = cpp_graph_op.$(OBJEXT) \
cppad_colpack.$(OBJEXT) csrc_writer.$(OBJEXT) \
json_lexer.$(OBJEXT) json_parser.$(OBJEXT) \
json_writer.$(OBJEXT)
json_writer.$(OBJEXT) temp_file.$(OBJEXT)
libcppad_lib_a_OBJECTS = $(am_libcppad_lib_a_OBJECTS)
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
Expand All @@ -156,7 +156,7 @@ am__maybe_remake_depfiles = depfiles
am__depfiles_remade = ./$(DEPDIR)/cpp_graph_op.Po \
./$(DEPDIR)/cppad_colpack.Po ./$(DEPDIR)/csrc_writer.Po \
./$(DEPDIR)/json_lexer.Po ./$(DEPDIR)/json_parser.Po \
./$(DEPDIR)/json_writer.Po
./$(DEPDIR)/json_writer.Po ./$(DEPDIR)/temp_file.Po
am__mv = mv -f
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
Expand Down Expand Up @@ -387,7 +387,8 @@ libcppad_lib_a_SOURCES = \
csrc_writer.cpp \
json_lexer.cpp \
json_parser.cpp \
json_writer.cpp
json_writer.cpp \
temp_file.cpp

all: all-am

Expand Down Expand Up @@ -471,6 +472,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/json_lexer.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/json_parser.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/json_writer.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/temp_file.Po@am__quote@ # am--include-marker

$(am__depfiles_remade):
@$(MKDIR_P) $(@D)
Expand Down Expand Up @@ -627,6 +629,7 @@ distclean: distclean-am
-rm -f ./$(DEPDIR)/json_lexer.Po
-rm -f ./$(DEPDIR)/json_parser.Po
-rm -f ./$(DEPDIR)/json_writer.Po
-rm -f ./$(DEPDIR)/temp_file.Po
-rm -f makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
Expand Down Expand Up @@ -678,6 +681,7 @@ maintainer-clean: maintainer-clean-am
-rm -f ./$(DEPDIR)/json_lexer.Po
-rm -f ./$(DEPDIR)/json_parser.Po
-rm -f ./$(DEPDIR)/json_writer.Po
-rm -f ./$(DEPDIR)/temp_file.Po
-rm -f makefile
maintainer-clean-am: distclean-am maintainer-clean-generic

Expand Down
10 changes: 8 additions & 2 deletions example/abs_normal/CMakeLists.txt
@@ -1,5 +1,5 @@
# -----------------------------------------------------------------------------
# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-19 Bradley M. Bell
# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-22 Bradley M. Bell
#
# CppAD is distributed under the terms of the
# Eclipse Public License Version 2.0.
Expand Down Expand Up @@ -31,7 +31,13 @@ SET(source_list
set_compile_flags( example_abs_normal "${cppad_debug_which}" "${source_list}" )
#
ADD_EXECUTABLE(example_abs_normal EXCLUDE_FROM_ALL ${source_list})

#
# List of libraries to be linked into the specified target
TARGET_LINK_LIBRARIES(example_abs_normal
${cppad_lib}
${colpack_libs}
)
#
# check_example_abs_normal target
ADD_CUSTOM_TARGET(check_example_abs_normal
example_abs_normal
Expand Down
7 changes: 7 additions & 0 deletions example/atomic_four/CMakeLists.txt
Expand Up @@ -31,11 +31,18 @@ set_compile_flags(example_atomic_four "${cppad_debug_which}" "${source_list}" )
#
ADD_EXECUTABLE(example_atomic_four EXCLUDE_FROM_ALL ${source_list})
#
# List of libraries to be linked into the specified target
TARGET_LINK_LIBRARIES(example_atomic_four
${cppad_lib}
${colpack_libs}
)
#
# Add the check_example_atomic_four target
ADD_CUSTOM_TARGET(check_example_atomic_four
example_atomic_four
DEPENDS example_atomic_four ${check_example_atomic_four_depends}
)
#
MESSAGE(STATUS "make check_example_atomic_four: available")
#
# add to check check_example_depends in parent environment
Expand Down
6 changes: 6 additions & 0 deletions example/atomic_four/lin_ode/CMakeLists.txt
Expand Up @@ -26,6 +26,12 @@ set_compile_flags(example_atomic_four_lin_ode
#
ADD_EXECUTABLE(example_atomic_four_lin_ode EXCLUDE_FROM_ALL ${source_list})
#
# List of libraries to be linked into the specified target
TARGET_LINK_LIBRARIES(example_atomic_four_lin_ode
${cppad_lib}
${colpack_libs}
)
#
# Add the check_example_atomic_four_lin_ode target
ADD_CUSTOM_TARGET(check_example_atomic_four_lin_ode
example_atomic_four_lin_ode
Expand Down
6 changes: 6 additions & 0 deletions example/atomic_four/mat_mul/CMakeLists.txt
Expand Up @@ -27,6 +27,12 @@ set_compile_flags(example_atomic_four_mat_mul
#
ADD_EXECUTABLE(example_atomic_four_mat_mul EXCLUDE_FROM_ALL ${source_list})
#
# List of libraries to be linked into the specified target
TARGET_LINK_LIBRARIES(example_atomic_four_mat_mul
${cppad_lib}
${colpack_libs}
)
#
# Add the check_example_atomic_four_mat_mul target
ADD_CUSTOM_TARGET(check_example_atomic_four_mat_mul
example_atomic_four_mat_mul
Expand Down
6 changes: 6 additions & 0 deletions example/atomic_four/vector/CMakeLists.txt
Expand Up @@ -28,6 +28,12 @@ set_compile_flags(example_atomic_four_vector "${cppad_debug_which}" "${source_li
#
ADD_EXECUTABLE(example_atomic_four_vector EXCLUDE_FROM_ALL ${source_list})
#
# List of libraries to be linked into the specified target
TARGET_LINK_LIBRARIES(example_atomic_four_vector
${cppad_lib}
${colpack_libs}
)
#
# Add the check_example_atomic_four_vector target
ADD_CUSTOM_TARGET(check_example_atomic_four_vector
example_atomic_four_vector
Expand Down
6 changes: 6 additions & 0 deletions example/atomic_three/CMakeLists.txt
Expand Up @@ -32,6 +32,12 @@ set_compile_flags(example_atomic_three "${cppad_debug_which}" "${source_list}" )
#
ADD_EXECUTABLE(example_atomic_three EXCLUDE_FROM_ALL ${source_list})
#
# List of libraries to be linked into the specified target
TARGET_LINK_LIBRARIES(example_atomic_three
${cppad_lib}
${colpack_libs}
)
#
# Add the check_example_atomic_three target
ADD_CUSTOM_TARGET(check_example_atomic_three
example_atomic_three
Expand Down
8 changes: 7 additions & 1 deletion example/atomic_two/CMakeLists.txt
@@ -1,5 +1,5 @@
# -----------------------------------------------------------------------------
# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-19 Bradley M. Bell
# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-22 Bradley M. Bell
#
# CppAD is distributed under the terms of the
# Eclipse Public License Version 2.0.
Expand Down Expand Up @@ -28,6 +28,12 @@ set_compile_flags( example_atomic_two "${cppad_debug_which}" "${source_list}" )
#
ADD_EXECUTABLE(example_atomic_two EXCLUDE_FROM_ALL ${source_list})
#
# List of libraries to be linked into the specified target
TARGET_LINK_LIBRARIES(example_atomic_two
${cppad_lib}
${colpack_libs}
)
#
# Add the check_example_atomic_two target
ADD_CUSTOM_TARGET(check_example_atomic_two
example_atomic_two
Expand Down
8 changes: 7 additions & 1 deletion example/chkpoint_two/CMakeLists.txt
@@ -1,5 +1,5 @@
# -----------------------------------------------------------------------------
# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-19 Bradley M. Bell
# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-22 Bradley M. Bell
#
# CppAD is distributed under the terms of the
# Eclipse Public License Version 2.0.
Expand All @@ -25,6 +25,12 @@ set_compile_flags( example_chkpoint_two "${cppad_debug_which}" "${source_list}"
#
ADD_EXECUTABLE(example_chkpoint_two EXCLUDE_FROM_ALL ${source_list})
#
# List of libraries to be linked into the specified target
TARGET_LINK_LIBRARIES(example_chkpoint_two
${cppad_lib}
${colpack_libs}
)
#
# Add the check_example_chkpoint_two target
ADD_CUSTOM_TARGET(check_example_chkpoint_two
example_chkpoint_two
Expand Down
1 change: 1 addition & 0 deletions example/general/CMakeLists.txt
Expand Up @@ -147,6 +147,7 @@ ADD_EXECUTABLE(example_general EXCLUDE_FROM_ALL ${source_list})
TARGET_LINK_LIBRARIES(example_general
${adolc_LIBRARIES}
${cppad_lib}
${colpack_libs}
)
#
# Add the check_example_general target
Expand Down
8 changes: 7 additions & 1 deletion example/get_started/CMakeLists.txt
@@ -1,5 +1,5 @@
# -----------------------------------------------------------------------------
# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-17 Bradley M. Bell
# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-22 Bradley M. Bell
#
# CppAD is distributed under the terms of the
# Eclipse Public License Version 2.0.
Expand All @@ -22,6 +22,12 @@ ADD_CUSTOM_TARGET(check_example_get_started
example_get_started
DEPENDS example_get_started
)
#
# List of libraries to be linked into the specified target
TARGET_LINK_LIBRARIES(example_get_started
${cppad_lib}
${colpack_libs}
)
MESSAGE(STATUS "make check_example_get_started: available")
#
# Change check depends in parent environment
Expand Down
8 changes: 6 additions & 2 deletions example/multi_thread/bthread/CMakeLists.txt
@@ -1,5 +1,5 @@
# -----------------------------------------------------------------------------
# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-21 Bradley M. Bell
# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-22 Bradley M. Bell
#
# CppAD is distributed under the terms of the
# Eclipse Public License Version 2.0.
Expand Down Expand Up @@ -37,7 +37,11 @@ set_compile_flags(
ADD_EXECUTABLE( example_multi_thread_bthread EXCLUDE_FROM_ALL ${source_list} )

# List of libraries to be linked into the specified target
TARGET_LINK_LIBRARIES(example_multi_thread_bthread ${Boost_LIBRARIES})
TARGET_LINK_LIBRARIES(example_multi_thread_bthread
${cppad_lib}
${colpack_libs}
${Boost_LIBRARIES}
)

# Add the check_example_multi_thread_bthread target
ADD_CUSTOM_TARGET(check_example_multi_thread_bthread
Expand Down
9 changes: 7 additions & 2 deletions example/multi_thread/openmp/CMakeLists.txt
@@ -1,5 +1,5 @@
# -----------------------------------------------------------------------------
# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-21 Bradley M. Bell
# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-22 Bradley M. Bell
#
# CppAD is distributed under the terms of the
# Eclipse Public License Version 2.0.
Expand Down Expand Up @@ -37,7 +37,12 @@ SET(source_list ../thread_test.cpp
set_compile_flags( example_multi_thread_openmp "${cppad_debug_which}" "${source_list}" )
#
ADD_EXECUTABLE( example_multi_thread_openmp EXCLUDE_FROM_ALL ${source_list} )
TARGET_LINK_LIBRARIES(example_multi_thread_openmp PRIVATE ${OpenMP_CXX_LIBRARIES})
TARGET_LINK_LIBRARIES(
example_multi_thread_openmp PRIVATE
${cppad_lib}
${colpack_libs}
${OpenMP_CXX_LIBRARIES}
)

# Extra flags used by linker for openmp support
SET(CMAKE_EXE_LINKER_FLAGS ${OpenMP_CXX_FLAGS} )
Expand Down
8 changes: 6 additions & 2 deletions example/multi_thread/pthread/CMakeLists.txt
@@ -1,5 +1,5 @@
# -----------------------------------------------------------------------------
# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-21 Bradley M. Bell
# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-22 Bradley M. Bell
#
# CppAD is distributed under the terms of the
# Eclipse Public License Version 2.0.
Expand Down Expand Up @@ -39,7 +39,11 @@ ADD_EXECUTABLE( example_multi_thread_pthread EXCLUDE_FROM_ALL ${source_list} )
LINK_DIRECTORIES( ${pthread_lib_path} )

# List of libraries to be linked into the specified target
TARGET_LINK_LIBRARIES(example_multi_thread_pthread ${pthread_lib})
TARGET_LINK_LIBRARIES(example_multi_thread_pthread
${cppad_lib}
${colpack_libs}
${pthread_lib}
)

# Add the check_example_multi_thread_pthread target
ADD_CUSTOM_TARGET(check_example_multi_thread_pthread
Expand Down
10 changes: 8 additions & 2 deletions example/optimize/CMakeLists.txt
@@ -1,5 +1,5 @@
# -----------------------------------------------------------------------------
# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-19 Bradley M. Bell
# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-22 Bradley M. Bell
#
# CppAD is distributed under the terms of the
# Eclipse Public License Version 2.0.
Expand Down Expand Up @@ -29,7 +29,13 @@ SET(source_list
set_compile_flags( example_optimize "${cppad_debug_which}" "${source_list}" )
#
ADD_EXECUTABLE(example_optimize EXCLUDE_FROM_ALL ${source_list})

#
# List of libraries to be linked into the specified target
TARGET_LINK_LIBRARIES(example_optimize
${cppad_lib}
${colpack_libs}
)
#
# Add the check_example_optimize target
ADD_CUSTOM_TARGET(check_example_optimize
example_optimize
Expand Down
9 changes: 7 additions & 2 deletions example/print_for/CMakeLists.txt
@@ -1,5 +1,5 @@
# -----------------------------------------------------------------------------
# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-17 Bradley M. Bell
# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-22 Bradley M. Bell
#
# CppAD is distributed under the terms of the
# Eclipse Public License Version 2.0.
Expand All @@ -16,7 +16,12 @@ SET(source_list print_for.cpp)
set_compile_flags( example_print_for "${cppad_debug_which}" "${source_list}" )
#
ADD_EXECUTABLE(example_print_for EXCLUDE_FROM_ALL ${source_list})

#
# List of libraries to be linked into the specified target
TARGET_LINK_LIBRARIES(example_print_for
${cppad_lib}
${colpack_libs}
)
# check_example_print_for target
ADD_CUSTOM_TARGET(check_example_print_for
example_print_for
Expand Down
8 changes: 6 additions & 2 deletions include/cppad/utility/link_dll_lib.hpp
Expand Up @@ -33,7 +33,6 @@ in the Eclipse Public License, Version 2.0 are satisfied:
# else
// LoadLibrary, GetProcAddress, FreeLibrary, GetLastError, RTLD_LAZY
# include <windows.h>
# define RTLD_LAZY 0
# endif

namespace CppAD { // BEGIN_CPPAD_NAMESPACE
Expand Down Expand Up @@ -84,7 +83,12 @@ class link_dll_lib {
public:
// ctor
link_dll_lib(const std::string& dll_file, std::string& err_msg)
{ handle_ = dlopen(dll_file.c_str(), RTLD_LAZY);
{
# ifdef _WIN32
handle_ = dlopen(dll_file.c_str(), 0);
# else
handle_ = dlopen(dll_file.c_str(), RTLD_LAZY);
# endif
if( handle_ != nullptr )
err_msg = "";
else
Expand Down
3 changes: 3 additions & 0 deletions include/makefile.am
Expand Up @@ -343,6 +343,7 @@ nobase_myinclude_HEADERS = \
cppad/local/sweep/rev_hes.hpp \
cppad/local/sweep/rev_jac.hpp \
cppad/local/sweep/reverse.hpp \
cppad/local/temp_file.hpp \
cppad/local/utility/cppad_vector_itr.hpp \
cppad/local/utility/vector_bool.hpp \
cppad/speed/det_33.hpp \
Expand All @@ -358,9 +359,11 @@ nobase_myinclude_HEADERS = \
cppad/utility.hpp \
cppad/utility/check_numeric_type.hpp \
cppad/utility/check_simple_vector.hpp \
cppad/utility/create_dll_lib.hpp \
cppad/utility/elapsed_seconds.hpp \
cppad/utility/error_handler.hpp \
cppad/utility/index_sort.hpp \
cppad/utility/link_dll_lib.hpp \
cppad/utility/lu_factor.hpp \
cppad/utility/lu_invert.hpp \
cppad/utility/lu_solve.hpp \
Expand Down
3 changes: 3 additions & 0 deletions include/makefile.in
Expand Up @@ -932,6 +932,7 @@ uninstall-am: uninstall-nobase_myincludeHEADERS
cppad/local/sweep/rev_hes.hpp \
cppad/local/sweep/rev_jac.hpp \
cppad/local/sweep/reverse.hpp \
cppad/local/temp_file.hpp \
cppad/local/utility/cppad_vector_itr.hpp \
cppad/local/utility/vector_bool.hpp \
cppad/speed/det_33.hpp \
Expand All @@ -947,9 +948,11 @@ uninstall-am: uninstall-nobase_myincludeHEADERS
cppad/utility.hpp \
cppad/utility/check_numeric_type.hpp \
cppad/utility/check_simple_vector.hpp \
cppad/utility/create_dll_lib.hpp \
cppad/utility/elapsed_seconds.hpp \
cppad/utility/error_handler.hpp \
cppad/utility/index_sort.hpp \
cppad/utility/link_dll_lib.hpp \
cppad/utility/lu_factor.hpp \
cppad/utility/lu_invert.hpp \
cppad/utility/lu_solve.hpp \
Expand Down

0 comments on commit 6f82dd3

Please sign in to comment.