Skip to content

Commit

Permalink
Add lib_version()
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitigr committed Apr 12, 2022
1 parent 43f0469 commit 231117d
Show file tree
Hide file tree
Showing 7 changed files with 166 additions and 8 deletions.
24 changes: 17 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion cmake/dmitigr_cpplipa.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
31 changes: 31 additions & 0 deletions src/lib_version.cpp.in
Original file line number Diff line number Diff line change
@@ -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@
43 changes: 43 additions & 0 deletions src/lib_version.hpp.in
Original file line number Diff line number Diff line change
@@ -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 <cstdint>

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
31 changes: 31 additions & 0 deletions src/pgfe/lib_version.cpp
Original file line number Diff line number Diff line change
@@ -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
43 changes: 43 additions & 0 deletions src/pgfe/lib_version.hpp
Original file line number Diff line number Diff line change
@@ -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 <cstdint>

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
1 change: 1 addition & 0 deletions src/pgfe/pgfe.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,6 @@
#include "tuple.hpp"
#include "types_fwd.hpp"
#include "version.hpp"
#include "lib_version.hpp"

#endif // DMITIGR_PGFE_PGFE_HPP

0 comments on commit 231117d

Please sign in to comment.