[build] Clean up CMake files (#6802)

Explicitly list required components when using FindJava and FindJNI
Consolidate find_package calls for Java, JNI, and OpenCV into the root CMakeLists.txt file
Remove references to main_lib_dest
Install missing generated headers
Flatten some if statements
Use LinkMacOSGUI macro instead of hand rolling it
Stop installing OpenCV libraries and an extra ntcorejni library; OpenCV JAR will still be installed to make it easy to use
Only print platform version on Windows
Prevent GUI modules from being built when wpimath is off, which would otherwise cause a build failure
Simplify build configuration checks
Clean up fieldImages JAR creation
Place built JARs in the same subdir as installed JARs
Remove unnecessary JAR includes
Remove extra directories in target_include_directories
Improve CMake docs
This commit is contained in:
Gold856
2024-07-11 18:01:05 -04:00
committed by GitHub
parent 27a2e02b52
commit bf75c03218
21 changed files with 132 additions and 253 deletions

View File

@@ -1,4 +1,5 @@
include(FetchContent)
include(LinkMacOSGUI)
fetchcontent_declare(
glfw3
@@ -82,14 +83,12 @@ endif()
target_compile_definitions(imgui PUBLIC IMGUI_IMPL_OPENGL_LOADER_GL3W)
if(MSVC)
target_sources(imgui PRIVATE ${imgui_SOURCE_DIR}/backends/imgui_impl_dx11.cpp)
elseif(APPLE)
target_compile_options(imgui PRIVATE -fobjc-arc)
wpilib_link_macos_gui(imgui)
target_sources(imgui PRIVATE ${imgui_SOURCE_DIR}/backends/imgui_impl_metal.mm)
else()
if(APPLE)
target_compile_options(imgui PRIVATE -fobjc-arc)
set_target_properties(imgui PROPERTIES LINK_FLAGS "-framework Metal -framework QuartzCore")
target_sources(imgui PRIVATE ${imgui_SOURCE_DIR}/backends/imgui_impl_metal.mm)
else()
#target_sources(imgui PRIVATE ${imgui_SOURCE_DIR}/backends/imgui_impl_opengl3.cpp)
endif()
#target_sources(imgui PRIVATE ${imgui_SOURCE_DIR}/backends/imgui_impl_opengl3.cpp)
endif()
target_link_libraries(imgui PUBLIC glfw)
target_include_directories(