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