[Lldb-commits] [lldb] r229569 - [CMake] Create a custom target for generating extension module.
Zachary Turner
zturner at google.com
Tue Feb 17 14:20:29 PST 2015
Author: zturner
Date: Tue Feb 17 16:20:29 2015
New Revision: 229569
URL: http://llvm.org/viewvc/llvm-project?rev=229569&view=rev
Log:
[CMake] Create a custom target for generating extension module.
Previously we would create the extension module as a post-build
step of creating liblldb. As part of this process, we created
symlinks and did other stuff.
This had several longstanding issues related to target
dependencies, such as not re-creating the symlink if liblldb.dll
failed to link, or if the build was Ctrl+C'ed from.
Then, the script that creates the symlinks began to grow to
include other things, such as argdumper, and it would try to
create symlinks before it had finished building the targets it
needed to symlink to.
This patches addresses all of these problems by creating an
explicit target for the script to run, and making it have a
dependency on all the targets it needs to create symlinks from/to.
Modified:
lldb/trunk/CMakeLists.txt
lldb/trunk/source/CMakeLists.txt
Modified: lldb/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=229569&r1=229568&r2=229569&view=diff
==============================================================================
--- lldb/trunk/CMakeLists.txt (original)
+++ lldb/trunk/CMakeLists.txt Tue Feb 17 16:20:29 2015
@@ -375,3 +375,13 @@ endif ()
add_subdirectory(source)
add_subdirectory(test)
add_subdirectory(tools)
+
+
+if ( LLDB_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION AND NOT LLDB_DISABLE_PYTHON )
+ # Add a Post-Build Event to copy over Python files and create the symlink to liblldb.so for the Python API(hardlink on Windows)
+ add_custom_target( finish_swig ALL
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py --buildConfig=${CMAKE_BUILD_TYPE} "--srcRoot=${LLDB_SOURCE_DIR}" "--targetDir=${CMAKE_CURRENT_BINARY_DIR}/scripts" "--cfgBldDir=${CMAKE_CURRENT_BINARY_DIR}/scripts" "--prefix=${CMAKE_BINARY_DIR}" "--cmakeBuildConfiguration=${CMAKE_CFG_INTDIR}" -m
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py
+ COMMENT "Python script sym-linking LLDB Python API")
+ add_dependencies(finish_swig liblldb argdumper)
+endif ()
Modified: lldb/trunk/source/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/CMakeLists.txt?rev=229569&r1=229568&r2=229569&view=diff
==============================================================================
--- lldb/trunk/source/CMakeLists.txt (original)
+++ lldb/trunk/source/CMakeLists.txt Tue Feb 17 16:20:29 2015
@@ -65,6 +65,7 @@ endif()
if (LLDB_WRAP_PYTHON OR LLDB_VERS_GENERATED_FILE)
add_dependencies(liblldb swig_wrapper)
+ message("Adding dependency on swig_wrapper")
endif()
target_link_libraries(liblldb ${cmake_2_8_12_PRIVATE} ${LLDB_SYSTEM_LIBS})
@@ -94,17 +95,6 @@ endif ()
# FIXME: implement svn/git revision and repository parsing solution on Windows. There is an SVN-only
# revision parsing solution in tools/clang/lib/Basic/CMakelists.txt.
-if ( LLDB_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION )
- # Add a Post-Build Event to copy over Python files and create the symlink to liblldb.so for the Python API(hardlink on Windows)
- if ( NOT LLDB_DISABLE_PYTHON )
- add_custom_command( TARGET liblldb
- POST_BUILD
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/finishSwigWrapperClasses.py
- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/finishSwigWrapperClasses.py --buildConfig=${CMAKE_BUILD_TYPE} "--srcRoot=${LLDB_SOURCE_DIR}" "--targetDir=${CMAKE_CURRENT_BINARY_DIR}/../scripts" "--cfgBldDir=${CMAKE_CURRENT_BINARY_DIR}/../scripts" "--prefix=${CMAKE_BINARY_DIR}" "--cmakeBuildConfiguration=${CMAKE_CFG_INTDIR}" -m
- COMMENT "Python script sym-linking LLDB Python API")
- endif ()
-endif ()
-
install(TARGETS liblldb
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
More information about the lldb-commits
mailing list