-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
129 additions
and
1 deletion.
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,69 @@ | ||
#/* CMakeLists.txt */ | ||
#/* Project builder */ | ||
|
||
PROJECT(pba) | ||
|
||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8) | ||
|
||
IF(COMMAND CMAKE_POLICY) | ||
CMAKE_POLICY(SET CMP0016 NEW) | ||
ENDIF(COMMAND CMAKE_POLICY) | ||
|
||
SET(CMAKE_SKIP_BUILD_RPATH TRUE) | ||
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) | ||
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE) | ||
|
||
SET(CMAKE_MODULE_PATH "cmake/;${CMAKE_MODULE_PATH}") | ||
|
||
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) | ||
SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) | ||
|
||
# Set a default build type if none was specified | ||
IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) | ||
MESSAGE(STATUS "Setting build type to 'Release' as none was specified.") | ||
SET(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) | ||
# Set the possible values of build type for cmake-gui | ||
SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" | ||
"MinSizeRel" "RelWithDebInfo") | ||
ENDIF() | ||
|
||
SET(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -O2 -mfpmath=sse -fPIC") | ||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -O2 -mfpmath=sse -fPIC") | ||
|
||
#SET(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -O2 -mfpmath=sse -fPIC -Wno-error=reorder -fpermissive -Wno-narrowing") | ||
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -mfpmath=sse -fPIC -Wno-error=reorder -fpermissive -Wno-narrowing") | ||
|
||
#### | ||
# find threads | ||
find_package(Threads REQUIRED) | ||
IF(CMAKE_USE_PTHREADS_INIT) | ||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread") | ||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread") | ||
ENDIF() | ||
|
||
##### | ||
# find CUDA | ||
FIND_PACKAGE(CUDA QUIET) | ||
|
||
IF(CUDA_FOUND) | ||
ELSE() | ||
ADD_DEFINITIONS(-DPBA_NO_GPU) | ||
ENDIF() | ||
|
||
OPTION(CPUPBA_USE_AVX "USE_AVX" ON) | ||
|
||
if(CPUPBA_USE_AVX) | ||
ADD_DEFINITIONS(-DCPUPBA_USE_AVX) | ||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx") | ||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx") | ||
endif() | ||
|
||
ADD_SUBDIRECTORY(src/pba) | ||
ADD_SUBDIRECTORY(src/driver) | ||
|
||
INSTALL( | ||
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/pba | ||
DESTINATION include/ | ||
COMPONENT headers | ||
FILES_MATCHING PATTERN "*.hpp" PATTERN "*.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
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 @@ | ||
# pba | ||
Parralel Bundle Adjustment | ||
|
||
|
||
* This is clean code derived from http://grail.cs.washington.edu/projects/mcba/ (v1.0.5) | ||
|
||
Some Changes: | ||
|
||
- CMake infrastructure. | ||
- Fixed AVX2 for GCC / Linux. | ||
- No compile warns, clean code. |
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,7 @@ | ||
|
||
ADD_EXECUTABLE(pba_driver driver.cpp) | ||
|
||
TARGET_LINK_LIBRARIES(pba_driver pba ${CMAKE_THREAD_LIBS_INIT}) | ||
|
||
INSTALL(TARGETS pba_driver DESTINATION "/usr/bin/") | ||
|
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,37 @@ | ||
|
||
|
||
IF(CUDA_FOUND) | ||
|
||
INCLUDE_DIRECTORIES(${CUDA_INCLUDE_DIRS}) | ||
|
||
CUDA_COMPILE(PROGRAM_CU ProgramCU.cu) | ||
|
||
SET(SRCS pba.cpp | ||
ConfigBA.cpp | ||
CuTexImage.cpp | ||
SparseBundleCPU.cpp | ||
SparseBundleCU.cpp) | ||
|
||
CUDA_ADD_LIBRARY(pba SHARED ${SRCS} ${PROGRAM_CU} ${CUDA_LIBRARY}) | ||
|
||
TARGET_LINK_LIBRARIES(pba ${CMAKE_THREAD_LIBS_INIT}) | ||
|
||
SET_TARGET_PROPERTIES(pba PROPERTIES | ||
SOVERSION 1 | ||
VERSION 1.5.0) | ||
ELSE() | ||
|
||
SET(SRCS pba.cpp | ||
ConfigBA.cpp | ||
SparseBundleCPU.cpp) | ||
|
||
ADD_LIBRARY(pba SHARED ${SRCS}) | ||
|
||
SET_TARGET_PROPERTIES(pba PROPERTIES | ||
SOVERSION 1 | ||
VERSION 1.5.0) | ||
TARGET_LINK_LIBRARIES(pba ${CMAKE_THREAD_LIBS_INIT}) | ||
|
||
ENDIF() | ||
|
||
INSTALL(TARGETS pba DESTINATION "lib${LIB_SUFFIX}") |