Skip to content

Commit

Permalink
Add support for omc-diff and reference files. (#8277)
Browse files Browse the repository at this point in the history
  - The target `reference-files` can be used to extract the reference files.

  - Explicitly set qwt as SHARED lib. This was overlooked.

  - Do not show statements when installing libraries. This was fixed for
    the CMake version but was forgotten for the makefiles.
  • Loading branch information
mahge committed Dec 7, 2021
1 parent cf55cd7 commit 49552c6
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 2 deletions.
2 changes: 1 addition & 1 deletion OMPlot/qwt/src/CMakeLists.txt
Expand Up @@ -214,7 +214,7 @@ if (QWT_WITH_WIDGETS)
qwt_wheel.cpp)
endif ()

add_library(qwt ${QWT_HEADERS} ${QWT_SOURCES})
add_library(qwt SHARED ${QWT_HEADERS} ${QWT_SOURCES})

target_compile_definitions(qwt
PUBLIC
Expand Down
3 changes: 3 additions & 0 deletions testsuite/CMakeLists.txt
@@ -1,2 +1,5 @@


omc_add_subdirectory(difftool)
omc_add_subdirectory(ReferenceFiles)
omc_add_subdirectory(libraries-for-testing)
26 changes: 26 additions & 0 deletions testsuite/ReferenceFiles/CMakeLists.txt
@@ -0,0 +1,26 @@


file(GLOB_RECURSE COMPRESSED_REF_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.mat.xz)

foreach(compressed_file_path ${COMPRESSED_REF_FILES})
get_filename_component(compressed_file_dir ${compressed_file_path} DIRECTORY)
# Remove only the last extension. The file names have a lot of dots.
get_filename_component(compressed_file_name_no_xz_ext ${compressed_file_path} NAME_WLE)
set(output_file_path ${compressed_file_dir}/${compressed_file_name_no_xz_ext})

add_custom_command(
DEPENDS ${compressed_file_path}
COMMAND xz --keep --decompress --force ${compressed_file_path}
OUTPUT ${output_file_path}
COMMENT "Extracting: ${compressed_file_path}"
)

set(OMC_EXTRACTED_REFERENCE_FILES ${OMC_EXTRACTED_REFERENCE_FILES} ${output_file_path})
endforeach()

# A custom target the depends on the extracted files. Makeing sure they get generated when it is
# invoked.
add_custom_target(reference-files
DEPENDS ${OMC_EXTRACTED_REFERENCE_FILES}
COMMENT "Extracted reference files to ${CMAKE_CURRENT_SOURCE_DIR}"
)
12 changes: 12 additions & 0 deletions testsuite/difftool/CMakeLists.txt
@@ -0,0 +1,12 @@


find_package(FLEX)

if(NOT FLEX_FOUND)
message(WARNING "GNU Flex not found. You will not be able to use omc-diff to verify test results against expected results.")
else()
FLEX_TARGET(omc_diff_lexer omc-diff.l ${CMAKE_CURRENT_BINARY_DIR}/lex.yy.c)
add_executable(omc-diff ${FLEX_omc_diff_lexer_OUTPUTS})

install(TARGETS omc-diff)
endif()
2 changes: 1 addition & 1 deletion testsuite/libraries-for-testing/Makefile
Expand Up @@ -11,4 +11,4 @@ clean:
$(MAKE) clean
mkdir -p .openmodelica/libraries
ls -l .openmodelica/libraries
../../build/bin/omc -d=showStatement index.mos
../../build/bin/omc index.mos

0 comments on commit 49552c6

Please sign in to comment.