Skip to content

Commit

Permalink
Merge pull request #3645 from jamiesnape/use-non-pod-snopt
Browse files Browse the repository at this point in the history
Use non-POD snopt
  • Loading branch information
jamiesnape authored Oct 5, 2016
2 parents 75bdcb8 + 2cf2123 commit 232fd58
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 13 deletions.
18 changes: 17 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ drake_add_external(gloptipoly CMAKE)
drake_add_external(gurobi)
drake_add_external(meshconverters PUBLIC CMAKE)
drake_add_external(mosek PUBLIC)
drake_add_external(snopt CMAKE)
drake_add_external(spdlog PUBLIC CMAKE)
drake_add_external(swigmake PUBLIC CMAKE)
drake_add_external(yalmip PUBLIC CMAKE)
Expand Down Expand Up @@ -198,6 +197,23 @@ drake_add_external(nlopt PUBLIC CMAKE
drake_add_external(sedumi CMAKE
CMAKE_ARGS -DMatlab_ROOT_DIR=${MATLAB_ROOT_DIR})

# snopt
if(NOT DISABLE_MATLAB AND matlab)
set(SNOPT_EXTRA_CMAKE_ARGS
-DBUILD_SNOPT_C_MEX=ON
-DMatlab_ROOT_DIR=${MATLAB_ROOT_DIR})
else()
set(SNOPT_EXTRA_CMAKE_ARGS
-DBUILD_SNOPT_C_MEX=OFF)
endif()

drake_add_external(snopt CMAKE
CMAKE_ARGS
-DBUILD_SNOPT_CPP=OFF
-DBUILD_SHARED_LIBS=ON
-DBUILD_TESTING=OFF
${SNOPT_EXTRA_CMAKE_ARGS})

# spotless
drake_add_external(spotless PUBLIC CMAKE
CMAKE_ARGS -DMatlab_ROOT_DIR=${MATLAB_ROOT_DIR})
Expand Down
2 changes: 2 additions & 0 deletions drake/bindings/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ function(drake_add_python_test module_name)
WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/dist-packages)
endfunction()

find_package(snopt_c)

if(snopt_c_FOUND)
drake_add_python_test(pydrake.test.testRBTIK)
drake_add_python_test(pydrake.test.testPR2IK)
Expand Down
2 changes: 2 additions & 0 deletions drake/bindings/swig/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang"
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-maybe-uninitialized")
endif()

find_package(snopt_c)

if(PYTHON_EXECUTABLE)
include(SwigPython)
set(python_install_subdir lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/dist-packages ${CMAKE_CURRENT_SOURCE_DIR}/../python)
Expand Down
2 changes: 2 additions & 0 deletions drake/examples/Pendulum/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ if(lcm_FOUND)
# TODO(sam.creasey) There is currently no non-linear solver on Windows: see
# issues #2352, #2569.
find_package(NLopt)
find_package(snopt_c)

if(ipopt_FOUND OR NLopt_FOUND OR snopt_c_FOUND)
drake_add_test(NAME pendulum_run_swing_up
COMMAND pendulum_run_swing_up --non-realtime)
Expand Down
2 changes: 2 additions & 0 deletions drake/examples/Pendulum/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ if(lcm_FOUND)
# TODO(sam.creasey) There is currently no non-linear solver on Windows: see
# issues #2352, #2569.
find_package(NLopt)
find_package(snopt_c)

if(ipopt_FOUND OR NLopt_FOUND OR snopt_c_FOUND)
drake_add_test(NAME pendulum_trajectory_optimization_test
COMMAND pendulum_trajectory_optimization_test)
Expand Down
5 changes: 3 additions & 2 deletions drake/matlab/solvers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ endif()
add_mex(lqrmex lqrmex.cpp)
target_link_libraries(lqrmex drakeUtil)

pods_find_pkg_config(snopt_c)
find_package(snopt_c)

if(snopt_c_FOUND)
add_mex(NonlinearProgramSnoptmex NonlinearProgramSnoptmex.cpp)
pods_use_pkg_config_packages(NonlinearProgramSnoptmex snopt_c)
target_link_libraries(NonlinearProgramSnoptmex snopt_c)

# These warnings are not worth fixing.
target_compile_options(NonlinearProgramSnoptmex PRIVATE
Expand Down
4 changes: 2 additions & 2 deletions drake/solvers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ if(dreal_FOUND)
else()
list(APPEND optimization_files no_dreal.cc)
endif()
pods_find_pkg_config(snopt_c)
find_package(snopt_c)
if(snopt_c_FOUND)
list(APPEND optimization_files snopt_solver.cc)
else()
Expand Down Expand Up @@ -97,7 +97,7 @@ if(dreal_FOUND)
pods_use_pkg_config_packages(drakeOptimization dreal)
endif()
if(snopt_c_FOUND)
pods_use_pkg_config_packages(drakeOptimization snopt_c)
target_link_libraries(drakeOptimization snopt_c)
endif()
if(gurobi_FOUND)
pods_use_pkg_config_packages(drakeOptimization gurobi)
Expand Down
2 changes: 2 additions & 0 deletions drake/solvers/trajectoryOptimization/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ target_link_libraries(trajectory_optimization_test drakeTrajectoryOptimization
# TODO(Lucy-tri) There is currently no non-linear solver on Windows: see
# issues #2352, #2569.
find_package(NLopt)
find_package(snopt_c)

if(ipopt_FOUND OR NLopt_FOUND OR snopt_c_FOUND)
drake_add_test(NAME trajectory_optimization_test COMMAND
trajectory_optimization_test)
Expand Down
4 changes: 3 additions & 1 deletion drake/systems/plants/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pods_install_pkg_config_file(drake-rbm
VERSION 0.0.1)

pods_find_pkg_config(gurobi)
pods_find_pkg_config(snopt_c)

add_subdirectory(shapes)
add_subdirectory(collision)
add_subdirectory(constraint)
Expand Down Expand Up @@ -173,6 +173,8 @@ if(MATLAB_FOUND)
target_compile_options(${ARGV} PRIVATE ${CXX_FLAGS_NO_SIGN_COMPARE})
endmacro()

find_package(snopt_c)

if(snopt_c_FOUND)
add_ik_mex(inverseKinmex)
add_ik_mex(inverseKinPointwisemex)
Expand Down
2 changes: 1 addition & 1 deletion drake/systems/plants/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ if(gurobi_FOUND)
add_ik_cpp(testApproximateIK)
endif()

pods_find_pkg_config(snopt_c)
find_package(snopt_c)
pods_find_pkg_config(ipopt)

if(snopt_c_FOUND OR ipopt_FOUND)
Expand Down
8 changes: 3 additions & 5 deletions drake/systems/trajectories/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,19 @@ find_package(Bullet)

if(BULLET_FOUND AND MATLAB_FOUND)
find_package(BLAS)
pods_find_pkg_config(snopt_c)
find_package(snopt_c)

if(BLAS_FOUND AND snopt_c_FOUND)
add_mex(replanFunnels_mex replanFunnels_mex.cpp)
pods_use_pkg_config_packages(replanFunnels_mex snopt_c)
target_include_directories(replanFunnels_mex PRIVATE ${BULLET_INCLUDE_DIRS})
target_link_libraries(replanFunnels_mex drakeMexUtil
target_link_libraries(replanFunnels_mex drakeMexUtil snopt_c
${BLAS_LIBRARIES} ${BULLET_LIBRARIES})
set_property(TARGET replanFunnels_mex APPEND_STRING PROPERTY
LINK_FLAGS "${BLAS_LINKER_FLAGS}")

add_mex(shiftFunnel_snopt_mex shiftFunnel_snopt_mex.cpp)
pods_use_pkg_config_packages(shiftFunnel_snopt_mex snopt_c)
target_include_directories(shiftFunnel_snopt_mex PRIVATE ${BULLET_INCLUDE_DIRS})
target_link_libraries(shiftFunnel_snopt_mex drakeMexUtil
target_link_libraries(shiftFunnel_snopt_mex drakeMexUtil snopt_c
${BLAS_LIBRARIES} ${BULLET_LIBRARIES})
set_property(TARGET shiftFunnel_snopt_mex APPEND_STRING PROPERTY
LINK_FLAGS "${BLAS_LINKER_FLAGS}")
Expand Down
2 changes: 1 addition & 1 deletion externals/snopt
Submodule snopt updated from e9a971 to b51313

0 comments on commit 232fd58

Please sign in to comment.