Skip to content

Commit

Permalink
Optimize header includes, use precompiled headers
Browse files Browse the repository at this point in the history
  • Loading branch information
rjonaitis committed Sep 8, 2024
1 parent 172f209 commit 865792b
Show file tree
Hide file tree
Showing 63 changed files with 225 additions and 123 deletions.
30 changes: 29 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ endif()

if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
#enable warnings
add_compile_options(-Wall -Wpedantic)
add_compile_options(-Wall -Wpedantic -ftime-trace)
endif()

if(MSVC)
Expand Down Expand Up @@ -251,6 +251,34 @@ if(APPLE)
set(CMAKE_MACOSX_RPATH ON)
endif()

set(CPP_STL_PCH
<array>
<atomic>
<algorithm>
<cassert>
<chrono>
<cmath>
<cstdint>
<cstring>
<filesystem>
<fstream>
<functional>
<iostream>
<list>
<limits>
<random>
<set>
<string>
<string_view>
<map>
<memory>
<mutex>
<thread>
<unordered_map>
<vector>
<queue>
)

#########################################################################
# externals
#########################################################################
Expand Down
27 changes: 27 additions & 0 deletions GUI/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,34 @@ endif()

include(${wxWidgets_USE_FILE})

set(WXWIDGETS_PCH
<wx/panel.h>
<wx/button.h>
<wx/checkbox.h>
<wx/choice.h>
<wx/combobox.h>
<wx/dialog.h>
<wx/event.h>
<wx/frame.h>
<wx/combobox.h>
<wx/notebook.h>
<wx/msgdlg.h>
<wx/radiobox.h>
<wx/radiobut.h>
<wx/scrolbar.h>
<wx/sizer.h>
<wx/spinctrl.h>
<wx/statbox.h>
<wx/stattext.h>
<wx/string.h>
<wx/textctrl.h>
<wx/timer.h>
)

add_executable(limeGUI resources/resource.rc)
target_precompile_headers(limeGUI
PRIVATE ${CPP_STL_PCH} ${WXWIDGETS_PCH}
)

set(BINARY_OUTPUT_DIR "${CMAKE_BINARY_DIR}/bin")
set_target_properties(limeGUI PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${BINARY_OUTPUT_DIR})
Expand Down
2 changes: 1 addition & 1 deletion GUI/chips/LMS7002M/lms7002_mainPanel.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <assert.h>
#include <cassert>
#include "commonWxHeaders.h"
#include "lms7002_mainPanel.h"
#include "lms7002_pnlAFE_view.h"
Expand Down
2 changes: 1 addition & 1 deletion GUI/chips/LMS7002M/lms7002_pnlRFE_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <wx/msgdlg.h>
#include <map>
#include <vector>
#include <assert.h>
#include <cassert>
#include "lms7002_gui_utilities.h"
#include "numericSlider.h"
#include <tuple>
Expand Down
2 changes: 1 addition & 1 deletion GUI/chips/LMS7002M/lms7002_pnlSX_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <wx/msgdlg.h>
#include <wx/spinctrl.h>
#include <map>
#include <assert.h>
#include <cassert>
#include "numericSlider.h"
#include "lms7002_gui_utilities.h"
#include "events.h"
Expand Down
1 change: 0 additions & 1 deletion GUI/chips/Si5351C/Si5351C_wxgui.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <wx/button.h>
#include <wx/radiobox.h>
#include <string>
#include "limesuiteng/SDRDevice.h"

namespace lime {
class SDRDevice;
Expand Down
1 change: 0 additions & 1 deletion GUI/commonWxHeaders.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <wx/radiobox.h>
#include <wx/radiobut.h>
#include <wx/sizer.h>
#include <wx/button.h>
#include <wx/statbox.h>
#include <wx/checkbox.h>
#include <wx/choice.h>
22 changes: 15 additions & 7 deletions cli/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,38 @@ endif()
# common functionality among cli tools
add_library(cli-shared STATIC common.cpp)
target_include_directories(cli-shared PUBLIC ${CMAKE_CURRENT_LIST_DIR})
target_link_libraries(cli-shared PUBLIC limesuiteng)
target_link_libraries(cli-shared PUBLIC limesuiteng taywee::args)

target_precompile_headers(cli-shared PUBLIC ${CPP_STL_PCH} \"args.hxx\")

add_executable(limeDevice limeDevice.cpp)
set_target_properties(limeDevice PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
target_link_libraries(limeDevice PRIVATE cli-shared taywee::args)
target_link_libraries(limeDevice PRIVATE cli-shared)
target_precompile_headers(limeDevice REUSE_FROM cli-shared)

add_executable(limeSPI limeSPI.cpp)
set_target_properties(limeSPI PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
target_link_libraries(limeSPI PRIVATE cli-shared taywee::args)
target_link_libraries(limeSPI PRIVATE cli-shared)
target_precompile_headers(limeSPI REUSE_FROM cli-shared)

add_executable(limeConfig limeConfig.cpp)
set_target_properties(limeConfig PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
target_link_libraries(limeConfig PRIVATE cli-shared taywee::args)
target_link_libraries(limeConfig PRIVATE cli-shared)
target_precompile_headers(limeConfig REUSE_FROM cli-shared)

add_executable(limeFLASH limeFLASH.cpp)
set_target_properties(limeFLASH PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
target_link_libraries(limeFLASH PRIVATE cli-shared taywee::args)
target_link_libraries(limeFLASH PRIVATE cli-shared)
target_precompile_headers(limeFLASH REUSE_FROM cli-shared)

add_executable(limeTRX limeTRX.cpp)
set_target_properties(limeTRX PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
target_link_libraries(limeTRX PRIVATE cli-shared kissfft taywee::args)
target_link_libraries(limeTRX PRIVATE cli-shared kissfft)
target_precompile_headers(limeTRX REUSE_FROM cli-shared)

add_executable(limeOEM limeOEM.cpp)
set_target_properties(limeOEM PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
target_link_libraries(limeOEM PRIVATE cli-shared taywee::args)
target_link_libraries(limeOEM PRIVATE cli-shared)
target_precompile_headers(limeOEM REUSE_FROM cli-shared)

install(TARGETS limeDevice limeSPI limeFLASH limeTRX limeConfig limeOEM DESTINATION bin)
2 changes: 2 additions & 0 deletions cli/common.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "common.h"

#include "limesuiteng/SDRDevice.h"

using namespace lime;
using namespace std::literals::string_literals;
using namespace std::literals::string_view_literals;
Expand Down
5 changes: 2 additions & 3 deletions cli/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <chrono>
#include <vector>
#include <stdint.h>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <iostream>
Expand All @@ -15,9 +15,8 @@

#include "limesuiteng/DeviceHandle.h"
#include "limesuiteng/DeviceRegistry.h"
#include "limesuiteng/SDRDevice.h"
#include "limesuiteng/SDRDescriptor.h"
#include "limesuiteng/Logger.h"
#include "limesuiteng/SDRDevice.h"

lime::SDRDevice* ConnectToFilteredOrDefaultDevice(const std::string_view argument);

Expand Down
2 changes: 2 additions & 0 deletions cli/limeConfig.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#include "common.h"

#include "limesuiteng/SDRDescriptor.h"
#include "limesuiteng/LMS7002M.h"
#include "limesuiteng/Logger.h"

#include <cassert>
#include <cstring>
#include <string_view>
Expand Down
2 changes: 2 additions & 0 deletions cli/limeDevice.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "common.h"
#include "args.hxx"

#include "limesuiteng/SDRDescriptor.h"

using namespace std;
using namespace lime;
using namespace std::literals::string_literals;
Expand Down
2 changes: 2 additions & 0 deletions cli/limeFLASH.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#include <filesystem>
#include "args.hxx"

#include "limesuiteng/SDRDescriptor.h"

using namespace std;
using namespace lime;

Expand Down
6 changes: 5 additions & 1 deletion cli/limeOEM.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "common.h"

#include "limesuiteng/SDRDescriptor.h"
#include "limesuiteng/OpStatus.h"
#include "OEMTesting.h"

#include <assert.h>
#include <cstring>
#include <sstream>
Expand All @@ -10,6 +12,8 @@
#include "utilities/toString.h"
#include "args.hxx"

#include "OEMTesting.h"

using namespace std;
using namespace lime;
using namespace std::literals::string_literals;
Expand Down
2 changes: 2 additions & 0 deletions cli/limeSPI.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "common.h"

#include "limesuiteng/SDRDescriptor.h"

#include <cassert>
#include <cstring>
#include <filesystem>
Expand Down
3 changes: 3 additions & 0 deletions cli/limeTRX.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#include "common.h"

#include "limesuiteng/SDRDescriptor.h"

#include "limesuiteng/StreamConfig.h"
#include "limesuiteng/StreamComposite.h"
#include <iostream>
Expand Down
1 change: 1 addition & 0 deletions plugins/Soapy_limesuiteng/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include "limesuiteng/DeviceHandle.h"
#include "limesuiteng/Logger.h"
#include "limesuiteng/SDRDevice.h"
#include "limesuiteng/SDRDescriptor.h"
#include "utilities/toString.h"

Expand Down
5 changes: 4 additions & 1 deletion plugins/Soapy_limesuiteng/Soapy_limesuiteng.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <SoapySDR/Device.hpp>

#include "limesuiteng/DeviceRegistry.h"
#include "limesuiteng/SDRDevice.h"
#include "limesuiteng/StreamConfig.h"

#include <array>
Expand All @@ -20,6 +19,10 @@

struct IConnectionStream;

namespace lime {
class SDRDevice;
}

class Soapy_limesuiteng : public SoapySDR::Device
{
public:
Expand Down
1 change: 1 addition & 0 deletions plugins/Soapy_limesuiteng/Streaming.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <ratio>
#include <thread>

#include "limesuiteng/SDRDevice.h"
#include "limesuiteng/Logger.h"

using namespace lime;
Expand Down
1 change: 1 addition & 0 deletions plugins/gr-limesdr/lib/device_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#include "limesuiteng/DeviceRegistry.h"
#include "limesuiteng/VersionInfo.h"
#include "limesuiteng/limesuiteng.hpp"

#include <array>
#include <cmath>
Expand Down
8 changes: 7 additions & 1 deletion plugins/gr-limesdr/lib/device_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#ifndef DEVICE_HANDLER_H
#define DEVICE_HANDLER_H

#include "limesuiteng/limesuiteng.hpp"
#ifdef ENABLE_RFE
#include <limesuiteng/limeRFE.h>
#endif
Expand All @@ -31,6 +30,13 @@
#include <string>
#include <vector>

#include "limesuiteng/StreamConfig.h"

namespace lime {
class SDRDevice;
class DeviceHandle;
} // namespace lime

class device_handler
{
private:
Expand Down
5 changes: 2 additions & 3 deletions plugins/gr-limesdr/lib/logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@

#include "logging.h"

#include <limesuiteng/Logger.h>

#include <gnuradio/logger.h>

#include <cassert>
#include <mutex>

#include "limesuiteng/Logger.h"

static gr::logger_ptr logger;
static gr::logger_ptr debug_logger;

Expand Down
2 changes: 0 additions & 2 deletions plugins/gr-limesdr/lib/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
#ifndef LOGGING_H
#define LOGGING_H

#include <limesuiteng/Logger.h>

#include <gnuradio/logger.h>
#include <fmt/core.h>
#include <fmt/format.h>
Expand Down
7 changes: 5 additions & 2 deletions plugins/gr-limesdr/lib/sink_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@
#include "config.h"
#endif

#include <gnuradio/io_signature.h>
#include <stdexcept>

#include "device_handler.h"
#include "logging.h"
#include "sink_impl.h"
#include <gnuradio/io_signature.h>

#include <stdexcept>
#include "limesuiteng/SDRDevice.h"

using namespace std::literals::string_literals;

Expand Down
5 changes: 3 additions & 2 deletions plugins/gr-limesdr/lib/sink_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
#ifndef INCLUDED_LIMESDR_SINK_IMPL_H
#define INCLUDED_LIMESDR_SINK_IMPL_H

#include "device_handler.h"
#include <limesdr/sink.h>
#include "limesdr/sink.h"
#include "limesuiteng/StreamConfig.h"

#include <array>
#include <string>

Expand Down
8 changes: 6 additions & 2 deletions plugins/gr-limesdr/lib/source_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,15 @@
#include "config.h"
#endif

#include <gnuradio/io_signature.h>
#include <stdexcept>

#include "device_handler.h"
#include "logging.h"
#include "source_impl.h"
#include <gnuradio/io_signature.h>

#include <stdexcept>
#include "limesuiteng/SDRDevice.h"

using namespace std::literals::string_literals;

namespace gr {
Expand Down
Loading

0 comments on commit 865792b

Please sign in to comment.