summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorVasilii Chernov <vchernov@inr.ru>2016-02-24 18:24:22 +0100
committerVasilii Chernov <vchernov@inr.ru>2016-02-24 18:24:22 +0100
commitb0a034e6ef4a958235a56ebde0831c0f30a84d30 (patch)
treea1f46d2d536c692edd6b17efc61ac9fefef2796b /CMakeLists.txt
parentda842568b94b0e00c1709ae01f441a7424c15b87 (diff)
parent3ea1907f3169e0233d3a32a7d470af3c34b6f967 (diff)
downloadpcitool-b0a034e6ef4a958235a56ebde0831c0f30a84d30.tar.gz
pcitool-b0a034e6ef4a958235a56ebde0831c0f30a84d30.tar.bz2
pcitool-b0a034e6ef4a958235a56ebde0831c0f30a84d30.tar.xz
pcitool-b0a034e6ef4a958235a56ebde0831c0f30a84d30.zip
Merge with Suren branch. Fix memory leaks.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt55
1 files changed, 35 insertions, 20 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ce56bbc..22a685b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,6 @@
project(pcitool)
-set(PCILIB_VERSION "0.2.5")
+set(PCILIB_VERSION "0.2.6")
set(PCILIB_ABI_VERSION "2")
cmake_minimum_required(VERSION 2.8)
@@ -8,7 +8,7 @@ cmake_minimum_required(VERSION 2.8)
#set(CMAKE_PREFIX_PATH ${CMAKE_SYSTEM_PREFIX_PATH})
set(DISABLE_PCITOOL FALSE CACHE BOOL "Build only the library")
-set(BUILD_PYTHON_MODULES TRUE CACHE BOOL "Build pcilib python modules")
+set(DISABLE_PYTHON FALSE CACHE BOOL "Disable python scripting support")
#list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
@@ -37,11 +37,11 @@ SET(ENV{PKG_CONFIG_PATH} "${LIB_INSTALL_DIR}/pkgconfig:$ENV{PKG_CONFIG_PATH}")
find_package(PkgConfig REQUIRED)
find_package(Threads REQUIRED)
-if (BUILD_PYTHON_MODULES)
- find_package(PythonLibs 2.7 REQUIRED)
- find_package(SWIG REQUIRED)
- add_definitions(-DBUILD_PYTHON_MODULES)
-endif (BUILD_PYTHON_MODULES)
+if (NOT DISABLE_PYTHON)
+ find_package(PythonLibs 2.7 REQUIRED)
+ find_package(SWIG REQUIRED)
+ set(HAVE_PYTHON TRUE)
+endif (NOT DISABLE_PYTHON)
set(EXTRA_SYSTEM_LIBS -lrt)
@@ -65,8 +65,17 @@ add_definitions("-fPIC --std=c99 -Wall -O2 -gdwarf-2 -g3 -fno-omit-frame-pointer
#add_definitions("-fPIC --std=c99 -Wall -O2")
include(cmake/version.cmake)
+
VERSION_TO_VARS(${PCILIB_VERSION} PCILIB_VERSION_MAJOR PCILIB_VERSION_MINOR PCILIB_VERSION_MICRO)
+add_custom_target(build)
+add_custom_command(TARGET build
+ COMMAND ${CMAKE_COMMAND} -DPCILIB_SOURCE_DIR=${CMAKE_SOURCE_DIR} -DPCILIB_BINARY_DIR=${CMAKE_BINARY_DIR} -P ${CMAKE_SOURCE_DIR}/cmake/build.cmake
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+)
+set_source_files_properties(${CMAKE_BINARY_DIR}/pcilib/build.h PROPERTIES GENERATED TRUE)
+
+
set(TARNAME "pcitool")
set(PACKAGE_VERSION ${PCILIB_VERSION})
set(PACKAGE_NAME "${TARNAME}")
@@ -88,30 +97,36 @@ add_subdirectory(pcitool)
add_subdirectory(apps)
add_subdirectory(xml)
-if (BUILD_PYTHON_MODULES)
- add_subdirectory(pywrap)
-endif (BUILD_PYTHON_MODULES)
+if (HAVE_PYTHON)
+ add_subdirectory(pywrap)
+endif (HAVE_PYTHON)
set_target_properties(pcilib PROPERTIES
VERSION ${PCILIB_VERSION}
SOVERSION ${PCILIB_ABI_VERSION}
)
-file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/xml DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
-file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/pywrap/templates DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/pywrap)
-file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/pywrap/static DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/pywrap)
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/pywrap/html_server.py ${CMAKE_CURRENT_BINARY_DIR}/pywrap/html_server.py)
-
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/misc/pcitool.pc.in ${CMAKE_CURRENT_BINARY_DIR}/misc/pcitool.pc)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/pcilib/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/pcilib/config.h)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/pcilib/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/pcilib/version.h)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/docs/Doxyfile)
-file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/pci
- DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
- FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ
- GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
-
+if (NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
+ file(COPY ${CMAKE_SOURCE_DIR}/xml DESTINATION ${CMAKE_BINARY_DIR})
+ file(COPY ${CMAKE_SOURCE_DIR}/pci
+ DESTINATION ${CMAKE_BINARY_DIR}
+ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+ )
+ file(COPY ${CMAKE_SOURCE_DIR}/run
+ DESTINATION ${CMAKE_BINARY_DIR}
+ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+ )
+
+ file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/xml DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+ file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/pywrap/templates DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/pywrap)
+ file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/pywrap/static DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/pywrap)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/pywrap/html_server.py ${CMAKE_CURRENT_BINARY_DIR}/pywrap/html_server.py)
+endif(NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/misc/pcitool.pc