Skip to content

Commit 61c6c44

Browse files
osander1awalther1
authored andcommitted
Add a simple cmake build system
This is the initial part of a CMake build system. It allows to build ADOL-C with default options. Non-default configurations will come in separate commits.
1 parent 3108773 commit 61c6c44

File tree

11 files changed

+208
-3
lines changed

11 files changed

+208
-3
lines changed

ADOL-C/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
add_subdirectory(include)
2+
add_subdirectory(src)

ADOL-C/include/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
add_subdirectory(adolc)
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
install(FILES
2+
adalloc.h
3+
adolc_fatalerror.h
4+
adolc.h
5+
adolc_openmp.h
6+
adolc_sparse.h
7+
adoublecuda.h
8+
adouble.h
9+
adtl.h
10+
adtl_hov.h
11+
adtl_indo.h
12+
adutilsc.h
13+
adutils.h
14+
advector.h
15+
checkpointing.h
16+
convolut.h
17+
edfclasses.h
18+
externfcts2.h
19+
externfcts.h
20+
fixpoint.h
21+
fortutils.h
22+
interfaces.h
23+
param.h
24+
revolve.h
25+
taping.h
26+
DESTINATION "include/adolc")
27+
28+
add_subdirectory(drivers)
29+
add_subdirectory(internal)
30+
add_subdirectory(lie)
31+
add_subdirectory(tapedoc)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
install(FILES
2+
drivers.h
3+
odedrivers.h
4+
psdrivers.h
5+
taylor.h
6+
DESTINATION "include/adolc/drivers")
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
install(FILES
2+
adubfunc.h
3+
common.h
4+
paramfunc.h
5+
usrparms.h
6+
DESTINATION "include/adolc/internal")
7+
8+
# Write options into the file adolc_settings.h
9+
configure_file(adolc_settings.h.in ${CMAKE_CURRENT_BINARY_DIR}/adolc_settings.h @ONLY)
10+
install(FILES
11+
${CMAKE_CURRENT_BINARY_DIR}/adolc_settings.h
12+
DESTINATION "include/adolc/internal")
13+
target_include_directories(adolc
14+
PRIVATE
15+
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/ADOL-C/include>)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
install(FILES
2+
drivers.h
3+
DESTINATION "include/adolc/lie")
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
install(FILES
2+
tapedoc.h
3+
DESTINATION "include/adolc/tapedoc")

ADOL-C/src/CMakeLists.txt

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
target_sources(adolc PRIVATE
2+
adalloc.c
3+
adouble.cpp
4+
adouble_tl.cpp
5+
adouble_tl_hov.cpp
6+
adouble_tl_indo.cpp
7+
advector.cpp
8+
ampisupport.cpp
9+
ampisupportAdolc.cpp
10+
checkpointing.cpp
11+
convolut.c
12+
externfcts.cpp
13+
externfcts2.cpp
14+
fixpoint.cpp
15+
fortutils.c
16+
forward_partx.c
17+
fos_forward.c
18+
fos_pl_forward.c
19+
fos_pl_reverse.c
20+
fos_pl_sig_forward.c
21+
fos_reverse.c
22+
fov_forward.c
23+
fov_offset_forward.c
24+
fov_pl_sig_forward.c
25+
fos_pl_sig_reverse.c
26+
fov_pl_forward.c
27+
fov_reverse.c
28+
hos_forward.c
29+
hos_ov_reverse.c
30+
hos_reverse.c
31+
hov_forward.c
32+
hov_reverse.c
33+
hov_wk_forward.c
34+
indopro_forward_pl.c
35+
indopro_forward_s.c
36+
indopro_forward_t.c
37+
int_forward_s.c
38+
int_forward_t.c
39+
int_reverse_s.c
40+
int_reverse_t.c
41+
interfaces.cpp
42+
interfacesf.c
43+
medipacksupport.cpp
44+
nonl_ind_forward_s.c
45+
nonl_ind_forward_t.c
46+
nonl_ind_old_forward_s.c
47+
nonl_ind_old_forward_t.c
48+
param.cpp
49+
revolve.c
50+
rpl_malloc.c
51+
storemanager.cpp
52+
tape_handling.cpp
53+
taping.c
54+
zos_forward.c
55+
zos_pl_forward.c
56+
)
57+
58+
add_subdirectory(drivers)

ADOL-C/src/drivers/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
target_sources(adolc PRIVATE
2+
drivers.c
3+
driversf.c
4+
odedrivers.c
5+
odedriversf.c
6+
psdrivers.c
7+
psdriversf.c
8+
taylor.c
9+
)

CMakeLists.txt

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
cmake_minimum_required(VERSION 3.19)
2+
3+
project(adol-c
4+
VERSION 2.7.3
5+
LANGUAGES C CXX
6+
DESCRIPTION "A Package for Automatic Differentiation of Algorithms Written in C/C++"
7+
HOMEPAGE_URL "https://github.com/coin-or/ADOL-C")
8+
9+
add_library(adolc SHARED)
10+
add_library(adolc::adolc ALIAS adolc)
11+
12+
target_compile_features(adolc PUBLIC cxx_std_17)
13+
14+
# Make the version of ADOL-C available as compile definitions
15+
target_compile_definitions(adolc PRIVATE
16+
ADOLC_VERSION=${adol-c_VERSION_MAJOR}
17+
ADOLC_SUBVERSION=${adol-c_VERSION_MINOR}
18+
ADOLC_PATCHLEVEL=${adol-c_VERSION_PATCH})
19+
20+
# Set the public include directory containing headers that will be installed
21+
target_include_directories(adolc
22+
PUBLIC
23+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/ADOL-C/include>
24+
$<INSTALL_INTERFACE:include>)
25+
26+
# Set an include directory for the internally used library headers.
27+
#
28+
# This includes the files uni5_for.c, fo_rev.c, and ho_rev.c. Even though
29+
# they end with .c, they are used like header files. Together with some
30+
# preprocessor trickery this is an old-fashioned way to do generic programming.
31+
target_include_directories(adolc
32+
PRIVATE
33+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/ADOL-C/src>)
34+
35+
36+
# handle the options
37+
# ------------------
38+
39+
set(UINT_TYPE uint32_t)
40+
set(REAL_TYPE double)
41+
42+
set(ADVBRANCH "#undef ADOLC_ADVANCED_BRANCHING")
43+
set(ADTL_REFCNT "#undef USE_ADTL_REFCOUNTING")
44+
set(SPARSE_DRIVERS "#undef SPARSE_DRIVERS")
45+
set(USE_BOOST_POOL "#undef USE_BOOST_POOL")
46+
47+
# include subdirectories for handling of includes and source files
48+
# ----------------------------------------------------------------
49+
50+
add_subdirectory(ADOL-C)
51+
52+
53+
# export the targets
54+
# ------------------
55+
56+
include(CMakePackageConfigHelpers)
57+
include(GNUInstallDirs)
58+
59+
install(TARGETS adolc EXPORT adolcTargets)
60+
install(EXPORT adolcTargets
61+
FILE adolc-targets.cmake
62+
NAMESPACE adolc::
63+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/adolc)

0 commit comments

Comments
 (0)