Commit d38c21be authored by Stefano Bonicatti's avatar Stefano Bonicatti

Make tests and benchmarks build on Windows

Differential Revision: https://phabricator.kde.org/D900
parent 1f56d274
......@@ -529,7 +529,7 @@ if(HAVE_VC)
macro(ko_compile_for_all_implementations_no_scalar _objs _src)
if(PACKAGERS_BUILD)
vc_compile_for_all_implementations(${_objs} ${_src} FLAGS ${ADDITIONAL_VC_FLAGS} -fPIC ONLY SSE2 SSSE3 SSE4_1 AVX AVX2)
vc_compile_for_all_implementations(${_objs} ${_src} FLAGS ${ADDITIONAL_VC_FLAGS} ONLY SSE2 SSSE3 SSE4_1 AVX AVX2)
else()
set(${_objs} ${_src})
endif()
......@@ -698,9 +698,7 @@ endif()
add_subdirectory(libs)
add_subdirectory(plugins)
if (NOT WIN32)
add_subdirectory( benchmarks )
endif ()
add_subdirectory( benchmarks )
macro_display_feature_log()
......
......@@ -4,7 +4,7 @@ include_directories(
${CMAKE_SOURCE_DIR}/sdk/tests
${CMAKE_SOURCE_DIR}/libs/pigment/compositeops
${EIGEN3_INCLUDE_DIR}
${Boost_INCLUDE_DIRS}
)
......
......@@ -17,21 +17,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kis_composition_benchmark.h"
#include <QTest>
#include <KoColorSpace.h>
#include <KoCompositeOp.h>
#include <KoColorSpaceRegistry.h>
#include <KoColorSpaceTraits.h>
#include <KoCompositeOpAlphaDarken.h>
#include <KoCompositeOpOver.h>
#include "KoOptimizedCompositeOpFactory.h"
// for calculation of the needed alignment
#include <config-vc.h>
#ifdef HAVE_VC
......@@ -47,6 +32,19 @@
#pragma warning ( pop )
#endif
#include "kis_composition_benchmark.h"
#include <QTest>
#include <KoColorSpace.h>
#include <KoCompositeOp.h>
#include <KoColorSpaceRegistry.h>
#include <KoColorSpaceTraits.h>
#include <KoCompositeOpAlphaDarken.h>
#include <KoCompositeOpOver.h>
#include "KoOptimizedCompositeOpFactory.h"
#include <KoOptimizedCompositeOpOver32.h>
#include <KoOptimizedCompositeOpOver128.h>
#include <KoOptimizedCompositeOpAlphaDarken32.h>
......@@ -57,6 +55,14 @@
#include <kis_debug.h>
#if defined _MSC_VER
#define MEMALIGN_ALLOC(p, a, s) ((*(p)) = _aligned_malloc((s), (a)), *(p) ? 0 : errno)
#define MEMALIGN_FREE(p) _aligned_free((p))
#else
#define MEMALIGN_ALLOC(p, a, s) posix_memalign((p), (a), (s))
#define MEMALIGN_FREE(p) free((p))
#endif
const int alpha_pos = 3;
enum AlphaRange {
......@@ -232,17 +238,17 @@ QVector<Tile> generateTiles(int size,
const size_t maskAlignment = qMax(size_t(vecSize), size_t(256));
for (int i = 0; i < size; i++) {
void *ptr = NULL;
int error = posix_memalign(&ptr, pixelAlignment, numPixels * pixelSize + srcAlignmentShift);
int error = MEMALIGN_ALLOC(&ptr, pixelAlignment, numPixels * pixelSize + srcAlignmentShift);
if (error) {
qFatal("posix_memalign failed: %d", error);
}
tiles[i].src = (quint8*)ptr + srcAlignmentShift;
error = posix_memalign(&ptr, pixelAlignment, numPixels * pixelSize + dstAlignmentShift);
error = MEMALIGN_ALLOC(&ptr, pixelAlignment, numPixels * pixelSize + dstAlignmentShift);
if (error) {
qFatal("posix_memalign failed: %d", error);
}
tiles[i].dst = (quint8*)ptr + dstAlignmentShift;
error = posix_memalign(&ptr, maskAlignment, numPixels);
error = MEMALIGN_ALLOC(&ptr, maskAlignment, numPixels);
if (error) {
qFatal("posix_memalign failed: %d", error);
}
......@@ -265,9 +271,9 @@ void freeTiles(QVector<Tile> tiles,
const int dstAlignmentShift)
{
Q_FOREACH (const Tile &tile, tiles) {
free(tile.src - srcAlignmentShift);
free(tile.dst - dstAlignmentShift);
free(tile.mask);
MEMALIGN_FREE(tile.src - srcAlignmentShift);
MEMALIGN_FREE(tile.dst - dstAlignmentShift);
MEMALIGN_FREE(tile.mask);
}
}
......@@ -753,12 +759,12 @@ void KisCompositionBenchmark::benchmarkUintFloat()
#ifdef HAVE_VC
const int dataSize = 4096;
void *ptr = NULL;
int error = posix_memalign(&ptr, uint8VecAlignment, dataSize);
int error = MEMALIGN_ALLOC(&ptr, uint8VecAlignment, dataSize);
if (error) {
qFatal("posix_memalign failed: %d", error);
}
quint8 *iData = (quint8*)ptr;
error = posix_memalign(&ptr, floatVecAlignment, dataSize * sizeof(float));
error = MEMALIGN_ALLOC(&ptr, floatVecAlignment, dataSize * sizeof(float));
if (error) {
qFatal("posix_memalign failed: %d", error);
}
......@@ -773,8 +779,8 @@ void KisCompositionBenchmark::benchmarkUintFloat()
}
}
free(iData);
free(fData);
MEMALIGN_FREE(iData);
MEMALIGN_FREE(fData);
#endif
}
......@@ -783,12 +789,12 @@ void KisCompositionBenchmark::benchmarkUintIntFloat()
#ifdef HAVE_VC
const int dataSize = 4096;
void *ptr = NULL;
int error = posix_memalign(&ptr, uint8VecAlignment, dataSize);
int error = MEMALIGN_ALLOC(&ptr, uint8VecAlignment, dataSize);
if (error) {
qFatal("posix_memalign failed: %d", error);
}
quint8 *iData = (quint8*)ptr;
error = posix_memalign(&ptr, floatVecAlignment, dataSize * sizeof(float));
error = MEMALIGN_ALLOC(&ptr, floatVecAlignment, dataSize * sizeof(float));
if (error) {
qFatal("posix_memalign failed: %d", error);
}
......@@ -803,8 +809,8 @@ void KisCompositionBenchmark::benchmarkUintIntFloat()
}
}
free(iData);
free(fData);
MEMALIGN_FREE(iData);
MEMALIGN_FREE(fData);
#endif
}
......@@ -813,12 +819,12 @@ void KisCompositionBenchmark::benchmarkFloatUint()
#ifdef HAVE_VC
const int dataSize = 4096;
void *ptr = NULL;
int error = posix_memalign(&ptr, uint32VecAlignment, dataSize * sizeof(quint32));
int error = MEMALIGN_ALLOC(&ptr, uint32VecAlignment, dataSize * sizeof(quint32));
if (error) {
qFatal("posix_memalign failed: %d", error);
}
quint32 *iData = (quint32*)ptr;
error = posix_memalign(&ptr, floatVecAlignment, dataSize * sizeof(float));
error = MEMALIGN_ALLOC(&ptr, floatVecAlignment, dataSize * sizeof(float));
if (error) {
qFatal("posix_memalign failed: %d", error);
}
......@@ -833,8 +839,8 @@ void KisCompositionBenchmark::benchmarkFloatUint()
}
}
free(iData);
free(fData);
MEMALIGN_FREE(iData);
MEMALIGN_FREE(fData);
#endif
}
......@@ -843,12 +849,12 @@ void KisCompositionBenchmark::benchmarkFloatIntUint()
#ifdef HAVE_VC
const int dataSize = 4096;
void *ptr = NULL;
int error = posix_memalign(&ptr, uint32VecAlignment, dataSize * sizeof(quint32));
int error = MEMALIGN_ALLOC(&ptr, uint32VecAlignment, dataSize * sizeof(quint32));
if (error) {
qFatal("posix_memalign failed: %d", error);
}
quint32 *iData = (quint32*)ptr;
error = posix_memalign(&ptr, floatVecAlignment, dataSize * sizeof(float));
error = MEMALIGN_ALLOC(&ptr, floatVecAlignment, dataSize * sizeof(float));
if (error) {
qFatal("posix_memalign failed: %d", error);
}
......@@ -863,8 +869,8 @@ void KisCompositionBenchmark::benchmarkFloatIntUint()
}
}
free(iData);
free(fData);
MEMALIGN_FREE(iData);
MEMALIGN_FREE(fData);
#endif
}
......
......@@ -16,8 +16,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <QTest>
#include <config-vc.h>
#ifdef HAVE_VC
#if defined _MSC_VER
......@@ -33,6 +31,7 @@
#endif
#endif
#include <QTest>
#include "kis_mask_generator_benchmark.h"
......
include_directories(${Boost_INCLUDE_DIRS})
add_subdirectory(tests)
include_directories(${CMAKE_BINARY_DIR}/libs/psd) #For kispsd_include.h
include_directories(${Boost_INCLUDE_DIRS})
include_directories( ${CMAKE_BINARY_DIR}/libs/psd #For kispsd_include.h
${Boost_INCLUDE_DIRS}
)
set(kritapsd_LIB_SRCS
psd_utils.cpp
......@@ -28,8 +29,6 @@ else (WIN32)
endif (WIN32)
target_link_libraries(kritapsd LINK_INTERFACE_LIBRARIES kritaglobal ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})
set_target_properties(kritapsd PROPERTIES
VERSION ${GENERIC_CALLIGRA_LIB_VERSION} SOVERSION ${GENERIC_CALLIGRA_LIB_SOVERSION}
)
......
......@@ -239,7 +239,7 @@ target_link_libraries(KisAnimationFrameCacheTest kritaui kritaimage ${QT_QTTEST_
########### next target ###############
set(ResourceBundleTest_SRCS ResourceBundleTest.cpp ../KisResourceBundle.cpp ../KisResourceBundleManifest.cpp)
set(ResourceBundleTest_SRCS ResourceBundleTest.cpp)
kde4_add_unit_test(ResourceBundleTest TESTNAME krita-resourcemanager-ResourceBundleTest ${ResourceBundleTest_SRCS})
target_link_libraries(ResourceBundleTest kritaui kritalibbrush kritalibpaintop Qt5::Test )
......
project( lcmsengine )
if(NOT WIN32)
## Only test if on non-Windows system
add_subdirectory(tests)
endif()
add_subdirectory(tests)
include_directories(
${LCMS2_INCLUDE_DIR}
......
......@@ -31,7 +31,7 @@ set(TestKoLcmsColorProfile_test_SRCS TestKoLcmsColorProfile.cpp )
kde4_add_unit_test(TestKoLcmsColorProfile TESTNAME libs-pigment-TestKoLcmsColorProfile ${TestKoLcmsColorProfile_test_SRCS})
target_link_libraries(TestKoLcmsColorProfile kritawidgets kritapigment KF5::I18n Qt5::Test ${LCMS2_LIBRARIES} kritalcmsengine )
target_link_libraries(TestKoLcmsColorProfile kritawidgets kritapigment KF5::I18n Qt5::Test ${LCMS2_LIBRARIES} )
########### next target ###############
......
......@@ -35,7 +35,7 @@ ki18n_wrap_ui(KRITA_ANIMATIONDOCKER_SOURCES
onion_skins_docker.ui
)
add_library(kritaanimationdocker MODULE ${KRITA_ANIMATIONDOCKER_SOURCES})
add_library(kritaanimationdocker SHARED ${KRITA_ANIMATIONDOCKER_SOURCES})
generate_export_header(kritaanimationdocker BASE_NAME kritaanimationdocker EXPORT_MACRO_NAME KRITAANIMATIONDOCKER_EXPORT)
target_link_libraries(kritaanimationdocker kritaui)
install(TARGETS kritaanimationdocker DESTINATION ${CALLIGRA_PLUGIN_INSTALL_DIR})
......
......@@ -14,7 +14,7 @@ ki18n_wrap_ui(KRITA_LUTDOCKER_SOURCES
wdglut.ui
)
add_library(kritalutdocker MODULE ${KRITA_LUTDOCKER_SOURCES})
add_library(kritalutdocker SHARED ${KRITA_LUTDOCKER_SOURCES})
generate_export_header(kritalutdocker BASE_NAME kritalutdocker)
target_link_libraries(kritalutdocker kritaui ${Boost_SYSTEM_LIBRARY} ${OCIO_LIBRARIES})
install(TARGETS kritalutdocker DESTINATION ${CALLIGRA_PLUGIN_INSTALL_DIR})
macro_add_unittest_definitions()
include_directories( ${OCIO_INCLUDE_DIR})
include_directories( ${OCIO_INCLUDE_DIR}
${Boost_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/sdk/tests)
########### next target ###############
......
......@@ -24,11 +24,11 @@
#include "KoColorModelStandardIds.h"
#include "../../../../../sdk/tests/stroke_testing_utils.h"
#include "../../../../../sdk/tests/testutil.h"
#include <stroke_testing_utils.h>
#include <testutil.h>
#include "kis_exposure_gamma_correction_interface.h"
#include "../ocio_display_filter.h"
#include <ocio_display_filter.h>
#include "kis_display_color_converter.h"
#include "kis_canvas_resource_provider.h"
......
......@@ -29,12 +29,12 @@ set(kritapsdimport_SOURCES
${LIB_PSD_SRCS}
)
add_library(kritapsdimport MODULE ${kritapsdimport_SOURCES})
add_library(kritapsdimport SHARED ${kritapsdimport_SOURCES})
if (WIN32)
target_link_libraries(kritapsdimport kritaui kritapsd ${WIN32_PLATFORM_NET_LIBS} ${ZLIB_LIBRARIES})
target_link_libraries(kritapsdimport kritaglobal kritaui kritapsd KF5::I18n ${WIN32_PLATFORM_NET_LIBS} ${ZLIB_LIBRARIES})
else ()
target_link_libraries(kritapsdimport kritaui kritapsd ${ZLIB_LIBRARIES})
target_link_libraries(kritapsdimport kritaglobal kritaui kritapsd KF5::I18n ${ZLIB_LIBRARIES})
endif ()
install(TARGETS kritapsdimport DESTINATION ${CALLIGRA_PLUGIN_INSTALL_DIR})
......
include_directories(${CMAKE_BINARY_DIR}/krita/libpsd) #For kispsd_include.h
include_directories(${CMAKE_BINARY_DIR}/libs/psd) #For kispsd_include.h
include_directories(${CMAKE_BINARY_DIR}/libs/pigment)
set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} )
include_directories(
${CMAKE_SOURCE_DIR}/..
${CMAKE_SOURCE_DIR}/sdk/tests
${CMAKE_SOURCE_DIR}/libs/psd
${CMAKE_SOURCE_DIR}/plugins/impex/psd
${CMAKE_SOURCE_DIR}/libs/pigment
)
macro_add_unittest_definitions()
if (WIN32)
set(PSD_TEST_LIBS kritaglobal kritapsd kritapigment Qt5::Test ${WIN32_PLATFORM_NET_LIBS})
set(PSD_TEST_LIBS kritapsd Qt5::Test ${WIN32_PLATFORM_NET_LIBS})
else (WIN32)
set(PSD_TEST_LIBS kritaglobal kritapsd kritapigment Qt5::Test)
set(PSD_TEST_LIBS kritapsd Qt5::Test)
endif (WIN32)
########### next target ###############
set(psd_header_test_SRCS psd_header_test.cpp ${CMAKE_SOURCE_DIR}/libs/psd/psd_utils.cpp ../psd_header.cpp )
set(psd_header_test_SRCS psd_header_test.cpp ../psd_header.cpp)
kde4_add_unit_test(psd_header_test TESTNAME krita-psd-psd_header_test ${psd_header_test_SRCS})
target_link_libraries(psd_header_test ${PSD_TEST_LIBS})
target_link_libraries(psd_header_test kritaglobal KF5::I18n ${PSD_TEST_LIBS})
########### next target ###############
set(psd_utils_test_SRCS psd_utils_test.cpp ${CMAKE_SOURCE_DIR}/libs/psd/psd_utils.cpp)
set(psd_utils_test_SRCS psd_utils_test.cpp)
kde4_add_unit_test(psd_utils_test TESTNAME krita-psd-psd_utils_test ${psd_utils_test_SRCS})
target_link_libraries(psd_utils_test ${PSD_TEST_LIBS})
########### next target ###############
set(psd_colormode_block_test_SRCS psd_colormode_block_test.cpp ../psd_colormode_block.cpp ../psd_header.cpp ${CMAKE_SOURCE_DIR}/libs/psd/psd_utils.cpp)
set(psd_colormode_block_test_SRCS psd_colormode_block_test.cpp ../psd_header.cpp ../psd_colormode_block.cpp)
kde4_add_unit_test(psd_colormode_block_test TESTNAME krita-psd-psd_colormode_block_test ${psd_colormode_block_test_SRCS})
target_link_libraries(psd_colormode_block_test ${PSD_TEST_LIBS})
target_link_libraries(psd_colormode_block_test kritaglobal KF5::I18n Qt5::Gui ${PSD_TEST_LIBS})
########### next target ###############
set(compression_test_SRCS compression_test.cpp ${CMAKE_SOURCE_DIR}/libs/psd/compression.cpp)
set(compression_test_SRCS compression_test.cpp)
kde4_add_unit_test(compression_test TESTNAME krita-psd-compression_test ${compression_test_SRCS})
target_link_libraries(compression_test ${PSD_TEST_LIBS})
......
......@@ -22,9 +22,9 @@
#include <QCoreApplication>
#include <klocalizedstring.h>
#include <QTest>
#include "../../libs/psd/psd.h"
#include "../psd_header.h"
#include "../psd_colormode_block.h"
#include <psd.h>
#include <psd_header.h>
#include <psd_colormode_block.h>
#ifndef FILES_DATA_DIR
#error "FILES_DATA_DIR not set. A directory with the data used for testing the importing of files in krita"
#endif
......
......@@ -22,7 +22,7 @@
#include <QCoreApplication>
#include <klocalizedstring.h>
#include <QTest>
#include "../psd_header.h"
#include <psd_header.h>
#ifndef FILES_DATA_DIR
#error "FILES_DATA_DIR not set. A directory with the data used for testing the importing of files in krita"
#endif
......
......@@ -22,7 +22,7 @@
#include <QCoreApplication>
#include <klocalizedstring.h>
#include <QTest>
#include "../..//libs/psd/psd_utils.h"
#include <psd_utils.h>
#include <QByteArray>
#include <QBuffer>
......
add_subdirectory(tests)
include_directories(${Boost_INCLUDE_DIR})
include_directories(${Boost_INCLUDE_DIRS})
set(kritatooltransform_SOURCES
tool_transform.cc
......@@ -27,7 +27,7 @@ set(kritatooltransform_SOURCES
qt5_add_resources(kritatooltransform_SOURCES tool_transform.qrc)
ki18n_wrap_ui(kritatooltransform_SOURCES wdg_tool_transform.ui)
add_library(kritatooltransform MODULE ${kritatooltransform_SOURCES})
add_library(kritatooltransform SHARED ${kritatooltransform_SOURCES})
generate_export_header(kritatooltransform BASE_NAME kritatooltransform)
if (NOT GSL_FOUND)
......
set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} )
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_SOURCE_DIR}/sdk/tests )
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/..
${CMAKE_CURRENT_BINARY_DIR}/..
${CMAKE_SOURCE_DIR}/sdk/tests
${Boost_INCLUDE_DIRS}
)
macro_add_unittest_definitions()
......
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