add balancing tool target
This commit is contained in:
@@ -4,6 +4,7 @@ set(TARGET_APP_NAME "${TARGET_BASE_NAME}")
|
||||
set(TARGET_LIB_NAME "${TARGET_BASE_NAME}_lib")
|
||||
set(TARGET_UI_NAME "${TARGET_BASE_NAME}_ui")
|
||||
set(TARGET_TEST_NAME "${TARGET_BASE_NAME}_test")
|
||||
set(TARGET_BALANCING_NAME "${TARGET_BASE_NAME}_balancing")
|
||||
|
||||
set(TARGET_LIB_INCLUDE_DIRS
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/lib"
|
||||
@@ -11,6 +12,7 @@ set(TARGET_LIB_INCLUDE_DIRS
|
||||
)
|
||||
set(TARGET_UI_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/ui")
|
||||
set(TARGET_TEST_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/test")
|
||||
set(TARGET_BALANCING_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/balancing")
|
||||
|
||||
set(SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
|
||||
@@ -188,6 +190,73 @@ unset(HDRS)
|
||||
unset(SRCS)
|
||||
|
||||
|
||||
# ============================================================
|
||||
# balancing — ship balancing tool; depends on lib + QtWidgets
|
||||
# ============================================================
|
||||
|
||||
if (WIN32)
|
||||
COPY_QT_BINARIES("${OUTPUT_ROOT_PATH}/Debug/balancing/" True)
|
||||
COPY_QT_BINARIES("${OUTPUT_ROOT_PATH}/Release/balancing/" False)
|
||||
|
||||
execute_process(
|
||||
COMMAND "cmd.exe" "/k" "rmdir" "${BACKSLASHED_OUTPUT_ROOT_PATH}\\Debug\\balancing\\data" & "mklink" "/d" "/j" "${BACKSLASHED_OUTPUT_ROOT_PATH}\\Debug\\balancing\\data" "${BACKSLASHED_CMAKE_SOURCE_DIR}\\bin\\balancing\\data" & exit
|
||||
COMMAND "cmd.exe" "/k" "rmdir" "${BACKSLASHED_OUTPUT_ROOT_PATH}\\Release\\balancing\\data" & "mklink" "/d" "/j" "${BACKSLASHED_OUTPUT_ROOT_PATH}\\Release\\balancing\\data" "${BACKSLASHED_CMAKE_SOURCE_DIR}\\bin\\balancing\\data" & exit
|
||||
)
|
||||
endif ()
|
||||
|
||||
set(HDRS)
|
||||
set(SRCS)
|
||||
|
||||
add_subdirectory(balancing)
|
||||
|
||||
set(RELATIVE_HDRS)
|
||||
foreach (_file ${HDRS})
|
||||
file(RELATIVE_PATH _relPath "${SRC_DIR}" "${_file}")
|
||||
list(APPEND RELATIVE_HDRS "${_relPath}")
|
||||
endforeach()
|
||||
|
||||
set(RELATIVE_SRCS)
|
||||
foreach (_file ${SRCS})
|
||||
file(RELATIVE_PATH _relPath "${SRC_DIR}" "${_file}")
|
||||
list(APPEND RELATIVE_SRCS "${_relPath}")
|
||||
endforeach()
|
||||
|
||||
add_files(BALANCING_FILES ${RELATIVE_HDRS} ${RELATIVE_SRCS})
|
||||
|
||||
add_executable(${TARGET_BALANCING_NAME} ${BALANCING_FILES})
|
||||
create_source_groups(${BALANCING_FILES})
|
||||
|
||||
foreach (OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})
|
||||
string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG)
|
||||
set_target_properties(${TARGET_BALANCING_NAME} PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} "${OUTPUT_ROOT_PATH}/${OUTPUTCONFIG}/balancing/"
|
||||
)
|
||||
endforeach ()
|
||||
|
||||
set_target_properties(${TARGET_BALANCING_NAME} PROPERTIES
|
||||
AUTOMOC ON
|
||||
CXX_STANDARD 17
|
||||
VS_DEBUGGER_WORKING_DIRECTORY "${OUTPUT_ROOT_PATH}/$(Configuration)/balancing/"
|
||||
)
|
||||
target_include_directories(${TARGET_BALANCING_NAME} PRIVATE
|
||||
"${TARGET_BALANCING_INCLUDE_DIRS}"
|
||||
"${TARGET_LIB_INCLUDE_DIRS}"
|
||||
"${LIB_INCLUDE_PATH}"
|
||||
)
|
||||
target_compile_definitions(${TARGET_BALANCING_NAME} PRIVATE
|
||||
CONFIG_DIR="${CMAKE_SOURCE_DIR}/bin/app/data/config"
|
||||
BALANCING_CONFIG="${CMAKE_SOURCE_DIR}/bin/balancing/data/balancing.toml"
|
||||
TOML_FLOAT_CHARCONV=0
|
||||
)
|
||||
target_link_libraries(${TARGET_BALANCING_NAME} ${TARGET_LIB_NAME} Qt5::Widgets)
|
||||
|
||||
unset(BALANCING_FILES)
|
||||
unset(RELATIVE_HDRS)
|
||||
unset(RELATIVE_SRCS)
|
||||
unset(HDRS)
|
||||
unset(SRCS)
|
||||
|
||||
|
||||
# ============================================================
|
||||
# tests — Catch2 tests; links against lib only (no QtWidgets)
|
||||
# ============================================================
|
||||
@@ -218,3 +287,4 @@ target_link_libraries(${TARGET_TEST_NAME} ${TARGET_LIB_NAME})
|
||||
set(TARGET_LIB_NAME "${TARGET_LIB_NAME}" PARENT_SCOPE)
|
||||
set(TARGET_UI_NAME "${TARGET_UI_NAME}" PARENT_SCOPE)
|
||||
set(TARGET_APP_NAME "${TARGET_APP_NAME}" PARENT_SCOPE)
|
||||
set(TARGET_BALANCING_NAME "${TARGET_BALANCING_NAME}" PARENT_SCOPE)
|
||||
|
||||
Reference in New Issue
Block a user