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

dev: Integrates glog/gflags with FetchContent style. #35

Open
wants to merge 1 commit into
base: master
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
21 changes: 21 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "bin/")
set(CMAKE_FILES_DIRECTORY "build/")

# includes
include(FetchContent)
include_directories(SYSTEM ${PROJECT_SOURCE_DIR})
include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/qmf/third-party/gtest-1.7.0/fused-src)

Expand All @@ -42,6 +43,26 @@ set(SOURCES
${PROJECT_SOURCE_DIR}/qmf/utils/Util.cpp
)

set(FETCHCONTENT_QUIET FALSE)

FetchContent_Declare(
glog
GIT_REPOSITORY https://github.com/google/glog.git
GIT_TAG v0.4.0
GIT_PROGRESS TRUE
)
FetchContent_Declare(glog)
FetchContent_MakeAvailable(glog)

FetchContent_Declare(
gflags
GIT_REPOSITORY https://github.com/gflags/gflags.git
GIT_TAG v2.2.2
GIT_PROGRESS TRUE
)
FetchContent_Declare(gflags)
FetchContent_MakeAvailable(gflags)

add_library(qmf STATIC ${SOURCES})
target_link_libraries(qmf glog gflags lapack)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ QMF requires gcc 5.0+, as it uses the C++14 standard, and CMake version 2.8+. It

To install libraries dependencies:
```
sudo apt-get install libgoogle-glog-dev libgflags-dev liblapack-dev
sudo apt-get install liblapack-dev
```

To build the binaries:
Expand Down
4 changes: 2 additions & 2 deletions qmf/bpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ DEFINE_string(user_factors, "", "filename of user factors");
DEFINE_string(item_factors, "", "filename of item factors");

int main(int argc, char** argv) {
google::SetUsageMessage("bpr");
google::ParseCommandLineFlags(&argc, &argv, true);
gflags::SetUsageMessage("bpr");
gflags::ParseCommandLineFlags(&argc, &argv, true);
google::InitGoogleLogging(argv[0]);
// make glog to log to stderr
FLAGS_logtostderr = 1;
Expand Down
4 changes: 2 additions & 2 deletions qmf/wals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ DEFINE_string(user_factors, "", "filename of user factors");
DEFINE_string(item_factors, "", "filename of item factors");

int main(int argc, char** argv) {
google::SetUsageMessage("wals");
google::ParseCommandLineFlags(&argc, &argv, true);
gflags::SetUsageMessage("wals");
gflags::ParseCommandLineFlags(&argc, &argv, true);
google::InitGoogleLogging(argv[0]);
// make glog to log to stderr
FLAGS_logtostderr = 1;
Expand Down