-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
78 lines (67 loc) · 6.08 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
cmake_minimum_required(VERSION 3.17)
project(Ownly)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_PREFIX_PATH "C:\\msys64\\mingw64")
list(APPEND CMAKE_PREFIX_PATH "C:\\msys64\\mingw64\\lib\\cmake\\Qt5")
list(APPEND CMAKE_PREFIX_PATH "C:\\msys64\\usr\\local\\lib\\cmake\\Catch2")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
message("CMAKE_FIND_LIBRARY_SUFFIXES: ${CMAKE_FIND_LIBRARY_SUFFIXES}")
find_package(Qt5 COMPONENTS Core Widgets REQUIRED)
find_package(SQLite3 REQUIRED)
find_package(Catch2 REQUIRED)
qt5_wrap_cpp(SOURCES src/MainWindow.h)
qt5_wrap_ui(SOURCES src/MainWindow.ui)
if (SQLITE3_FOUND)
include_directories(${SQLITE3_INCLUDE_DIRS})
else()
message("SQLite3 not found!")
message("SQLite3 include dir=${SQLITE3_INCLUDE_DIR}")
message("SQLite3 library dir=${SQLITE3_LIBRARY}")
endif(SQLITE3_FOUND)
include_directories(${SQLITE3_INCLUDE_DIRS})
message(STATUS ${CMAKE_BUILD_TYPE})
IF(CMAKE_BUILD_TYPE MATCHES Release)
message(STATUS "Building release.")
add_executable(Ownly WIN32 src/main.cpp src/Database.cpp src/Database.h src/main.h src/exporters.cpp src/exporters.h src/ExportOptions.cpp src/ExportOptions.h src/ClearWarning.cpp src/ClearWarning.h)
ELSE()
message(STATUS "Building debug.")
add_executable(Ownly src/main.cpp src/Database.cpp src/Database.h src/main.h src/exporters.cpp src/exporters.h src/ExportOptions.cpp src/ExportOptions.h src/ClearWarning.cpp src/ClearWarning.h)
ENDIF()
add_executable(functions_test src/Database.cpp test/test-main.cpp test/test_database_functions.cpp test/test_export_functions.cpp src/exporters.cpp)
add_custom_command(TARGET Ownly POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "C:/msys64/mingw64/bin/libsqlite3-0.dll" $<TARGET_FILE_DIR:Ownly>)
add_custom_command(TARGET Ownly POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "C:/msys64/mingw64/bin/libgcc_s_seh-1.dll" $<TARGET_FILE_DIR:Ownly>)
add_custom_command(TARGET Ownly POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "C:/msys64/mingw64/bin/Qt5Core.dll" $<TARGET_FILE_DIR:Ownly>)
add_custom_command(TARGET Ownly POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "C:/msys64/mingw64/bin/Qt5Gui.dll" $<TARGET_FILE_DIR:Ownly>)
add_custom_command(TARGET Ownly POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "C:/msys64/mingw64/bin/Qt5Widgets.dll" $<TARGET_FILE_DIR:Ownly>)
add_custom_command(TARGET Ownly POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "C:/msys64/mingw64/share/qt5/plugins/platforms/qwindows.dll" $<TARGET_FILE_DIR:Ownly>/platforms/qwindows.dll)
add_custom_command(TARGET Ownly POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "C:/msys64/mingw64/bin/libstdc++-6.dll" $<TARGET_FILE_DIR:Ownly>)
add_custom_command(TARGET Ownly POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "C:/msys64/mingw64/bin/libwinpthread-1.dll" $<TARGET_FILE_DIR:Ownly>)
add_custom_command(TARGET Ownly POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "C:/msys64/mingw64/bin/libdouble-conversion.dll" $<TARGET_FILE_DIR:Ownly>)
add_custom_command(TARGET Ownly POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "C:/msys64/mingw64/bin/libicuin67.dll" $<TARGET_FILE_DIR:Ownly>)
add_custom_command(TARGET Ownly POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "C:/msys64/mingw64/bin/libicuuc67.dll" $<TARGET_FILE_DIR:Ownly>)
add_custom_command(TARGET Ownly POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "C:/msys64/mingw64/bin/libicuuc67.dll" $<TARGET_FILE_DIR:Ownly>)
add_custom_command(TARGET Ownly POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "C:/msys64/mingw64/bin/libicudt67.dll" $<TARGET_FILE_DIR:Ownly>)
add_custom_command(TARGET Ownly POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "C:/msys64/mingw64/bin/zlib1.dll" $<TARGET_FILE_DIR:Ownly>)
add_custom_command(TARGET Ownly POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "C:/msys64/mingw64/bin/libzstd.dll" $<TARGET_FILE_DIR:Ownly>)
add_custom_command(TARGET Ownly POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "C:/msys64/mingw64/bin/libharfbuzz-0.dll" $<TARGET_FILE_DIR:Ownly>)
add_custom_command(TARGET Ownly POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "C:/msys64/mingw64/bin/libpng16-16.dll" $<TARGET_FILE_DIR:Ownly>)
add_custom_command(TARGET Ownly POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "C:/msys64/mingw64/bin/libgraphite2.dll" $<TARGET_FILE_DIR:Ownly>)
add_custom_command(TARGET Ownly POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "C:/msys64/mingw64/bin/libfreetype-6.dll" $<TARGET_FILE_DIR:Ownly>)
add_custom_command(TARGET Ownly POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "C:/msys64/mingw64/bin/libglib-2.0-0.dll" $<TARGET_FILE_DIR:Ownly>)
add_custom_command(TARGET Ownly POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "C:/msys64/mingw64/bin/libbrotlidec.dll" $<TARGET_FILE_DIR:Ownly>)
add_custom_command(TARGET Ownly POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "C:/msys64/mingw64/bin/libbz2-1.dll" $<TARGET_FILE_DIR:Ownly>)
add_custom_command(TARGET Ownly POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "C:/msys64/mingw64/bin/libintl-8.dll" $<TARGET_FILE_DIR:Ownly>)
add_custom_command(TARGET Ownly POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "C:/msys64/mingw64/bin/libpcre-1.dll" $<TARGET_FILE_DIR:Ownly>)
add_custom_command(TARGET Ownly POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "C:/msys64/mingw64/bin/libbrotlicommon.dll" $<TARGET_FILE_DIR:Ownly>)
add_custom_command(TARGET Ownly POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "C:/msys64/mingw64/bin/libiconv-2.dll" $<TARGET_FILE_DIR:Ownly>)
add_custom_command(TARGET Ownly POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "C:/msys64/mingw64/bin/libpcre2-16-0.dll" $<TARGET_FILE_DIR:Ownly>)
message(STATUS ${SQLite3_INCLUDE_DIRS})
target_include_directories(Ownly PRIVATE ${SQLite3_INCLUDE_DIRS})
target_link_libraries(Ownly Qt5::Core Qt5::Widgets SQLite3)
target_include_directories(functions_test PRIVATE ${SQLite3_INCLUDE_DIRS})
target_link_libraries(functions_test SQLite3)
include(CTest)
include(ParseAndAddCatchTests)
ParseAndAddCatchTests(functions_test)