Move source code into subdirectory

Also removed a stray copy of the automatically generated config.h which
  had somehow gotten into the distribution. Closes #36.
This commit is contained in:
Glen Whitney 2019-07-27 01:35:44 -04:00
parent 255bd86bf5
commit ea230efc23
41 changed files with 68 additions and 70 deletions

View File

@ -9,63 +9,8 @@ option(ENABLE_HELP "Enable built-in documentation" ON)
option(ENABLE_UTF8 "Enable UTF-8 support" ON) option(ENABLE_UTF8 "Enable UTF-8 support" ON)
option(ENABLE_STATIC "Link FLTK statically" OFF) option(ENABLE_STATIC "Link FLTK statically" OFF)
add_library(teapotlib context.c csv.c eval.c func.c htmlio.c latex.c main.c misc.c parser.c sc.c scanner.c sheet.c utf8.c wk1.c xdr.c) include_directories("${Teapot_BINARY_DIR}/")
add_subdirectory(src)
find_library(LIB_PORTABLEXDR portablexdr)
if (NOT LIB_PORTABLEXDR)
find_library(LIB_TIRPC tirpc)
if (LIB_TIRPC)
set(LIB_PORTABLEXDR ${LIB_TIRPC})
else ()
set(LIB_PORTABLEXDR "")
endif ()
endif ()
find_package(Curses)
if (CURSES_FOUND AND ENABLE_UTF8)
find_library(LIB_CURSESW ncursesw)
if (NOT LIB_CURSESW)
find_library(LIB_CURSESW ncursesw5)
endif ()
if (LIB_CURSESW)
set(teapot_DEB_DEPENDS ", libncursesw5 (>= 5.6+20071006-3)")
set(CURSES_CURSES_LIBRARY ${LIB_CURSESW})
else ()
set(ENABLE_UTF8 OFF)
set(teapot_DEB_DEPENDS ", libncurses5 (>= 5.6+20071006-3)")
endif ()
elseif (CURSES_FOUND)
set(teapot_DEB_DEPENDS ", libncurses5 (>= 5.6+20071006-3)")
endif ()
if (CURSES_FOUND)
include_directories("${CURSES_INCLUDE_DIR}")
add_executable(teapot display.c complete.c)
target_link_libraries(teapot teapotlib m ${CURSES_CURSES_LIBRARY} ${LIB_PORTABLEXDR})
install(TARGETS teapot DESTINATION bin)
endif ()
find_package(FLTK)
if (FLTK_FOUND)
fltk_wrap_ui(fteapot fteapot.fl)
add_executable(fteapot WIN32 ${fteapot_FLTK_UI_SRCS})
set(fteapot_DEB_DEPENDS ", libstdc++6 (>= 4.1.1), libfltk1.3")
if (ENABLE_HELP)
set(fteapot_DEB_DEPENDS "${fteapot_DEB_DEPENDS}, libfltk-images1.3")
if (ENABLE_STATIC)
target_link_libraries(fteapot teapotlib fltk fltk_images ${LIB_PORTABLEXDR})
else ()
target_link_libraries(fteapot teapotlib fltk fltk_images ${LIB_PORTABLEXDR})
endif ()
else ()
if (ENABLE_STATIC)
target_link_libraries(fteapot teapotlib fltk fltk_images ${LIB_PORTABLEXDR})
else ()
target_link_libraries(fteapot teapotlib fltk ${LIB_PORTABLEXDR})
endif ()
endif ()
install(TARGETS fteapot DESTINATION bin)
endif ()
if (ENABLE_HELP) if (ENABLE_HELP)
add_custom_command( add_custom_command(

View File

@ -1,13 +0,0 @@
/* configuration values */
#define VERSION "2.2.1"
#define HELPFILE "/usr/local/share/doc/teapot/html/index.html"
#define ENABLE_HELP
#define ENABLE_UTF8
#define CURSES_HAVE_CURSES_H
/* #undef CURSES_HAVE_NCURSES_H */
/* #undef CURSES_HAVE_NCURSES_NCURSES_H */
/* #undef CURSES_HAVE_NCURSES_CURSES_H */

60
src/CMakeLists.txt Normal file
View File

@ -0,0 +1,60 @@
add_subdirectory(common)
include_directories("${Teapot_SOURCE_DIR}/src")
include_directories("${Teapot_SOURCE_DIR}/src/common")
find_library(LIB_PORTABLEXDR portablexdr)
if (NOT LIB_PORTABLEXDR)
find_library(LIB_TIRPC tirpc)
if (LIB_TIRPC)
set(LIB_PORTABLEXDR ${LIB_TIRPC})
else ()
set(LIB_PORTABLEXDR "")
endif ()
endif ()
find_package(Curses)
if (CURSES_FOUND AND ENABLE_UTF8)
find_library(LIB_CURSESW ncursesw)
if (NOT LIB_CURSESW)
find_library(LIB_CURSESW ncursesw5)
endif ()
if (LIB_CURSESW)
set(teapot_DEB_DEPENDS ", libncursesw5 (>= 5.6+20071006-3)")
set(CURSES_CURSES_LIBRARY ${LIB_CURSESW})
else ()
set(ENABLE_UTF8 OFF)
set(teapot_DEB_DEPENDS ", libncurses5 (>= 5.6+20071006-3)")
endif ()
elseif (CURSES_FOUND)
set(teapot_DEB_DEPENDS ", libncurses5 (>= 5.6+20071006-3)")
endif ()
if (CURSES_FOUND)
include_directories("${CURSES_INCLUDE_DIR}")
add_executable(teapot display.c complete.c)
target_link_libraries(teapot teapotlib m ${CURSES_CURSES_LIBRARY} ${LIB_PORTABLEXDR})
install(TARGETS teapot DESTINATION bin)
endif ()
find_package(FLTK)
if (FLTK_FOUND)
fltk_wrap_ui(fteapot fteapot.fl)
add_executable(fteapot WIN32 ${fteapot_FLTK_UI_SRCS})
set(fteapot_DEB_DEPENDS ", libstdc++6 (>= 4.1.1), libfltk1.3")
if (ENABLE_HELP)
set(fteapot_DEB_DEPENDS "${fteapot_DEB_DEPENDS}, libfltk-images1.3")
if (ENABLE_STATIC)
target_link_libraries(fteapot teapotlib fltk fltk_images ${LIB_PORTABLEXDR})
else ()
target_link_libraries(fteapot teapotlib fltk fltk_images ${LIB_PORTABLEXDR})
endif ()
else ()
if (ENABLE_STATIC)
target_link_libraries(fteapot teapotlib fltk fltk_images ${LIB_PORTABLEXDR})
else ()
target_link_libraries(fteapot teapotlib fltk ${LIB_PORTABLEXDR})
endif ()
endif ()
install(TARGETS fteapot DESTINATION bin)
endif ()

View File

@ -0,0 +1,6 @@
include_directories("${Teapot_SOURCE_DIR}/src")
include_directories("${Teapot_SOURCE_DIR}/src/common")
link_directories("${Teapot_SOURCE_DIR}/src/common")
add_library(teapotlib context.c csv.c eval.c func.c htmlio.c latex.c main.c misc.c parser.c sc.c scanner.c sheet.c utf8.c wk1.c xdr.c)