summaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--CMakeLists.txt95
-rw-r--r--generator/cppgenerator.cpp (renamed from cppgenerator.cpp)0
-rw-r--r--generator/cppgenerator.h (renamed from cppgenerator.h)0
-rw-r--r--generator/headergenerator.cpp (renamed from headergenerator.cpp)0
-rw-r--r--generator/headergenerator.h (renamed from headergenerator.h)0
-rw-r--r--generator/main.cpp (renamed from main.cpp)0
-rw-r--r--generator/overloaddata.cpp (renamed from overloaddata.cpp)0
-rw-r--r--generator/overloaddata.h (renamed from overloaddata.h)0
-rw-r--r--generator/shiboken.cpp (renamed from shiboken.cpp)0
-rw-r--r--generator/shibokengenerator.cpp (renamed from shibokengenerator.cpp)0
-rw-r--r--generator/shibokengenerator.h (renamed from shibokengenerator.h)0
-rw-r--r--libshiboken/CMakeLists.txt8
-rw-r--r--tests/CMakeLists.txt23
-rw-r--r--tests/otherbinding/CMakeLists.txt2
-rw-r--r--tests/samplebinding/CMakeLists.txt2
15 files changed, 55 insertions, 75 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)
diff --git a/cppgenerator.cpp b/generator/cppgenerator.cpp
index 2df2bae9..2df2bae9 100644
--- a/cppgenerator.cpp
+++ b/generator/cppgenerator.cpp
diff --git a/cppgenerator.h b/generator/cppgenerator.h
index b4d68dc4..b4d68dc4 100644
--- a/cppgenerator.h
+++ b/generator/cppgenerator.h
diff --git a/headergenerator.cpp b/generator/headergenerator.cpp
index 2e060f42..2e060f42 100644
--- a/headergenerator.cpp
+++ b/generator/headergenerator.cpp
diff --git a/headergenerator.h b/generator/headergenerator.h
index 9802a104..9802a104 100644
--- a/headergenerator.h
+++ b/generator/headergenerator.h
diff --git a/main.cpp b/generator/main.cpp
index 05122506..05122506 100644
--- a/main.cpp
+++ b/generator/main.cpp
diff --git a/overloaddata.cpp b/generator/overloaddata.cpp
index a71091ea..a71091ea 100644
--- a/overloaddata.cpp
+++ b/generator/overloaddata.cpp
diff --git a/overloaddata.h b/generator/overloaddata.h
index a0bd4640..a0bd4640 100644
--- a/overloaddata.h
+++ b/generator/overloaddata.h
diff --git a/shiboken.cpp b/generator/shiboken.cpp
index 005df90e..005df90e 100644
--- a/shiboken.cpp
+++ b/generator/shiboken.cpp
diff --git a/shibokengenerator.cpp b/generator/shibokengenerator.cpp
index e7d0b7de..e7d0b7de 100644
--- a/shibokengenerator.cpp
+++ b/generator/shibokengenerator.cpp
diff --git a/shibokengenerator.h b/generator/shibokengenerator.h
index 1a7c5a63..1a7c5a63 100644
--- a/shibokengenerator.h
+++ b/generator/shibokengenerator.h
diff --git a/libshiboken/CMakeLists.txt b/libshiboken/CMakeLists.txt
index bfd160b1..f21681f5 100644
--- a/libshiboken/CMakeLists.txt
+++ b/libshiboken/CMakeLists.txt
@@ -1,4 +1,12 @@
project(libshiboken)
+
+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(ENABLE_VERSION_SUFFIX)
+ set(shiboken_SUFFIX "-${shiboken_MAJOR_VERSION}.${shiboken_MINOR_VERSION}")
+else()
+ set(shiboken_SUFFIX "")
+endif()
+
#Find installed sparsehash
find_path(SPARSEHASH_INCLUDE_PATH sparseconfig.h PATH_SUFFIXES "/google/sparsehash")
if(SPARSEHASH_INCLUDE_PATH)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index dc5e52d4..48d9de48 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -1,5 +1,28 @@
add_subdirectory(libsample)
add_subdirectory(libother)
+
+# 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()
+
add_subdirectory(samplebinding)
add_subdirectory(otherbinding)
diff --git a/tests/otherbinding/CMakeLists.txt b/tests/otherbinding/CMakeLists.txt
index 25294bf7..3a16dd67 100644
--- a/tests/otherbinding/CMakeLists.txt
+++ b/tests/otherbinding/CMakeLists.txt
@@ -14,7 +14,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/other/other_module_wrapper.cpp
)
add_custom_command(OUTPUT ${other_SRC}
-COMMAND ${GENERATORRUNNER_BINARY} --generatorSet=${shiboken_BINARY_DIR}/shiboken_generator${CMAKE_RELEASE_POSTFIX}${CMAKE_DEBUG_POSTFIX} --enable-parent-ctor-heuristic
+COMMAND ${GENERATORRUNNER_BINARY} --generatorSet=${generators_BINARY_DIR}/shiboken_generator${CMAKE_RELEASE_POSTFIX}${CMAKE_DEBUG_POSTFIX} --enable-parent-ctor-heuristic
${CMAKE_CURRENT_SOURCE_DIR}/global.h
--include-paths=${libother_SOURCE_DIR}${PATH_SEP}${libsample_SOURCE_DIR}${PATH_SEP}${libsample_SOURCE_DIR}/..
--typesystem-paths=${CMAKE_CURRENT_SOURCE_DIR}${PATH_SEP}${sample_SOURCE_DIR}
diff --git a/tests/samplebinding/CMakeLists.txt b/tests/samplebinding/CMakeLists.txt
index 3536ce39..2de6deea 100644
--- a/tests/samplebinding/CMakeLists.txt
+++ b/tests/samplebinding/CMakeLists.txt
@@ -77,7 +77,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/sample/valueandvirtual_wrapper.cpp
)
add_custom_command(OUTPUT ${sample_SRC}
-COMMAND ${GENERATORRUNNER_BINARY} --generatorSet=${shiboken_BINARY_DIR}/shiboken_generator${CMAKE_RELEASE_POSTFIX}${CMAKE_DEBUG_POSTFIX} --enable-parent-ctor-heuristic
+COMMAND ${GENERATORRUNNER_BINARY} --generatorSet=${generators_BINARY_DIR}/shiboken_generator${CMAKE_RELEASE_POSTFIX}${CMAKE_DEBUG_POSTFIX} --enable-parent-ctor-heuristic
${CMAKE_CURRENT_SOURCE_DIR}/global.h
--include-paths=${libsample_SOURCE_DIR}
--typesystem-paths=${CMAKE_CURRENT_SOURCE_DIR}