Skip to content

Commit

Permalink
[build] CMake: disable Java components by default
Browse files Browse the repository at this point in the history
  • Loading branch information
Gold856 committed Aug 16, 2024
1 parent dc25c13 commit 68fee27
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- os: ubuntu-22.04
name: Linux
container: wpilib/roborio-cross-ubuntu:2024-22.04
flags: "-DCMAKE_BUILD_TYPE=Release -DWITH_EXAMPLES=ON"
flags: "-DCMAKE_BUILD_TYPE=Release -DWITH_JAVA=ON -DWITH_EXAMPLES=ON"
- os: macOS-14
name: macOS
container: ""
Expand Down
11 changes: 9 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ endif()

set(WPILIB_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})

include(CMakeDependentOption)
include(CPack)
include(OptionValidation)

Expand Down Expand Up @@ -55,12 +56,18 @@ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

# Options for building certain parts of the repo. Everything is built by default.
option(BUILD_SHARED_LIBS "Build with shared libs (needed for JNI)" ON)
option(WITH_JAVA "Include Java and JNI in the build" ON)
option(WITH_JAVA "Include Java and JNI in the build" OFF)
option(WITH_JAVA_SOURCE "Build Java source jars" ${WITH_JAVA})
option(WITH_CSCORE "Build cscore (needs OpenCV)" ON)
option(WITH_NTCORE "Build ntcore" ON)
option(WITH_WPIMATH "Build wpimath" ON)
option(WITH_WPIUNITS "Build wpiunits" ON)
cmake_dependent_option(
WITH_WPIUNITS
"Build wpiunits"
ON
WITH_JAVA
OFF
)
option(WITH_WPILIB "Build hal, wpilibc/j, and developerRobot (needs OpenCV)" ON)
option(WITH_EXAMPLES "Build examples" OFF)
option(WITH_TESTS "Build unit tests (requires internet connection)" ON)
Expand Down
4 changes: 2 additions & 2 deletions README-CMAKE.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ The following build options are available:
* This option will build C++ examples.
* `WITH_GUI` (ON Default)
* This option will build GUI items. If this is off, and `WITH_SIMULATION_MODULES` is on, the simulation GUI will not be built.
* `WITH_JAVA` (ON Default)
* `WITH_JAVA` (OFF Default)
* This option will enable Java and JNI builds. If this is on, `BUILD_SHARED_LIBS` must be on. Otherwise CMake will error.
* `WITH_JAVA_SOURCE` (`WITH_JAVA` Default)
* This option will build Java source JARs for each enabled Java library. This does not require `WITH_JAVA` to be on, allowing source JARs to be built without the compiled JARs if desired.
Expand All @@ -66,7 +66,7 @@ The following build options are available:
* This option will build the HAL and wpilibc/j during the build. The HAL is the simulation HAL, unless the external HAL options are used. The CMake build has no capability to build for the roboRIO.
* `WITH_WPIMATH` (ON Default)
* This option will build the wpimath library. This option must be on to build wpilib.
* `WITH_WPIUNITS` (ON Default)
* `WITH_WPIUNITS` (`WITH_JAVA` Default)
* This option will build the wpiunits library. This option must be on to build the Java wpimath library and requires `WITH_JAVA` to also be on.
* `OPENCV_JAVA_INSTALL_DIR`
* Set this option to the location of the archive of the OpenCV Java bindings (it should be called opencv-xxx.jar, with the x'es being version numbers). NOTE: set it to the LOCATION of the file, not the file itself!
Expand Down

0 comments on commit 68fee27

Please sign in to comment.