Skip to content

Commit

Permalink
195 vessel thumbnails (#196)
Browse files Browse the repository at this point in the history
* #195: Moved vessel thumbnails to individual vessel projects. Thumbnails are copied to expected target directory on build and install so they show up in scenario editor. Added some more vessel project for non-code vessel classes.

* #195: some additional abstraction in vessel cmake files.
  • Loading branch information
mschweiger authored Jul 20, 2022
1 parent 1cc1730 commit bc229e3
Show file tree
Hide file tree
Showing 39 changed files with 378 additions and 75 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ set(ORBITER_BINARY_DOC_DIR ${ORBITER_BINARY_ROOT_DIR}/Doc)
set(ORBITER_BINARY_SDK_DIR ${ORBITER_BINARY_ROOT_DIR}/Orbitersdk)

set(ORBITER_INSTALL_ROOT_DIR "Orbiter") # This path is relative to CMAKE_INSTALL_PREFIX
set(ORBITER_INSTALL_MESH_DIR ${ORBITER_INSTALL_ROOT_DIR}/Meshes)
set(ORBITER_INSTALL_MODULE_DIR ${ORBITER_INSTALL_ROOT_DIR}/Modules)
set(ORBITER_INSTALL_CELBODY_DIR ${ORBITER_INSTALL_MODULE_DIR}/Celbody)
set(ORBITER_INSTALL_PLUGIN_DIR ${ORBITER_INSTALL_MODULE_DIR}/Plugin)
Expand Down
50 changes: 31 additions & 19 deletions Src/Vessel/Atlantis/Atlantis/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# Copyright (c) Martin Schweiger
# Licensed under the MIT License

set(VESSEL_NAME Atlantis)
set(INSTALL_SUBDIR Atlantis)

set(MESH_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Meshes)
set(TEXTURE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Textures)
set(CONFIG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Config)
set(THUMBNAIL_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Thumbnail)

add_library(Atlantis SHARED
add_library(${VESSEL_NAME} SHARED
AscentAP.cpp
Atlantis.cpp
PlBayOp.cpp
Expand All @@ -15,19 +19,19 @@ add_library(Atlantis SHARED
${ORBITER_SOURCE_MODULE_DIR}/Common/Dialog/TabDlg.cpp
)

set_target_properties(Atlantis
set_target_properties(${VESSEL_NAME}
PROPERTIES
FOLDER Vessels/Atlantis
FOLDER Vessels/${VESSEL_NAME}
)

target_include_directories(Atlantis
target_include_directories(${VESSEL_NAME}
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC ${ORBITER_SOURCE_SDK_INCLUDE_DIR}
PUBLIC ${ORBITER_SOURCE_MODULE_DIR}
PUBLIC ${CMAKE_CURRENT_BINARY_DIR} # for the dynamically generated header files
)

target_link_libraries(Atlantis
target_link_libraries(${VESSEL_NAME}
${ORBITER_LIB}
${ORBITER_SDK_LIB}
${ORBITER_DLGCTRL_LIB}
Expand All @@ -44,53 +48,61 @@ add_custom_command(OUTPUT meshres_vc.h
COMMAND ${ORBITER_TOOL_MESHC} /I ${MESH_SOURCE_DIR}/AtlantisVC.msh /P _VC /O meshres_vc.h
DEPENDS ${MESH_SOURCE_DIR}/AtlantisVC.msh
)
add_custom_target(Atlantis_Prerequisites
add_custom_target(${VESSEL_NAME}_Prerequisites
DEPENDS meshres.h meshres_vc.h
)
add_dependencies(Atlantis_Prerequisites
add_dependencies(${VESSEL_NAME}_Prerequisites
meshc
)

add_custom_command(
TARGET Atlantis PRE_BUILD
TARGET ${VESSEL_NAME} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CONFIG_SOURCE_DIR}/ ${CMAKE_BINARY_DIR}/Config/Vessels
)

add_custom_command(
TARGET Atlantis PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${MESH_SOURCE_DIR}/ ${CMAKE_BINARY_DIR}/Meshes/Atlantis
TARGET ${VESSEL_NAME} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${MESH_SOURCE_DIR}/ ${ORBITER_BINARY_MESH_DIR}/${INSTALL_SUBDIR}
)

add_custom_command(
TARGET Atlantis PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${TEXTURE_SOURCE_DIR}/ ${ORBITER_BINARY_TEXTURES_DIR}/Atlantis
TARGET ${VESSEL_NAME} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${TEXTURE_SOURCE_DIR}/ ${ORBITER_BINARY_TEXTURES_DIR}/${INSTALL_SUBDIR}
)

add_dependencies(Atlantis
add_custom_command(
TARGET ${VESSEL_NAME} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${THUMBNAIL_SOURCE_DIR}/ ${CMAKE_BINARY_DIR}/Images/Vessels/Default
)

add_dependencies(${VESSEL_NAME}
${OrbiterTgt}
Orbitersdk
DlgCtrl
Atlantis_SRB
Atlantis_Tank
Atlantis_Prerequisites
${VESSEL_NAME}_Prerequisites
)

set_target_properties(Atlantis_Prerequisites
set_target_properties(${VESSEL_NAME}_Prerequisites
PROPERTIES
FOLDER Vessels/Atlantis
FOLDER Vessels/${VESSEL_NAME}
)

# Installation
install(TARGETS Atlantis
install(TARGETS ${VESSEL_NAME}
RUNTIME
DESTINATION ${ORBITER_INSTALL_MODULE_DIR}
)
install(DIRECTORY ${CONFIG_SOURCE_DIR}/
DESTINATION ${ORBITER_INSTALL_ROOT_DIR}/Config/Vessels
)
install(DIRECTORY ${MESH_SOURCE_DIR}/
DESTINATION ${ORBITER_INSTALL_ROOT_DIR}/Meshes/Atlantis
DESTINATION ${ORBITER_INSTALL_MESH_DIR}/${INSTALL_SUBDIR}
)
install(DIRECTORY ${TEXTURE_SOURCE_DIR}/
DESTINATION ${ORBITER_INSTALL_TEXTURES_DIR}/Atlantis
DESTINATION ${ORBITER_INSTALL_TEXTURES_DIR}/${INSTALL_SUBDIR}
)
install(DIRECTORY ${THUMBNAIL_SOURCE_DIR}/
DESTINATION ${ORBITER_INSTALL_ROOT_DIR}/Images/Vessels/Default
)
File renamed without changes.
50 changes: 31 additions & 19 deletions Src/Vessel/Atlantis/Atlantis_SRB/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
# Copyright (c) Martin Schweiger
# Licensed under the MIT License

set(VESSEL_NAME Atlantis_SRB)
set(INSTALL_SUBDIR Atlantis)

set(MESH_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Meshes)
set(TEXTURE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Textures)
set(CONFIG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Config)
set(THUMBNAIL_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Thumbnail)

add_library(Atlantis_SRB SHARED
add_library(${VESSEL_NAME} SHARED
Atlantis_SRB.cpp
../Common.cpp
)

set_target_properties(Atlantis_SRB
set_target_properties(${VESSEL_NAME}
PROPERTIES
FOLDER Vessels/Atlantis_SRB
FOLDER Vessels/${VESSEL_NAME}
)

target_include_directories(Atlantis_SRB
target_include_directories(${VESSEL_NAME}
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../Atlantis
PUBLIC ${ORBITER_SOURCE_SDK_INCLUDE_DIR}
PUBLIC ${CMAKE_CURRENT_BINARY_DIR} # for the dynamically generated header files
)

target_link_libraries(Atlantis_SRB
target_link_libraries(${VESSEL_NAME}
${ORBITER_LIB}
${ORBITER_SDK_LIB}
)
Expand All @@ -31,50 +35,58 @@ add_custom_command(OUTPUT meshres.h
COMMAND ${ORBITER_TOOL_MESHC} /I ${MESH_SOURCE_DIR}/Atlantis_SRB.msh /P - /O meshres.h
DEPENDS ${MESH_SOURCE_DIR}/Atlantis_SRB.msh
)
add_custom_target(Atlantis_SRB_Prerequisites
add_custom_target(${VESSEL_NAME}_Prerequisites
DEPENDS meshres.h
)
add_dependencies(Atlantis_SRB_Prerequisites
add_dependencies(${VESSEL_NAME}_Prerequisites
meshc
)

add_custom_command(
TARGET Atlantis_SRB PRE_BUILD
TARGET ${VESSEL_NAME} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CONFIG_SOURCE_DIR}/ ${CMAKE_BINARY_DIR}/Config/Vessels
)

add_custom_command(
TARGET Atlantis_SRB PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${MESH_SOURCE_DIR}/ ${CMAKE_BINARY_DIR}/Meshes/Atlantis
TARGET ${VESSEL_NAME} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${MESH_SOURCE_DIR}/ ${ORBITER_BINARY_MESH_DIR}/${INSTALL_SUBDIR}
)

add_custom_command(
TARGET Atlantis_SRB PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${TEXTURE_SOURCE_DIR}/ ${ORBITER_BINARY_TEXTURES_DIR}/Atlantis
TARGET ${VESSEL_NAME} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${TEXTURE_SOURCE_DIR}/ ${ORBITER_BINARY_TEXTURES_DIR}/${INSTALL_SUBDIR}
)

add_dependencies(Atlantis_SRB
add_custom_command(
TARGET ${VESSEL_NAME} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${THUMBNAIL_SOURCE_DIR}/ ${CMAKE_BINARY_DIR}/Images/Vessels/Default
)

add_dependencies(${VESSEL_NAME}
${OrbiterTgt}
Orbitersdk
Atlantis_SRB_Prerequisites
${VESSEL_NAME}_Prerequisites
)

set_target_properties(Atlantis_SRB_Prerequisites
set_target_properties(${VESSEL_NAME}_Prerequisites
PROPERTIES
FOLDER Vessels/Atlantis_SRB
FOLDER Vessels/${VESSEL_NAME}
)

# Installation
install(TARGETS Atlantis_SRB
install(TARGETS ${VESSEL_NAME}
RUNTIME
DESTINATION ${ORBITER_INSTALL_MODULE_DIR}
)
install(DIRECTORY ${CONFIG_SOURCE_DIR}/
DESTINATION ${ORBITER_INSTALL_ROOT_DIR}/Config/Vessels
)
install(DIRECTORY ${MESH_SOURCE_DIR}/
DESTINATION ${ORBITER_INSTALL_ROOT_DIR}/Meshes/Atlantis
DESTINATION ${ORBITER_INSTALL_MESH_DIR}/${INSTALL_SUBDIR}
)
install(DIRECTORY ${TEXTURE_SOURCE_DIR}/
DESTINATION ${ORBITER_INSTALL_TEXTURES_DIR}/Atlantis
DESTINATION ${ORBITER_INSTALL_TEXTURES_DIR}/${INSTALL_SUBDIR}
)
install(DIRECTORY ${THUMBNAIL_SOURCE_DIR}/
DESTINATION ${ORBITER_INSTALL_ROOT_DIR}/Images/Vessels/Default
)
File renamed without changes.
40 changes: 26 additions & 14 deletions Src/Vessel/Atlantis/Atlantis_Tank/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,61 +1,73 @@
# Copyright (c) Martin Schweiger
# Licensed under the MIT License

set(VESSEL_NAME Atlantis_Tank)
set(INSTALL_SUBDIR Atlantis)

set(MESH_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Meshes)
set(TEXTURE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Textures)
set(CONFIG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Config)
set(THUMBNAIL_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Thumbnail)

add_library(Atlantis_Tank SHARED
add_library(${VESSEL_NAME} SHARED
Atlantis_Tank.cpp
)

set_target_properties(Atlantis_Tank
set_target_properties(${VESSEL_NAME}
PROPERTIES
FOLDER Vessels
FOLDER Vessels/${VESSEL_NAME}
)

target_include_directories(Atlantis_Tank
target_include_directories(${VESSEL_NAME}
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../Atlantis
PUBLIC ${ORBITER_SOURCE_SDK_INCLUDE_DIR}
)

target_link_libraries(Atlantis_Tank
target_link_libraries(${VESSEL_NAME}
${ORBITER_LIB}
${ORBITER_SDK_LIB}
$<TARGET_LINKER_FILE:Atlantis_SRB>
)

add_custom_command(
TARGET Atlantis_Tank PRE_BUILD
TARGET ${VESSEL_NAME} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CONFIG_SOURCE_DIR}/ ${CMAKE_BINARY_DIR}/Config/Vessels
)

add_custom_command(
TARGET Atlantis_Tank PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${MESH_SOURCE_DIR}/ ${CMAKE_BINARY_DIR}/Meshes/Atlantis
TARGET ${VESSEL_NAME} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${MESH_SOURCE_DIR}/ ${ORBITER_BINARY_MESH_DIR}/${INSTALL_SUBDIR}
)

add_custom_command(
TARGET Atlantis_Tank PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${TEXTURE_SOURCE_DIR}/ ${ORBITER_BINARY_TEXTURES_DIR}/Atlantis
TARGET ${VESSEL_NAME} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${TEXTURE_SOURCE_DIR}/ ${ORBITER_BINARY_TEXTURES_DIR}/${INSTALL_SUBDIR}
)

add_dependencies(Atlantis_Tank
add_custom_command(
TARGET ${VESSEL_NAME} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${THUMBNAIL_SOURCE_DIR}/ ${CMAKE_BINARY_DIR}/Images/Vessels/Default
)

add_dependencies(${VESSEL_NAME}
${OrbiterTgt}
Orbitersdk
Atlantis_SRB
)

install(TARGETS Atlantis_Tank
install(TARGETS ${VESSEL_NAME}
RUNTIME
DESTINATION ${ORBITER_INSTALL_MODULE_DIR}
)
install(DIRECTORY ${CONFIG_SOURCE_DIR}/
DESTINATION ${ORBITER_INSTALL_ROOT_DIR}/Config/Vessels
)
install(DIRECTORY ${MESH_SOURCE_DIR}/
DESTINATION ${ORBITER_INSTALL_ROOT_DIR}/Meshes/Atlantis
DESTINATION ${ORBITER_INSTALL_MESH_DIR}/${INSTALL_SUBDIR}
)
install(DIRECTORY ${TEXTURE_SOURCE_DIR}/
DESTINATION ${ORBITER_INSTALL_TEXTURES_DIR}/Atlantis
DESTINATION ${ORBITER_INSTALL_TEXTURES_DIR}/${INSTALL_SUBDIR}
)
install(DIRECTORY ${THUMBNAIL_SOURCE_DIR}/
DESTINATION ${ORBITER_INSTALL_ROOT_DIR}/Images/Vessels/Default
)
File renamed without changes.
3 changes: 3 additions & 0 deletions Src/Vessel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ set(VESSEL_COMMON_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Common)

# The individual vessel projects
add_subdirectory(Atlantis)
add_subdirectory(Carina)
add_subdirectory(DeltaGlider)
add_subdirectory(Dragonfly)
add_subdirectory(HST)
add_subdirectory(ISS)
add_subdirectory(LDEF)
add_subdirectory(Leonardo)
add_subdirectory(MMU)
add_subdirectory(Quadcopter)
add_subdirectory(ScriptVessel)
Expand Down
Loading

0 comments on commit bc229e3

Please sign in to comment.