Seems to work.

This commit is contained in:
Nissim Hadar 2017-11-13 13:25:59 -08:00
parent aa4320104b
commit d11aa64306
6 changed files with 44 additions and 17 deletions

View file

@ -1,31 +1,39 @@
set(TARGET_NAME auto-tester)
project(${TARGET_NAME})
# Automatically run UIC and MOC. This replaces the older WRAP macros
SET(CMAKE_AUTOUIC ON)
SET(CMAKE_AUTOMOC ON)
setup_hifi_project(Widgets)
link_hifi_libraries()
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set_property(TARGET auto-tester PROPERTY WIN32_EXECUTABLE true)
set(SOURCES src/main.cpp src/Test.cpp src/ui/AutoTester.cpp src/ui/MismatchWindow.cpp)
set(MOC_HEADERS src/ui/AutoTester.h src/ui/MismatchWindow.h)
set(UIS ui/AutoTester.ui ui/MismatchWindow.ui)
set(RESOURCES src/AutoTester.qrc)
QT5_ADD_RESOURCES(RES_SOURCES ${RESOURCES})
QT5_WRAP_UI(UI_HEADERS ${UIS})
QT5_WRAP_CPP(MOC_SRCS ${MOC_HEADERS})
add_executable(PROJECT_NAME ${SOURCES} ${MOC_SRCS} ${RES_SOURCES} ${UI_HEADERS})
# This is preferred to GLOB_RECURSE, as per CMake documentation
set(SOURCES src/main.cpp src/Test.cpp src/ui/autoTester.cpp src/ui/mismatchWindow.cpp)
set(MOC_HEADERS src/autoTester.h src/mismatchWindow.h)
set(UIS src/ui/autoTester.ui src/ui/mismatchWindow.ui)
if (WIN32)
add_executable(PROJECT_NAME WIN32 ${SOURCES} ${MOC_SRCS} ${UI_HEADERS})
else()
add_executable(PROJECT_NAME ${SOURCES} ${MOC_SRCS} ${RES_SOURCES} ${UI_HEADERS})
endif()
target_link_libraries(PROJECT_NAME ${QT_LIBRARIES})
# Copy required dll's.
# Note that the two ImageMagick files are copied twice. This is to allow the tester to run from VS as well as
# directly from the executable.
add_custom_command(
TARGET auto-tester
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:Qt5::Core> $<TARGET_FILE_DIR:auto-tester>
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:Qt5::Gui> $<TARGET_FILE_DIR:auto-tester>
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:Qt5::Widgets> $<TARGET_FILE_DIR:auto-tester>
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/ImageMagick/magick.exe $<TARGET_FILE_DIR:auto-tester>
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/ImageMagick/magic.xml $<TARGET_FILE_DIR:auto-tester>
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/ImageMagick/magick.exe $<TARGET_FILE_DIR:auto-tester>/..
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/ImageMagick/magic.xml $<TARGET_FILE_DIR:auto-tester>/..
)

View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE magicmap [
<!ELEMENT magicmap (magic)+>
<!ELEMENT magic (#PCDATA)>
<!ATTLIST magic name CDATA #REQUIRED>
<!ATTLIST magic offset CDATA "0">
<!ATTLIST magic target CDATA #REQUIRED>
]>
<!--
Associate an image format with a unique identifier.
Many image formats have identifiers that uniquely identify a particular
image format. For example, the GIF image format always begins with GIF8
as the first 4 characters of the image. ImageMagick uses this information
to quickly determine the type of image it is dealing with when it reads
an image.
-->
<magicmap>
<!-- <magic name="GIF" offset="0" target="GIF8"/> -->
<!-- <magic name="JPEG" offset="0" target="\377\330\377"/> -->
<!-- <magic name="PNG" offset="0" target="\211PNG\r\n\032\n"/> -->
<!-- <magic name="TIFF" offset="0" target="\115\115\000\052"/> -->
</magicmap>

Binary file not shown.

View file

@ -1,4 +0,0 @@
<RCC>
<qresource prefix="AutoTester">
</qresource>
</RCC>