From 664bbc81eb86ff18b0b7a647ade1d08fb56769cf Mon Sep 17 00:00:00 2001 From: Tyler Lentz Date: Thu, 18 Apr 2024 20:59:48 +0000 Subject: [PATCH] Revert "use unity builds" This reverts commit 6bf4fc7e36fb3fb1ae6f53a194797a20f80d3a6c. --- CMakeLists.txt | 14 +++++--------- protos | 2 +- src/CMakeLists.txt | 4 ---- src/camera/CMakeLists.txt | 12 +----------- src/core/CMakeLists.txt | 5 +---- src/cv/CMakeLists.txt | 11 ++--------- src/network/CMakeLists.txt | 5 +---- src/pathing/CMakeLists.txt | 5 +---- src/ticks/CMakeLists.txt | 5 +---- src/utilities/CMakeLists.txt | 12 +----------- 10 files changed, 14 insertions(+), 61 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 52556362..7c2204d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,11 +11,11 @@ FATAL: In-source builds are not allowed. endif() # enable build caching -# find_program(CCACHE ccache) -# if(CCACHE) -# set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE}) -# set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE}) -# endif(CCACHE) +find_program(CCACHE ccache) +if(CCACHE) + set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE}) + set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE}) +endif(CCACHE) set(CMAKE_CXX_COMPILER g++) set(CMAKE_CXX_STANDARD 20) @@ -100,10 +100,6 @@ add_definitions( -DMAGICKCORE_HDRI_ENABLE=0 ) find_package(ImageMagick COMPONENTS Magick++ REQUIRED) # ============================= -function(set_unity_for_target target_name) - set_target_properties(${target_name} PROPERTIES UNITY_BUILD ON UNITY_BUILD_MODE BATCH UNITY_BUILD_BATCH_SIZE 16 UNITY_BUILD_UNIQUE_ID "MY_UNITY_ID") -endfunction() - # ============================= # obcpp library & executable diff --git a/protos b/protos index c5841043..abe95730 160000 --- a/protos +++ b/protos @@ -1 +1 @@ -Subproject commit c5841043ba805c065997232b5a6ae281873d9969 +Subproject commit abe95730634b146f39fb5127ee96bac511e9cbd5 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c0d1a408..3afe542a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,5 +1,3 @@ -add_library(obcpp_protos STATIC ${PROJECT_SOURCE_DIR}/build/gen_protos/protos/obc.pb.cc) - add_subdirectory(camera) add_subdirectory(core) add_subdirectory(cv) @@ -10,7 +8,6 @@ add_subdirectory(utilities) add_library(obcpp_lib INTERFACE) target_link_libraries(obcpp_lib INTERFACE - obcpp_protos obcpp_camera obcpp_core obcpp_cv @@ -23,7 +20,6 @@ target_link_libraries(obcpp_lib INTERFACE # for use in unit tests add_library(obcpp_lib_mock INTERFACE) target_link_libraries(obcpp_lib_mock INTERFACE - obcpp_protos obcpp_camera obcpp_core obcpp_cv diff --git a/src/camera/CMakeLists.txt b/src/camera/CMakeLists.txt index b3eb637f..f55a1335 100644 --- a/src/camera/CMakeLists.txt +++ b/src/camera/CMakeLists.txt @@ -5,20 +5,10 @@ set(FILES mock.cpp ) -SET(LIB_DEPS - obcpp_protos -) - -add_library(${LIB_NAME} STATIC +add_library(${LIB_NAME} STATIC ${PROJECT_SOURCE_DIR}/build/gen_protos/protos/obc.pb.cc ${FILES} ) -target_link_libraries(${LIB_NAME} PRIVATE - ${LIB_DEPS} -) - -set_unity_for_target(${LIB_NAME}) - target_add_protobuf(${LIB_NAME}) target_add_torch(${LIB_NAME}) # target_add_arena(${LIB_NAME}) # Tyler: currently broken, so we had to comment this out diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 6dd55441..5945142c 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -7,7 +7,6 @@ set(FILES ) set(LIB_DEPS - obcpp_protos obcpp_camera obcpp_cv obcpp_network @@ -16,7 +15,7 @@ set(LIB_DEPS obcpp_utilities ) -add_library(${LIB_NAME} STATIC +add_library(${LIB_NAME} STATIC ${PROJECT_SOURCE_DIR}/build/gen_protos/protos/obc.pb.cc ${FILES} ) @@ -24,8 +23,6 @@ target_link_libraries(${LIB_NAME} PRIVATE ${LIB_DEPS} ) -set_unity_for_target(${LIB_NAME}) - target_add_protobuf(${LIB_NAME}) target_add_torch(${LIB_NAME}) # target_add_arena(${LIB_NAME}) # Tyler: currently broken, so we had to comment this out diff --git a/src/cv/CMakeLists.txt b/src/cv/CMakeLists.txt index d0fd517a..d3a531a1 100644 --- a/src/cv/CMakeLists.txt +++ b/src/cv/CMakeLists.txt @@ -11,21 +11,14 @@ set(FILES utilities.cpp ) -set(LIB_DEPS - obcpp_protos - obcpp_utilities -) - -add_library(${LIB_NAME} STATIC +add_library(${LIB_NAME} STATIC ${PROJECT_SOURCE_DIR}/build/gen_protos/protos/obc.pb.cc ${FILES} ) target_link_libraries(${LIB_NAME} PRIVATE - ${LIB_DEPS} + obcpp_utilities ) -set_unity_for_target(${LIB_NAME}) - target_add_protobuf(${LIB_NAME}) target_add_torch(${LIB_NAME}) # target_add_arena(${LIB_NAME}) # Tyler: currently broken, so we had to comment this out diff --git a/src/network/CMakeLists.txt b/src/network/CMakeLists.txt index 0c10fcee..5cf6e371 100644 --- a/src/network/CMakeLists.txt +++ b/src/network/CMakeLists.txt @@ -19,14 +19,13 @@ set(MOCK_FILES ) set(LIB_DEPS - obcpp_protos obcpp_utilities obcpp_ticks obcpp_core obcpp_pathing ) -add_library(${LIB_NAME} STATIC +add_library(${LIB_NAME} STATIC ${PROJECT_SOURCE_DIR}/build/gen_protos/protos/obc.pb.cc ${FILES} ) @@ -34,8 +33,6 @@ target_link_libraries(${LIB_NAME} PRIVATE ${LIB_DEPS} ) -set_unity_for_target(${LIB_NAME}) - target_add_protobuf(${LIB_NAME}) target_add_torch(${LIB_NAME}) # target_add_arena(${LIB_NAME}) # Tyler: currently broken, so we had to comment this out diff --git a/src/pathing/CMakeLists.txt b/src/pathing/CMakeLists.txt index deeb4f6d..1cf512c1 100644 --- a/src/pathing/CMakeLists.txt +++ b/src/pathing/CMakeLists.txt @@ -9,20 +9,17 @@ set(FILES ) set (LIB_DEPS - obcpp_protos obcpp_core obcpp_network obcpp_utilities ) -add_library(${LIB_NAME} STATIC +add_library(${LIB_NAME} STATIC ${PROJECT_SOURCE_DIR}/build/gen_protos/protos/obc.pb.cc ${FILES} ) target_link_libraries(${LIB_NAME} PRIVATE ${LIB_DEPS}) -set_unity_for_target(${LIB_NAME}) - target_add_protobuf(${LIB_NAME}) target_add_torch(${LIB_NAME}) # target_add_arena(${LIB_NAME}) # Tyler: currently broken, so we had to comment this out diff --git a/src/ticks/CMakeLists.txt b/src/ticks/CMakeLists.txt index b787f7c9..d9994a53 100644 --- a/src/ticks/CMakeLists.txt +++ b/src/ticks/CMakeLists.txt @@ -17,14 +17,13 @@ set(FILES ) set(LIB_DEPS - obcpp_protos obcpp_pathing obcpp_utilities obcpp_core obcpp_network ) -add_library(${LIB_NAME} STATIC +add_library(${LIB_NAME} STATIC ${PROJECT_SOURCE_DIR}/build/gen_protos/protos/obc.pb.cc ${FILES} ) @@ -32,8 +31,6 @@ target_link_libraries(${LIB_NAME} PRIVATE ${LIB_DEPS} ) -set_unity_for_target(${LIB_NAME}) - target_add_protobuf(${LIB_NAME}) target_add_torch(${LIB_NAME}) # target_add_arena(${LIB_NAME}) # Tyler: currently broken, so we had to comment this out diff --git a/src/utilities/CMakeLists.txt b/src/utilities/CMakeLists.txt index b0f0ae57..67ce45af 100644 --- a/src/utilities/CMakeLists.txt +++ b/src/utilities/CMakeLists.txt @@ -8,20 +8,10 @@ SET(FILES rng.cpp ) -SET(LIB_DEPS - obcpp_protos -) - -add_library(${LIB_NAME} STATIC +add_library(${LIB_NAME} STATIC ${PROJECT_SOURCE_DIR}/build/gen_protos/protos/obc.pb.cc ${FILES} ) -target_link_libraries(${LIB_NAME} PRIVATE - ${LIB_DEPS} -) - -set_unity_for_target(${LIB_NAME}) - target_add_protobuf(${LIB_NAME}) target_add_torch(${LIB_NAME}) # target_add_arena(${LIB_NAME}) # Tyler: currently broken, so we had to comment this out