-
Notifications
You must be signed in to change notification settings - Fork 345
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
CMake Integration #22
Open
waqqas
wants to merge
3
commits into
PlatformLab:master
Choose a base branch
from
waqqas:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
.idea/ | ||
CMakeLists.txt | ||
cmake-build-debug/ | ||
make-all.sh | ||
build/ | ||
|
||
._* |
This file was deleted.
Oops, something went wrong.
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,50 @@ | ||
cmake_minimum_required(VERSION 3.10) | ||
|
||
project(NanoLog VERSION 0.0.1 DESCRIPTION "Nanolog is an extremely performant nanosecond scale logging system for C++ that exposes a simple printf-like API.") | ||
|
||
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules") | ||
|
||
set(CMAKE_CXX_STANDARD 17) | ||
|
||
# pre-requisites | ||
find_package(Threads REQUIRED) | ||
find_package(RT REQUIRED) | ||
|
||
file(GLOB HEADERS ${PROJECT_SOURCE_DIR}/runtime/*.h) | ||
file(GLOB SOURCES ${PROJECT_SOURCE_DIR}/runtime/*.cc ${PROJECT_SOURCE_DIR}/runtime/testHelper/GeneratedCode.cc) | ||
add_library(${PROJECT_NAME} ${SOURCES} ${HEADERS}) | ||
|
||
target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_SOURCE_DIR}/runtime) | ||
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. This should be marked as PUBLIC not PRIVATE to ensure that non standalone builds get the correct include directories. |
||
|
||
set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${PROJECT_VERSION}) | ||
set_target_properties(${PROJECT_NAME} PROPERTIES SOVERSION 1) | ||
set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER "${HEADERS}") | ||
|
||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY) | ||
|
||
option(BUILD_DECOPRESSOR "Build decompressor app" ON) | ||
if(BUILD_DECOPRESSOR) | ||
add_subdirectory(decompressor) | ||
endif() | ||
|
||
option(BUILD_PERF "Build perf app" OFF) | ||
if(BUILD_PERF) | ||
add_subdirectory(perf) | ||
endif() | ||
|
||
option(BUILD_SAMPLE "Build sample app" OFF) | ||
if(BUILD_SAMPLE) | ||
add_subdirectory(sample) | ||
endif() | ||
|
||
option(BUILD_TEST "Build unit tests" ON) | ||
if(BUILD_TEST) | ||
enable_testing () | ||
add_subdirectory(tests) | ||
endif() | ||
|
||
include(GNUInstallDirs) | ||
|
||
install(TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) | ||
install(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig) | ||
|
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,14 @@ | ||
prefix="@CMAKE_INSTALL_PREFIX@" | ||
exec_prefix="@CMAKE_INSTALL_PREFIX@" | ||
libdir="${exec_prefix}/@CMAKE_INSTALL_LIBDIR@" | ||
includedir="${exec_prefix}/@CMAKE_INSTALL_INCLUDEDIR@" | ||
|
||
Name: @PROJECT_NAME@ | ||
Description: @PROJECT_DESCRIPTION@ | ||
URL: https://github.com/PlatformLab/NanoLog.git | ||
Version: @PROJECT_VERSION@ | ||
Requires: @PKGCONF_LIBS_PUB@ | ||
Requires.private: @PKGCONF_REQ_PRIV@ | ||
Cflags: -I"${includedir}" | ||
Libs: -L"${libdir}" -l@PROJECT_NAME@ @CMAKE_THREAD_LIBS_INIT@ @RT_LIBRARIES@ @PKGCONF_LIBS_PUB@ | ||
Libs.private: -L"${libdir}" -l@PROJECT_NAME@ @CMAKE_THREAD_LIBS_INIT@ @RT_LIBRARIES@ @PKGCONF_LIBS_PRIV@ |
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,21 @@ | ||
# Try to find real time libraries | ||
# Once done, this will define | ||
# | ||
# RT_FOUND - system has rt library | ||
# RT_LIBRARIES - rt libraries directory | ||
|
||
include(FindPackageHandleStandardArgs) | ||
|
||
if(RT_LIBRARIES) | ||
set(RT_FIND_QUIETLY TRUE) | ||
else() | ||
find_library( | ||
RT_LIBRARY | ||
NAMES rt | ||
HINTS ${RT_ROOT_DIR} | ||
PATH_SUFFIXES ${LIBRARY_PATH_PREFIX}) | ||
|
||
set(RT_LIBRARIES ${RT_LIBRARY}) | ||
find_package_handle_standard_args(rt DEFAULT_MSG RT_LIBRARY) | ||
mark_as_advanced(RT_LIBRARY) | ||
endif() |
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,10 @@ | ||
project(decompressor) | ||
|
||
file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cc ${CMAKE_SOURCE_DIR}/runtime/testHelper/GeneratedCode.cc) | ||
add_executable(${PROJECT_NAME} ${SOURCES}) | ||
|
||
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/runtime) | ||
target_link_libraries(${PROJECT_NAME} NanoLog) | ||
|
||
include(GNUInstallDirs) | ||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) |
File renamed without changes.
Submodule googletest
deleted from
ecd530
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,9 @@ | ||
project(Perf) | ||
|
||
find_package(Threads REQUIRED) | ||
|
||
file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cc ${CMAKE_CURRENT_SOURCE_DIR}/*.h ${CMAKE_SOURCE_DIR}/runtime/testHelper/GeneratedCode.cc) | ||
add_executable(${PROJECT_NAME} ${SOURCES}) | ||
|
||
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/runtime) | ||
target_link_libraries(${PROJECT_NAME} NanoLog ${CMAKE_THREAD_LIBS_INIT}) |
File renamed without changes.
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,12 @@ | ||
project(sample) | ||
|
||
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules") | ||
|
||
find_package(Threads REQUIRED) | ||
find_package(RT REQUIRED) | ||
|
||
file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cc) | ||
add_executable(${PROJECT_NAME} ${SOURCES}) | ||
|
||
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/runtime) | ||
target_link_libraries(${PROJECT_NAME} NanoLog ${CMAKE_THREAD_LIBS_INIT} ${RT_LIBRARIES}) |
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,11 @@ | ||
project(Tests) | ||
|
||
find_package(GTest REQUIRED) | ||
|
||
file(GLOB SOURCES *.cc) | ||
add_executable(${PROJECT_NAME} ${SOURCES}) | ||
|
||
target_link_libraries(${PROJECT_NAME} GTest::GTest GTest::Main NanoLog ${CMAKE_THREAD_LIBS_INIT} ${RT_LIBRARIES}) | ||
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/runtime) | ||
|
||
gtest_discover_tests(${PROJECT_NAME}) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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.
GeneratedCode.cc is not a file that exists in the repo - it has to be generated by the preprocessor script. I don't think this command succeed on a standard check out. @syang0 do you have CI checks enabled on pull requests? I see no checks ran on this PR and I suspect they should be failing.
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.
No, CI checks are only enabled on the main branch. They wouldn't have run anyway for this PR since it substantially changed the build structure and where the executables exist.