Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conan testing #2

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
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
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
**/cmake-build*
**/.idea/
**/cmake-build
**/conan-build
**/.idea
36 changes: 0 additions & 36 deletions ProjectA/CMakeLists.txt

This file was deleted.

10 changes: 0 additions & 10 deletions ProjectA/Component1/CMakeLists.txt

This file was deleted.

70 changes: 0 additions & 70 deletions ProjectA/Component2/CMakeLists.txt

This file was deleted.

9 changes: 0 additions & 9 deletions ProjectA/Component2/Config.cmake.in

This file was deleted.

3 changes: 0 additions & 3 deletions ProjectA/Component2/temp.cpp

This file was deleted.

64 changes: 0 additions & 64 deletions ProjectA/Component3/CMakeLists.txt

This file was deleted.

7 changes: 0 additions & 7 deletions ProjectA/Component3/Config.cmake.in

This file was deleted.

8 changes: 0 additions & 8 deletions ProjectA/Component3/helper.cpp

This file was deleted.

3 changes: 0 additions & 3 deletions ProjectA/Component3/helper.h

This file was deleted.

4 changes: 0 additions & 4 deletions ProjectA/Config.cmake.in

This file was deleted.

29 changes: 29 additions & 0 deletions ProjectARepository/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
cmake_minimum_required(VERSION 3.28)

include(CMakePackageConfigHelpers)

project(ProjectA)

if (NOT CMAKE_TOOLCHAIN_FILE)
# No toolchain used, set global C++ settings
set(CMAKE_CXX_STANDARD 20)
endif ()

find_package(spdlog REQUIRED CONFIG)

add_subdirectory(ProjectA/LayerSupport)
add_subdirectory(ProjectA/LayerApps)

#########################################################################################
## CMake install configuration
#########################################################################################

configure_package_config_file(Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION share/${PROJECT_NAME}
)

install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
DESTINATION share/${PROJECT_NAME}
)
36 changes: 36 additions & 0 deletions ProjectARepository/CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"version": 6,
"configurePresets": [
{
"hidden": true,
"name": "default",
"binaryDir": "cmake-build",
"cacheVariables": {
"CMAKE_PROJECT_TOP_LEVEL_INCLUDES": {
"type": "FILEPATH",
"value": "${sourceDir}/conan_provider.cmake"
}
}
},
{
"name": "linux",
"inherits": "default",
"displayName": "Linux build",
"description": "Default build using Ninja Multi-Config generator",
"generator": "Ninja Multi-Config"
},
{
"name": "windows",
"inherits": "default",
"displayName": "Windows configuration",
"description": "This build is only available on Windows",
"generator": "Visual Studio 16 2019",
"architecture": "Win64",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
}
]
}
4 changes: 4 additions & 0 deletions ProjectARepository/Config.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@PACKAGE_INIT@

include(${CMAKE_CURRENT_LIST_DIR}/LayerSupportTargets.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/LayerAppsTargets.cmake)
15 changes: 15 additions & 0 deletions ProjectARepository/ProjectA/LayerApps/App/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
project(App)

add_executable(${PROJECT_NAME} main.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE ProjectA::LayerA::LibraryComponent)

#########################################################################################
## CMake install configuration
#########################################################################################

install(TARGETS ${PROJECT_NAME}
EXPORT ${ExportName}
ARCHIVE DESTINATION lib/$<CONFIG>
LIBRARY DESTINATION lib/$<CONFIG>
RUNTIME DESTINATION bin/$<CONFIG>
)
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
#include <mutex>
#include <memory>
#include <utility>
#include <ProjectA/LayerSupport/HeaderOnlyComponent/LogSingleton.h>
#include <ProjectA/LayerSupport/LibraryComponent/Library.h>

#include <spdlog/spdlog.h>
#include <spdlog/sinks/stdout_color_sinks.h>

#include <ProjectA/Component2/LogSingleton.h>
#include <thread>

int main() {
std::thread t1([] {
Expand Down Expand Up @@ -35,8 +31,17 @@ int main() {
a--;
}
});
std::thread t4([] {
int a = 100;
while (a >= 0) {
simpleLog("Simple log using LibraryComponent");
std::this_thread::sleep_for(std::chrono::milliseconds(1));
a--;
}
});

t1.join();
t2.join();
t3.join();
t4.join();
}
10 changes: 10 additions & 0 deletions ProjectARepository/ProjectA/LayerApps/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
project(LayerApps)
set(ExportName ${PROJECT_NAME}Targets)

add_subdirectory(App)

install(EXPORT ${ExportName}
FILE ${ExportName}.cmake
DESTINATION share/${CMAKE_PROJECT_NAME}
NAMESPACE ${CMAKE_PROJECT_NAME}::${PROJECT_NAME}::
)
11 changes: 11 additions & 0 deletions ProjectARepository/ProjectA/LayerSupport/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
project(LayerSupport)
set(ExportName ${PROJECT_NAME}Targets)

add_subdirectory(HeaderOnlyComponent)
add_subdirectory(LibraryComponent)

install(EXPORT ${ExportName}
FILE ${ExportName}.cmake
DESTINATION share/${CMAKE_PROJECT_NAME}
NAMESPACE ${CMAKE_PROJECT_NAME}::${PROJECT_NAME}::
)
Loading