summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2010-09-20 17:26:09 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2010-09-20 17:33:18 -0300
commit231253beff97ce9d81d63ee437b833cc73ed1142 (patch)
treef3a1bd609b7e4c97aa17133a52666379ac8eb32d /CMakeLists.txt
parenta02e6fff64cdfcf2022c73d03d779a2584544842 (diff)
downloadshiboken-231253beff97ce9d81d63ee437b833cc73ed1142.tar.gz
shiboken-231253beff97ce9d81d63ee437b833cc73ed1142.tar.xz
shiboken-231253beff97ce9d81d63ee437b833cc73ed1142.zip
Shiboken generator code moved to the directory generator.
Reviewer: Renato Ara├║jo <renato.filho@openbossa.org> Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt95
1 files changed, 22 insertions, 73 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8bb2d464..2830bcba 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,17 +6,21 @@ cmake_minimum_required(VERSION 2.6)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules/
${CMAKE_MODULE_PATH})
-find_package(Qt4 4.5.0 REQUIRED)
-find_package(ApiExtractor 0.8 REQUIRED)
-find_package(GeneratorRunner 0.6.1 REQUIRED)
-find_package(PythonLibs REQUIRED)
-find_package(PythonInterpWithDebug REQUIRED)
+find_package(Qt4 4.5.0)
+find_package(ApiExtractor 0.8)
+find_package(GeneratorRunner 0.6.1)
+find_package(PythonLibs)
+find_package(PythonInterpWithDebug)
add_definitions(${QT_DEFINITIONS})
+set(shiboken_MAJOR_VERSION "0")
+set(shiboken_MINOR_VERSION "5")
+set(shiboken_MICRO_VERSION "1")
+set(shiboken_VERSION "${shiboken_MAJOR_VERSION}.${shiboken_MINOR_VERSION}.${shiboken_MICRO_VERSION}")
+
option(AVOID_PROTECTED_HACK "Avoid protected hack on generated bindings." FALSE)
option(BUILD_TESTS "Build tests." TRUE)
-option(ENABLE_VERSION_SUFFIX "Used to use current version in suffix to generated files. This is used to allow multiples versions installed simultaneous." FALSE)
if(MSVC)
set(CMAKE_CXX_FLAGS "/Zc:wchar_t- /GR /EHsc /DWIN32 /D_WINDOWS /D_SCL_SECURE_NO_WARNINGS")
@@ -35,6 +39,9 @@ else()
endif()
endif()
+set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
+set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is /lib${LIB_SUFFIX})" FORCE)
+
if (WIN32)
set(PATH_SEP "\;")
else()
@@ -48,45 +55,6 @@ else()
message(STATUS "Using protected hack!")
endif()
-set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
-set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is /lib${LIB_SUFFIX})" FORCE)
-
-set(shiboken_MAJOR_VERSION "0")
-set(shiboken_MINOR_VERSION "5")
-set(shiboken_MICRO_VERSION "1")
-set(shiboken_VERSION "${shiboken_MAJOR_VERSION}.${shiboken_MINOR_VERSION}.${shiboken_MICRO_VERSION}")
-if(ENABLE_VERSION_SUFFIX)
- set(shiboken_SUFFIX "-${shiboken_MAJOR_VERSION}.${shiboken_MINOR_VERSION}")
-else()
- set(shiboken_SUFFIX "")
-endif()
-
-set(shiboken_SRC
-cppgenerator.cpp
-headergenerator.cpp
-overloaddata.cpp
-shiboken.cpp
-shibokengenerator.cpp
-)
-
-include_directories(${CMAKE_CURRENT_SOURCE_DIR}
- ${APIEXTRACTOR_INCLUDE_DIR}
- ${GENERATORRUNNER_INCLUDE_DIR}
- ${QT_INCLUDE_DIR}
- ${QT_QTCORE_INCLUDE_DIR})
-
-add_library(shiboken_generator SHARED ${shiboken_SRC})
-set_property(TARGET shiboken_generator PROPERTY PREFIX "")
-
-target_link_libraries(shiboken_generator
- ${APIEXTRACTOR_LIBRARY}
- ${GENERATORRUNNER_LIBRARY}
- ${QT_QTCORE_LIBRARY})
-
-add_executable(shiboken main.cpp)
-set_target_properties(shiboken PROPERTIES OUTPUT_NAME shiboken${shiboken_SUFFIX})
-target_link_libraries(shiboken ${QT_QTCORE_LIBRARY})
-
# uninstall target
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
@@ -94,28 +62,6 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake"
add_custom_target(uninstall "${CMAKE_COMMAND}"
-P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
-# Detect if the python libs were compiled in debug mode
-execute_process(
- COMMAND ${PYTHON_EXECUTABLE} -c "from distutils import sysconfig; \\
- print sysconfig.get_config_var('Py_DEBUG')"
- OUTPUT_VARIABLE PY_DEBUG
- OUTPUT_STRIP_TRAILING_WHITESPACE)
-
-if(CMAKE_BUILD_TYPE STREQUAL "Debug")
- if(NOT PYTHON_DEBUG_LIBRARIES)
- message(FATAL_ERROR "Python debug library not found. Try compile shiboken with -DCMAKE_BUILD_TYPE=Release")
- endif()
- if(NOT PY_DEBUG)
- message(WARNING "Compiling shiboken with debug enabled, but the python executable was not compiled with debug support.")
- else()
- add_definitions("-DPy_DEBUG")
- endif()
- set(SBK_PYTHON_LIBRARIES ${PYTHON_DEBUG_LIBRARIES})
-else()
- set(SBK_PYTHON_LIBRARIES ${PYTHON_LIBRARIES})
- add_definitions("-DNDEBUG")
-endif()
-
if (BUILD_TESTS)
enable_testing()
endif()
@@ -123,8 +69,15 @@ endif()
add_subdirectory(libshiboken)
add_subdirectory(doc)
-if (BUILD_TESTS)
- add_subdirectory(tests)
+# deps found, compile the generator.
+if (QT4_FOUND AND ApiExtractor_FOUND AND GeneratorRunner_FOUND AND PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND)
+ add_subdirectory(generator)
+
+ if (BUILD_TESTS)
+ add_subdirectory(tests)
+ endif()
+else()
+ message("!! Some dependencies were not found, shiboken generator compilation disabled!")
endif()
add_subdirectory(data)
@@ -138,8 +91,4 @@ add_custom_target(dist
echo "Source package created at ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2.\n"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
-add_dependencies(shiboken shiboken_generator)
-
-install(TARGETS shiboken_generator DESTINATION "${GENERATORRUNNER_PLUGIN_DIR}")
-install(TARGETS shiboken DESTINATION bin)