Skip to content

Commit

Permalink
System libs for glog and ceres
Browse files Browse the repository at this point in the history
  • Loading branch information
YakoYakoYokuYoku committed Jul 23, 2022
1 parent 82c58de commit f48b7d0
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 10 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ project(Natron

set(CMAKE_CXX_STANDARD 11)

option(NATRON_SYSTEM_LIBS "use system versions of dependencies instead of bundled ones" OFF)
option(NATRON_BUILD_TESTS "build the Natron test suite" ON)

find_package(Boost COMPONENTS headers serialization)
Expand All @@ -44,6 +45,11 @@ set(QTWIDGETS_INCLUDE_DIRS ${Qt5Widgets_INCLUDE_DIRS})

find_package(expat REQUIRED)

if(NATRON_SYSTEM_LIBS)
find_package(glog)
find_package(Ceres)
endif()

if(UNIX AND NOT APPLE)
find_package(ECM NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_MODULE_PATH})
Expand Down
10 changes: 7 additions & 3 deletions libs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@
# along with Natron. If not, see <http://www.gnu.org/licenses/gpl-2.0.html>
# ***** END LICENSE BLOCK *****

add_subdirectory(gflags)
add_subdirectory(glog)
if(NOT glog_FOUND)
add_subdirectory(gflags)
add_subdirectory(glog)
endif()
add_subdirectory(hoedown)
add_subdirectory(libtess)
add_subdirectory(ceres)
if(NOT Ceres_FOUND)
add_subdirectory(ceres)
endif()
add_subdirectory(libmv)
add_subdirectory(openMVG)
add_subdirectory(qhttpserver)
3 changes: 2 additions & 1 deletion libs/ceres/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -258,5 +258,6 @@ target_compile_definitions(ceres
CERES_STD_UNORDERED_MAP
CERES_STD_SHARED_PTR
)
target_link_libraries(ceres PUBLIC glog)
target_link_libraries(ceres PUBLIC glog::glog)
set_target_properties(ceres PROPERTIES POSITION_INDEPENDENT_CODE ON)
add_library(Ceres::ceres ALIAS ceres)
9 changes: 5 additions & 4 deletions libs/glog/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,12 @@ else()
)
endif()
add_library(glog STATIC ${glog_HEADERS} ${glog_SOURCES})
target_include_directories(glog PUBLIC src)
target_compile_definitions(glog PUBLIC GOOGLE_GLOG_DLL_DECL=)
target_include_directories(glog src)
target_compile_definitions(glog GOOGLE_GLOG_DLL_DECL=)
if(WINDOWS)
target_include_directories(glog PUBLIC src/windows)
target_compile_definitions(glog PUBLIC GLOG_NO_ABBREVIATED_SEVERITIES)
target_include_directories(APPEND glog src/windows)
target_compile_definitions(APPEND glog GLOG_NO_ABBREVIATED_SEVERITIES)
endif()
target_link_libraries(glog PUBLIC gflags)
set_target_properties(glog PROPERTIES POSITION_INDEPENDENT_CODE ON)
add_library(glog::glog ALIAS glog)
2 changes: 1 addition & 1 deletion libs/libmv/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,5 @@ if(MSVC)
target_include_directories(mv PUBLIC third_party/msinttypes)
endif()
target_compile_definitions(mv PUBLIC LIBMV_NO_FAST_DETECTOR=)
target_link_libraries(mv PUBLIC ceres)
target_link_libraries(mv PUBLIC Ceres::ceres)
set_target_properties(mv PROPERTIES POSITION_INDEPENDENT_CODE ON)
2 changes: 1 addition & 1 deletion libs/openMVG/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -172,5 +172,5 @@ target_compile_definitions(openMVG
OPENMVG_STD_UNORDERED_MAP
OPENMVG_STD_SHARED_PTR
)
target_link_libraries(openMVG PUBLIC ceres)
target_link_libraries(openMVG PUBLIC Ceres::ceres)
set_target_properties(openMVG PROPERTIES POSITION_INDEPENDENT_CODE ON)

0 comments on commit f48b7d0

Please sign in to comment.