Commit b973ea80 authored by Kohei Yoshida's avatar Kohei Yoshida

Split CMakeLists.txt one per directory.

parent 90a52b77
Pipeline #45194229 passed with stage
in 3 minutes and 56 seconds
......@@ -17,6 +17,8 @@ find_package(Boost COMPONENTS program_options filesystem)
find_package(Threads)
find_package(Python3)
include(GNUInstallDirs)
enable_testing()
set(CMAKE_CTEST_COMMAND ctest -V)
......@@ -42,150 +44,7 @@ include_directories(
link_directories(${Boost_LIBRARY_DIRS})
set(LIBIXION_SRC_DIR ${PROJECT_SOURCE_DIR}/src/libixion)
add_library(libixion SHARED
${LIBIXION_SRC_DIR}/address.cpp
${LIBIXION_SRC_DIR}/address_iterator.cpp
${LIBIXION_SRC_DIR}/calc_status.cpp
${LIBIXION_SRC_DIR}/cell.cpp
${LIBIXION_SRC_DIR}/cell_queue_manager.cpp
${LIBIXION_SRC_DIR}/compute_engine.cpp
${LIBIXION_SRC_DIR}/compute_engine_cuda.cpp
${LIBIXION_SRC_DIR}/concrete_formula_tokens.cpp
${LIBIXION_SRC_DIR}/config.cpp
${LIBIXION_SRC_DIR}/dirty_cell_tracker.cpp
${LIBIXION_SRC_DIR}/exceptions.cpp
${LIBIXION_SRC_DIR}/formula.cpp
${LIBIXION_SRC_DIR}/formula_calc.cpp
${LIBIXION_SRC_DIR}/formula_functions.cpp
${LIBIXION_SRC_DIR}/formula_function_opcode.cpp
${LIBIXION_SRC_DIR}/formula_interpreter.cpp
${LIBIXION_SRC_DIR}/formula_lexer.cpp
${LIBIXION_SRC_DIR}/formula_name_resolver.cpp
${LIBIXION_SRC_DIR}/formula_parser.cpp
${LIBIXION_SRC_DIR}/formula_result.cpp
${LIBIXION_SRC_DIR}/formula_tokens.cpp
${LIBIXION_SRC_DIR}/formula_value_stack.cpp
${LIBIXION_SRC_DIR}/global.cpp
${LIBIXION_SRC_DIR}/grouped_ranges.cpp
${LIBIXION_SRC_DIR}/info.cpp
${LIBIXION_SRC_DIR}/interface.cpp
${LIBIXION_SRC_DIR}/lexer_tokens.cpp
${LIBIXION_SRC_DIR}/matrix.cpp
${LIBIXION_SRC_DIR}/mem_str_buf.cpp
${LIBIXION_SRC_DIR}/model_context.cpp
${LIBIXION_SRC_DIR}/model_iterator.cpp
${LIBIXION_SRC_DIR}/module.cpp
${LIBIXION_SRC_DIR}/queue_entry.cpp
${LIBIXION_SRC_DIR}/table.cpp
${LIBIXION_SRC_DIR}/types.cpp
${LIBIXION_SRC_DIR}/workbook.cpp
)
add_executable(ixion-parser
${PROJECT_SOURCE_DIR}/src/ixion_parser.cpp
${PROJECT_SOURCE_DIR}/src/model_parser.cpp
${PROJECT_SOURCE_DIR}/src/session_handler.cpp
${PROJECT_SOURCE_DIR}/src/table_handler.cpp
)
add_executable(ixion-sorter
${PROJECT_SOURCE_DIR}/src/ixion_sorter.cpp
${PROJECT_SOURCE_DIR}/src/sort_input_parser.cpp
)
add_executable(ixion-formula-tokenizer
${PROJECT_SOURCE_DIR}/src/ixion_formula_tokenizer.cpp
)
add_custom_target(
py_gen_files
COMMAND ${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/bin/gen-files.py
--properties
IXION_MAJOR_VERSION=${IXION_MAJOR_VERSION}
IXION_MINOR_VERSION=${IXION_MINOR_VERSION}
IXION_MICRO_VERSION=${IXION_MICRO_VERSION}
IXION_MAJOR_API_VERSION=${IXION_MAJOR_API_VERSION}
IXION_MINOR_API_VERSION=${IXION_MINOR_API_VERSION}
--files
${LIBIXION_SRC_DIR}/constants.inl
)
add_dependencies(libixion py_gen_files)
target_compile_definitions(libixion PRIVATE IXION_BUILD DLL_EXPORT)
target_link_libraries(ixion-parser libixion)
target_link_libraries(ixion-sorter libixion)
target_link_libraries(ixion-formula-tokenizer libixion)
install(DIRECTORY
${PROJECT_SOURCE_DIR}/include/ixion
DESTINATION include/ixion-${IXION_API_VERSION}
FILES_MATCHING PATTERN "*.hpp"
)
install(TARGETS libixion ixion-parser ixion-sorter ixion-formula-tokenizer
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
# test programs
add_executable(ixion-test EXCLUDE_FROM_ALL
${LIBIXION_SRC_DIR}/ixion_test.cpp
)
add_executable(ixion-test-track-deps EXCLUDE_FROM_ALL
${LIBIXION_SRC_DIR}/ixion_test_track_deps.cpp
)
add_executable(dirty-cell-tracker-test EXCLUDE_FROM_ALL
${LIBIXION_SRC_DIR}/dirty_cell_tracker_test.cpp
)
add_executable(compute-engine-test EXCLUDE_FROM_ALL
${LIBIXION_SRC_DIR}/compute_engine_test.cpp
)
file(GLOB PARSER_TEST_FILES ${PROJECT_SOURCE_DIR}/test/*.txt)
foreach(_I RANGE 8)
set(_IS "${_I}")
add_custom_target(parser-test-t${_IS} COMMAND ixion-parser -t ${_I} ${PARSER_TEST_FILES} DEPENDS ixion-parser)
endforeach()
foreach(_I RANGE 7)
set(_IS "${_I}")
math(EXPR _INEXT "${_I}+1")
add_dependencies(parser-test-t${_INEXT} parser-test-t${_IS})
endforeach()
target_link_libraries(ixion-test libixion)
target_link_libraries(ixion-test-track-deps libixion)
target_link_libraries(dirty-cell-tracker-test libixion)
target_link_libraries(compute-engine-test libixion)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})
add_dependencies(check
ixion-test
ixion-test-track-deps
dirty-cell-tracker-test
compute-engine-test
parser-test-t0
parser-test-t1
parser-test-t2
parser-test-t3
parser-test-t4
parser-test-t5
parser-test-t6
parser-test-t7
parser-test-t8
)
add_test(ixion-test ixion-test)
add_test(ixion-test-track-deps ixion-test-track-deps)
add_test(dirty-cell-tracker-test dirty-cell-tracker-test)
add_test(compute-engine-test compute-engine-test)
add_subdirectory(include)
add_subdirectory(src)
add_subdirectory(ixion)
add_subdirectory(interface)
file(GLOB _HEADERS *.hpp)
install(FILES ${_HEADERS}
DESTINATION include/ixion-${IXION_API_VERSION}
)
file(GLOB _HEADERS *.hpp)
install(FILES ${_HEADERS}
DESTINATION include/ixion-${IXION_API_VERSION}/interface
)
add_subdirectory(libixion)
add_executable(ixion-parser
ixion_parser.cpp
model_parser.cpp
session_handler.cpp
table_handler.cpp
)
add_executable(ixion-sorter
ixion_sorter.cpp
sort_input_parser.cpp
)
add_executable(ixion-formula-tokenizer
ixion_formula_tokenizer.cpp
)
target_link_libraries(ixion-parser libixion)
target_link_libraries(ixion-sorter libixion)
target_link_libraries(ixion-formula-tokenizer libixion)
add_custom_command(TARGET ixion-parser POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:libixion>
$<TARGET_FILE_DIR:ixion-parser>
)
# test programs
file(GLOB PARSER_TEST_FILES ${PROJECT_SOURCE_DIR}/test/*.txt)
foreach(_I RANGE 8)
set(_IS "${_I}")
add_custom_target(parser-test-t${_IS} COMMAND $<TARGET_FILE:ixion-parser> -t ${_I} ${PARSER_TEST_FILES} DEPENDS ixion-parser)
endforeach()
foreach(_I RANGE 7)
set(_IS "${_I}")
math(EXPR _INEXT "${_I}+1")
add_dependencies(parser-test-t${_INEXT} parser-test-t${_IS})
endforeach()
add_dependencies(check
parser-test-t0
parser-test-t1
parser-test-t2
parser-test-t3
parser-test-t4
parser-test-t5
parser-test-t6
parser-test-t7
parser-test-t8
)
install(TARGETS ixion-parser ixion-sorter ixion-formula-tokenizer
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
add_library(libixion SHARED
address.cpp
address_iterator.cpp
calc_status.cpp
cell.cpp
cell_queue_manager.cpp
compute_engine.cpp
compute_engine_cuda.cpp
concrete_formula_tokens.cpp
config.cpp
dirty_cell_tracker.cpp
exceptions.cpp
formula.cpp
formula_calc.cpp
formula_functions.cpp
formula_function_opcode.cpp
formula_interpreter.cpp
formula_lexer.cpp
formula_name_resolver.cpp
formula_parser.cpp
formula_result.cpp
formula_tokens.cpp
formula_value_stack.cpp
global.cpp
info.cpp
interface.cpp
lexer_tokens.cpp
matrix.cpp
mem_str_buf.cpp
model_context.cpp
model_iterator.cpp
module.cpp
queue_entry.cpp
table.cpp
types.cpp
workbook.cpp
)
add_custom_target(
py_gen_files
COMMAND ${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/bin/gen-files.py
--properties
IXION_MAJOR_VERSION=${IXION_MAJOR_VERSION}
IXION_MINOR_VERSION=${IXION_MINOR_VERSION}
IXION_MICRO_VERSION=${IXION_MICRO_VERSION}
IXION_MAJOR_API_VERSION=${IXION_MAJOR_API_VERSION}
IXION_MINOR_API_VERSION=${IXION_MINOR_API_VERSION}
--files
${CMAKE_CURRENT_SOURCE_DIR}/constants.inl
)
add_dependencies(libixion py_gen_files)
target_compile_definitions(libixion PRIVATE IXION_BUILD DLL_EXPORT)
install(TARGETS libixion
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
# test programs
add_executable(ixion-test EXCLUDE_FROM_ALL
ixion_test.cpp
)
add_executable(ixion-test-track-deps EXCLUDE_FROM_ALL
ixion_test_track_deps.cpp
)
add_executable(dirty-cell-tracker-test EXCLUDE_FROM_ALL
dirty_cell_tracker_test.cpp
)
add_executable(compute-engine-test EXCLUDE_FROM_ALL
compute_engine_test.cpp
)
target_link_libraries(ixion-test libixion)
target_link_libraries(ixion-test-track-deps libixion)
target_link_libraries(dirty-cell-tracker-test libixion)
target_link_libraries(compute-engine-test libixion)
add_dependencies(check
ixion-test
ixion-test-track-deps
dirty-cell-tracker-test
compute-engine-test
)
add_test(ixion-test ixion-test)
add_test(ixion-test-track-deps ixion-test-track-deps)
add_test(dirty-cell-tracker-test dirty-cell-tracker-test)
add_test(compute-engine-test compute-engine-test)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment