From f6d8df74e1751e6b0b960bd7e93fb5a06620b119 Mon Sep 17 00:00:00 2001 From: Andreas Suter Date: Sat, 12 May 2018 15:56:32 +0200 Subject: [PATCH] cmake: attempt to get the cuba library compiled as collection of object libraries. Compiles and links, but not yet tested. --- src/external/libCuba/src/CMakeLists.txt | 49 +++++++++---------- src/external/libCuba/src/common/stddecl.h | 2 +- src/external/libCuba/src/cuhre/CMakeLists.txt | 31 ++++++++++++ .../libCuba/src/divonne/CMakeLists.txt | 31 ++++++++++++ src/external/libCuba/src/suave/CMakeLists.txt | 31 ++++++++++++ src/external/libCuba/src/vegas/CMakeLists.txt | 31 ++++++++++++ 6 files changed, 147 insertions(+), 28 deletions(-) create mode 100644 src/external/libCuba/src/cuhre/CMakeLists.txt create mode 100644 src/external/libCuba/src/divonne/CMakeLists.txt create mode 100644 src/external/libCuba/src/suave/CMakeLists.txt create mode 100644 src/external/libCuba/src/vegas/CMakeLists.txt diff --git a/src/external/libCuba/src/CMakeLists.txt b/src/external/libCuba/src/CMakeLists.txt index d2970a60..63201c5c 100644 --- a/src/external/libCuba/src/CMakeLists.txt +++ b/src/external/libCuba/src/CMakeLists.txt @@ -9,37 +9,32 @@ set(CUBA_VERSION "1.0.0") set(CUBA_LIBRARY_NAME "cuba") configure_file("cuba.pc.in" "cuba.pc" @ONLY) +add_subdirectory(cuhre) +add_subdirectory(divonne) +add_subdirectory(suave) +add_subdirectory(vegas) + #--- lib creation ------------------------------------------------------------- add_library(cuba SHARED - cuhre/Cuhre.c - divonne/Divonne.c - suave/Suave.c - vegas/Vegas.c - common/WorkerIni.c -) -#--- make sure that the include directory is found ---------------------------- -target_include_directories( - cuba BEFORE PRIVATE - $ - $ - $ - $ - $ + $ + $ + $ + $ ) -#--- check for pre compile flags ---------------------------------------------- -set(COMP_DEF "") -if (HAVE_FORK) - set(COMP_DEF ${COMP_DEF} "-DHAVE_FORK") -endif (HAVE_FORK) -if (HAVE_ALLOCA_H) - set(COMP_DEF ${COMP_DEF} "-DHAVE_ALLOCA_H") -endif (HAVE_ALLOCA_H) -if (HAVE_SHMGET) - set(COMP_DEF ${COMP_DEF} "-DHAVE_SHMGET") -endif (HAVE_SHMGET) +#--- install cuba solib ------------------------------------------------------- +install(TARGETS cuba DESTINATION lib) -target_compile_definitions( - cuba PRIVATE ${COMP_DEF} +#--- install cuba header ------------------------------------------------------ +install( + FILES + cuba.h + DESTINATION + include ) +#--- install pkg-config info -------------------------------------------------- +install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/cuba.pc + DESTINATION lib/pkgconfig +) diff --git a/src/external/libCuba/src/common/stddecl.h b/src/external/libCuba/src/common/stddecl.h index fed006f3..6118aa0a 100644 --- a/src/external/libCuba/src/common/stddecl.h +++ b/src/external/libCuba/src/common/stddecl.h @@ -12,7 +12,7 @@ #include "config.h" #endif -#define _BSD_SOURCE +#define _DEFAULT_SOURCE #define _XOPEN_SOURCE #include diff --git a/src/external/libCuba/src/cuhre/CMakeLists.txt b/src/external/libCuba/src/cuhre/CMakeLists.txt new file mode 100644 index 00000000..21bae662 --- /dev/null +++ b/src/external/libCuba/src/cuhre/CMakeLists.txt @@ -0,0 +1,31 @@ +#--- cuhre -------------------------------------------------------------------- + +#--- obj lib creation --------------------------------------------------------- +add_library(cuhre OBJECT + Cuhre.c +) + +#--- make sure that the include directory is found ---------------------------- +target_include_directories( + cuhre BEFORE PRIVATE + $ + $ + $ +) + +#--- check for pre compile flags ---------------------------------------------- +set(COMP_DEF "") +if (HAVE_FORK) + set(COMP_DEF ${COMP_DEF} "-DHAVE_FORK") +endif (HAVE_FORK) +if (HAVE_ALLOCA_H) + set(COMP_DEF ${COMP_DEF} "-DHAVE_ALLOCA_H") +endif (HAVE_ALLOCA_H) +if (HAVE_SHMGET) + set(COMP_DEF ${COMP_DEF} "-DHAVE_SHMGET") +endif (HAVE_SHMGET) + +target_compile_definitions( + cuhre PRIVATE ${COMP_DEF} +) + diff --git a/src/external/libCuba/src/divonne/CMakeLists.txt b/src/external/libCuba/src/divonne/CMakeLists.txt new file mode 100644 index 00000000..0a0ce00a --- /dev/null +++ b/src/external/libCuba/src/divonne/CMakeLists.txt @@ -0,0 +1,31 @@ +#--- divonne ------------------------------------------------------------------ + +#--- obj lib creation --------------------------------------------------------- +add_library(divonne OBJECT + Divonne.c +) + +#--- make sure that the include directory is found ---------------------------- +target_include_directories( + divonne BEFORE PRIVATE + $ + $ + $ +) + +#--- check for pre compile flags ---------------------------------------------- +set(COMP_DEF "") +if (HAVE_FORK) + set(COMP_DEF ${COMP_DEF} "-DHAVE_FORK") +endif (HAVE_FORK) +if (HAVE_ALLOCA_H) + set(COMP_DEF ${COMP_DEF} "-DHAVE_ALLOCA_H") +endif (HAVE_ALLOCA_H) +if (HAVE_SHMGET) + set(COMP_DEF ${COMP_DEF} "-DHAVE_SHMGET") +endif (HAVE_SHMGET) + +target_compile_definitions( + divonne PRIVATE ${COMP_DEF} +) + diff --git a/src/external/libCuba/src/suave/CMakeLists.txt b/src/external/libCuba/src/suave/CMakeLists.txt new file mode 100644 index 00000000..b4417c15 --- /dev/null +++ b/src/external/libCuba/src/suave/CMakeLists.txt @@ -0,0 +1,31 @@ +#--- suave -------------------------------------------------------------------- + +#--- obj lib creation --------------------------------------------------------- +add_library(suave OBJECT + Suave.c +) + +#--- make sure that the include directory is found ---------------------------- +target_include_directories( + suave BEFORE PRIVATE + $ + $ + $ +) + +#--- check for pre compile flags ---------------------------------------------- +set(COMP_DEF "") +if (HAVE_FORK) + set(COMP_DEF ${COMP_DEF} "-DHAVE_FORK") +endif (HAVE_FORK) +if (HAVE_ALLOCA_H) + set(COMP_DEF ${COMP_DEF} "-DHAVE_ALLOCA_H") +endif (HAVE_ALLOCA_H) +if (HAVE_SHMGET) + set(COMP_DEF ${COMP_DEF} "-DHAVE_SHMGET") +endif (HAVE_SHMGET) + +target_compile_definitions( + suave PRIVATE ${COMP_DEF} +) + diff --git a/src/external/libCuba/src/vegas/CMakeLists.txt b/src/external/libCuba/src/vegas/CMakeLists.txt new file mode 100644 index 00000000..8ceb2d9b --- /dev/null +++ b/src/external/libCuba/src/vegas/CMakeLists.txt @@ -0,0 +1,31 @@ +#--- vegas -------------------------------------------------------------------- + +#--- obj lib creation --------------------------------------------------------- +add_library(vegas OBJECT + Vegas.c +) + +#--- make sure that the include directory is found ---------------------------- +target_include_directories( + vegas BEFORE PRIVATE + $ + $ + $ +) + +#--- check for pre compile flags ---------------------------------------------- +set(COMP_DEF "") +if (HAVE_FORK) + set(COMP_DEF ${COMP_DEF} "-DHAVE_FORK") +endif (HAVE_FORK) +if (HAVE_ALLOCA_H) + set(COMP_DEF ${COMP_DEF} "-DHAVE_ALLOCA_H") +endif (HAVE_ALLOCA_H) +if (HAVE_SHMGET) + set(COMP_DEF ${COMP_DEF} "-DHAVE_SHMGET") +endif (HAVE_SHMGET) + +target_compile_definitions( + vegas PRIVATE ${COMP_DEF} +) +