Skip to content

Commit

Permalink
Add version and pkgconfig (#474)
Browse files Browse the repository at this point in the history
* Add version and pkgconfig

* simply versioning

Co-authored-by: Bret Curtis <bret.curtis@pegus.digital>
  • Loading branch information
psi29a and Bret Curtis committed Mar 5, 2021
1 parent 1f25f9c commit 63a4ee4
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 6 deletions.
23 changes: 22 additions & 1 deletion CMakeLists.txt
Expand Up @@ -4,7 +4,8 @@ project(RecastNavigation)

# lib versions
SET(SOVERSION 1)
SET(VERSION 1.0.0)
set(LIB_VERSION 1.5.1)
string(REPLACE "." "," LIB_VERSION_NUM "${LIB_VERSION}.0")

option(RECASTNAVIGATION_DEMO "Build demo" ON)
option(RECASTNAVIGATION_TESTS "Build tests" ON)
Expand All @@ -16,6 +17,26 @@ endif()

include(GNUInstallDirs)

configure_file(
"${RecastNavigation_SOURCE_DIR}/version.h.in"
"${RecastNavigation_BINARY_DIR}/version.h")
install(FILES "${RecastNavigation_BINARY_DIR}/version.h" DESTINATION
${CMAKE_INSTALL_INCLUDEDIR}/recastnavigation)

# Needed for recastnavigation.pc.in
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix "\${prefix}")
set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
set(bindir "\${exec_prefix}/${CMAKE_INSTALL_BINDIR}")
set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
set(PACKAGE_VERSION "${LIB_VERSION}")
configure_file(
"${RecastNavigation_SOURCE_DIR}/recastnavigation.pc.in"
"${RecastNavigation_BINARY_DIR}/recastnavigation.pc"
@ONLY)
install(FILES "${RecastNavigation_BINARY_DIR}/recastnavigation.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")

add_subdirectory(DebugUtils)
add_subdirectory(Detour)
add_subdirectory(DetourCrowd)
Expand Down
2 changes: 1 addition & 1 deletion DebugUtils/CMakeLists.txt
Expand Up @@ -18,7 +18,7 @@ target_link_libraries(DebugUtils

set_target_properties(DebugUtils PROPERTIES
SOVERSION ${SOVERSION}
VERSION ${VERSION}
VERSION ${LIB_VERSION}
COMPILE_PDB_OUTPUT_DIRECTORY .
COMPILE_PDB_NAME "DebugUtils-d"
)
Expand Down
2 changes: 1 addition & 1 deletion Detour/CMakeLists.txt
Expand Up @@ -12,7 +12,7 @@ target_include_directories(Detour PUBLIC

set_target_properties(Detour PROPERTIES
SOVERSION ${SOVERSION}
VERSION ${VERSION}
VERSION ${LIB_VERSION}
COMPILE_PDB_OUTPUT_DIRECTORY .
COMPILE_PDB_NAME "Detour-d"
)
Expand Down
2 changes: 1 addition & 1 deletion DetourCrowd/CMakeLists.txt
Expand Up @@ -16,7 +16,7 @@ target_link_libraries(DetourCrowd

set_target_properties(DetourCrowd PROPERTIES
SOVERSION ${SOVERSION}
VERSION ${VERSION}
VERSION ${LIB_VERSION}
COMPILE_PDB_OUTPUT_DIRECTORY .
COMPILE_PDB_NAME "DetourCrowd-d"
)
Expand Down
2 changes: 1 addition & 1 deletion DetourTileCache/CMakeLists.txt
Expand Up @@ -16,7 +16,7 @@ target_link_libraries(DetourTileCache

set_target_properties(DetourTileCache PROPERTIES
SOVERSION ${SOVERSION}
VERSION ${VERSION}
VERSION ${LIB_VERSION}
COMPILE_PDB_OUTPUT_DIRECTORY .
COMPILE_PDB_NAME "DetourTileCache-d"
)
Expand Down
2 changes: 1 addition & 1 deletion Recast/CMakeLists.txt
Expand Up @@ -12,7 +12,7 @@ target_include_directories(Recast PUBLIC

set_target_properties(Recast PROPERTIES
SOVERSION ${SOVERSION}
VERSION ${VERSION}
VERSION ${LIB_VERSION}
COMPILE_PDB_OUTPUT_DIRECTORY .
COMPILE_PDB_NAME "Recast-d"
)
Expand Down
10 changes: 10 additions & 0 deletions recastnavigation.pc.in
@@ -0,0 +1,10 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@

Name: RecastNavigation
Description: RecastNavigation is a cross-platform navigation mesh construction toolset for games
Version: @PACKAGE_VERSION@
Libs: -L${libdir} -lRecast -lDetour -lDebugUtils -lDetourCrowd -lDetourTileCache
Cflags: -I${includedir} -I${includedir}/recastnavigation @PKG_CONFIG_CFLAGS@
3 changes: 3 additions & 0 deletions version.h.in
@@ -0,0 +1,3 @@
/* Define to the library version */
#define RECASTNAV_VERSION "${LIB_VERSION}"
#define RECASTNAV_VERSION_NUM ${LIB_VERSION_NUM}

0 comments on commit 63a4ee4

Please sign in to comment.