-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Feature/add cmake support #187
Closed
jakesylvestre
wants to merge
6
commits into
cameron314:master
from
xplorfin:feature/add-cmake-support
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e7170af
Added top level CMakeLists.txt and tests CMakeLists.txt
1276a65
tests/CMakeLists.txt added tests
a150265
Added install cmake file to interface library
93be8ef
Move include to include/concurrentqueue and adapt makefiles
5306607
CMakeLists.txt: changed C11 to C++11
b6621bf
Merge branch 'feature/add-cmake-support' of https://github.com/kobi-c…
jakesylvestre File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
cmake_minimum_required(VERSION 3.13) | ||
project(concurrentqueue VERSION 0.1 LANGUAGES CXX) | ||
|
||
set(CMAKE_CXX_STANDARD 11) | ||
set(THREADS_PREFER_PTHREAD_FLAG ON) | ||
find_package(Threads REQUIRED) | ||
|
||
enable_testing() | ||
|
||
add_library(concurrentqueue INTERFACE) | ||
|
||
# -Wall -pedantic-errors -Wpedantic -Wconversion -fno-elide-constructors | ||
target_compile_options(concurrentqueue INTERFACE -Wall -pedantic-errors -Wpedantic -Wconversion -fno-elide-constructors) | ||
|
||
target_include_directories(concurrentqueue INTERFACE | ||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> | ||
$<INSTALL_INTERFACE:include> | ||
) | ||
target_link_libraries(concurrentqueue INTERFACE Threads::Threads rt) | ||
|
||
include(CMakePackageConfigHelpers) | ||
write_basic_package_version_file( | ||
"${PROJECT_BINARY_DIR}/concurrentqueueConfigVersion.cmake" | ||
VERSION 0.1 | ||
COMPATIBILITY AnyNewerVersion | ||
) | ||
install(TARGETS concurrentqueue | ||
EXPORT concurrentqueueTargets | ||
LIBRARY DESTINATION lib COMPONENT Runtime | ||
ARCHIVE DESTINATION lib COMPONENT Development | ||
RUNTIME DESTINATION bin COMPONENT Runtime | ||
PUBLIC_HEADER DESTINATION include COMPONENT Development | ||
BUNDLE DESTINATION bin COMPONENT Runtime | ||
) | ||
include(CMakePackageConfigHelpers) | ||
configure_package_config_file( | ||
"${PROJECT_SOURCE_DIR}/cmake/concurrentqueueConfig.cmake.in" | ||
"${PROJECT_BINARY_DIR}/concurrentqueueConfig.cmake" | ||
INSTALL_DESTINATION lib/cmake/concurrentqueue | ||
) | ||
install(EXPORT concurrentqueueTargets DESTINATION lib/cmake/concurrentqueue) | ||
install(FILES "${PROJECT_BINARY_DIR}/concurrentqueueConfigVersion.cmake" | ||
"${PROJECT_BINARY_DIR}/concurrentqueueConfig.cmake" | ||
DESTINATION lib/cmake/concurrentqueue) | ||
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/ DESTINATION include) | ||
|
||
add_subdirectory(tests) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@PACKAGE_INIT@ | ||
|
||
include("${CMAKE_INSTALL_PREFIX}/lib/cmake/concurrentqueue/concurrentqueueTargets.cmake") | ||
check_required_components("@PROJECT_NAME@") |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
set(UNITTESTS_SRC | ||
unittests/unittests.cpp | ||
unittests/mallocmacro.cpp | ||
common/simplethread.cpp | ||
common/systemtime.cpp | ||
) | ||
add_executable(unittests ${UNITTESTS_SRC}) | ||
target_link_libraries(unittests PRIVATE concurrentqueue) | ||
add_test(NAME unittests COMMAND unittests) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
set(FUZZTESTS_SRC | ||
fuzztests/fuzztests.cpp | ||
common/simplethread.cpp | ||
common/systemtime.cpp | ||
) | ||
add_executable(fuzztests ${FUZZTESTS_SRC}) | ||
target_link_libraries(fuzztests PRIVATE concurrentqueue) | ||
add_test(NAME fuzztests COMMAND fuzztests) | ||
|
||
set(LIBTBB_SRC | ||
${concurrentqueue_SOURCE_DIR}/benchmarks/tbb/cache_aligned_allocator.cpp | ||
${concurrentqueue_SOURCE_DIR}/benchmarks/tbb/concurrent_queue.cpp | ||
${concurrentqueue_SOURCE_DIR}/benchmarks/tbb/dynamic_link.cpp | ||
${concurrentqueue_SOURCE_DIR}/benchmarks/tbb/tbb_misc.cpp | ||
) | ||
add_library(libtbb STATIC ${LIBTBB_SRC}) | ||
target_include_directories(libtbb PUBLIC ${concurrentqueue_SOURCE_DIR}/benchmarks/) | ||
set_property(TARGET libtbb PROPERTY POSITION_INDEPENDENT_CODE ON) | ||
|
||
set(BENCHMARKS_SRC | ||
${concurrentqueue_SOURCE_DIR}/benchmarks/benchmarks.cpp | ||
${concurrentqueue_SOURCE_DIR}/benchmarks/cpuid.cpp | ||
common/simplethread.cpp | ||
common/systemtime.cpp | ||
) | ||
add_executable(benchmarks ${BENCHMARKS_SRC}) | ||
target_link_libraries(benchmarks PRIVATE concurrentqueue libtbb) | ||
add_test(NAME benchmarks COMMAND benchmarks) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#define malloc(x) malloc(x) | ||
#define free(x) free(x) | ||
|
||
#include "../../blockingconcurrentqueue.h" | ||
#include "concurrentqueue//blockingconcurrentqueue.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I understand, it doesn't build c_api files as a separated library, so the current approach will have the error like:
Because of that, it's important to add c_api files to
UNITTESTS_SRC
, isn't it? (or add a target to build c_api library)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the c_api contribution existed back then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, okay, in this case it is a necessary to add c_api support to CMake build system.