diff --git a/Modules/Numerics/Optimizersv4/include/itkLBFGS2Optimizerv4.h b/Modules/Numerics/Optimizersv4/include/itkLBFGS2Optimizerv4.h index 0d6f509f188..0fff5ef4aea 100644 --- a/Modules/Numerics/Optimizersv4/include/itkLBFGS2Optimizerv4.h +++ b/Modules/Numerics/Optimizersv4/include/itkLBFGS2Optimizerv4.h @@ -22,7 +22,7 @@ #include "ITKOptimizersv4Export.h" #include -#include "lbfgs.h" +#include "itk_lbfgs.h" namespace itk { diff --git a/Modules/ThirdParty/libLBFGS/CMakeLists.txt b/Modules/ThirdParty/libLBFGS/CMakeLists.txt index 4014a511fbb..1d4179167e7 100644 --- a/Modules/ThirdParty/libLBFGS/CMakeLists.txt +++ b/Modules/ThirdParty/libLBFGS/CMakeLists.txt @@ -13,9 +13,14 @@ set(ITKLIBLBFGS_THIRD_PARTY 1) # set(ITKLIBLBFGS_NO_SRC 1) #else() -set(ITKLIBLBFGS_INCLUDE_DIRS ${ITKLIBLBFGS_SOURCE_DIR}/include ) +set(ITKLIBLBFGS_INCLUDE_DIRS ${ITKLIBLBFGS_SOURCE_DIR}/src) set(ITKLIBLBFGS_LIBRARIES itklbfgs) #endif() itk_module_impl() + +install(FILES ${ITKLIBLBFGS_SOURCE_DIR}/src/itk_lbfgs.h + DESTINATION ${ITKLIBLBFGS_INSTALL_INCLUDE_DIR} + COMPONENT Development + ) diff --git a/Modules/ThirdParty/libLBFGS/src/CMakeLists.txt b/Modules/ThirdParty/libLBFGS/src/CMakeLists.txt index 7babdc9462e..390dbcad0a0 100644 --- a/Modules/ThirdParty/libLBFGS/src/CMakeLists.txt +++ b/Modules/ThirdParty/libLBFGS/src/CMakeLists.txt @@ -1,25 +1,7 @@ -ADD_LIBRARY( itklbfgs - lbfgs.c -) - -IF(ITK_LIBRARY_PROPERTIES) - SET_TARGET_PROPERTIES(itklbfgs PROPERTIES ${ITK_LIBRARY_PROPERTIES}) -ENDIF(ITK_LIBRARY_PROPERTIES) - set(ITK3P_INSTALL_EXPORT_NAME "${ITKLIBLBFGS-targets}") set(ITK3P_INSTALL_INCLUDE_DIR "${ITKLIBLBFGS_INSTALL_INCLUDE_DIR}") set(ITK3P_INSTALL_RUNTIME_DIR "${ITKLIBLBFGS_INSTALL_RUNTIME_DIR}") set(ITK3P_INSTALL_LIBRARY_DIR "${ITKLIBLBFGS_INSTALL_LIBRARY_DIR}") set(ITK3P_INSTALL_ARCHIVE_DIR "${ITKLIBLBFGS_INSTALL_ARCHIVE_DIR}") - -IF(UNIX) - TARGET_LINK_LIBRARIES(itklbfgs m) -ENDIF(UNIX) - -INSTALL(TARGETS itklbfgs - EXPORT ${ITK3P_INSTALL_EXPORT_NAME} - RUNTIME DESTINATION ${ITK3P_INSTALL_RUNTIME_DIR} COMPONENT RuntimeLibraries - LIBRARY DESTINATION ${ITK3P_INSTALL_LIBRARY_DIR} COMPONENT RuntimeLibraries - ARCHIVE DESTINATION ${ITK3P_INSTALL_ARCHIVE_DIR} COMPONENT Development) - +add_subdirectory(itklbfgs) itk_module_target(itklbfgs NO_INSTALL) diff --git a/Modules/ThirdParty/libLBFGS/src/itk_lbfgs.h b/Modules/ThirdParty/libLBFGS/src/itk_lbfgs.h new file mode 100644 index 00000000000..3f55150d779 --- /dev/null +++ b/Modules/ThirdParty/libLBFGS/src/itk_lbfgs.h @@ -0,0 +1,27 @@ +/*========================================================================= + * + * Copyright NumFOCUS + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +/*========================================================================= + * Include file to wrap the internal ITK libLBFGS library header + *=========================================================================*/ + +#ifndef itk_lbfgs_h +#define itk_lbfgs_h + +#include + +#endif diff --git a/Modules/ThirdParty/libLBFGS/src/itklbfgs/CMakeLists.txt b/Modules/ThirdParty/libLBFGS/src/itklbfgs/CMakeLists.txt new file mode 100644 index 00000000000..41007f09388 --- /dev/null +++ b/Modules/ThirdParty/libLBFGS/src/itklbfgs/CMakeLists.txt @@ -0,0 +1,20 @@ +add_library(itklbfgs lib/lbfgs.c) +target_include_directories(itklbfgs PRIVATE include) + +if(ITK_LIBRARY_PROPERTIES) + set_target_properties(itklbfgs PROPERTIES ${ITK_LIBRARY_PROPERTIES}) +endif() + +if(UNIX) + target_link_libraries(itklbfgs m) +endif() + +install(TARGETS itklbfgs + EXPORT ${ITK3P_INSTALL_EXPORT_NAME} + RUNTIME DESTINATION ${ITK3P_INSTALL_RUNTIME_DIR} COMPONENT RuntimeLibraries + LIBRARY DESTINATION ${ITK3P_INSTALL_LIBRARY_DIR} COMPONENT RuntimeLibraries + ARCHIVE DESTINATION ${ITK3P_INSTALL_ARCHIVE_DIR} COMPONENT Development) + +install(FILES + ${CMAKE_CURRENT_SOURCE_DIR}/include/lbfgs.h + DESTINATION ${ITK3P_INSTALL_INCLUDE_DIR}/itklbfgs/include)