krytarowski created this revision.
krytarowski added a reviewer: joerg.
krytarowski added a subscriber: lldb-commits.
krytarowski set the repository for this revision to rL LLVM.
Summary of the changes:
- add config.h (CMake and autotools target).
- Handle ncurses with a proper CMake find_package() call
- Handle ncurses panel library with proper find_library()
- Stop hardcoding broken '-lncurses -lpanel' entries
- Handle pkgsrc/NetBSD headers location (<ncurses/ncurses.h>)
Repository:
rL LLVM
http://reviews.llvm.org/D12994
Files:
CMakeLists.txt
cmake/LLDBDependencies.cmake
cmake/modules/LLDBConfig.cmake
include/lldb/Config/config.h.cmake
include/lldb/Config/config.h.in
source/Core/CMakeLists.txt
source/Core/IOHandler.cpp
Index: source/Core/IOHandler.cpp
===================================================================
--- source/Core/IOHandler.cpp
+++ source/Core/IOHandler.cpp
@@ -11,6 +11,7 @@
#include <string>
#include "lldb/Breakpoint/BreakpointLocation.h"
+#include "lldb/Config/config.h"
#include "lldb/Core/IOHandler.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Module.h"
@@ -29,8 +30,17 @@
#include "lldb/Target/ThreadPlan.h"
#ifndef LLDB_DISABLE_CURSES
+
+#if defined(HAVE_NCURSES_H)
#include <ncurses.h>
#include <panel.h>
+#elif defined(HAVE_NCURSES_NCURSES_H)
+#include <ncurses/ncurses.h>
+#include <ncurses/panel.h>
+#else
+#error No NCURSES header!
+#endif
+
#endif
using namespace lldb;
Index: source/Core/CMakeLists.txt
===================================================================
--- source/Core/CMakeLists.txt
+++ source/Core/CMakeLists.txt
@@ -74,3 +74,5 @@
VMRange.cpp
)
+include_directories(${CURSES_INCLUDE_DIR})
+target_link_libraries(lldbCore ${CURSES_LIBRARIES})
Index: include/lldb/Config/config.h.in
===================================================================
--- /dev/null
+++ include/lldb/Config/config.h.in
@@ -0,0 +1,14 @@
+/* This generated file is for internal use. Do not include it from headers. */
+
+#ifdef CONFIG_H
+#error config.h can only be included once
+#else
+#define CONFIG_H
+
+/* Define to 1 if you have the <ncurses.h> header file. */
+#undef HAVE_NCURSES_H
+
+/* Define to 1 if you have the <ncurses/ncurses.h> header file. */
+#undef HAVE_NCURSES_NCURSES_H
+
+#endif
Index: include/lldb/Config/config.h.cmake
===================================================================
--- /dev/null
+++ include/lldb/Config/config.h.cmake
@@ -0,0 +1,23 @@
+/* This generated file is for internal use. Do not include it from headers. */
+
+#ifdef CONFIG_H
+#error config.h can only be included once
+#else
+#define CONFIG_H
+
+/* Define to 1 if you have the <ncurses.h> header file. */
+#cmakedefine CURSES_HAVE_NCURSES_H
+
+/* Define to 1 if you have the <ncurses/ncurses.h> header file. */
+#cmakedefine CURSES_HAVE_NCURSES_NCURSES_H
+
+/* autotools compat */
+#ifdef CURSES_HAVE_NCURSES_H
+#define HAVE_NCURSES_H 1
+#endif
+
+#ifdef CURSES_HAVE_NCURSES_NCURSES_H
+#define HAVE_NCURSES_NCURSES_H 1
+#endif
+
+#endif // CONFIG_H
Index: cmake/modules/LLDBConfig.cmake
===================================================================
--- cmake/modules/LLDBConfig.cmake
+++ cmake/modules/LLDBConfig.cmake
@@ -190,7 +190,7 @@
find_library(DEBUG_SYMBOLS_LIBRARY DebugSymbols PATHS "/System/Library/PrivateFrameworks")
add_definitions( -DLIBXML2_DEFINED )
- list(APPEND system_libs xml2 ncurses panel)
+ list(APPEND system_libs xml2)
list(APPEND system_libs ${CARBON_LIBRARY} ${FOUNDATION_LIBRARY}
${CORE_FOUNDATION_LIBRARY} ${CORE_SERVICES_LIBRARY} ${SECURITY_LIBRARY}
${DEBUG_SYMBOLS_LIBRARY})
@@ -276,3 +276,17 @@
else()
set(LLDB_CAN_USE_DEBUGSERVER 0)
endif()
+
+if (NOT LLDB_DISABLE_CURSES)
+ set(CURSES_NEED_NCURSES TRUE)
+ find_package(Curses REQUIRED)
+
+ find_library(NCURSES_PANEL_LIBRARY NAMES panel DOC "The ncureses panel library")
+ if (CURSES_FOUND)
+ # Add panels to the library path
+ set (CURSES_LIBRARIES ${CURSES_LIBRARIES} ${NCURSES_PANEL_LIBRARY})
+ endif ()
+
+ list(APPEND system_libs ${CURSES_LIBRARIES})
+ include_directories(${CURSES_INCLUDE_DIR})
+endif ()
Index: cmake/LLDBDependencies.cmake
===================================================================
--- cmake/LLDBDependencies.cmake
+++ cmake/LLDBDependencies.cmake
@@ -141,7 +141,7 @@
list(APPEND LLDB_SYSTEM_LIBS edit)
endif()
if (NOT LLDB_DISABLE_CURSES)
- list(APPEND LLDB_SYSTEM_LIBS panel ncurses)
+ list(APPEND LLDB_SYSTEM_LIBS ${CURSES_LIBRARIES})
if(LLVM_ENABLE_TERMINFO AND HAVE_TERMINFO)
list(APPEND LLDB_SYSTEM_LIBS ${TERMINFO_LIBS})
endif()
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -15,6 +15,10 @@
add_subdirectory(unittests)
add_subdirectory(lit)
+configure_file(
+ ${LLDB_SOURCE_DIR}/include/lldb/Config/config.h.cmake
+ ${LLDB_BINARY_DIR}/include/lldb/Config/config.h)
+
if (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
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits