Skip to content
Snippets Groups Projects
Commit 51d951ad authored by Joscha Schmiedt's avatar Joscha Schmiedt
Browse files

Rename main CMakeLists.txt

parent 383f543f
No related branches found
No related tags found
2 merge requests!61Release 0.3.0,!55Rename caosdb-cpplib to linkahead-cpplib
#
# This file is a part of the CaosDB Project.
# This file is a part of the LinkAhead Project.
#
# Copyright (C) 2021 Timm Fitschen <t.fitschen@indiscale.com>
# Copyright (C) 2021 Joscha Schmiedt <joscha@schmiedt.dev>
# Copyright (C) 2024 Joscha Schmiedt <joscha@schmiedt.dev>
# Copyright (C) 2021-2024 IndiScale GmbH <info@indiscale.com>
#
#
......@@ -22,15 +22,15 @@
cmake_minimum_required(VERSION 3.13)
set(libcaosdb_VERSION 0.3.0)
set(libcaosdb_COMPATIBLE_SERVER_VERSION_MAJOR 0)
set(libcaosdb_COMPATIBLE_SERVER_VERSION_MINOR 9)
set(libcaosdb_COMPATIBLE_SERVER_VERSION_PATCH 0)
set(libcaosdb_COMPATIBLE_SERVER_VERSION_PRE_RELEASE "")
set(liblinkahead_VERSION 0.3.0)
set(liblinkahead_COMPATIBLE_SERVER_VERSION_MAJOR 0)
set(liblinkahead_COMPATIBLE_SERVER_VERSION_MINOR 9)
set(liblinkahead_COMPATIBLE_SERVER_VERSION_PATCH 0)
set(liblinkahead_COMPATIBLE_SERVER_VERSION_PRE_RELEASE "")
project(libcaosdb
VERSION ${libcaosdb_VERSION}
DESCRIPTION "C and C++ client libraries for CaosDB"
project(liblinkahead
VERSION ${liblinkahead_VERSION}
DESCRIPTION "C and C++ client libraries for LinkAhead"
LANGUAGES CXX C)
set(CMAKE_C_STANDARD 11)
......@@ -141,10 +141,10 @@ message(DEBUG "GRPC_GENERATED: ${GRPC_GENERATED}")
###############################################################################
### Set up main targets
### * caosdb - The main library including the protobuf and grpc generated files.
### * cxxcaosdbcli - A C++ test client.
### * ccaosdb - A C-Wrapper of the C++ caosdb library.
### * ccaosdbcli - A plain C test client.
### * linkahead - The main library including the protobuf and grpc generated files.
### * cxxlinkaheadcli - A C++ test client.
### * clinkahead - A C-Wrapper of the C++ linkahead library.
### * clinkaheadcli - A plain C test client.
###############################################################################
find_package(gRPC CONFIG REQUIRED)
......@@ -162,64 +162,64 @@ message(DEBUG "gRPC_INCLUDE_DIRS: ${gRPC_INCLUDE_DIRS}")
message(DEBUG "Boost_INCLUDE_DIRS: ${Boost_INCLUDE_DIRS}")
message(DEBUG "GTest_INCLUDE_DIRS: ${GTest_INCLUDE_DIRS}")
message(DEBUG "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
message(DEBUG "libcaosdb_SOURCE_DIR: ${libcaosdb_SOURCE_DIR}")
message(DEBUG "libcaosdb_BINARY_DIR: ${libcaosdb_BINARY_DIR}")
message(DEBUG "liblinkahead_SOURCE_DIR: ${liblinkahead_SOURCE_DIR}")
message(DEBUG "liblinkahead_BINARY_DIR: ${liblinkahead_BINARY_DIR}")
# libcaosdb
# liblinkahead
# ---------
add_library(caosdb SHARED
${libcaosdb_INCL} ${libcaosdb_SRC} ${GRPC_GENERATED})
target_link_libraries(caosdb PUBLIC
add_library(linkahead SHARED
${liblinkahead_INCL} ${liblinkahead_SRC} ${GRPC_GENERATED})
target_link_libraries(linkahead PUBLIC
gRPC::grpc gRPC::grpc++ protobuf::libprotobuf ${Boost_LIBRARIES}
)
set(LIBCAOSDB caosdb)
set(liblinkahead linkahead)
target_include_directories(caosdb PUBLIC
$<BUILD_INTERFACE:${libcaosdb_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${libcaosdb_BINARY_DIR}/include>
$<BUILD_INTERFACE:${libcaosdb_SOURCE_DIR}/src>
target_include_directories(linkahead PUBLIC
$<BUILD_INTERFACE:${liblinkahead_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${liblinkahead_BINARY_DIR}/include>
$<BUILD_INTERFACE:${liblinkahead_SOURCE_DIR}/src>
$<INSTALL_INTERFACE:include>
)
# libccaosdb
# libclinkahead
# ----------
add_library(ccaosdb SHARED src/ccaosdb.cpp ${GRPC_GENERATED})
target_link_libraries(ccaosdb PUBLIC
caosdb
add_library(clinkahead SHARED src/clinkahead.cpp ${GRPC_GENERATED})
target_link_libraries(clinkahead PUBLIC
linkahead
gRPC::grpc gRPC::grpc++ protobuf::libprotobuf ${Boost_LIBRARIES}
)
target_include_directories(ccaosdb PUBLIC
$<BUILD_INTERFACE:${libcaosdb_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${libcaosdb_BINARY_DIR}/include>
target_include_directories(clinkahead PUBLIC
$<BUILD_INTERFACE:${liblinkahead_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${liblinkahead_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include>
)
# ccaosdbcli
# clinkaheadcli
# ----------
add_executable(ccaosdbcli EXCLUDE_FROM_ALL src/ccaosdbcli.c)
target_include_directories(ccaosdbcli PUBLIC
$<BUILD_INTERFACE:${libcaosdb_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${libcaosdb_BINARY_DIR}/include>
add_executable(clinkaheadcli EXCLUDE_FROM_ALL src/clinkaheadcli.c)
target_include_directories(clinkaheadcli PUBLIC
$<BUILD_INTERFACE:${liblinkahead_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${liblinkahead_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include>
)
target_link_libraries(ccaosdbcli PRIVATE
target_link_libraries(clinkaheadcli PRIVATE
gRPC::grpc protobuf::libprotobuf ${Boost_LIBRARIES}
ccaosdb
clinkahead
)
# cxxcaosdbcli
# cxxlinkaheadcli
# ------------
add_executable(cxxcaosdbcli EXCLUDE_FROM_ALL src/cxxcaosdbcli.cpp)
target_include_directories(cxxcaosdbcli PUBLIC
$<BUILD_INTERFACE:${libcaosdb_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${libcaosdb_BINARY_DIR}/include>
add_executable(cxxlinkaheadcli EXCLUDE_FROM_ALL src/cxxlinkaheadcli.cpp)
target_include_directories(cxxlinkaheadcli PUBLIC
$<BUILD_INTERFACE:${liblinkahead_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${liblinkahead_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include>
)
target_link_libraries(cxxcaosdbcli PRIVATE
caosdb gRPC::grpc++ protobuf::libprotobuf ${Boost_LIBRARIES}
target_link_libraries(cxxlinkaheadcli PRIVATE
linkahead gRPC::grpc++ protobuf::libprotobuf ${Boost_LIBRARIES}
)
......@@ -273,19 +273,19 @@ if(_LINTING)
# add_compiler_flag("-Werror") # removed until issue #71 is resolved
message(STATUS "PEDANTIC_CMAKE_CXX_FLAGS: [${PEDANTIC_CMAKE_CXX_FLAGS}]")
set(TARGET_CAOSDB_COMPILE_FLAGS "${TARGET_CAOSDB_COMPILE_FLAGS} ${PEDANTIC_CMAKE_CXX_FLAGS}")
set(TARGET_CCAOSDB_COMPILE_FLAGS "${TARGET_CCAOSDB_COMPILE_FLAGS} ${PEDANTIC_CMAKE_C_FLAGS}")
set(TARGET_CXXCAOSDBCLI_COMPILE_FLAGS "${TARGET_CXXCAOSDBCLI_COMPILE_FLAGS} ${PEDANTIC_CMAKE_CXX_FLAGS}")
set(TARGET_CCAOSDBCLI_COMPILE_FLAGS "${TARGET_CCAOSDBCLI_COMPILE_FLAGS} ${PEDANTIC_CMAKE_C_FLAGS}")
set_target_properties(caosdb PROPERTIES
COMPILE_FLAGS "${TARGET_CAOSDB_COMPILE_FLAGS}")
set_target_properties(ccaosdb PROPERTIES
COMPILE_FLAGS "${TARGET_CCAOSDB_COMPILE_FLAGS}")
set_target_properties(cxxcaosdbcli PROPERTIES
COMPILE_FLAGS "${TARGET_CXXCAOSDBCLI_COMPILE_FLAGS}")
set_target_properties(ccaosdbcli PROPERTIES
COMPILE_FLAGS "${TARGET_CCAOSDBCLI_COMPILE_FLAGS}")
set(TARGET_LINKAHEAD_COMPILE_FLAGS "${TARGET_LINKAHEAD_COMPILE_FLAGS} ${PEDANTIC_CMAKE_CXX_FLAGS}")
set(TARGET_CLINKAHEAD_COMPILE_FLAGS "${TARGET_CLINKAHEAD_COMPILE_FLAGS} ${PEDANTIC_CMAKE_C_FLAGS}")
set(TARGET_CXXLINKAHEADCLI_COMPILE_FLAGS "${TARGET_CXXLINKAHEADCLI_COMPILE_FLAGS} ${PEDANTIC_CMAKE_CXX_FLAGS}")
set(TARGET_CLINKAHEADCLI_COMPILE_FLAGS "${TARGET_CLINKAHEADCLI_COMPILE_FLAGS} ${PEDANTIC_CMAKE_C_FLAGS}")
set_target_properties(linkahead PROPERTIES
COMPILE_FLAGS "${TARGET_LINKAHEAD_COMPILE_FLAGS}")
set_target_properties(clinkahead PROPERTIES
COMPILE_FLAGS "${TARGET_CLINKAHEAD_COMPILE_FLAGS}")
set_target_properties(cxxlinkaheadcli PROPERTIES
COMPILE_FLAGS "${TARGET_CXXLINKAHEADCLI_COMPILE_FLAGS}")
set_target_properties(clinkaheadcli PROPERTIES
COMPILE_FLAGS "${TARGET_CLINKAHEADCLI_COMPILE_FLAGS}")
find_program(iwyu
NAMES include-what-you-use iwyu
......@@ -297,13 +297,13 @@ if(_LINTING)
set(_CMAKE_CXX_INCLUDE_WHAT_YOU_USE ${iwyu}
"-Xiwyu" "--cxx17ns" "-Xiwyu" "--no_fwd_decls")
set_target_properties(caosdb PROPERTIES
set_target_properties(linkahead PROPERTIES
CXX_INCLUDE_WHAT_YOU_USE "${_CMAKE_CXX_INCLUDE_WHAT_YOU_USE}"
)
set_target_properties(cxxcaosdbcli PROPERTIES
set_target_properties(cxxlinkaheadcli PROPERTIES
CXX_INCLUDE_WHAT_YOU_USE "${_CMAKE_CXX_INCLUDE_WHAT_YOU_USE}"
)
set_target_properties(ccaosdbcli PROPERTIES
set_target_properties(clinkaheadcli PROPERTIES
C_INCLUDE_WHAT_YOU_USE "${_CMAKE_CXX_INCLUDE_WHAT_YOU_USE}"
)
endif()
......@@ -326,16 +326,16 @@ if(_LINTING)
endif()
message(STATUS "Using clang-tidy with
'${_CMAKE_CXX_CLANG_TIDY};${_CMAKE_CXX_CLANG_TIDY_CHECKS}'")
set_target_properties(caosdb PROPERTIES
set_target_properties(linkahead PROPERTIES
CXX_CLANG_TIDY "${_CMAKE_CXX_CLANG_TIDY};${_CMAKE_CXX_CLANG_TIDY_CHECKS}"
)
set_target_properties(cxxcaosdbcli PROPERTIES
set_target_properties(cxxlinkaheadcli PROPERTIES
CXX_CLANG_TIDY "${_CMAKE_CXX_CLANG_TIDY};${_CMAKE_CXX_CLANG_TIDY_CHECKS}"
)
set_target_properties(ccaosdb PROPERTIES
set_target_properties(clinkahead PROPERTIES
C_CLANG_TIDY "${_CMAKE_C_CLANG_TIDY};${_CMAKE_C_CLANG_TIDY_CHECKS}"
)
set_target_properties(ccaosdbcli PROPERTIES
set_target_properties(clinkaheadcli PROPERTIES
C_CLANG_TIDY "${_CMAKE_C_CLANG_TIDY};${_CMAKE_C_CLANG_TIDY_CHECKS}"
)
endif()
......@@ -355,38 +355,38 @@ endif()
# ############ INSTALLATION #####################
# ###############################################
set(libcaosdb_INCLUDE_DEST "include/caosdb")
set(libcaosdb_LIB_DEST "lib")
set(liblinkahead_INCLUDE_DEST "include/linkahead")
set(liblinkahead_LIB_DEST "lib")
set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/.local/")
install(
# targets to install
TARGETS ${LIBCAOSDB} ccaosdb
TARGETS ${liblinkahead} clinkahead
# name of the CMake "export group" containing the targets we want to install
EXPORT caosdbTargets
EXPORT linkaheadTargets
# Dynamic, static library and include destination locations after running
# "make install"
LIBRARY DESTINATION ${libcaosdb_LIB_DEST}
ARCHIVE DESTINATION ${libcaosdb_LIB_DEST}
INCLUDES DESTINATION ${libcaosdb_INCLUDE_DEST}
LIBRARY DESTINATION ${liblinkahead_LIB_DEST}
ARCHIVE DESTINATION ${liblinkahead_LIB_DEST}
INCLUDES DESTINATION ${liblinkahead_INCLUDE_DEST}
)
set(libcaosdb_CMAKE_DEST "${libcaosdb_LIB_DEST}/cmake/caosdb")
set(liblinkahead_CMAKE_DEST "${liblinkahead_LIB_DEST}/cmake/linkahead")
install(
# The export we want to save (matches name defined above containing the
# install targets)
EXPORT caosdbTargets
EXPORT linkaheadTargets
# CMake file in which to store the export's information
FILE caosdbTargets.cmake
FILE linkaheadTargets.cmake
# Namespace prepends all targets in the export (when we import later, we
# will use caosdb::caosdb)
NAMESPACE caosdb::
# will use linkahead::linkahead)
NAMESPACE linkahead::
# where to place the resulting file (here, we're putting it with the library)
DESTINATION ${libcaosdb_CMAKE_DEST}
DESTINATION ${liblinkahead_CMAKE_DEST}
)
install(FILES ${libcaosdb_INCL} ${PROJECT_SOURCE_DIR}/include/ccaosdb.h DESTINATION ${libcaosdb_INCLUDE_DEST})
install(FILES ${liblinkahead_INCL} ${PROJECT_SOURCE_DIR}/include/clinkahead.h DESTINATION ${liblinkahead_INCLUDE_DEST})
foreach(i RANGE "${len_proto_files}")
list(GET PROTO_FILES ${i} next_proto_file)
......@@ -406,21 +406,21 @@ foreach(i RANGE "${len_proto_files}")
set(next_grpc_hdr
"${CMAKE_CURRENT_BINARY_DIR}/include/caosdb/${next_proto_module}/main.grpc.pb.h")
install(FILES ${next_proto_hdr} ${next_grpc_hdr} DESTINATION
${libcaosdb_INCLUDE_DEST}/${next_proto_module})
${liblinkahead_INCLUDE_DEST}/${next_proto_module})
endforeach()
install(FILES ${PROJECT_SOURCE_DIR}/caosdbConfig.cmake
DESTINATION ${libcaosdb_CMAKE_DEST})
install(FILES ${PROJECT_SOURCE_DIR}/linkaheadConfig.cmake
DESTINATION ${liblinkahead_CMAKE_DEST})
#set_property(TARGET caosdb PROPERTY VERSION ${libcaosdb_VERSION})
#set_property(TARGET caosdb PROPERTY VERSION ${liblinkahead_VERSION})
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"${PROJECT_SOURCE_DIR}/caosdbConfigVersion.cmake"
VERSION ${libcaosdb_VERSION}
"${PROJECT_SOURCE_DIR}/linkaheadConfigVersion.cmake"
VERSION ${liblinkahead_VERSION}
COMPATIBILITY AnyNewerVersion
)
install(FILES ${PROJECT_SOURCE_DIR}/caosdbConfigVersion.cmake
DESTINATION ${libcaosdb_CMAKE_DEST})
install(FILES ${PROJECT_SOURCE_DIR}/linkaheadConfigVersion.cmake
DESTINATION ${liblinkahead_CMAKE_DEST})
#######################################################
### code formatting with clang-format
......@@ -429,12 +429,12 @@ option(AUTOFORMATTING "call clang-format at configure time" ON)
if(AUTOFORMATTING AND NOT SKIP_LINTING)
find_program(clang_format NAMES clang-format-11 clang-format)
file(GLOB format_test_sources test/*.cpp test/*.h test/*.h.in)
execute_process(COMMAND ${clang_format} -i --verbose ${libcaosdb_INCL}
${libcaosdb_SRC} ${libcaosdb_TEST_SRC}
${PROJECT_SOURCE_DIR}/src/cxxcaosdbcli.cpp
${PROJECT_SOURCE_DIR}/src/ccaosdbcli.c
${PROJECT_SOURCE_DIR}/src/ccaosdb.cpp
${PROJECT_SOURCE_DIR}/include/ccaosdb.h
execute_process(COMMAND ${clang_format} -i --verbose ${liblinkahead_INCL}
${liblinkahead_SRC} ${liblinkahead_TEST_SRC}
${PROJECT_SOURCE_DIR}/src/cxxlinkaheadcli.cpp
${PROJECT_SOURCE_DIR}/src/clinkaheadcli.c
${PROJECT_SOURCE_DIR}/src/clinkahead.cpp
${PROJECT_SOURCE_DIR}/include/clinkahead.h
${format_test_sources}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
endif()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment