Skip to content

Commit

Permalink
Use precompiled headers
Browse files Browse the repository at this point in the history
  • Loading branch information
Gold856 committed Jan 8, 2025
1 parent 995bc98 commit 75ccf54
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
7 changes: 7 additions & 0 deletions wpimath/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,13 @@ if(NOT USE_SYSTEM_EIGEN)
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/main/native/thirdparty/eigen/include>
)
file(
GLOB eigen_hdrs
LIST_DIRECTORIES false
src/main/native/thirdparty/eigen/include/Eigen/*
src/main/native/include/frc/geometry/*
)
target_precompile_headers(wpimath PRIVATE ${eigen_hdrs} <chrono>)
else()
find_package(Eigen3 CONFIG REQUIRED)
target_link_libraries(wpimath Eigen3::Eigen)
Expand Down
6 changes: 6 additions & 0 deletions wpimath/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ model {
components {
all {
it.sources.each {
preCompiledHeader "pch.h"
if (it.targetPlatform.operatingSystem.isWindows()) {
it.cppCompiler.args.add("/FI pch.h")
} else {
it.cppCompiler.args.add("-include pch.h")
}
it.exportedHeaders {
srcDirs 'src/main/native/include',
'src/main/native/thirdparty/eigen/include',
Expand Down
24 changes: 24 additions & 0 deletions wpimath/src/main/native/include/pch.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include <frc/geometry/CoordinateAxis.h>
#include <frc/geometry/CoordinateSystem.h>
#include <frc/geometry/Ellipse2d.h>
#include <frc/geometry/Pose2d.h>
#include <frc/geometry/Pose3d.h>
#include <frc/geometry/Quaternion.h>
#include <frc/geometry/Rectangle2d.h>
#include <frc/geometry/Rotation2d.h>
#include <frc/geometry/Rotation3d.h>
#include <frc/geometry/Transform2d.h>
#include <frc/geometry/Transform3d.h>
#include <frc/geometry/Translation2d.h>
#include <frc/geometry/Translation3d.h>
#include <frc/geometry/Twist2d.h>
#include <frc/geometry/Twist3d.h>
#include <frc/estimator/SwerveDrivePoseEstimator.h>
#include <frc/estimator/SwerveDrivePoseEstimator3d.h>
#include <frc/kinematics/SwerveDrivePoseEstimator3d.h>
#include <frc/kinematics/SwerveDriveKinematics.h>
#include <frc/kinematics/SwerveDriveOdometry.h>
#include <frc/kinematics/SwerveDriveOdometry3d.h>

0 comments on commit 75ccf54

Please sign in to comment.