mirror of
https://github.com/redstrate/Novus.git
synced 2025-04-24 04:57:45 +00:00
Improve Windows support
This commit is contained in:
parent
14e59c4fe3
commit
191a93a596
1 changed files with 39 additions and 2 deletions
|
@ -8,7 +8,27 @@ find_package(Qt5 COMPONENTS Core Widgets CONFIG REQUIRED)
|
||||||
|
|
||||||
add_subdirectory(libxiv)
|
add_subdirectory(libxiv)
|
||||||
|
|
||||||
find_package(fmt)
|
include(FetchContent)
|
||||||
|
|
||||||
|
find_package(fmt QUIET)
|
||||||
|
|
||||||
|
if(TARGET fmt::fmt)
|
||||||
|
message("Using system library for fmt")
|
||||||
|
|
||||||
|
set(LIBRARIES fmt::fmt ${LIBRARIES})
|
||||||
|
else()
|
||||||
|
message("Using built-in fmt")
|
||||||
|
|
||||||
|
FetchContent_Declare(
|
||||||
|
fmt
|
||||||
|
GIT_REPOSITORY https://github.com/fmtlib/fmt
|
||||||
|
GIT_TAG master
|
||||||
|
)
|
||||||
|
|
||||||
|
FetchContent_MakeAvailable(fmt)
|
||||||
|
|
||||||
|
set(LIBRARIES fmt::fmt ${LIBRARIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
add_executable(novus
|
add_executable(novus
|
||||||
src/main.cpp
|
src/main.cpp
|
||||||
|
@ -16,4 +36,21 @@ add_executable(novus
|
||||||
target_include_directories(novus
|
target_include_directories(novus
|
||||||
PUBLIC
|
PUBLIC
|
||||||
include)
|
include)
|
||||||
target_link_libraries(novus PUBLIC libxiv fmt::fmt z Qt5::Core Qt5::Widgets)
|
target_link_libraries(novus PUBLIC libxiv ${LIBRARIES} Qt5::Core Qt5::Widgets)
|
||||||
|
|
||||||
|
install(TARGETS novus
|
||||||
|
DESTINATION "${INSTALL_BIN_PATH}")
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
get_target_property(QMAKE_EXE Qt5::qmake IMPORTED_LOCATION)
|
||||||
|
get_filename_component(QT_BIN_DIR "${QMAKE_EXE}" DIRECTORY)
|
||||||
|
|
||||||
|
find_program(WINDEPLOYQT_ENV_SETUP qtenv2.bat HINTS "${QT_BIN_DIR}")
|
||||||
|
find_program(WINDEPLOYQT_EXECUTABLE windeployqt HINTS "${QT_BIN_DIR}")
|
||||||
|
|
||||||
|
# Run windeployqt immediately after build
|
||||||
|
add_custom_command(TARGET novus
|
||||||
|
POST_BUILD
|
||||||
|
COMMAND "${WINDEPLOYQT_ENV_SETUP}" && "${WINDEPLOYQT_EXECUTABLE}" \"$<TARGET_FILE:novus>\"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
Loading…
Add table
Reference in a new issue