tycho: move qt sources into source
|
@ -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
|
||||
)
|
||||
|
||||
|
|
Before Width: | Height: | Size: 805 B After Width: | Height: | Size: 805 B |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 761 B After Width: | Height: | Size: 761 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 343 B After Width: | Height: | Size: 343 B |
Before Width: | Height: | Size: 972 B After Width: | Height: | Size: 972 B |
Before Width: | Height: | Size: 306 B After Width: | Height: | Size: 306 B |
Before Width: | Height: | Size: 673 B After Width: | Height: | Size: 673 B |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |