mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-29 12:32:52 +00:00
Merge branch 'optional-tests'
This commit is contained in:
commit
aea1e24e32
@ -19,7 +19,7 @@ before_install:
|
||||
before_script:
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake .. -DUSE_SHARED_CURL=$SHARED -DUSE_SHARED_GIFLIB=$SHARED -DUSE_SHARED_JPEGLIB=$SHARED -DUSE_SHARED_ZLIB=$SHARED -DUSE_SHARED_LIBPNG=$SHARED -DUSE_SHARED_TINYXML=$SHARED -DUSE_SHARED_PIXMAN=$SHARED -DUSE_SHARED_ALLEGRO4=$SHARED
|
||||
- cmake .. -DUSE_SHARED_CURL=$SHARED -DUSE_SHARED_GIFLIB=$SHARED -DUSE_SHARED_JPEGLIB=$SHARED -DUSE_SHARED_ZLIB=$SHARED -DUSE_SHARED_LIBPNG=$SHARED -DUSE_SHARED_TINYXML=$SHARED -DUSE_SHARED_PIXMAN=$SHARED -DUSE_SHARED_ALLEGRO4=$SHARED -DENABLE_TESTS=ON
|
||||
|
||||
script:
|
||||
- "make"
|
||||
|
@ -55,6 +55,7 @@ option(USE_SKIA_BACKEND "Use Skia backend" off)
|
||||
option(ENABLE_MEMLEAK "Enable memory-leaks detector (only for developers)" off)
|
||||
option(ENABLE_UPDATER "Enable automatic check for updates" on)
|
||||
option(ENABLE_WEBSERVER "Enable support to run a webserver (for HTML5 gamedev)" off)
|
||||
option(ENABLE_TESTS "Enable the unit tests" off)
|
||||
option(ENABLE_TRIAL_MODE "Compile the trial version" off)
|
||||
option(ENABLE_STEAM "Compile with Steam library" off)
|
||||
option(FULLSCREEN_PLATFORM "Enable fullscreen by default" off)
|
||||
|
35
cmake/FindTests.cmake
Normal file
35
cmake/FindTests.cmake
Normal file
@ -0,0 +1,35 @@
|
||||
# Find tests and add rules to compile them and run them
|
||||
|
||||
function(find_tests dir dependencies)
|
||||
file(GLOB tests ${CMAKE_CURRENT_SOURCE_DIR}/${dir}/*_tests.cpp)
|
||||
list(REMOVE_AT ARGV 0)
|
||||
|
||||
# Add gtest include directory so we can #include <gtest/gtest.h> in tests source code
|
||||
include_directories(${CMAKE_SOURCE_DIR}/third_party/gtest/include)
|
||||
|
||||
# See if the test is linked with "she" library.
|
||||
list(FIND dependencies she link_with_she)
|
||||
if(link_with_she)
|
||||
set(extra_definitions -DLINKED_WITH_SHE)
|
||||
endif()
|
||||
|
||||
foreach(testsourcefile ${tests})
|
||||
get_filename_component(testname ${testsourcefile} NAME_WE)
|
||||
|
||||
add_executable(${testname} ${testsourcefile})
|
||||
add_test(NAME ${testname} COMMAND ${testname})
|
||||
|
||||
if(MSVC)
|
||||
# Fix problem compiling gen from a Visual Studio solution
|
||||
set_target_properties(${testname}
|
||||
PROPERTIES LINK_FLAGS -ENTRY:"mainCRTStartup")
|
||||
endif()
|
||||
|
||||
target_link_libraries(${testname} gtest ${ARGV} ${PLATFORM_LIBS})
|
||||
|
||||
if(extra_definitions)
|
||||
set_target_properties(${testname}
|
||||
PROPERTIES COMPILE_FLAGS ${extra_definitions})
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
@ -165,47 +165,17 @@ install(DIRECTORY ../data
|
||||
######################################################################
|
||||
# Tests
|
||||
|
||||
function(find_tests dir dependencies)
|
||||
file(GLOB tests ${CMAKE_CURRENT_SOURCE_DIR}/${dir}/*_tests.cpp)
|
||||
list(REMOVE_AT ARGV 0)
|
||||
if(ENABLE_TESTS)
|
||||
include(FindTests)
|
||||
|
||||
# Add gtest include directory so we can #include <gtest/gtest.h> in tests source code
|
||||
include_directories(${CMAKE_SOURCE_DIR}/third_party/gtest/include)
|
||||
|
||||
# See if the test is linked with "she" library.
|
||||
list(FIND dependencies she link_with_she)
|
||||
if(link_with_she)
|
||||
set(extra_definitions -DLINKED_WITH_SHE)
|
||||
endif()
|
||||
|
||||
foreach(testsourcefile ${tests})
|
||||
get_filename_component(testname ${testsourcefile} NAME_WE)
|
||||
|
||||
add_executable(${testname} ${testsourcefile})
|
||||
add_test(NAME ${testname} COMMAND ${testname})
|
||||
|
||||
if(MSVC)
|
||||
# Fix problem compiling gen from a Visual Studio solution
|
||||
set_target_properties(${testname}
|
||||
PROPERTIES LINK_FLAGS -ENTRY:"mainCRTStartup")
|
||||
endif()
|
||||
|
||||
target_link_libraries(${testname} gtest ${ARGV} ${PLATFORM_LIBS})
|
||||
|
||||
if(extra_definitions)
|
||||
set_target_properties(${testname}
|
||||
PROPERTIES COMPILE_FLAGS ${extra_definitions})
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
find_tests(base base-lib)
|
||||
find_tests(undo undo-lib)
|
||||
find_tests(gfx gfx-lib)
|
||||
find_tests(doc doc-lib)
|
||||
find_tests(render render-lib)
|
||||
find_tests(css css-lib)
|
||||
find_tests(ui ui-lib)
|
||||
find_tests(app/file app-lib)
|
||||
find_tests(app app-lib)
|
||||
find_tests(. app-lib)
|
||||
find_tests(base base-lib)
|
||||
find_tests(undo undo-lib)
|
||||
find_tests(gfx gfx-lib)
|
||||
find_tests(doc doc-lib)
|
||||
find_tests(render render-lib)
|
||||
find_tests(css css-lib)
|
||||
find_tests(ui ui-lib)
|
||||
find_tests(app/file app-lib)
|
||||
find_tests(app app-lib)
|
||||
find_tests(. app-lib)
|
||||
endif()
|
||||
|
Loading…
x
Reference in New Issue
Block a user