Cleaned up the build

This commit is contained in:
Efi Fogel 2024-01-08 17:19:35 +02:00
parent 13b22abd4f
commit a086c3b8a5
2 changed files with 62 additions and 72 deletions

View File

@ -1,3 +1,5 @@
# This is the CMake script for compiling a CGAL application.
cmake_minimum_required(VERSION 3.1...3.23) cmake_minimum_required(VERSION 3.1...3.23)
project(earth LANGUAGES CXX) project(earth LANGUAGES CXX)
@ -10,58 +12,53 @@ if(POLICY CMP0071)
cmake_policy(SET CMP0071 NEW) cmake_policy(SET CMP0071 NEW)
endif() endif()
# if(NOT DEFINED INSTALL_EXAMPLESDIR)
# set(INSTALL_EXAMPLESDIR "examples")
# endif()
# set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/opengl/earth")
# CGAL and its components
find_package(CGAL QUIET COMPONENTS)
if (NOT CGAL_FOUND)
message(STATUS "This project requires the CGAL library, and will not be compiled.")
return()
endif()
find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL OpenGLWidgets Widgets Xml) find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL OpenGLWidgets Widgets Xml)
add_definitions(-DQT_NO_VERSION_TAGGING) find_package(CGAL COMPONENTS Qt6)
# Boost and its components
find_package(Boost REQUIRED) find_package(Boost REQUIRED)
if (NOT Boost_FOUND) if (NOT CGAL_FOUND OR NOT CGAL_Qt6_FOUND OR NOT Qt6_FOUND OR NOT Boost_FOUND)
message(STATUS "This project requires the Boost library, and will not be compiled.") if (NOT CGAL_FOUND)
set(MISSING_DEPS "the CGAL library, ${MISSING_DEPS}")
endif()
if (NOT CGAL_Qt6_FOUND)
set(MISSING_DEPS "the CGAL Qt6 component, ${MISSING_DEPS}")
endif()
if (NOT CGAL_Qt6_FOUND)
set(MISSING_DEPS "the Qt6 library, ${MISSING_DEPS}")
endif()
if (NOT CGAL_Boost_FOUND)
set(MISSING_DEPS "the Boost library, ${MISSING_DEPS}")
endif()
message(STATUS "This project requires ${MISSING_DEPS} and will not be compiled.")
return() return()
endif() endif()
################################################################################ ################################################################################
include(FetchContent) include(FetchContent)
FetchContent_Declare(json URL https://github.com/nlohmann/json/releases/download/v3.11.2/json.tar.xz) FetchContent_Declare(json
GIT_REPOSITORY https://github.com/nlohmann/json
GIT_TAG v3.11.3)
FetchContent_MakeAvailable(json) FetchContent_MakeAvailable(json)
# find_package(nlohmann_json 3.2.0 REQUIRED) # find_package(nlohmann_json 3.2.0 REQUIRED)
################################################################################ ################################################################################
add_definitions(-DQT_NO_VERSION_TAGGING)
# AOS # AOS
file(GLOB source_files_aos file(GLOB source_files_aos Aos.h Aos.cpp Aos_defs.h
Aos.h Aos.cpp Aos_triangulator.h Aos_triangulator.cpp)
Aos_defs.h
Aos_triangulator.h Aos_triangulator.cpp
)
source_group("Aos" FILES ${source_files_aos}) source_group("Aos" FILES ${source_files_aos})
# GIS # GIS
file(GLOB source_files_gis file(GLOB source_files_gis Kml_reader.h Kml_reader.cpp)
Kml_reader.h Kml_reader.cpp
)
source_group("GIS" FILES ${source_files_gis}) source_group("GIS" FILES ${source_files_gis})
# GRAPHICS # GRAPHICS
file(GLOB source_files_graphics file(GLOB source_files_graphics Camera.h Camera.cpp
Camera.h Camera.cpp Shader_program.h Shader_program.cpp)
Shader_program.h Shader_program.cpp source_group("Graphics" FILES ${source_files_graphics})
)
source_group( "Graphics" FILES ${source_files_graphics} )
# GRAPHICS-GEOMETRY (Graphics-related) # GRAPHICS-GEOMETRY (Graphics-related)
file(GLOB source_files_graphics_geometry file(GLOB source_files_graphics_geometry
Line_strips.h Line_strips.cpp Line_strips.h Line_strips.cpp
@ -69,8 +66,7 @@ file(GLOB source_files_graphics_geometry
Sphere.h Sphere.cpp Sphere.h Sphere.cpp
Triangles.h Triangles.cpp Triangles.h Triangles.cpp
Vertices.h Vertices.cpp Vertices.h Vertices.cpp
World_coordinate_axes.h World_coordinate_axes.cpp World_coordinate_axes.h World_coordinate_axes.cpp)
)
source_group("Graphics_Geometry" FILES ${source_files_graphics_geometry}) source_group("Graphics_Geometry" FILES ${source_files_graphics_geometry})
# GUI # GUI
@ -80,20 +76,15 @@ file(GLOB source_files_gui
Camera_manip_rot_bpa.h Camera_manip_rot_bpa.cpp Camera_manip_rot_bpa.h Camera_manip_rot_bpa.cpp
Camera_manip_zoom.h Camera_manip_zoom.cpp Camera_manip_zoom.h Camera_manip_zoom.cpp
GUI_country_pick_handler.h GUI_country_pick_handler.cpp GUI_country_pick_handler.h GUI_country_pick_handler.cpp
GUI_event_handler.h GUI_event_handler.cpp GUI_event_handler.h GUI_event_handler.cpp)
)
source_group("GUI" FILES ${source_files_gui}) source_group("GUI" FILES ${source_files_gui})
#SOURCE FILES (NOT CATEGORIZED YET) #SOURCE FILES (NOT CATEGORIZED YET)
file(GLOB source_files file(GLOB source_files Common_defs.h earth.cpp Timer.h
Common_defs.h
main.cpp
Main_widget.h Main_widget.cpp Main_widget.h Main_widget.cpp
Message_manager.h Message_manager.cpp Message_manager.h Message_manager.cpp
Timer.h
Tools.h Tools.cpp Tools.h Tools.cpp
Verification.h Verification.cpp Verification.h Verification.cpp)
)
source_group("Source Files" FILES ${source_files}) source_group("Source Files" FILES ${source_files})
qt_standard_project_setup() qt_standard_project_setup()
@ -124,8 +115,7 @@ target_link_libraries(earth PRIVATE
Qt6::Widgets Qt6::Widgets
Qt6::Xml Qt6::Xml
CGAL::CGAL CGAL::CGAL
nlohmann_json::nlohmann_json nlohmann_json::nlohmann_json)
)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/shaders file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/shaders
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) DESTINATION ${CMAKE_CURRENT_BINARY_DIR})