diff --git a/CMakeLists.txt b/CMakeLists.txt index a07ab440..6029cad2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -101,6 +101,7 @@ configure_file ( ${CMAKE_SOURCE_DIR}/cmake.h) add_subdirectory (src) +add_subdirectory (src/common) if (EXISTS ${CMAKE_SOURCE_DIR}/test) add_subdirectory (test EXCLUDE_FROM_ALL) endif (EXISTS ${CMAKE_SOURCE_DIR}/test) @@ -116,6 +117,7 @@ set (CPACK_SOURCE_GENERATOR "TGZ") set (CPACK_SOURCE_PACKAGE_FILE_NAME ${PACKAGE_NAME}-${PACKAGE_VERSION}) set (CPACK_SOURCE_IGNORE_FILES "CMakeCache" "CMakeFiles" "CPackConfig" "CPackSourceConfig" "_CPack_Packages" "cmake_install" "install_manifest" "Makefile$" - "test" "package-config" "misc/*" "src/timew$" "src/calc$" "performance" - "src/libtimew.a" "/\\\\.gitignore" "/\\\\.git/" "swp$" "src/lex$") + "test" "package-config" "misc/*" "src/timew$" "src/common/libcommon.a" + "performance" "src/libtimew.a" "/\\\\.gitignore" "/\\\\.git/" "swp$" + "src/lex$") include (CPack) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1795cf9c..540ff6e1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,17 +1,15 @@ cmake_minimum_required (VERSION 2.8) include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src + ${CMAKE_SOURCE_DIR}/common ${TIMEW_INCLUDE_DIRS}) -set (timew_SRCS Color.h Color.cpp - text.h text.cpp - utf8.h utf8.cpp - wcwidth6.cpp) +set (timew_SRCS LR0.cpp LR0.h) add_library (timew STATIC ${timew_SRCS}) add_executable (timew_executable main.cpp) -target_link_libraries (timew_executable timew ${TIMEW_LIBRARIES}) +target_link_libraries (timew_executable common timew ${TIMEW_LIBRARIES}) set_property (TARGET timew_executable PROPERTY OUTPUT_NAME "timew") diff --git a/src/common/.gitignore b/src/common/.gitignore new file mode 100644 index 00000000..41f2e534 --- /dev/null +++ b/src/common/.gitignore @@ -0,0 +1 @@ +libcommon.a diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt new file mode 100644 index 00000000..b2ca6485 --- /dev/null +++ b/src/common/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required (VERSION 2.8) +include_directories (${CMAKE_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/src + ${CMAKE_SOURCE_DIR}/src/common + ${TIMEW_INCLUDE_DIRS}) + +set (common_SRCS Color.cpp Color.h + text.cpp text.h + utf8.cpp utf8.h + wcwidth6.cpp) + +add_library (common STATIC ${common_SRCS}) + +#SET(CMAKE_BUILD_TYPE gcov) +#SET(CMAKE_CXX_FLAGS_GCOV "--coverage") +#SET(CMAKE_C_FLAGS_GCOV "--coverage") +#SET(CMAKE_EXE_LINKER_FLAGS_GCOV "--coverage") diff --git a/src/Color.cpp b/src/common/Color.cpp similarity index 100% rename from src/Color.cpp rename to src/common/Color.cpp diff --git a/src/Color.h b/src/common/Color.h similarity index 100% rename from src/Color.h rename to src/common/Color.h diff --git a/src/text.cpp b/src/common/text.cpp similarity index 100% rename from src/text.cpp rename to src/common/text.cpp diff --git a/src/text.h b/src/common/text.h similarity index 100% rename from src/text.h rename to src/common/text.h diff --git a/src/utf8.cpp b/src/common/utf8.cpp similarity index 100% rename from src/utf8.cpp rename to src/common/utf8.cpp diff --git a/src/utf8.h b/src/common/utf8.h similarity index 100% rename from src/utf8.h rename to src/common/utf8.h diff --git a/src/wcwidth6.cpp b/src/common/wcwidth6.cpp similarity index 100% rename from src/wcwidth6.cpp rename to src/common/wcwidth6.cpp diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 4c5e0a88..ec34c8ca 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -5,6 +5,7 @@ endif() include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src + ${CMAKE_SOURCE_DIR}/common ${CMAKE_SOURCE_DIR}/test ${TIMEW_INCLUDE_DIRS}) @@ -19,7 +20,7 @@ add_custom_target (build_tests DEPENDS ${test_SRCS} foreach (src_FILE ${test_SRCS}) add_executable (${src_FILE} "${src_FILE}.cpp" test.cpp) - target_link_libraries (${src_FILE} timew ${TIMEW_LIBRARIES}) + target_link_libraries (${src_FILE} timew common ${TIMEW_LIBRARIES}) endforeach (src_FILE) configure_file(run_all run_all COPYONLY)