|
| 1 | +qt_standard_project_setup() |
| 2 | +qt_add_executable(cesium-gui gui.cpp) |
| 3 | +set_target_properties(cesium-gui PROPERTIES |
| 4 | + WIN32_EXECUTABLE ON |
| 5 | + MACOSX_BUNDLE ON |
| 6 | +) |
| 7 | +# set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT cesium-gui) |
| 8 | + |
| 9 | +# Set output directory to build/bin |
| 10 | +set_target_properties(cesium-gui PROPERTIES |
| 11 | + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" |
| 12 | + # RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/bin" |
| 13 | + # RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/bin" |
| 14 | +) |
| 15 | + |
| 16 | +# Compiler warnings (all platforms) |
| 17 | +target_compile_options(cesium-gui PRIVATE -Wall -Wextra -Wpedantic) |
| 18 | + |
| 19 | +# Platform-specific settings |
| 20 | +if(WIN32) |
| 21 | + target_compile_definitions(cesium-gui PRIVATE |
| 22 | + _WIN32_WINNT=0x0601 |
| 23 | + WIN32_LEAN_AND_MEAN |
| 24 | + ) |
| 25 | +elseif(APPLE) |
| 26 | + # macOS-specific settings |
| 27 | +elseif(UNIX) |
| 28 | + # Linux-specific settings |
| 29 | +endif() |
| 30 | + |
| 31 | +# Clang-specific flags |
| 32 | +if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") |
| 33 | + target_compile_options(cesium-gui PRIVATE -Wno-unused-parameter) |
| 34 | + # Fix lld-link warning about multiple entry points |
| 35 | + if(WIN32) |
| 36 | + target_link_options(cesium-gui PRIVATE -Xlinker /ENTRY:wWinMainCRTStartup) |
| 37 | + endif() |
| 38 | +endif() |
| 39 | + |
| 40 | +target_link_libraries(cesium-gui |
| 41 | + PRIVATE |
| 42 | + ${CMAKE_DL_LIBS} # For dlopen/dlsym on Unix systems |
| 43 | + Qt6::Core |
| 44 | + Qt6::Widgets |
| 45 | +) |
| 46 | + |
| 47 | +# Deploy Qt libraries after build (for debug/development) |
| 48 | +if(WIN32) |
| 49 | + set(TMP_DEPLOY_TOOL windeployqt) |
| 50 | +elseif(APPLE) |
| 51 | + set(TMP_DEPLOY_TOOL macdeployqt) |
| 52 | +endif() |
| 53 | +set(DEPLOY_TOOL "$<TARGET_NAME_IF_EXISTS:Qt6::${TMP_DEPLOY_TOOL}>") |
| 54 | +set(DEPLOY_TOOL_FALLBACK ${TMP_DEPLOY_TOOL}) |
| 55 | + |
| 56 | +if(WIN32 OR APPLE) |
| 57 | + add_custom_command(TARGET cesium-gui POST_BUILD |
| 58 | + COMMAND $<IF:$<BOOL:${DEPLOY_TOOL}>,$<TARGET_FILE:${DEPLOY_TOOL}>,${DEPLOY_TOOL_FALLBACK}> |
| 59 | + --debug --no-translations $<TARGET_FILE:cesium-gui> |
| 60 | + COMMENT "Deploying Qt application" |
| 61 | + ) |
| 62 | +endif() |
| 63 | + |
| 64 | +# Installation rules |
| 65 | +install(TARGETS cesium-gui |
| 66 | + RUNTIME DESTINATION bin |
| 67 | + LIBRARY DESTINATION lib |
| 68 | + ARCHIVE DESTINATION lib |
| 69 | +) |
| 70 | + |
| 71 | +# add_subdirectory(src) |
| 72 | +# add_subdirectory(include) |
0 commit comments