solstice

Compute collected power and efficiencies of a solar plant
git clone git://git.meso-star.com/solstice.git
Log | Files | Refs | README | LICENSE

commit 21030407605729e631ba59573c5cf660631dd09c
parent fa7f0c45ff4dc4b8219b91a4f97b744164aa54c0
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Wed,  9 Nov 2016 17:32:46 +0100

Refactor the project building strategy

Build the solstice code as a static library linked against the tests and
the main program.

Diffstat:
Mcmake/CMakeLists.txt | 21++++++++++-----------
Msrc/test_solstice_parser.c | 2+-
2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt @@ -50,7 +50,6 @@ set(VERSION_PATCH 0) set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) set(SOLSTICE_FILES_SRC - solstice.c solstice_parser.c) set(SOLSTICE_FILES_INC solstice_parser.h) set(SOLSTICE_FILES_DOC COPYING README.md) @@ -64,8 +63,9 @@ if(CMAKE_COMPILER_IS_GNUCC) set(MATH_LIB m) endif() -add_executable(solstice ${SOLSTICE_FILES_SRC} ${SOLSTICE_FILES_INC}) -target_link_libraries(solstice LibYAML RSys StarSP ${MATH_LIB}) +add_library(solstitium STATIC ${SOLSTICE_FILES_SRC} ${SOLSTICE_FILES_INC}) +add_executable(solstice ${SOLSTICE_SOURCE_DIR}/solstice.c) +target_link_libraries(solstice LibYAML RSys StarSP ${MATH_LIB} solstitium) set_target_properties(solstice PROPERTIES VERSION ${VERSION} SOVERSION ${VERSION_MAJOR}) @@ -75,15 +75,14 @@ rcmake_copy_runtime_libraries(solstice) # Tests ################################################################################ if(NOT NO_TEST) - set(_test_files - solstice_parser.h - solstice_parser.c - test_solstice_parser.c - test_solstice_utils.h) - rcmake_prepend_path(_test_files ${SOLSTICE_SOURCE_DIR}) - add_executable(test_solstice_parser ${_test_files}) - target_link_libraries(test_solstice_parser LibYAML ${MATH_LIB} RSys) + function(build_test _name) + add_executable(${_name} + ${SOLSTICE_SOURCE_DIR}/${_name}.c + ${SOLSTICE_SOURCE_DIR}/test_solstice_utils.h) + target_link_libraries(${_name} LibYAML ${MATH_LIB} RSys solstitium) + endfunction() + build_test(test_solstice_parser) add_test(test_solstice_parser_ok_0 test_solstice_parser ${SOLSTICE_SOURCE_DIR}/yaml/test_ok_0.yaml) add_test(test_solstice_parser_ko_0 test_solstice_parser -e diff --git a/src/test_solstice_parser.c b/src/test_solstice_parser.c @@ -39,7 +39,7 @@ main(int argc, char** argv) "option to check that the FILEs are invalid.\n\n"); printf("OPTIONS:\n"); printf(" -h print this help and exit.\n"); - printf(" -e check that the submitted FILEs has errors.\n"); + printf(" -e check that the submitted FILEs have errors.\n"); return 0; } }