Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .codeql-prebuild-cpp-Linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt-get install -y \
build-essential \
cmake \
ninja-build
ninja-build \
nlohmann-json3-dev

# clean apt cache
sudo apt-get clean
Expand Down
4 changes: 3 additions & 1 deletion .codeql-prebuild-cpp-Windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ pacman --noconfirm -S \
mingw-w64-ucrt-x86_64-binutils \
mingw-w64-ucrt-x86_64-cmake \
mingw-w64-ucrt-x86_64-ninja \
mingw-w64-ucrt-x86_64-toolchain
mingw-w64-ucrt-x86_64-toolchain \
mingw-w64-ucrt-x86_64-boost \
mingw-w64-ucrt-x86_64-nlohmann-json

# build
mkdir -p build
Expand Down
4 changes: 3 additions & 1 deletion .codeql-prebuild-cpp-macOS.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ set -e
# install dependencies
brew install \
cmake \
ninja
ninja \
boost \
nlohmann-json

# build
mkdir -p build
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,17 @@ jobs:
sudo apt-get install -y \
build-essential \
cmake \
ninja-build
ninja-build \
nlohmann-json3-dev

- name: Setup Dependencies macOS
if: runner.os == 'macOS'
run: |
brew install \
cmake \
ninja
ninja \
boost \
nlohmann-json

- name: Setup Dependencies Windows
if: runner.os == 'Windows'
Expand All @@ -62,6 +65,8 @@ jobs:
mingw-w64-ucrt-x86_64-cmake
mingw-w64-ucrt-x86_64-ninja
mingw-w64-ucrt-x86_64-toolchain
mingw-w64-ucrt-x86_64-boost
mingw-w64-ucrt-x86_64-nlohmann-json

- name: Prepare tests
id: prepare-tests
Expand Down
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,3 @@
path = third-party/googletest
url = https://github.com/google/googletest.git
branch = v1.14.x
[submodule "third-party/json"]
path = third-party/json
url = https://github.com/nlohmann/json.git
branch = master
4 changes: 3 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ Install dependencies:
mingw-w64-ucrt-x86_64-binutils \
mingw-w64-ucrt-x86_64-cmake \
mingw-w64-ucrt-x86_64-ninja \
mingw-w64-ucrt-x86_64-toolchain
mingw-w64-ucrt-x86_64-toolchain \
mingw-w64-ucrt-x86_64-boost \
mingw-w64-ucrt-x86_64-nlohmann-json

Build
~~~~~
Expand Down
2 changes: 1 addition & 1 deletion cmake/Boost_DD.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ set(REQUIRED_HEADER_LIBRARIES
uuid
)

find_package(Boost 1.85 QUIET GLOBAL)
find_package(Boost 1.85 CONFIG QUIET GLOBAL)
if(NOT Boost_FOUND)
message(STATUS "Boost v1.85.x package not found in the system. Falling back to FetchContent.")
include(FetchContent)
Expand Down
12 changes: 10 additions & 2 deletions cmake/Json_DD.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ include_guard(GLOBAL)

find_package(nlohmann_json 3.11 QUIET GLOBAL)
if(NOT nlohmann_json_FOUND)
message(STATUS "nlohmann_json v3.11.x package not found in the system. Falling back to submodule.")
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../third-party/json third-party/json)
message(STATUS "nlohmann_json v3.11.x package not found in the system. Falling back to FetchContent.")
include(FetchContent)

FetchContent_Declare(
json
URL https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz
URL_HASH MD5=c23a33f04786d85c29fda8d16b5f0efd
DOWNLOAD_EXTRACT_TIMESTAMP
)
FetchContent_MakeAvailable(json)
endif()
15 changes: 11 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,22 @@ add_subdirectory(common)
if(WIN32)
add_subdirectory(windows)
elseif(APPLE)
add_library(libdisplaydevice_macos_dummy INTERFACE)
add_library(libdisplaydevice::platform ALIAS libdisplaydevice_macos_dummy)
message(WARNING "MacOS is not supported yet.")
elseif(UNIX)
add_library(libdisplaydevice_linux_dummy INTERFACE)
add_library(libdisplaydevice::platform ALIAS libdisplaydevice_linux_dummy)
message(WARNING "Linux is not supported yet.")
else()
message(FATAL_ERROR "Unsupported platform")
endif()

# This is a platform-specific library that loads the correct library for the OS
add_subdirectory(platf)
# Create a target that links to everything
add_library(libdisplaydevice_display_device INTERFACE)
target_link_libraries(libdisplaydevice_display_device INTERFACE
libdisplaydevice::common
libdisplaydevice::platform)

# This is the main library
add_subdirectory(display_device)
# Create an alias for the main target
add_library(libdisplaydevice::display_device ALIAS libdisplaydevice_display_device)
4 changes: 3 additions & 1 deletion src/common/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# A global identifier for the library
set(MODULE libcommon)
set(MODULE libdisplaydevice_common)
set(MODULE_ALIAS libdisplaydevice::common)

# Globing headers (so that they appear in some IDEs) and sources
file(GLOB HEADER_LIST CONFIGURE_DEPENDS "include/display_device/*.h")
Expand All @@ -8,6 +9,7 @@ file(GLOB SOURCE_LIST CONFIGURE_DEPENDS "*.cpp")

# Automatic library - will be static or dynamic based on user setting
add_library(${MODULE} ${HEADER_LIST} ${HEADER_DETAIL_LIST} ${SOURCE_LIST})
add_library(${MODULE_ALIAS} ALIAS ${MODULE})

# Provide the includes together with this library
target_include_directories(${MODULE} PUBLIC include)
Expand Down
15 changes: 0 additions & 15 deletions src/display_device/CMakeLists.txt

This file was deleted.

Empty file.
6 changes: 0 additions & 6 deletions src/display_device/libddplaceholder.cpp

This file was deleted.

26 changes: 0 additions & 26 deletions src/platf/CMakeLists.txt

This file was deleted.

Empty file.
6 changes: 0 additions & 6 deletions src/platf/libplatfplaceholder.cpp

This file was deleted.

6 changes: 4 additions & 2 deletions src/windows/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# A global identifier for the library
set(MODULE libwindows)
set(MODULE libdisplaydevice_windows)
set(MODULE_ALIAS libdisplaydevice::platform)

# Globing headers (so that they appear in some IDEs) and sources
file(GLOB HEADER_LIST CONFIGURE_DEPENDS "include/display_device/windows/*.h")
Expand All @@ -8,6 +9,7 @@ file(GLOB SOURCE_LIST CONFIGURE_DEPENDS "*.cpp")

# Automatic library - will be static or dynamic based on user setting
add_library(${MODULE} ${HEADER_LIST} ${HEADER_DETAIL_LIST} ${SOURCE_LIST})
add_library(${MODULE_ALIAS} ALIAS ${MODULE})

# Provide the includes together with this library
target_include_directories(${MODULE} PUBLIC include)
Expand All @@ -27,6 +29,6 @@ target_link_libraries(${MODULE} PRIVATE
Boost::algorithm
Boost::scope
Boost::uuid
libcommon
libdisplaydevice::common
nlohmann_json::nlohmann_json
setupapi)
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ add_executable(${TEST_BINARY} ${sources})
target_link_libraries(${TEST_BINARY}
PUBLIC
gmock_main # if we use this we don't need our own main function
libdisplaydevice # we are always testing at least the public API so it's safe to always link this
libdisplaydevice::display_device # this target includes common + platform specific targets
libfixtures # these are our fixtures/helpers for the tests
${libraries} # additional libraries if needed
)
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ target_link_libraries(${MODULE}

PRIVATE
gtest
libcommon
libdisplaydevice::common
)
1 change: 0 additions & 1 deletion tests/unit/windows/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
add_dd_test_dir(
ADDITIONAL_LIBRARIES
Boost::scope
libwindows

ADDITIONAL_SOURCES
utils/*.h
Expand Down
1 change: 0 additions & 1 deletion third-party/json
Submodule json deleted from 9cca28