Skip to content

Commit

Permalink
[build]: correct install directory and generate pkgconfig for linux
Browse files Browse the repository at this point in the history
Change-Id: Id4f6b2278ee0fe50ffc9806fffc5b01267f723db
Signed-off-by: Jacob Chen <[email protected]>
  • Loading branch information
wzyy2 committed Dec 19, 2017
1 parent 0b71be0 commit 81759e8
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 12 deletions.
23 changes: 16 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -358,12 +358,9 @@ configure_file(
# ----------------------------------------------------------------------------
# Build options
# ----------------------------------------------------------------------------
set(CMAKE_INSTALL_PREFIX "")
set(LIB_INSTALL_DIR "${CMAKE_SOURCE_DIR}/out/lib/${SYSPROC}" CACHE STRING "Install location of libraries")
set(BIN_INSTALL_DIR "${CMAKE_SOURCE_DIR}/out/bin" CACHE STRING "Install location of executables")
set(TEST_INSTALL_DIR "${CMAKE_BINARY_DIR}/test" CACHE STRING "Install location of unit test")
set(INC_INSTALL_DIR "${CMAKE_SOURCE_DIR}/out/inc" CACHE STRING "Install location of headers")

find_package(PkgConfig)
INCLUDE(GNUInstallDirs)
pkg_search_module(PTHREAD pthread)

# ----------------------------------------------------------------------------
# Set Warning as Error
Expand Down Expand Up @@ -491,6 +488,18 @@ add_subdirectory(test)
# install headers
# ----------------------------------------------------------------------------
install(DIRECTORY ${CMAKE_SOURCE_DIR}/inc/
DESTINATION "${INC_INSTALL_DIR}"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/rockchip"
FILES_MATCHING PATTERN "*.h"
)

# ----------------------------------------------------------------------------
# pkgconfig
# ----------------------------------------------------------------------------
CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/pkgconfig/rockchip_mpp.pc.cmake"
"${CMAKE_BINARY_DIR}/rockchip_mpp.pc" @ONLY)
CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/pkgconfig/rockchip_vpu.pc.cmake"
"${CMAKE_BINARY_DIR}/rockchip_vpu.pc" @ONLY)
install(FILES "${CMAKE_BINARY_DIR}/rockchip_mpp.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig/")
install(FILES "${CMAKE_BINARY_DIR}/rockchip_vpu.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig/")
4 changes: 2 additions & 2 deletions mpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@ add_subdirectory(legacy)
add_subdirectory(test)

install(TARGETS ${MPP_STATIC} ${MPP_SHARED}
ARCHIVE DESTINATION "${LIB_INSTALL_DIR}"
LIBRARY DESTINATION "${LIB_INSTALL_DIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)
5 changes: 5 additions & 0 deletions mpp/legacy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,8 @@ if(RKPLATFORM)
else()
target_link_libraries(${VPU_SHARED} ${MPP_SHARED})
endif()

install(TARGETS ${VPU_STATIC} ${VPU_SHARED}
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)
2 changes: 1 addition & 1 deletion mpp/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ macro(add_mpp_test module)
add_executable(${test_name} ${test_name}.c)
target_link_libraries(${test_name} ${MPP_SHARED})
set_target_properties(${test_name} PROPERTIES FOLDER "mpp/test")
install(TARGETS ${test_name} RUNTIME DESTINATION ${TEST_INSTALL_DIR})
install(TARGETS ${test_name} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
#add_test(NAME ${test_name} COMMAND ${test_name})
endif()
endmacro()
Expand Down
4 changes: 2 additions & 2 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ macro(add_mpp_test module)
add_executable(${test_name} ${test_name}.c mpp_event_trigger.c mpp_parse_cfg.c)
target_link_libraries(${test_name} ${MPP_SHARED} utils)
set_target_properties(${test_name} PROPERTIES FOLDER "test")
#install(TARGETS ${test_name} RUNTIME DESTINATION ${TEST_INSTALL_DIR})
install(TARGETS ${test_name} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
#add_test(NAME ${test_name} COMMAND ${test_name})
endif()
endmacro()
Expand Down Expand Up @@ -47,7 +47,7 @@ macro(add_legacy_test module)
add_executable(${test_name} ${test_name}.c)
target_link_libraries(${test_name} ${VPU_SHARED} utils)
set_target_properties(${test_name} PROPERTIES FOLDER "test")
#install(TARGETS ${test_name} RUNTIME DESTINATION ${TEST_INSTALL_DIR})
install(TARGETS ${test_name} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
#add_test(NAME ${test_name} COMMAND ${test_name})
endif()
endmacro()
Expand Down

0 comments on commit 81759e8

Please sign in to comment.