From 0b075b0276402dd164cf7a703a6038ed85a1522b Mon Sep 17 00:00:00 2001 From: Alison Watson Date: Sat, 8 Jun 2019 23:43:33 -0400 Subject: [PATCH] tycho: move qt sources into source --- CMakeLists.txt | 78 ++++++++++++------ source/{tycho-qt => tycho}/headers/mapprops.h | 0 source/{tycho-qt => tycho}/headers/menu.h | 0 source/{tycho-qt => tycho}/headers/tycho.h | 0 .../resources/color/lines.png | Bin .../resources/color/map.png | Bin .../resources/color/points.png | Bin .../resources/color/polygons.png | Bin .../resources/hc/lines.png | Bin .../{tycho-qt => tycho}/resources/hc/map.png | Bin .../resources/hc/points.png | Bin .../resources/hc/polygons.png | Bin .../resources/misc/tycho1.png | Bin .../resources/misc/tycho2.png | Bin .../resources/resources.qrc | 0 .../resources/sources/icons.psd | Bin .../resources/sources/tycho1.psd | Bin .../resources/sources/tycho2.psd | Bin source/{tycho-qt => tycho}/source/main.cc | 0 source/{tycho-qt => tycho}/source/mapprops.cc | 0 source/{tycho-qt => tycho}/source/menu.cc | 0 source/{tycho-qt => tycho}/ui/about.ui | 0 source/{tycho-qt => tycho}/ui/mapprops.ui | 0 source/{tycho-qt => tycho}/ui/mapview.ui | 0 source/{tycho-qt => tycho}/ui/menu.ui | 0 source/{tycho-qt => tycho}/ui/points.ui | 0 26 files changed, 54 insertions(+), 24 deletions(-) rename source/{tycho-qt => tycho}/headers/mapprops.h (100%) rename source/{tycho-qt => tycho}/headers/menu.h (100%) rename source/{tycho-qt => tycho}/headers/tycho.h (100%) rename source/{tycho-qt => tycho}/resources/color/lines.png (100%) rename source/{tycho-qt => tycho}/resources/color/map.png (100%) rename source/{tycho-qt => tycho}/resources/color/points.png (100%) rename source/{tycho-qt => tycho}/resources/color/polygons.png (100%) rename source/{tycho-qt => tycho}/resources/hc/lines.png (100%) rename source/{tycho-qt => tycho}/resources/hc/map.png (100%) rename source/{tycho-qt => tycho}/resources/hc/points.png (100%) rename source/{tycho-qt => tycho}/resources/hc/polygons.png (100%) rename source/{tycho-qt => tycho}/resources/misc/tycho1.png (100%) rename source/{tycho-qt => tycho}/resources/misc/tycho2.png (100%) rename source/{tycho-qt => tycho}/resources/resources.qrc (100%) rename source/{tycho-qt => tycho}/resources/sources/icons.psd (100%) rename source/{tycho-qt => tycho}/resources/sources/tycho1.psd (100%) rename source/{tycho-qt => tycho}/resources/sources/tycho2.psd (100%) rename source/{tycho-qt => tycho}/source/main.cc (100%) rename source/{tycho-qt => tycho}/source/mapprops.cc (100%) rename source/{tycho-qt => tycho}/source/menu.cc (100%) rename source/{tycho-qt => tycho}/ui/about.ui (100%) rename source/{tycho-qt => tycho}/ui/mapprops.ui (100%) rename source/{tycho-qt => tycho}/ui/mapview.ui (100%) rename source/{tycho-qt => tycho}/ui/menu.ui (100%) rename source/{tycho-qt => tycho}/ui/points.ui (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 738e03a..555ae41 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,44 +1,71 @@ cmake_minimum_required(VERSION 3.14) project(maraiah-tycho CXX) +include(FeatureSummary) + set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) -set(THREADS_PREFER_PTHREAD_FLAG ON) -set(RS_DIR "${CMAKE_BINARY_DIR}/rslib") -set(RS_OUT "${CMAKE_BINARY_DIR}") -set(RS_LIB "${RS_OUT}/libtycho.a") -set(CMAKE_C_FLAGS_DEBUGOPT "-O2 -g") set(CMAKE_CXX_FLAGS_DEBUGOPT "-O2 -g") +set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DQT_QML_DEBUG") + +set(THREADS_PREFER_PTHREAD_FLAG ON) + +set(CARGO_FLAGS) + +if(CMAKE_BUILD_TYPE STREQUAL Release) + set(RUST_TARGET_DIR "release") + set(CARGO_FLAGS "${CARGO_FLAGS} --release") +else() + set(RUST_TARGET_DIR "debug") +endif() + +set(CARGO_TARGET_DIR "${CMAKE_BINARY_DIR}/rust") +set(RUST_LIB "${CARGO_TARGET_DIR}/${RUST_TARGET_DIR}/libtycho.a") find_package(Threads REQUIRED) -find_package(Qt5Widgets CONFIG REQUIRED) +find_package(Qt5 5.6.0 CONFIG REQUIRED COMPONENTS Core Widgets) -add_custom_target( - maraiah-tycho-lib ALL - BYPRODUCTS "${RS_LIB}" - COMMAND cargo build -p maraiah-tycho -Z unstable-options --target-dir "${RS_DIR}" --out-dir "${RS_OUT}" +feature_summary( + WHAT + ALL + INCLUDE_QUIET_PACKAGES + FATAL_ON_MISSING_REQUIRED_PACKAGES +) + +add_custom_command( + OUTPUT "${RUST_LIB}" + COMMAND env CARGO_TARGET_DIR="${CARGO_TARGET_DIR}" cargo build -p maraiah-tycho ${CARGO_FLAGS} WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" COMMENT "Building Rust library" ) +add_custom_target( + test + COMMAND env CARGO_TARGET_DIR="${CARGO_TARGET_DIR}" cargo test + DEPENDS "${RUST_LIB}" + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" +) + +add_custom_target(maraiah-tycho-rust DEPENDS "${RUST_LIB}") + add_executable( maraiah-tycho WIN32 - source/tycho-qt/headers/mapprops.h - source/tycho-qt/headers/menu.h - source/tycho-qt/headers/tycho.h - source/tycho-qt/resources/resources.qrc - source/tycho-qt/source/main.cc - source/tycho-qt/source/mapprops.cc - source/tycho-qt/source/menu.cc - source/tycho-qt/ui/about.ui - source/tycho-qt/ui/mapprops.ui - source/tycho-qt/ui/mapview.ui - source/tycho-qt/ui/menu.ui - source/tycho-qt/ui/points.ui + source/tycho/headers/mapprops.h + source/tycho/headers/menu.h + source/tycho/headers/tycho.h + source/tycho/resources/resources.qrc + source/tycho/source/main.cc + source/tycho/source/mapprops.cc + source/tycho/source/menu.cc + source/tycho/ui/about.ui + source/tycho/ui/mapprops.ui + source/tycho/ui/mapview.ui + source/tycho/ui/menu.ui + source/tycho/ui/points.ui ) set_target_properties( @@ -48,13 +75,16 @@ set_target_properties( CXX_STANDARD_REQUIRED ON ) -target_include_directories(maraiah-tycho PUBLIC source/tycho-qt/headers) +target_include_directories(maraiah-tycho PUBLIC source/tycho/headers) + +add_dependencies(maraiah-tycho maraiah-tycho-rust) target_link_libraries( maraiah-tycho - "${RS_LIB}" + "${RUST_LIB}" Threads::Threads ${CMAKE_DL_LIBS} + Qt5::Core Qt5::Widgets ) diff --git a/source/tycho-qt/headers/mapprops.h b/source/tycho/headers/mapprops.h similarity index 100% rename from source/tycho-qt/headers/mapprops.h rename to source/tycho/headers/mapprops.h diff --git a/source/tycho-qt/headers/menu.h b/source/tycho/headers/menu.h similarity index 100% rename from source/tycho-qt/headers/menu.h rename to source/tycho/headers/menu.h diff --git a/source/tycho-qt/headers/tycho.h b/source/tycho/headers/tycho.h similarity index 100% rename from source/tycho-qt/headers/tycho.h rename to source/tycho/headers/tycho.h diff --git a/source/tycho-qt/resources/color/lines.png b/source/tycho/resources/color/lines.png similarity index 100% rename from source/tycho-qt/resources/color/lines.png rename to source/tycho/resources/color/lines.png diff --git a/source/tycho-qt/resources/color/map.png b/source/tycho/resources/color/map.png similarity index 100% rename from source/tycho-qt/resources/color/map.png rename to source/tycho/resources/color/map.png diff --git a/source/tycho-qt/resources/color/points.png b/source/tycho/resources/color/points.png similarity index 100% rename from source/tycho-qt/resources/color/points.png rename to source/tycho/resources/color/points.png diff --git a/source/tycho-qt/resources/color/polygons.png b/source/tycho/resources/color/polygons.png similarity index 100% rename from source/tycho-qt/resources/color/polygons.png rename to source/tycho/resources/color/polygons.png diff --git a/source/tycho-qt/resources/hc/lines.png b/source/tycho/resources/hc/lines.png similarity index 100% rename from source/tycho-qt/resources/hc/lines.png rename to source/tycho/resources/hc/lines.png diff --git a/source/tycho-qt/resources/hc/map.png b/source/tycho/resources/hc/map.png similarity index 100% rename from source/tycho-qt/resources/hc/map.png rename to source/tycho/resources/hc/map.png diff --git a/source/tycho-qt/resources/hc/points.png b/source/tycho/resources/hc/points.png similarity index 100% rename from source/tycho-qt/resources/hc/points.png rename to source/tycho/resources/hc/points.png diff --git a/source/tycho-qt/resources/hc/polygons.png b/source/tycho/resources/hc/polygons.png similarity index 100% rename from source/tycho-qt/resources/hc/polygons.png rename to source/tycho/resources/hc/polygons.png diff --git a/source/tycho-qt/resources/misc/tycho1.png b/source/tycho/resources/misc/tycho1.png similarity index 100% rename from source/tycho-qt/resources/misc/tycho1.png rename to source/tycho/resources/misc/tycho1.png diff --git a/source/tycho-qt/resources/misc/tycho2.png b/source/tycho/resources/misc/tycho2.png similarity index 100% rename from source/tycho-qt/resources/misc/tycho2.png rename to source/tycho/resources/misc/tycho2.png diff --git a/source/tycho-qt/resources/resources.qrc b/source/tycho/resources/resources.qrc similarity index 100% rename from source/tycho-qt/resources/resources.qrc rename to source/tycho/resources/resources.qrc diff --git a/source/tycho-qt/resources/sources/icons.psd b/source/tycho/resources/sources/icons.psd similarity index 100% rename from source/tycho-qt/resources/sources/icons.psd rename to source/tycho/resources/sources/icons.psd diff --git a/source/tycho-qt/resources/sources/tycho1.psd b/source/tycho/resources/sources/tycho1.psd similarity index 100% rename from source/tycho-qt/resources/sources/tycho1.psd rename to source/tycho/resources/sources/tycho1.psd diff --git a/source/tycho-qt/resources/sources/tycho2.psd b/source/tycho/resources/sources/tycho2.psd similarity index 100% rename from source/tycho-qt/resources/sources/tycho2.psd rename to source/tycho/resources/sources/tycho2.psd diff --git a/source/tycho-qt/source/main.cc b/source/tycho/source/main.cc similarity index 100% rename from source/tycho-qt/source/main.cc rename to source/tycho/source/main.cc diff --git a/source/tycho-qt/source/mapprops.cc b/source/tycho/source/mapprops.cc similarity index 100% rename from source/tycho-qt/source/mapprops.cc rename to source/tycho/source/mapprops.cc diff --git a/source/tycho-qt/source/menu.cc b/source/tycho/source/menu.cc similarity index 100% rename from source/tycho-qt/source/menu.cc rename to source/tycho/source/menu.cc diff --git a/source/tycho-qt/ui/about.ui b/source/tycho/ui/about.ui similarity index 100% rename from source/tycho-qt/ui/about.ui rename to source/tycho/ui/about.ui diff --git a/source/tycho-qt/ui/mapprops.ui b/source/tycho/ui/mapprops.ui similarity index 100% rename from source/tycho-qt/ui/mapprops.ui rename to source/tycho/ui/mapprops.ui diff --git a/source/tycho-qt/ui/mapview.ui b/source/tycho/ui/mapview.ui similarity index 100% rename from source/tycho-qt/ui/mapview.ui rename to source/tycho/ui/mapview.ui diff --git a/source/tycho-qt/ui/menu.ui b/source/tycho/ui/menu.ui similarity index 100% rename from source/tycho-qt/ui/menu.ui rename to source/tycho/ui/menu.ui diff --git a/source/tycho-qt/ui/points.ui b/source/tycho/ui/points.ui similarity index 100% rename from source/tycho-qt/ui/points.ui rename to source/tycho/ui/points.ui