Files
allwpilib/wpigui/CMakeLists.txt
Gold856 bf75c03218 [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
2024-07-11 16:01:05 -06:00

49 lines
1.4 KiB
CMake

project(wpigui)
include(CompileWarnings)
include(LinkMacOSGUI)
file(GLOB wpigui_src src/main/native/cpp/*.cpp)
file(GLOB wpigui_windows_src src/main/native/directx11/*.cpp)
file(GLOB wpigui_mac_src src/main/native/metal/*.mm)
file(GLOB wpigui_unix_src src/main/native/opengl3/*.cpp)
if(MSVC)
add_library(wpigui STATIC ${wpigui_src})
else()
add_library(wpigui ${wpigui_src})
endif()
set_target_properties(wpigui PROPERTIES DEBUG_POSTFIX "d")
set_property(TARGET wpigui PROPERTY POSITION_INDEPENDENT_CODE ON)
set_property(TARGET wpigui PROPERTY FOLDER "libraries")
wpilib_target_warnings(wpigui)
target_link_libraries(wpigui PUBLIC imgui)
target_include_directories(
wpigui
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/main/native/include>
$<INSTALL_INTERFACE:${include_dest}/wpigui>
)
if(MSVC)
target_sources(wpigui PRIVATE ${wpigui_windows_src})
elseif(APPLE)
target_compile_options(wpigui PRIVATE -fobjc-arc)
wpilib_link_macos_gui(wpigui)
target_sources(wpigui PRIVATE ${wpigui_mac_src})
else()
target_sources(wpigui PRIVATE ${wpigui_unix_src})
endif()
add_executable(wpiguidev src/dev/native/cpp/main.cpp)
wpilib_link_macos_gui(wpiguidev)
wpilib_target_warnings(wpiguidev)
target_link_libraries(wpiguidev wpigui)
install(TARGETS wpigui EXPORT wpigui)
export(TARGETS wpigui FILE wpigui.cmake NAMESPACE wpigui::)
install(DIRECTORY src/main/native/include/ DESTINATION "${include_dest}/wpigui")