Skip to content

Commit

Permalink
Implemented SO versioning similar to those build via original Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
nyue committed Nov 4, 2016
1 parent cd8273b commit b630b76
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 8 deletions.
43 changes: 39 additions & 4 deletions openvdb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,47 @@ ENDIF ()
IF (WIN32)
FIND_PACKAGE ( GLEW REQUIRED )
ENDIF()

# Determine OpenVDB version
#define OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER 4
#define OPENVDB_LIBRARY_MINOR_VERSION_NUMBER 0
#define OPENVDB_LIBRARY_PATCH_VERSION_NUMBER 0
SET ( OPENVDB_VERSION_FILE ${CMAKE_CURRENT_SOURCE_DIR}/version.h )

FILE ( STRINGS "${OPENVDB_VERSION_FILE}" openvdb_major_version_str REGEX "^#define[\t ]+OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER[\t ]+.*")
FILE ( STRINGS "${OPENVDB_VERSION_FILE}" openvdb_minor_version_str REGEX "^#define[\t ]+OPENVDB_LIBRARY_MINOR_VERSION_NUMBER[\t ]+.*")
FILE ( STRINGS "${OPENVDB_VERSION_FILE}" openvdb_build_version_str REGEX "^#define[\t ]+OPENVDB_LIBRARY_PATCH_VERSION_NUMBER[\t ]+.*")

STRING (REGEX REPLACE "^.*OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER[\t ]+([0-9]*).*$" "\\1"
_openvdb_major_version_number "${openvdb_major_version_str}")
STRING (REGEX REPLACE "^.*OPENVDB_LIBRARY_MINOR_VERSION_NUMBER[\t ]+([0-9]*).*$" "\\1"
_openvdb_minor_version_number "${openvdb_minor_version_str}")
STRING (REGEX REPLACE "^.*OPENVDB_LIBRARY_PATCH_VERSION_NUMBER[\t ]+([0-9]*).*$" "\\1"
_openvdb_build_version_number "${openvdb_build_version_str}")

SET ( OPENVDB_MAJOR_VERSION_NUMBER ${_openvdb_major_version_number} CACHE STRING "OpenVDB major version number" )
SET ( OPENVDB_MINOR_VERSION_NUMBER ${_openvdb_minor_version_number} CACHE STRING "OpenVDB minor version number" )
SET ( OPENVDB_BUILD_VERSION_NUMBER ${_openvdb_build_version_number} CACHE STRING "OpenVDB build version number" )

# MESSAGE ( "OPENVDB_VERSION_FILE = ${OPENVDB_VERSION_FILE}")
# MESSAGE ( "OPENVDB_MAJOR_VERSION_NUMBER = ${OPENVDB_MAJOR_VERSION_NUMBER}" )
# MESSAGE ( "OPENVDB_MINOR_VERSION_NUMBER = ${OPENVDB_MINOR_VERSION_NUMBER}" )
# MESSAGE ( "OPENVDB_BUILD_VERSION_NUMBER = ${OPENVDB_BUILD_VERSION_NUMBER}" )

IF (OPENVDB_BUILD_PYTHON_MODULE)
FIND_PACKAGE ( PythonInterp REQUIRED )
FIND_PACKAGE ( PythonLibs REQUIRED )
SET ( OPENVDB_BOOST_PYTHON_LIBRARY_COMPONENT_NAME python )
INCLUDE_DIRECTORIES ( ${PYTHON_INCLUDE_DIR} )
MESSAGE ( "PYTHONLIBS_VERSION_STRING = ${PYTHONLIBS_VERSION_STRING}" )
# MESSAGE ( "PYTHONLIBS_VERSION_STRING = ${PYTHONLIBS_VERSION_STRING}" )

STRING(REPLACE "." ";" VERSION_LIST ${PYTHONLIBS_VERSION_STRING})
LIST(GET VERSION_LIST 0 OPENVDB_PYTHON_VERSION_MAJOR)
LIST(GET VERSION_LIST 1 OPENVDB_PYTHON_VERSION_MINOR)
LIST(GET VERSION_LIST 2 OPENVDB_PYTHON_VERSION_PATCH)

MESSAGE ( "OPENVDB_PYTHON_VERSION_MAJOR = ${OPENVDB_PYTHON_VERSION_MAJOR}" )
MESSAGE ( "OPENVDB_PYTHON_VERSION_MINOR = ${OPENVDB_PYTHON_VERSION_MINOR}" )
# MESSAGE ( "OPENVDB_PYTHON_VERSION_MAJOR = ${OPENVDB_PYTHON_VERSION_MAJOR}" )
# MESSAGE ( "OPENVDB_PYTHON_VERSION_MINOR = ${OPENVDB_PYTHON_VERSION_MINOR}" )

ENDIF ()
FIND_PACKAGE ( Boost ${MINIMUM_BOOST_VERSION} REQUIRED COMPONENTS iostreams system thread ${OPENVDB_BOOST_PYTHON_LIBRARY_COMPONENT_NAME} )
Expand Down Expand Up @@ -159,10 +186,18 @@ TARGET_LINK_LIBRARIES ( openvdb_shared
${BLOSC_blosc_LIBRARY}
)

SET_TARGET_PROPERTIES ( openvdb_static openvdb_shared
SET_TARGET_PROPERTIES ( openvdb_static
PROPERTIES OUTPUT_NAME openvdb
)

SET_TARGET_PROPERTIES(
openvdb_shared
PROPERTIES
OUTPUT_NAME openvdb
SOVERSION ${OPENVDB_MAJOR_VERSION_NUMBER}.${OPENVDB_MINOR_VERSION_NUMBER}
VERSION ${OPENVDB_MAJOR_VERSION_NUMBER}.${OPENVDB_MINOR_VERSION_NUMBER}.${OPENVDB_BUILD_VERSION_NUMBER}
)

SET ( VDB_PRINT_SOURCE_FILES cmd/openvdb_print/main.cc )
SET_SOURCE_FILES_PROPERTIES ( ${VDB_PRINT_SOURCE_FILES}
PROPERTIES
Expand Down
12 changes: 8 additions & 4 deletions openvdb_houdini/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ PROJECT ( OpenVDB_Houdini )

FIND_PACKAGE ( HDK REQUIRED )


# This is to work around DWA way of doing stuff - REPEATED WITH VARIATION
MESSAGE ( "PROJECT_SOURCE_DIR = ${PROJECT_SOURCE_DIR}" )
MESSAGE ( "CMAKE_CURRENT_SOURCE_DIR = ${CMAKE_CURRENT_SOURCE_DIR}" )
FILE ( GLOB HOUDINI_UTILS_HEADER RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} houdini/*.h )

# This is to work around DWA way of doing stuff
Expand All @@ -54,7 +51,7 @@ INCLUDE_DIRECTORIES (
${HDK_INCLUDE_DIR}
)

MESSAGE ( "HDK_DEFINITIONS = ${HDK_DEFINITIONS}" )
# MESSAGE ( "HDK_DEFINITIONS = ${HDK_DEFINITIONS}" )

IF (NOT WIN32)
ADD_DEFINITIONS ( -pthread -fPIC )
Expand Down Expand Up @@ -96,6 +93,13 @@ TARGET_LINK_LIBRARIES ( openvdb_houdini
openvdb_shared
)

SET_TARGET_PROPERTIES(
openvdb_houdini
PROPERTIES
SOVERSION ${OPENVDB_MAJOR_VERSION_NUMBER}.${OPENVDB_MINOR_VERSION_NUMBER}
VERSION ${OPENVDB_MAJOR_VERSION_NUMBER}.${OPENVDB_MINOR_VERSION_NUMBER}.${OPENVDB_BUILD_VERSION_NUMBER}
)

SET ( OPENVDB_SOP_NAMES "" )
LIST ( APPEND OPENVDB_SOP_NAMES "SOP_OpenVDB_Advect" )
LIST ( APPEND OPENVDB_SOP_NAMES "GEO_VDBTranslator" )
Expand Down

0 comments on commit b630b76

Please sign in to comment.