diff options
| author | Petr Mrázek | 2011-05-21 20:32:53 +0200 |
|---|---|---|
| committer | Petr Mrázek | 2011-05-21 20:32:53 +0200 |
| commit | bb99924b24fdb2d3256095251294e226ce8f7180 (patch) | |
| tree | 709e522ef282cab04b2b6c6cbb2809eb98ac646a /CMakeLists.txt | |
| parent | 909cd8b60babbbe5fdeccf92b85ac62feae8d7fb (diff) | |
| download | dfhack-bb99924b24fdb2d3256095251294e226ce8f7180.tar.gz dfhack-bb99924b24fdb2d3256095251294e226ce8f7180.tar.bz2 dfhack-bb99924b24fdb2d3256095251294e226ce8f7180.tar.xz | |
Curses support across platforms!
Diffstat (limited to 'CMakeLists.txt')
| -rw-r--r-- | CMakeLists.txt | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 6b8e7ab2..d676741d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,6 +51,7 @@ IF(WIN32) ELSE() set (DFHACK_INST_DEFAULT "linux") ENDIF() + SET( DFHACK_INSTALL ${DFHACK_INST_DEFAULT} CACHE STRING "Choose the install type: 'portable' for a portable zip or tar.gz package (windows default) @@ -150,6 +151,26 @@ include_directories (${dfhack_SOURCE_DIR}/library/shm/) include_directories (${dfhack_SOURCE_DIR}/library/depends/argstream/) include_directories (${dfhack_SOURCE_DIR}/library/depends/xgetopt/) +# handle curses library bull**** on multiple platforms. +IF(UNIX) + find_package(Curses QUIET) + if(Curses_FOUND) + add_library(curses SHARED IMPORTED) + set_property(TARGET curses PROPERTY IMPORTED_LOCATION ${Curses_LIBRARY}) + include_directories (${Curses_INCLUDE_PATH}) + endif() +ELSE() + add_library(curses SHARED IMPORTED) + set_property(TARGET curses PROPERTY IMPORTED_LOCATION ${dfhack_SOURCE_DIR}/pdcurses/pdcurses.dll) + set_property(TARGET curses PROPERTY IMPORTED_IMPLIB ${dfhack_SOURCE_DIR}/pdcurses/pdcurses.lib) + include_directories (${dfhack_SOURCE_DIR}/pdcurses) + add_custom_target( curses-copy + COMMAND "${CMAKE_COMMAND}" -E copy "${dfhack_SOURCE_DIR}/pdcurses/pdcurses.dll" ${dfhack_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/ + DEPENDS "${dfhack_SOURCE_DIR}/pdcurses/pdcurses.dll") + SET(Curses_FOUND TRUE) + INSTALL(FILES "${dfhack_SOURCE_DIR}/pdcurses/pdcurses.dll" DESTINATION ${DFHACK_BINARY_DESTINATION}) +ENDIF() + # macro to save on typing in the tool subdirs # builds a tool, links it to the dfhack lib and makes sure the dependency # LOCAL_DEPNAME is built first, in case there is one @@ -164,6 +185,26 @@ MACRO(DFHACK_TOOL TOOL_NAME TOOL_SOURCES) RUNTIME DESTINATION ${DFHACK_BINARY_DESTINATION}) ENDMACRO() +# same as above builds a curses tool instead of plain terminal one. +MACRO(DFHACK_CURSES_TOOL TOOL_NAME TOOL_SOURCES) + IF(Curses_FOUND) + ADD_EXECUTABLE(${TOOL_NAME} ${TOOL_SOURCES}) + TARGET_LINK_LIBRARIES(${TOOL_NAME} dfhack curses) + if(DEFINED LOCAL_DEPNAME) + ADD_DEPENDENCIES(${TOOL_NAME} ${LOCAL_DEPNAME}) + endif() + if(WIN32) + ADD_DEPENDENCIES(${TOOL_NAME} curses-copy) + ENDIF() + install(TARGETS + ${TOOL_NAME} + RUNTIME DESTINATION ${DFHACK_BINARY_DESTINATION}) + ELSE() + MESSAGE(STATUS "Wide-character ncurses library not found - " ${TOOL_NAME} "can't be built") + ENDIF() +ENDMACRO() + + IF(BUILD_DFHACK_LIBRARY) add_subdirectory (library) |
