Skip to content

Commit

Permalink
Consolidate all find_package calls into drake_find_packages()
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamie Snape committed Oct 6, 2017
1 parent 812f30c commit 5e86b21
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 36 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ drake_add_external(tinyobjloader
-DTINYOBJLOADER_COMPILATION_SHARED=ON
)

drake_add_external(drake LOCAL MATLAB PYTHON
drake_add_external(drake LOCAL
SOURCE_DIR ${PROJECT_SOURCE_DIR}/drake
BINARY_DIR ${PROJECT_BINARY_DIR}/drake
CMAKE_ARGS -DDISABLE_MATLAB:BOOL=${DISABLE_MATLAB}
Expand Down
17 changes: 0 additions & 17 deletions cmake/config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@ function(drake_check_compiler NAME VERSION)
endif()
endfunction()

#------------------------------------------------------------------------------
# Find MATLAB.
#------------------------------------------------------------------------------
macro(drake_setup_matlab)
find_package(Matlab MODULE REQUIRED
COMPONENTS MAIN_PROGRAM MEX_COMPILER MX_LIBRARY)
endmacro()

#------------------------------------------------------------------------------
# Verify minimum required compiler version and set compile options.
#------------------------------------------------------------------------------
Expand All @@ -49,13 +41,6 @@ macro(drake_setup_compiler)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endmacro()

#------------------------------------------------------------------------------
# Set up Python.
#------------------------------------------------------------------------------
macro(drake_setup_python)
find_package(Python 2.7 MODULE REQUIRED)
endmacro()

#------------------------------------------------------------------------------
# Add local CMake modules to CMake search path.
#------------------------------------------------------------------------------
Expand Down Expand Up @@ -101,8 +86,6 @@ macro(drake_setup_platform)
list(REMOVE_DUPLICATES CMAKE_INSTALL_RPATH)

drake_setup_compiler()
drake_setup_matlab()
drake_setup_python()

# Set default build type
if(NOT CMAKE_BUILD_TYPE)
Expand Down
15 changes: 0 additions & 15 deletions cmake/externals.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,6 @@ macro(drake_add_cmake_external PROJECT)
CMAKE_INSTALL_RPATH
CMAKE_INSTALL_RPATH_USE_LINK_PATH)

if(_ext_MATLAB)
list(APPEND _ext_PROPAGATE_CACHE_VARS
Matlab_ROOT_DIR
MATLAB_ADDITIONAL_VERSIONS)
endif()

if(_ext_PYTHON)
list(APPEND _ext_PROPAGATE_CACHE_VARS
PYTHON_EXECUTABLE
PYTHON_INCLUDE_DIR
PYTHON_LIBRARY)
endif()

drake_build_cache_args(_ext_PROPAGATE_CACHE ${_ext_LIST_SEPARATOR}
${_ext_PROPAGATE_CACHE_VARS})

Expand Down Expand Up @@ -127,8 +114,6 @@ function(drake_add_external PROJECT)
# Parse arguments
set(_ext_flags
LOCAL
MATLAB
PYTHON
)
set(_ext_sv_args
SOURCE_SUBDIR
Expand Down
7 changes: 7 additions & 0 deletions cmake/packages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
# Find external packages.
#------------------------------------------------------------------------------
macro(drake_find_packages)
find_package(Matlab MODULE REQUIRED
COMPONENTS MAIN_PROGRAM MEX_COMPILER MX_LIBRARY)
find_package(Python 2.7 MODULE REQUIRED)

find_package(Doxygen MODULE)
find_package(Threads MODULE REQUIRED)

find_package(Eigen3 CONFIG REQUIRED)
set_property(TARGET Eigen3::Eigen APPEND PROPERTY
INTERFACE_COMPILE_DEFINITIONS EIGEN_MPL2_ONLY) # Per #4065.
Expand Down
3 changes: 0 additions & 3 deletions drake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ option(LONG_RUNNING_TESTS "some tests should be run nightly for coverage, but ar

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

find_package(Doxygen MODULE)
find_package(Threads MODULE REQUIRED)

# This makes all of our #include "drake/..." statements work.
include_directories(BEFORE ${PROJECT_SOURCE_DIR}/..)

Expand Down

0 comments on commit 5e86b21

Please sign in to comment.