diff --git a/aerodynamic_analysis/CMakeLists.txt b/aerodynamic_analysis/CMakeLists.txt index 6a0eb1ef3e54a8215f261df8984330daa9d73c5e..6d50a46beafc87b17e0f859beee63bd091720449 100644 --- a/aerodynamic_analysis/CMakeLists.txt +++ b/aerodynamic_analysis/CMakeLists.txt @@ -65,6 +65,9 @@ if(BUILD_UNITTEST) add_subdirectory(test) endif() +# Download LiftingLine +add_subdirectory(LiftingLine) + # Add the installation rules install(TARGETS ${MODULE_NAME} DESTINATION ${MODULE_NAME}) install(FILES @@ -75,6 +78,7 @@ install(FILES install( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/LiftingLine DESTINATION ${MODULE_NAME} + PATTERN "*CMakeLists*" EXCLUDE ) # Find and include all dependet libraries if dynamically linked diff --git a/aerodynamic_analysis/LiftingLine/CMakeLists.txt b/aerodynamic_analysis/LiftingLine/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..29c6fd02b49978ef6c80432fdfa1b3b3a48e9abb --- /dev/null +++ b/aerodynamic_analysis/LiftingLine/CMakeLists.txt @@ -0,0 +1,47 @@ +# Set the project name +project(LiftingLine) + +# Check operating system +message(STATUS "Check operating system for Lifting Line download uri -> ${CMAKE_SYSTEM_NAME}") +if(CMAKE_SYSTEM_NAME STREQUAL "Windows") + # set download URL + set(FILE_URL "https://ceras.ilr.rwth-aachen.de/tiki/tiki-download_file.php?fileId=74") + # set output file + set(OUTPUT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/LIFTING_LINE_WINDOWS_64BIT.exe") +else() + # set download URL + set(FILE_URL "https://ceras.ilr.rwth-aachen.de/tiki/tiki-download_file.php?fileId=76") + # set output file + set(OUTPUT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/LIFTING_LINE_LINUX_64BIT") +endif() + +# Check if the file exists +if(NOT EXISTS ${OUTPUT_FILE}) + # Download file + message(STATUS "Downloading Lifting Line ...") + file(DOWNLOAD + ${FILE_URL} + ${OUTPUT_FILE} + SHOW_PROGRESS + STATUS DOWNLOAD_STATUS) + + # Check download status status + list(GET DOWNLOAD_STATUS 0 STATUS_CODE) + list(GET DOWNLOAD_STATUS 1 STATUS_MESSAGE) + + # Print the result of download status + if(STATUS_CODE EQUAL 0) + message(STATUS "File downloaded ${STATUS_MESSAGE} -> ${OUTPUT_FILE}") + + # Update file rights on none windows systems + if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows") + message(STATUS "Changing file rights to --xr--r--") + file(CHMOD ${OUTPUT_FILE} + FILE_PERMISSIONS OWNER_EXECUTE GROUP_READ WORLD_READ) + endif() + else() + message(FATAL_ERROR "Download failed with message: ${STATUS_MESSAGE}") + endif() +else() + message(STATUS "File already exists -> ${OUTPUT_FILE}, skipping download.") +endif()