diff --git a/CMakeLists.txt b/CMakeLists.txt index 1eea5c8..1c2dcb5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -305,7 +305,7 @@ foreach(lib ${dmitigr_cpplipa_libraries}) configure_file(${lib_root}/${file}.in ${CMAKE_CURRENT_SOURCE_DIR}/${lib_root}/${lib}/${file} @ONLY NEWLINE_STYLE UNIX) - list(APPEND ${dmlib}_preprocessed_headers ${file}) + list(APPEND ${dmlib}_headers ${file}) endforeach() set(${dmlib}_header_only ${DMITIGR_CPPLIPA_HEADER_ONLY}) @@ -344,13 +344,24 @@ foreach(lib ${dmitigr_cpplipa_libraries}) configure_file(${lib_root}/version.hpp.in ${CMAKE_CURRENT_SOURCE_DIR}/${lib_root}/${lib}/version.hpp @ONLY NEWLINE_STYLE UNIX) - list(APPEND ${dmlib}_preprocessed_headers version.hpp) + list(APPEND ${dmlib}_headers version.hpp) - if(WIN32 AND NOT ${${dmlib}_header_only}) - configure_file(${lib_root}/version.rc.in - ${CMAKE_CURRENT_SOURCE_DIR}/${lib_root}/${lib}/version.rc @ONLY + if(NOT ${${dmlib}_header_only}) + configure_file(${lib_root}/lib_version.cpp.in + ${CMAKE_CURRENT_SOURCE_DIR}/${lib_root}/${lib}/lib_version.cpp @ONLY NEWLINE_STYLE UNIX) - list(APPEND ${dmlib}_build_only_sources version.rc) + list(APPEND ${dmlib}_implementations lib_version.cpp) + configure_file(${lib_root}/lib_version.hpp.in + ${CMAKE_CURRENT_SOURCE_DIR}/${lib_root}/${lib}/lib_version.hpp @ONLY + NEWLINE_STYLE UNIX) + list(APPEND ${dmlib}_headers lib_version.hpp) + + if(WIN32) + configure_file(${lib_root}/version.rc.in + ${CMAKE_CURRENT_SOURCE_DIR}/${lib_root}/${lib}/version.rc @ONLY + NEWLINE_STYLE UNIX) + list(APPEND ${dmlib}_build_only_sources version.rc) + endif() endif() endif() else() @@ -448,7 +459,6 @@ foreach(lib ${dmitigr_cpplipa_libraries}) # ------------------------------------ if(DMITIGR_CPPLIPA_INSTALL) - dmitigr_install_lib_includes(${dmlib}_preprocessed_headers) dmitigr_install_lib_includes(${dmlib}_headers) if(${${dmlib}_header_only}) dmitigr_install_lib_includes(${dmlib}_implementations) diff --git a/cmake/dmitigr_cpplipa.cmake b/cmake/dmitigr_cpplipa.cmake index 5e4811f..5c762f8 100644 --- a/cmake/dmitigr_cpplipa.cmake +++ b/cmake/dmitigr_cpplipa.cmake @@ -31,7 +31,6 @@ include(${CMAKE_CURRENT_LIST_DIR}/dmitigr_cpplipa_libraries_all.cmake) # ------------------------------------------------------------------------------ set(dmitigr_cpplipa_source_types - preprocessed_headers headers build_only_sources implementations diff --git a/src/lib_version.cpp.in b/src/lib_version.cpp.in new file mode 100644 index 0000000..08c46ba --- /dev/null +++ b/src/lib_version.cpp.in @@ -0,0 +1,31 @@ +// -*- C++ -*- +// +// Copyright 2022 Dmitry Igrishin +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +// This file is generated automatically. Edit lib_version.cpp.in instead!!!!!!!!!!!! +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +#include "lib_version.hpp" +#include "version.hpp" + +namespace dmitigr::@dmitigr_lib_name@ { + +DMITIGR_@dmitigr_lib_NAME@_INLINE std::int_fast32_t lib_version() noexcept +{ + return version(); +} + +} // namespace dmitigr::@dmitigr_lib_name@ diff --git a/src/lib_version.hpp.in b/src/lib_version.hpp.in new file mode 100644 index 0000000..cd91821 --- /dev/null +++ b/src/lib_version.hpp.in @@ -0,0 +1,43 @@ +// -*- C++ -*- +// +// Copyright 2022 Dmitry Igrishin +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +// This file is generated automatically. Edit lib_version.hpp.in instead!!!!!!!!!!!! +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +#ifndef DMITIGR_@dmitigr_lib_NAME@_LIB_VERSION_HPP +#define DMITIGR_@dmitigr_lib_NAME@_LIB_VERSION_HPP + +#include "dll.hpp" + +#include + +namespace dmitigr::@dmitigr_lib_name@ { + +/** + * @returns The library version. + * + * @see version(). + */ +DMITIGR_@dmitigr_lib_NAME@_API std::int_fast32_t lib_version() noexcept; + +} // namespace dmitigr::@dmitigr_lib_name@ + +#ifndef DMITIGR_@dmitigr_lib_NAME@_NOT_HEADER_ONLY +#include "lib_version.cpp" +#endif + +#endif // DMITIGR_@dmitigr_lib_NAME@_LIB_VERSION_HPP diff --git a/src/pgfe/lib_version.cpp b/src/pgfe/lib_version.cpp new file mode 100644 index 0000000..5b4605e --- /dev/null +++ b/src/pgfe/lib_version.cpp @@ -0,0 +1,31 @@ +// -*- C++ -*- +// +// Copyright 2022 Dmitry Igrishin +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +// This file is generated automatically. Edit lib_version.cpp.in instead!!!!!!!!!!!! +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +#include "lib_version.hpp" +#include "version.hpp" + +namespace dmitigr::pgfe { + +DMITIGR_PGFE_INLINE std::int_fast32_t lib_version() noexcept +{ + return version(); +} + +} // namespace dmitigr::pgfe diff --git a/src/pgfe/lib_version.hpp b/src/pgfe/lib_version.hpp new file mode 100644 index 0000000..f258857 --- /dev/null +++ b/src/pgfe/lib_version.hpp @@ -0,0 +1,43 @@ +// -*- C++ -*- +// +// Copyright 2022 Dmitry Igrishin +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +// This file is generated automatically. Edit lib_version.hpp.in instead!!!!!!!!!!!! +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +#ifndef DMITIGR_PGFE_LIB_VERSION_HPP +#define DMITIGR_PGFE_LIB_VERSION_HPP + +#include "dll.hpp" + +#include + +namespace dmitigr::pgfe { + +/** + * @returns The library version. + * + * @see version(). + */ +DMITIGR_PGFE_API std::int_fast32_t lib_version() noexcept; + +} // namespace dmitigr::pgfe + +#ifndef DMITIGR_PGFE_NOT_HEADER_ONLY +#include "lib_version.cpp" +#endif + +#endif // DMITIGR_PGFE_LIB_VERSION_HPP diff --git a/src/pgfe/pgfe.hpp b/src/pgfe/pgfe.hpp index 4a172d4..5145d82 100644 --- a/src/pgfe/pgfe.hpp +++ b/src/pgfe/pgfe.hpp @@ -54,5 +54,6 @@ #include "tuple.hpp" #include "types_fwd.hpp" #include "version.hpp" +#include "lib_version.hpp" #endif // DMITIGR_PGFE_PGFE_HPP