cmake: make maa a proper dynamic library and install it correctly
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
@@ -1,13 +1,21 @@
|
||||
cmake_minimum_required (VERSION 2.8)
|
||||
project (maa)
|
||||
|
||||
set(SWIG_EXECUTABLE /usr/bin/swig)
|
||||
FIND_PACKAGE(SWIG REQUIRED)
|
||||
INCLUDE(${SWIG_USE_FILE})
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall")
|
||||
|
||||
SET(CMAKE_SWIG_FLAGS "")
|
||||
set(maa_VERSION_MAJOR 0)
|
||||
set(maa_VERSION_MINOR 1)
|
||||
set(maa_VERSION_PATCH 1)
|
||||
set(maa_VERSION_STRING ${maa_VERSION_MAJOR}.${maa_VERSION_MINOR}.${maa_VERSION_PATCH})
|
||||
|
||||
option(test "Build all tests." OFF)
|
||||
set (SWIG_EXECUTABLE /usr/bin/swig)
|
||||
FIND_PACKAGE (SWIG REQUIRED)
|
||||
INCLUDE (${SWIG_USE_FILE})
|
||||
|
||||
SET (CMAKE_SWIG_FLAGS "")
|
||||
|
||||
option (test "Build all tests." OFF)
|
||||
|
||||
add_subdirectory (src)
|
||||
add_subdirectory (examples)
|
||||
@@ -15,4 +23,4 @@ add_subdirectory (examples)
|
||||
if (test)
|
||||
enable_testing ()
|
||||
add_subdirectory (tests)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
@@ -12,7 +12,23 @@ set (maa_LIB_SRCS
|
||||
${PROJECT_SOURCE_DIR}/src/pwm/pwm.cxx
|
||||
)
|
||||
|
||||
add_library (maa STATIC ${maa_LIB_SRCS})
|
||||
add_library (maa SHARED ${maa_LIB_SRCS})
|
||||
|
||||
add_subdirectory(python)
|
||||
add_subdirectory(javascript)
|
||||
set_target_properties(
|
||||
maa
|
||||
PROPERTIES
|
||||
SOVERSION ${maa_VERSION_MAJOR}
|
||||
VERSION ${maa_VERSION_STRING}
|
||||
)
|
||||
install (FILES ${maa_LIB_HEADERS} DESTINATION include/maa)
|
||||
|
||||
macro(maa_CREATE_INSTALL_PKGCONFIG generated_file install_location)
|
||||
configure_file(${generated_file}.cmake ${CMAKE_CURRENT_BINARY_DIR}/${generated_file} @ONLY)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${generated_file} DESTINATION ${install_location})
|
||||
endmacro(maa_CREATE_INSTALL_PKGCONFIG)
|
||||
maa_create_install_pkgconfig(maa.pc lib${LIB_SUFFIX}/pkgconfig)
|
||||
|
||||
install (TARGETS maa DESTINATION lib)
|
||||
|
||||
add_subdirectory (python)
|
||||
add_subdirectory (javascript)
|
||||
|
||||
11
src/maa.pc.cmake
Normal file
11
src/maa.pc.cmake
Normal file
@@ -0,0 +1,11 @@
|
||||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
exec_prefix=${prefix}
|
||||
libdir=${exec_prefix}/lib@LIB_SUFFIX@
|
||||
includedir=${prefix}/include
|
||||
|
||||
Name: maa
|
||||
Description: Low Level Skeleton Library for Communication
|
||||
Version: @maa_VERSION_STRING@
|
||||
|
||||
Libs: -L${libdir} -lmaa
|
||||
Cflags: -I${includedir}/maa -lpthread
|
||||
Reference in New Issue
Block a user