Replace build system with CMake.
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
build
|
||||||
24
CMakeLists.txt
Normal file
24
CMakeLists.txt
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
cmake_minimum_required (VERSION 3.1.0)
|
||||||
|
project(FMRI CXX)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
|
||||||
|
file(GLOB fmri_SRC
|
||||||
|
"src/*.cpp"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Build without GPU support for quicker development
|
||||||
|
add_definitions(-DCPU_ONLY)
|
||||||
|
|
||||||
|
|
||||||
|
# Locate libraries
|
||||||
|
find_package(OpenCV REQUIRED)
|
||||||
|
find_package(Boost REQUIRED COMPONENTS system)
|
||||||
|
|
||||||
|
add_executable(fmri ${fmri_SRC})
|
||||||
|
|
||||||
|
# Add libraries to link
|
||||||
|
target_link_libraries(fmri ${OpenCV_libs})
|
||||||
|
target_link_libraries(fmri ${Boost_LIBRARIES})
|
||||||
|
# These do not have CMake support, so link manually
|
||||||
|
target_link_libraries(fmri caffe glog)
|
||||||
26
src/Makefile
26
src/Makefile
@@ -1,26 +0,0 @@
|
|||||||
.PHONY: all clean
|
|
||||||
|
|
||||||
# Compilation settings
|
|
||||||
CXXFLAGS=-Wall -Wextra -pedantic -std=c++17 -g -O2 -DCPU_ONLY
|
|
||||||
LDLIBS=-lcaffe -lboost_system -lglog
|
|
||||||
|
|
||||||
|
|
||||||
# Project artifacts
|
|
||||||
_EXE=fmri
|
|
||||||
_OBJECTS=$(patsubst %.cpp, %.o, $(wildcard *.cpp))
|
|
||||||
|
|
||||||
all: fmri
|
|
||||||
|
|
||||||
fmri: $(_OBJECTS)
|
|
||||||
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
$(RM) *.o *.d
|
|
||||||
$(RM) $(_EXE)
|
|
||||||
|
|
||||||
# Automatic header dependency detection
|
|
||||||
%.d: %.cpp
|
|
||||||
$(CXX) $(CXXFLAGS) -MM -MF $@ $<
|
|
||||||
|
|
||||||
_DEPFILES=$(patsubst %.cpp, %.d, $(wildcard *.cpp))
|
|
||||||
-include $(_DEPFILES)
|
|
||||||
Reference in New Issue
Block a user