forked from highperformancecoder/scidavis-old
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request highperformancecoder#208 from ChinouneMehdi/build_…
…tests Rename cmake option for tests
- Loading branch information
Showing
3 changed files
with
78 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,97 +1,88 @@ | ||
if( ENABLE_Testing ) | ||
|
||
message( STATUS "Testing enabled" ) | ||
|
||
set( CMAKE_AUTOMOC OFF ) | ||
set( CMAKE_AUTOUIC OFF ) | ||
set( CMAKE_AUTORCC OFF ) | ||
|
||
set( SRCS | ||
"main.cpp" | ||
"applicationWindow.cpp" | ||
"readWriteProject.cpp" | ||
"fft.cpp" | ||
"menus.cpp" | ||
"arrowMarker.cpp" | ||
set( CMAKE_AUTOMOC OFF ) | ||
set( CMAKE_AUTOUIC OFF ) | ||
set( CMAKE_AUTORCC OFF ) | ||
|
||
set( SRCS | ||
"main.cpp" | ||
"applicationWindow.cpp" | ||
"readWriteProject.cpp" | ||
"fft.cpp" | ||
"menus.cpp" | ||
"arrowMarker.cpp" | ||
) | ||
if( NOT WIN32 ) | ||
list( APPEND SRCS | ||
"testPaintDevice.cpp" | ||
"3dplot.cpp" | ||
) | ||
if( NOT WIN32 ) | ||
list( APPEND SRCS | ||
"testPaintDevice.cpp" | ||
"3dplot.cpp" | ||
) | ||
endif() | ||
endif() | ||
|
||
add_executable( unittest ${SRCS} ) | ||
add_executable( unittest ${SRCS} ) | ||
|
||
find_package( GTest REQUIRED ) | ||
|
||
target_link_libraries( unittest libscidavis GTest::GTest ) | ||
|
||
if( NOT WIN32 ) | ||
target_link_libraries( unittest pthread ) | ||
endif() | ||
find_package( GTest REQUIRED ) | ||
|
||
if( ORIGIN_IMPORT ) | ||
target_compile_definitions( unittest PRIVATE ORIGIN_IMPORT ) | ||
endif() | ||
target_link_libraries( unittest libscidavis GTest::GTest ) | ||
|
||
if( MULTI_CONFIG ) | ||
target_include_directories( unittest PRIVATE | ||
"${CMAKE_BINARY_DIR}/libscidavis/libscidavis_autogen/include_$<CONFIG>" | ||
) | ||
else() | ||
target_include_directories( unittest PRIVATE | ||
"${CMAKE_BINARY_DIR}/libscidavis/libscidavis_autogen/include" | ||
) | ||
endif() | ||
if( NOT WIN32 ) | ||
target_link_libraries( unittest pthread ) | ||
endif() | ||
|
||
include(GoogleTest) | ||
gtest_discover_tests( unittest ) | ||
if( ORIGIN_IMPORT ) | ||
target_compile_definitions( unittest PRIVATE ORIGIN_IMPORT ) | ||
endif() | ||
|
||
set( TestDataFiles | ||
"3dplot.sciprj" | ||
"3dplotTable.sciprj" | ||
"testProject.sciprj" | ||
"Histo.opj" | ||
"USstates.opj" | ||
if( MULTI_CONFIG ) | ||
target_include_directories( unittest PRIVATE | ||
"${CMAKE_BINARY_DIR}/libscidavis/libscidavis_autogen/include_$<CONFIG>" | ||
) | ||
else() | ||
target_include_directories( unittest PRIVATE | ||
"${CMAKE_BINARY_DIR}/libscidavis/libscidavis_autogen/include" | ||
) | ||
file( COPY ${TestDataFiles} DESTINATION . ) | ||
endif() | ||
|
||
if( NOT (SEARCH_FOR_UPDATES OR DOWNLOAD_LINKS) ) | ||
include(GoogleTest) | ||
gtest_discover_tests( unittest DISCOVERY_MODE PRE_TEST ) | ||
|
||
set( menu_files defaultMenus_en.menudat appWithGraphen.menudat ) | ||
set( TestDataFiles | ||
"3dplot.sciprj" | ||
"3dplotTable.sciprj" | ||
"testProject.sciprj" | ||
"Histo.opj" | ||
"USstates.opj" | ||
) | ||
file( COPY ${TestDataFiles} DESTINATION . ) | ||
|
||
foreach( menu ${menu_files} ) | ||
get_filename_component( test_name ${menu} NAME_WLE ) | ||
add_test( NAME menuData_${test_name} COMMAND diff -q ${menu} ${CMAKE_CURRENT_SOURCE_DIR}/menuData/${menu} ) | ||
set_tests_properties( menuData_${test_name} PROPERTIES DEPENDS unittest ) | ||
endforeach() | ||
if( NOT (SEARCH_FOR_UPDATES OR DOWNLOAD_LINKS) ) | ||
|
||
endif() | ||
set( menu_files defaultMenus_en.menudat appWithGraphen.menudat ) | ||
|
||
if( SCRIPTING_PYTHON ) | ||
foreach( menu ${menu_files} ) | ||
get_filename_component( test_name ${menu} NAME_WLE ) | ||
add_test( NAME menuData_${test_name} COMMAND diff -q ${menu} ${CMAKE_CURRENT_SOURCE_DIR}/menuData/${menu} ) | ||
set_tests_properties( menuData_${test_name} PROPERTIES DEPENDS unittest ) | ||
endforeach() | ||
|
||
file( COPY pythonTests/ DESTINATION ./tmp ) | ||
file( COPY ../scidavis-logo.png DESTINATION ./tmp ) | ||
endif() | ||
|
||
file( GLOB pythonTests pythonTests/*.py ) | ||
# qwtPlotCurve segfault with sip5 or macos | ||
if( SIP_VERSION VERSION_GREATER_EQUAL 5 OR APPLE ) | ||
list( REMOVE_ITEM pythonTests ${CMAKE_CURRENT_SOURCE_DIR}/pythonTests/qwtPlotCurve.py ) | ||
endif() | ||
if( SCRIPTING_PYTHON ) | ||
|
||
foreach( pythonTest ${pythonTests} ) | ||
get_filename_component( test_name ${pythonTest} NAME_WLE ) | ||
add_test( NAME python_${test_name} | ||
COMMAND scidavis -l=en -x ${pythonTest} | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/tmp | ||
) | ||
endforeach() | ||
file( COPY pythonTests/ DESTINATION ./tmp ) | ||
file( COPY ../scidavis-logo.png DESTINATION ./tmp ) | ||
|
||
file( GLOB pythonTests pythonTests/*.py ) | ||
# qwtPlotCurve segfault with sip5 or macos | ||
if( SIP_VERSION VERSION_GREATER_EQUAL 5 OR APPLE ) | ||
list( REMOVE_ITEM pythonTests ${CMAKE_CURRENT_SOURCE_DIR}/pythonTests/qwtPlotCurve.py ) | ||
endif() | ||
|
||
else( ENABLE_Testing ) | ||
|
||
message( STATUS "Testing not enabled" ) | ||
foreach( pythonTest ${pythonTests} ) | ||
get_filename_component( test_name ${pythonTest} NAME_WLE ) | ||
add_test( NAME python_${test_name} | ||
COMMAND scidavis -l=en -x ${pythonTest} | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/tmp | ||
) | ||
endforeach() | ||
|
||
endif( ENABLE_Testing ) | ||
endif() |