Skip to content

Commit 1504329

Browse files
committed
Refactoring macro and cmake variables.
- Add version macro. - Change declare macro and plugin id macro.
1 parent ee75975 commit 1504329

File tree

111 files changed

+179
-155
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+179
-155
lines changed

CMakeLists.txt

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,22 @@ if(CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION)
1313
endif()
1414

1515
# version
16-
set(PROJECT_VERSION_MAJOR "1")
17-
set(PROJECT_VERSION_MINOR "0")
18-
set(PROJECT_VERSION_PATCH "0")
19-
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
16+
set(RENDER_PIPELINE_VERSION 0)
17+
file(STRINGS "${PROJECT_SOURCE_DIR}/render_pipeline/rpcore/version.hpp" _RENDER_PIPELINE_VERSION_HPP REGEX "#define RENDER_PIPELINE_VERSION ")
18+
if("${_RENDER_PIPELINE_VERSION_HPP}" MATCHES "#define RENDER_PIPELINE_VERSION ([0-9]+)")
19+
set(RENDER_PIPELINE_VERSION "${CMAKE_MATCH_1}")
20+
endif()
21+
unset(_RENDER_PIPELINE_VERSION_HPP)
22+
23+
math(EXPR RENDER_PIPELINE_VERSION_MAJOR "${RENDER_PIPELINE_VERSION} / 10000")
24+
math(EXPR RENDER_PIPELINE_VERSION_MINOR "${RENDER_PIPELINE_VERSION} / 100 % 100")
25+
math(EXPR RENDER_PIPELINE_VERSION_PATCH "${RENDER_PIPELINE_VERSION} % 100")
26+
set(RENDER_PIPELINE_VERSION_TAG "")
27+
28+
set(RENDER_PIPELINE_VERSION "${RENDER_PIPELINE_VERSION_MAJOR}.${RENDER_PIPELINE_VERSION_MINOR}.${RENDER_PIPELINE_VERSION_PATCH}${RENDER_PIPELINE_VERSION_TAG}")
29+
set(PROJECT_VERSION "${RENDER_PIPELINE_VERSION}")
30+
31+
message("Render Pipeline building version: ${RENDER_PIPELINE_VERSION}")
2032

2133
# configure project package
2234
include(FindPackages)
@@ -75,23 +87,24 @@ target_link_libraries(${PROJECT_NAME}
7587

7688
set_target_properties(${PROJECT_NAME} PROPERTIES
7789
FOLDER "render_pipeline"
78-
DEFINE_SYMBOL "RPCPP_BUILD"
90+
DEFINE_SYMBOL "RENDER_PIPELINE_BUILD"
7991
DEBUG_POSTFIX "-debug"
8092
RELWITHDEBINFO_POSTFIX "-reldeb"
8193
VERSION ${PROJECT_VERSION}
8294
)
8395

8496
# configure package
8597
set(PACKAGE_NAME "${PROJECT_NAME}")
86-
set(PACKAGE_VERSION_CONFIG_FILE "${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake")
87-
set(PACKAGE_CONFIG_FILE "${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config.cmake")
88-
set(TARGET_EXPORT_NAME "${PROJECT_NAME}-targets")
98+
set(PACKAGE_VERSION "${PROJECT_VERSION}")
99+
set(PACKAGE_VERSION_CONFIG_FILE "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-config-version.cmake")
100+
set(PACKAGE_CONFIG_FILE "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-config.cmake")
101+
set(TARGET_EXPORT_NAME "${PACKAGE_NAME}-targets")
89102
set(PACKAGE_CMAKE_INSTALL_DIR "lib/${PROJECT_NAME}/cmake")
90103
file(RELATIVE_PATH PACKAGE_CMAKE_INSTALL_DIR2ROOT_DIR "${CMAKE_INSTALL_PREFIX}/${PACKAGE_CMAKE_INSTALL_DIR}" "${CMAKE_INSTALL_PREFIX}")
91104

92105
include(CMakePackageConfigHelpers)
93106
write_basic_package_version_file(${PACKAGE_VERSION_CONFIG_FILE}
94-
VERSION ${PROJECT_VERSION}
107+
VERSION ${PACKAGE_VERSION}
95108
COMPATIBILITY SameMajorVersion
96109
)
97110
configure_package_config_file("${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}-config.cmake.in"
@@ -130,7 +143,7 @@ install(FILES ${PACKAGE_CONFIG_FILE} ${PACKAGE_VERSION_CONFIG_FILE} DESTINATION
130143
install(EXPORT ${TARGET_EXPORT_NAME} DESTINATION ${PACKAGE_CMAKE_INSTALL_DIR})
131144

132145
# documents
133-
if(RPCPP_BUILD_DOCUMENTS AND DOXYGEN_FOUND)
146+
if(RENDER_PIPELINE_BUILD_DOCUMENTS AND DOXYGEN_FOUND)
134147
set(DOCUMENTS_TARGET "documents")
135148
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in"
136149
"${CMAKE_CURRENT_BINARY_DIR}/Doxyfile"

cmake/FindPackages.cmake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ set(PANDA3D_ROOT "" CACHE PATH "Hint for finding panda3d root directory")
1616
find_package(panda3d REQUIRED)
1717

1818
# find doxygen
19-
option(RPCPP_BUILD_DOCUMENTS "Build doxygen documents" OFF)
20-
option(RPCPP_DOXYGEN_SKIP_DOT "Skip to find Dot for Doxygen" ON)
21-
if(RPCPP_BUILD_DOCUMENTS)
19+
option(RENDER_PIPELINE_BUILD_DOCUMENTS "Build doxygen documents" OFF)
20+
option(RENDER_PIPELINE_DOXYGEN_SKIP_DOT "Skip to find Dot for Doxygen" ON)
21+
if(RENDER_PIPELINE_BUILD_DOCUMENTS)
2222
find_package(doxygen REQUIRED)
2323
set(DOXYGEN_HAVE_DOT "NO")
24-
if(NOT RPCPP_DOXYGEN_SKIP_DOT)
24+
if(NOT RENDER_PIPELINE_DOXYGEN_SKIP_DOT)
2525
set(DOXYGEN_HAVE_DOT "YES")
2626
endif()
2727
endif()

cmake/render_pipeline-config.cmake.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
@PACKAGE_INIT@
22

3+
set (@PACKAGE_NAME@_VERSION "@PACKAGE_VERSION@")
4+
35
include(${CMAKE_CURRENT_LIST_DIR}/@TARGET_EXPORT_NAME@.cmake)
46

57
set(@PACKAGE_NAME@_INSTALL_DIR "${CMAKE_CURRENT_LIST_DIR}/@PACKAGE_CMAKE_INSTALL_DIR2ROOT_DIR@")

files.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ set(header_rpcore
4848
"${PROJECT_SOURCE_DIR}/render_pipeline/rpcore/render_target.h"
4949
"${PROJECT_SOURCE_DIR}/render_pipeline/rpcore/rpobject.h"
5050
"${PROJECT_SOURCE_DIR}/render_pipeline/rpcore/stage_manager.h"
51+
"${PROJECT_SOURCE_DIR}/render_pipeline/rpcore/version.hpp"
5152
)
5253

5354
set(header_rpcore_gui

render_pipeline/rpcore/config.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
#include <boost/config.hpp>
44

5-
#if defined(RPCPP_BUILD)
6-
# define RPCPP_DECL BOOST_SYMBOL_EXPORT
5+
#if defined(RENDER_PIPELINE_BUILD)
6+
# define RENDER_PIPELINE_DECL BOOST_SYMBOL_EXPORT
77
#else
8-
# define RPCPP_DECL BOOST_SYMBOL_IMPORT
8+
# define RENDER_PIPELINE_DECL BOOST_SYMBOL_IMPORT
99
#endif

render_pipeline/rpcore/effect.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace rpcore {
1313
* This class represents an instance of a compiled effect. It can be loaded
1414
* from a file.
1515
*/
16-
class RPCPP_DECL Effect: public RPObject
16+
class RENDER_PIPELINE_DECL Effect: public RPObject
1717
{
1818
public:
1919
using OptionType = std::map<std::string, bool>;

render_pipeline/rpcore/globals.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace rpcore {
1717
* which is bad practice. This class also attempts to help IDEs to figure out
1818
* where the variables come from and where they are defined.
1919
*/
20-
class RPCPP_DECL Globals
20+
class RENDER_PIPELINE_DECL Globals
2121
{
2222
public:
2323
static void load(rppanda::ShowBase* showbase);

render_pipeline/rpcore/gui/checkbox.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace rpcore {
1616
* This is a wrapper around DirectCheckBox, providing a simpler interface
1717
* and better visuals.
1818
*/
19-
class RPCPP_DECL Checkbox: public RPObject
19+
class RENDER_PIPELINE_DECL Checkbox: public RPObject
2020
{
2121
public:
2222
struct Parameters

render_pipeline/rpcore/gui/labeled_checkbox.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class Text;
1212
* This is a checkbox, combined with a label. The arguments are
1313
* equal to the Checkbox and OnscreenText arguments.
1414
*/
15-
class RPCPP_DECL LabeledCheckbox: public RPObject
15+
class RENDER_PIPELINE_DECL LabeledCheckbox: public RPObject
1616
{
1717
public:
1818
struct Parameters: public Checkbox::Parameters

render_pipeline/rpcore/image.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace rpcore {
1515
* the memory used. This is used by all classes instead of pandas builtin
1616
* Texture class.
1717
*/
18-
class RPCPP_DECL Image: public RPObject
18+
class RENDER_PIPELINE_DECL Image: public RPObject
1919
{
2020
public:
2121
using ComponentFormatType = std::pair<Texture::ComponentType, Texture::Format>;

0 commit comments

Comments
 (0)