From ea230efc23510ed0e6bd8af64d94d6c6797256a4 Mon Sep 17 00:00:00 2001 From: Glen Whitney Date: Sat, 27 Jul 2019 01:35:44 -0400 Subject: [PATCH] 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. --- CMakeLists.txt | 59 ++---------------------------- config.h | 13 ------- src/CMakeLists.txt | 60 +++++++++++++++++++++++++++++++ src/common/CMakeLists.txt | 6 ++++ context.c => src/common/context.c | 0 context.h => src/common/context.h | 0 csv.c => src/common/csv.c | 0 csv.h => src/common/csv.h | 0 default.h => src/common/default.h | 0 eval.c => src/common/eval.c | 0 eval.h => src/common/eval.h | 0 func.c => src/common/func.c | 0 func.h => src/common/func.h | 0 htmlio.c => src/common/htmlio.c | 0 htmlio.h => src/common/htmlio.h | 0 latex.c => src/common/latex.c | 0 latex.h => src/common/latex.h | 0 main.c => src/common/main.c | 0 main.h => src/common/main.h | 0 misc.c => src/common/misc.c | 0 misc.h => src/common/misc.h | 0 parser.c => src/common/parser.c | 0 parser.h => src/common/parser.h | 0 sc.c => src/common/sc.c | 0 sc.h => src/common/sc.h | 0 scanner.c => src/common/scanner.c | 0 scanner.h => src/common/scanner.h | 0 sheet.c => src/common/sheet.c | 0 sheet.h => src/common/sheet.h | 0 utf8.c => src/common/utf8.c | 0 utf8.h => src/common/utf8.h | 0 wk1.c => src/common/wk1.c | 0 wk1.h => src/common/wk1.h | 0 xdr.c => src/common/xdr.c | 0 xdr.h => src/common/xdr.h | 0 complete.c => src/complete.c | 0 complete.h => src/complete.h | 0 display.c => src/display.c | 0 display.h => src/display.h | 0 fteapot.fl => src/fteapot.fl | 0 graph.c => src/graph.c | 0 41 files changed, 68 insertions(+), 70 deletions(-) delete mode 100644 config.h create mode 100644 src/CMakeLists.txt create mode 100644 src/common/CMakeLists.txt rename context.c => src/common/context.c (100%) rename context.h => src/common/context.h (100%) rename csv.c => src/common/csv.c (100%) rename csv.h => src/common/csv.h (100%) rename default.h => src/common/default.h (100%) rename eval.c => src/common/eval.c (100%) rename eval.h => src/common/eval.h (100%) rename func.c => src/common/func.c (100%) rename func.h => src/common/func.h (100%) rename htmlio.c => src/common/htmlio.c (100%) rename htmlio.h => src/common/htmlio.h (100%) rename latex.c => src/common/latex.c (100%) rename latex.h => src/common/latex.h (100%) rename main.c => src/common/main.c (100%) rename main.h => src/common/main.h (100%) rename misc.c => src/common/misc.c (100%) rename misc.h => src/common/misc.h (100%) rename parser.c => src/common/parser.c (100%) rename parser.h => src/common/parser.h (100%) rename sc.c => src/common/sc.c (100%) rename sc.h => src/common/sc.h (100%) rename scanner.c => src/common/scanner.c (100%) rename scanner.h => src/common/scanner.h (100%) rename sheet.c => src/common/sheet.c (100%) rename sheet.h => src/common/sheet.h (100%) rename utf8.c => src/common/utf8.c (100%) rename utf8.h => src/common/utf8.h (100%) rename wk1.c => src/common/wk1.c (100%) rename wk1.h => src/common/wk1.h (100%) rename xdr.c => src/common/xdr.c (100%) rename xdr.h => src/common/xdr.h (100%) rename complete.c => src/complete.c (100%) rename complete.h => src/complete.h (100%) rename display.c => src/display.c (100%) rename display.h => src/display.h (100%) rename fteapot.fl => src/fteapot.fl (100%) rename graph.c => src/graph.c (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8c34d87..f44e09f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,63 +9,8 @@ option(ENABLE_HELP "Enable built-in documentation" ON) option(ENABLE_UTF8 "Enable UTF-8 support" ON) 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) - -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 () +include_directories("${Teapot_BINARY_DIR}/") +add_subdirectory(src) if (ENABLE_HELP) add_custom_command( diff --git a/config.h b/config.h deleted file mode 100644 index 2a4e34f..0000000 --- a/config.h +++ /dev/null @@ -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 */ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..a4441e9 --- /dev/null +++ b/src/CMakeLists.txt @@ -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 () diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt new file mode 100644 index 0000000..092b5af --- /dev/null +++ b/src/common/CMakeLists.txt @@ -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) diff --git a/context.c b/src/common/context.c similarity index 100% rename from context.c rename to src/common/context.c diff --git a/context.h b/src/common/context.h similarity index 100% rename from context.h rename to src/common/context.h diff --git a/csv.c b/src/common/csv.c similarity index 100% rename from csv.c rename to src/common/csv.c diff --git a/csv.h b/src/common/csv.h similarity index 100% rename from csv.h rename to src/common/csv.h diff --git a/default.h b/src/common/default.h similarity index 100% rename from default.h rename to src/common/default.h diff --git a/eval.c b/src/common/eval.c similarity index 100% rename from eval.c rename to src/common/eval.c diff --git a/eval.h b/src/common/eval.h similarity index 100% rename from eval.h rename to src/common/eval.h diff --git a/func.c b/src/common/func.c similarity index 100% rename from func.c rename to src/common/func.c diff --git a/func.h b/src/common/func.h similarity index 100% rename from func.h rename to src/common/func.h diff --git a/htmlio.c b/src/common/htmlio.c similarity index 100% rename from htmlio.c rename to src/common/htmlio.c diff --git a/htmlio.h b/src/common/htmlio.h similarity index 100% rename from htmlio.h rename to src/common/htmlio.h diff --git a/latex.c b/src/common/latex.c similarity index 100% rename from latex.c rename to src/common/latex.c diff --git a/latex.h b/src/common/latex.h similarity index 100% rename from latex.h rename to src/common/latex.h diff --git a/main.c b/src/common/main.c similarity index 100% rename from main.c rename to src/common/main.c diff --git a/main.h b/src/common/main.h similarity index 100% rename from main.h rename to src/common/main.h diff --git a/misc.c b/src/common/misc.c similarity index 100% rename from misc.c rename to src/common/misc.c diff --git a/misc.h b/src/common/misc.h similarity index 100% rename from misc.h rename to src/common/misc.h diff --git a/parser.c b/src/common/parser.c similarity index 100% rename from parser.c rename to src/common/parser.c diff --git a/parser.h b/src/common/parser.h similarity index 100% rename from parser.h rename to src/common/parser.h diff --git a/sc.c b/src/common/sc.c similarity index 100% rename from sc.c rename to src/common/sc.c diff --git a/sc.h b/src/common/sc.h similarity index 100% rename from sc.h rename to src/common/sc.h diff --git a/scanner.c b/src/common/scanner.c similarity index 100% rename from scanner.c rename to src/common/scanner.c diff --git a/scanner.h b/src/common/scanner.h similarity index 100% rename from scanner.h rename to src/common/scanner.h diff --git a/sheet.c b/src/common/sheet.c similarity index 100% rename from sheet.c rename to src/common/sheet.c diff --git a/sheet.h b/src/common/sheet.h similarity index 100% rename from sheet.h rename to src/common/sheet.h diff --git a/utf8.c b/src/common/utf8.c similarity index 100% rename from utf8.c rename to src/common/utf8.c diff --git a/utf8.h b/src/common/utf8.h similarity index 100% rename from utf8.h rename to src/common/utf8.h diff --git a/wk1.c b/src/common/wk1.c similarity index 100% rename from wk1.c rename to src/common/wk1.c diff --git a/wk1.h b/src/common/wk1.h similarity index 100% rename from wk1.h rename to src/common/wk1.h diff --git a/xdr.c b/src/common/xdr.c similarity index 100% rename from xdr.c rename to src/common/xdr.c diff --git a/xdr.h b/src/common/xdr.h similarity index 100% rename from xdr.h rename to src/common/xdr.h diff --git a/complete.c b/src/complete.c similarity index 100% rename from complete.c rename to src/complete.c diff --git a/complete.h b/src/complete.h similarity index 100% rename from complete.h rename to src/complete.h diff --git a/display.c b/src/display.c similarity index 100% rename from display.c rename to src/display.c diff --git a/display.h b/src/display.h similarity index 100% rename from display.h rename to src/display.h diff --git a/fteapot.fl b/src/fteapot.fl similarity index 100% rename from fteapot.fl rename to src/fteapot.fl diff --git a/graph.c b/src/graph.c similarity index 100% rename from graph.c rename to src/graph.c