From 5981d6d6d9c7718b65dab4ebe840efe8557a2ae0 Mon Sep 17 00:00:00 2001 From: robtor Date: Tue, 7 Nov 2023 11:33:16 +0100 Subject: [PATCH] win support --- .gitmodules | 3 +++ CMakeLists.txt | 12 +++++++----- task1/CMakeLists.txt | 13 +++++++------ third-party/fmt | 1 + toolchains/win.cmake | 11 +++++++++++ 5 files changed, 29 insertions(+), 11 deletions(-) create mode 100644 .gitmodules create mode 160000 third-party/fmt create mode 100644 toolchains/win.cmake diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..4c15fff --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "third-party/fmt"] + path = third-party/fmt + url = https://github.com/fmtlib/fmt.git diff --git a/CMakeLists.txt b/CMakeLists.txt index d3d97c7..c285173 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,13 +2,15 @@ cmake_minimum_required(VERSION 3.0) project(task1) set(CMAKE_CXX_STANDARD 20) -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTORCC ON) -set(CMAKE_AUTOUIC ON) +#set(CMAKE_AUTOMOC ON) +#set(CMAKE_AUTORCC ON) +#set(CMAKE_AUTOUIC ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) +set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/installed) + if (${CMAKE_BUILD_TYPE} STREQUAL "Release") - set(CMAKE_) + #set(CMAKE_) add_compile_options( -Wall -Wpedantic @@ -19,5 +21,5 @@ if (${CMAKE_BUILD_TYPE} STREQUAL "Release") NDEBUG) endif () - +add_subdirectory(third-party/fmt) add_subdirectory(task1) \ No newline at end of file diff --git a/task1/CMakeLists.txt b/task1/CMakeLists.txt index e86bafc..58a6e6d 100644 --- a/task1/CMakeLists.txt +++ b/task1/CMakeLists.txt @@ -1,7 +1,5 @@ -find_package(Qt6 COMPONENTS Core REQUIRED) -find_package(fmt) - find_package(Python3 COMPONENTS Interpreter REQUIRED) +find_package(fmt) add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/dataset.dat DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/dataset-gen.py @@ -22,8 +20,11 @@ add_executable(task1_7 main.cpp mergesort.h mergesort_mt.h) -target_link_libraries(task1_7 - fmt::fmt - Qt::Core) +target_link_libraries(task1_7 PRIVATE +fmt::fmt) + + +install(TARGETS task1_7 DESTINATION bin) +install(IMPORTED_RUNTIME_ARTIFACTS task1_7 DESTINATION bin) add_dependencies(task1_7 task1_7_dataset) diff --git a/third-party/fmt b/third-party/fmt new file mode 160000 index 0000000..050d41e --- /dev/null +++ b/third-party/fmt @@ -0,0 +1 @@ +Subproject commit 050d41e85760ea7d21de1d4d9fae16219365aa8e diff --git a/toolchains/win.cmake b/toolchains/win.cmake new file mode 100644 index 0000000..88812d4 --- /dev/null +++ b/toolchains/win.cmake @@ -0,0 +1,11 @@ +set(CMAKE_SYSTEM_NAME Windows) + +set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc) +set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++) + +#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mwindows -march=x86_64-w64") + +set(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32) +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)