Merge pull request #1 from lioncash/cmake

CMakeLists: Minor cleanup
This commit is contained in:
Phillip Stephens 2019-08-25 18:27:03 -07:00 committed by GitHub
commit 4a8a8fcbb9
1 changed files with 87 additions and 49 deletions

View File

@ -4,53 +4,99 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOUIC ON)
find_package(Qt5Widgets) find_package(Qt5 COMPONENTS Network Widgets Xml REQUIRED)
find_package(Qt5Network)
find_package(Qt5Xml)
if(APPLE)
set(PLAT_SRCS MacOSSystemVersion.hpp MacOSSystemVersion.mm)
set_source_files_properties(MacOSSystemVersion.mm
PROPERTIES COMPILE_FLAGS -fobjc-arc)
find_library(FOUNDATION_LIBRARY Foundation)
set(PLAT_LIBS ${FOUNDATION_LIBRARY})
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
set(PLAT_LIBS pthread dl)
endif()
if(WIN32)
list(APPEND PLAT_SRCS platforms/win/hecl-gui.rc platforms/win/hecl-gui.manifest)
elseif(APPLE)
list(APPEND PLAT_SRCS platforms/mac/mainicon.icns)
set_source_files_properties(platforms/mac/mainicon.icns PROPERTIES
MACOSX_PACKAGE_LOCATION Resources)
endif()
add_subdirectory(platforms/freedesktop)
declare_qticon_target()
list(APPEND PLAT_SRCS mainicon_qt.cpp)
file(GLOB QUAZIP_SRCS quazip/quazip/*.c quazip/quazip/*.cpp quazip/quazip/*.h) file(GLOB QUAZIP_SRCS quazip/quazip/*.c quazip/quazip/*.cpp quazip/quazip/*.h)
list(REMOVE_ITEM QUAZIP_SRCS list(REMOVE_ITEM QUAZIP_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/quazip/quazip/quagzipfile.cpp ${CMAKE_CURRENT_SOURCE_DIR}/quazip/quazip/quagzipfile.cpp
${CMAKE_CURRENT_SOURCE_DIR}/quazip/quazip/quagzipfile.h) ${CMAKE_CURRENT_SOURCE_DIR}/quazip/quazip/quagzipfile.h
)
if (NOT MSVC) if (NOT MSVC)
set_source_files_properties(${QUAZIP_SRCS} PROPERTIES COMPILE_OPTIONS -Wno-deprecated-declarations) set_source_files_properties(${QUAZIP_SRCS} PROPERTIES COMPILE_OPTIONS -Wno-deprecated-declarations)
endif() endif()
add_executable(hecl-gui WIN32 MACOSX_BUNDLE add_executable(hecl-gui WIN32 MACOSX_BUNDLE
ArgumentEditor.ui ArgumentEditor.cpp ArgumentEditor.hpp ArgumentEditor.cpp
MainWindow.ui MainWindow.hpp MainWindow.cpp ArgumentEditor.hpp
LaunchMenu.hpp LaunchMenu.cpp ArgumentEditor.ui
EscapeSequenceParser.hpp EscapeSequenceParser.cpp Common.cpp
FileDirDialog.hpp ErrorLabel.hpp Common.hpp
SysReqTableView.hpp SysReqTableView.cpp DownloadManager.cpp
VectorISATableView.hpp VectorISATableView.cpp DownloadManager.hpp
VectorISATableModel.hpp VectorISATableModelIntel.hpp ErrorLabel.hpp
FindBlender.hpp FindBlender.cpp EscapeSequenceParser.cpp
DownloadManager.hpp DownloadManager.cpp EscapeSequenceParser.hpp
ExtractZip.hpp ExtractZip.cpp ${QUAZIP_SRCS} ExtractZip.cpp
Common.hpp Common.cpp ${PLAT_SRCS} main.cpp) ExtractZip.hpp
FileDirDialog.hpp
FindBlender.cpp
FindBlender.hpp
LaunchMenu.cpp
LaunchMenu.hpp
MainWindow.cpp
MainWindow.hpp
MainWindow.ui
SysReqTableView.cpp
SysReqTableView.hpp
VectorISATableModel.hpp
VectorISATableModelIntel.hpp
VectorISATableView.cpp
VectorISATableView.hpp
main.cpp
${QUAZIP_SRCS}
)
target_link_libraries(hecl-gui
Qt5::Network
Qt5::Widgets
Qt5::Xml
athena-core
hecl-light
logvisor
xxhash
z
zeus
)
target_include_directories(hecl-gui PRIVATE quazip/quazip)
target_compile_definitions(hecl-gui PRIVATE QUAZIP_STATIC=1)
if(APPLE)
target_sources(hecl-gui PRIVATE
MacOSSystemVersion.hpp
MacOSSystemVersion.mm
)
set_source_files_properties(MacOSSystemVersion.mm
PROPERTIES COMPILE_FLAGS -fobjc-arc
)
find_library(FOUNDATION_LIBRARY Foundation)
target_link_libraries(hecl-gui PRIVATE ${FOUNDATION_LIBRARY})
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
target_link_libraries(hecl-gui PRIVATE
dl
pthread
)
endif()
if(WIN32)
target_sources(hecl-gui PRIVATE
platforms/win/hecl-gui.manifest
platforms/win/hecl-gui.rc
)
elseif(APPLE)
target_sources(hecl-gui PRIVATE platforms/mac/mainicon.icns)
set_source_files_properties(platforms/mac/mainicon.icns PROPERTIES
MACOSX_PACKAGE_LOCATION Resources
)
endif()
add_subdirectory(platforms/freedesktop)
declare_qticon_target()
target_sources(hecl-gui PRIVATE mainicon_qt.cpp)
if(COMMAND add_sanitizers) if(COMMAND add_sanitizers)
add_sanitizers(hecl-gui) add_sanitizers(hecl-gui)
endif() endif()
@ -60,13 +106,5 @@ if (NOT MSVC)
endif() endif()
set_target_properties(hecl-gui PROPERTIES set_target_properties(hecl-gui PROPERTIES
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/platforms/mac/Info.plist") MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/platforms/mac/Info.plist"
)
target_include_directories(hecl-gui PRIVATE quazip/quazip)
target_compile_definitions(hecl-gui PRIVATE QUAZIP_STATIC=1)
target_link_libraries(hecl-gui ${PLAT_LIBS}
${Qt5Widgets_LIBRARIES}
${Qt5Network_LIBRARIES}
${Qt5Xml_LIBRARIES}
hecl-light logvisor zeus athena-core xxhash z)