自己编译

This commit is contained in:
张壹 2019-10-21 22:24:25 +08:00
parent 462d3121ee
commit fb98a740ea
27 changed files with 62 additions and 2766 deletions

48
.gitignore vendored
View File

@ -21,49 +21,5 @@
*.app
## Autotools
# http://www.gnu.org/software/automake
Makefile.in
# http://www.gnu.org/software/autoconf
/autom4te.cache
/aclocal.m4
/compile
/configure
/depcomp
/install-sh
/missing
## vim
.*.s[a-w][a-z]
*.un~
Session.vim
.netrwhist
*~
## liblbfgs-specific
INSTALL
Makefile
config.guess
config.h
config.h.in
config.log
config.status
config.sub
lib/.deps
lib/.libs
lib/Makefile
libtool
ltmain.sh
sample/.deps
sample/.libs
sample/sample
sample/Makefile
stamp-h1
build/
.DS_Store

View File

@ -1 +0,0 @@
Naoaki Okazaki <okazaki at chokkan org>

View File

@ -1,241 +1,18 @@
#.rst
# CMake configuration of libLBFGS project
# ---------------------------------------
#
# This CMakeLists.txt defines some libLBFGS specific configuration variables
# using a custom "subproject_define" command defined in the Subproject.cmake module.
# The default values of these variables can be overridden either on the CMake
# command-line using the -D option of the cmake command or in a super-project
# which includes the libLBFGS source tree by setting the LBFGS_<varname>
# CMake variables before adding the libLBFGS source directory via CMake's
# add_subdirectory command. Only when the non-cached variable LBFGS_IS_SUBPROJECT
# has a value equivalent to FALSE, these configuration variables are added to
# the CMake cache so they can be edited in the CMake GUI. By default,
# LBFGS_IS_SUBPROJECT is set to TRUE when the CMAKE_SOURCE_DIR is not identical
# to the directory of this CMakeLists.txt file, i.e., the top-level directory of
# the libLBFGS project source tree.
#
# Example CMakeLists.txt of user project which requires separate libLBFGS
# installation (possibly requires FindLBFGS.cmake module for distribution
# packages of libLBFGS that do not include a LBFGSConfig.cmake file)::
#
# cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
#
# project(Foo)
#
# find_package(LBFGS REQUIRED)
#
# add_executable(foo src/foo.cc)
# target_link_libraries(foo LBFGS::lib)
#
# Example CMakeLists.txt of super-project which contains libLBFGS source tree::
#
# cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
#
# project(Foo)
#
# set(LBFGS_USE_SSE ON)
# set(LBFGS_lib_TARGET_NAME liblbfgs)
# add_subdirectory(lbfgs)
# set_target_properties(liblbfgs PROPERTIES OUTPUT_NAME foolbfgs)
#
# add_executable(foo src/foo.cc)
# target_link_libraries(foo liblbfgs)
# # or use the usual namespaced ALIAS target:
# #target_link_libraries(foo LBFGS::lib)
#
# Variables to configure the source files::
#
# LBFGS_USE_DOUBLE - Enable double precision floating point arithmetics. (default: ON)
# LBFGS_USE_SSE - Enable SSE/SSE2 optimiations. (default: OFF)
# LBFGS_USE_IEEE754 - Enable optimization routines for IEEE754 floating point values. (default: ON)
#
# Variables to configure the build::
#
# LBFGS_BUILD_SHARED_LIBS - Enable build of shared libraries. (default: OFF)
# LBFGS_BUILD_EXAMPLES - Enable build of example programs. (default: OFF)
# LBFGS_<target>_TARGET_NAME - Custom target name for target <target>, i.e., "lib" or "sample".
# By default, the target name is prefixed by "lbfgs_" if this project
# is configured as a subproject of another project.
# LBFGS_NO_ALIASES - Do not add ALIAS targets LBFGS::lib and LBFGS::sample. (default: OFF)
#
# Variables to configure the installation::
#
# LBFGS_INSTALL_STATIC_LIBS - Whether to install static library files.
# Shared libraries are always installed.
# When a library is installed, its public header
# files are installed as well. The default is
# to not install static libraries when this
# project is a subproject of another project.
# LBFGS_INSTALL_HEADERS - Can be used to omit installation of public header files.
# LBFGS_INSTALL_CONFIG - Whether to install CMake configuration files.
# By default, the CMake configuration files are
# installed when the library itself is installed.
# LBFGS_INSTALL_RUNTIME_DIR - Installation directory for runtime files. (default: bin)
# LBFGS_INSTALL_INCLUDE_DIR - Installation directory for public header files. (default: include)
# LBFGS_INSTALL_LIBRARY_DIR - Installation directory for library files. (default: lib)
# LBFGS_INSTALL_CONFIG_DIR - Installation directory for CMake configuration. (default: lib/cmake/liblbfgs)
# ==============================================================================
# libLBFGS: C library of limited-memory BFGS (L-BFGS)
#
# Copyright (c) 1990, Jorge Nocedal
# Copyright (c) 2007-2010, Naoaki Okazaki
#
# libLBFGS is distributed under the term of the MIT license.
# Please refer to COPYING file in the distribution.
# ==============================================================================
# ----------------------------------------------------------------------------
# CMake version and policies
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
if (POLICY CMP0042)
cmake_policy(SET CMP0042 NEW)
endif ()
# ----------------------------------------------------------------------------
# includes
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/Subproject.cmake")
# ----------------------------------------------------------------------------
# package info
subproject(LBFGS VERSION 1.10.0 LANGUAGES C)
set(PACKAGE_NAME "libLBFGS")
set(PACKAGE_STRING "${PACKAGE_NAME} ${PROJECT_VERSION}")
set(PACKAGE_TARNAME "liblbfgs-${PROJECT_VERSION}")
set(PACKAGE_BUGREPORT "https://github.com/chokkan/liblbfgs/issues")
# ----------------------------------------------------------------------------
# options
subproject_define(BOOL BUILD_SHARED_LIBS "Enable build of shared libraries" OFF)
subproject_define(BOOL BUILD_EXAMPLES "Enable build of sample programs" OFF)
subproject_define(BOOL USE_DOUBLE "Use double precision floating point arithmetics" ON)
subproject_define(BOOL USE_SSE "Use SSE/SSE2 instructions for optimization" OFF)
subproject_define(BOOL USE_IEEE754 "Activate optimization routines for IEEE754 floating point values" ON)
subproject_set_property(USE_IEEE754 ADVANCED TRUE)
# ----------------------------------------------------------------------------
# checks for SSE/SSE2 instructions header files
if (USE_SSE)
include(CheckIncludeFile)
if (USE_DOUBLE)
check_include_file(emmintrin.h HAVE_EMMINTRIN_H)
if (NOT HAVE_EMMINTRIN_H)
message(WARNING "SSE2 instructions header file emmintrin.h not found. Disabled SSE optimizations.")
subproject_set_property(USE_SSE VALUE OFF)
endif ()
else ()
check_include_file(xmmintrin.h HAVE_XMMINTRIN_H)
if (NOT HAVE_XMMINTRIN_H)
message(WARNING "SSE instructions header file xmmintrin.h not found. Disabled SSE optimizations.")
subproject_set_property(USE_SSE VALUE OFF)
endif ()
endif ()
endif ()
# ----------------------------------------------------------------------------
# library
set(HEADERS
"include/lbfgs.h"
)
set(SOURCES
"lib/lbfgs.c"
"lib/arithmetic_ansi.h"
"lib/arithmetic_sse_float.h"
"lib/arithmetic_sse_double.h"
)
subproject_add_library(_lib "lib" ${HEADERS} ${SOURCES})
set_target_properties(${_lib} PROPERTIES
OUTPUT_NAME lbfgs
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_SOVERSION}
DEBUG_POSTFIX d
POSITION_INDEPENDENT_CODE TRUE
)
target_include_directories(${_lib}
PUBLIC "$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>"
PRIVATE "${PROJECT_SOURCE_DIR}/lib"
)
if (NOT USE_DOUBLE)
target_compile_definitions(${_lib} INTERFACE LBFGS_FLOAT=32)
endif ()
if (NOT USE_IEEE754)
target_compile_definitions(${_lib} INTERFACE LBFGS_IEEE_FLOAT=0)
endif ()
if (USE_SSE)
if (USE_DOUBLE)
target_compile_definitions(${_lib} PRIVATE HAVE_EMMINTRIN_H=${HAVE_EMMINTRIN_H})
if (MSVC)
target_compile_definitions(${_lib} PRIVATE __SSE2__)
endif ()
else ()
target_compile_definitions(${_lib} PRIVATE HAVE_XMMINTRIN_H=${HAVE_XMMINTRIN_H})
if (MSVC)
target_compile_definitions(${_lib} PRIVATE __SSE__)
endif ()
endif ()
endif ()
if (CMAKE_COMPILER_IS_GNUC)
target_compile_options(${_lib} PRIVATE "$<$<CONFIG:Release>:-ffast-math>")
if (USE_SSE)
if (USE_DOUBLE)
target_compile_options(${_lib} PRIVATE "-msse2")
else ()
target_compile_options(${_lib} PRIVATE "-msse")
endif ()
endif ()
endif ()
subproject_install_library(${_lib}
RUNTIME_DESTINATION "bin"
LIBRARY_DESTINATION "lib"
INCLUDE_DESTINATION "include"
PUBLIC_HEADER_FILES "${HEADERS}"
)
# ----------------------------------------------------------------------------
# examples
if (BUILD_EXAMPLES)
subproject_add_executable(_sample "sample" sample/sample.c)
target_link_libraries(${_sample} ${_lib})
endif ()
# ----------------------------------------------------------------------------
# configuration
include(CMakePackageConfigHelpers)
subproject_get_install_config_dir(PROJECT_INSTALL_CONFIG_DIR)
configure_package_config_file(
"${PROJECT_SOURCE_DIR}/cmake/Config.cmake.in"
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION "${PROJECT_INSTALL_CONFIG_DIR}"
NO_SET_AND_CHECK_MACRO
NO_CHECK_REQUIRED_COMPONENTS_MACRO
)
write_basic_package_version_file(
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)
subproject_install_config_files(
FILES
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION
"${PROJECT_INSTALL_CONFIG_DIR}"
)
subproject_export(TARGETS ${_lib})
subproject_install_exports(DESTINATION "${PROJECT_INSTALL_CONFIG_DIR}")
cmake_minimum_required(VERSION 3.15.2)
# cxx
# 使
set(CMAKE_CXX_COMPILER /usr/local/bin/g++-9)
#
project(LIBLBFGS VERSION 1.1.0 LANGUAGES CXX)
#
set(CMAKE_INSTALL_PREFIX /usr/local)
#
option(LCG_FABS "use lcg's fabs" ON)
option(LCG_OPENMP "use openmp" ON)
# cmake
configure_file(
"${PROJECT_SOURCE_DIR}/config.h.in"
"${PROJECT_SOURCE_DIR}/src/lib/config.h"
)
#
add_subdirectory(src/)

22
COPYING
View File

@ -1,22 +0,0 @@
The MIT License
Copyright (c) 1990 Jorge Nocedal
Copyright (c) 2007-2010 Naoaki Okazaki
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

120
ChangeLog
View File

@ -1,120 +0,0 @@
2010-xx-xx Naoaki Okazaki <okazaki at chokkan org>
* libLBFGS 1.10:
- Fixed compiling errors on Mac OS X; this patch was kindly submitted by Nic Schraudolph.
- Reduced compiling warnings on Mac OS X; this patch was kindly submitted by Tamas Nepusz.
2010-01-29 Naoaki Okazaki <okazaki at chokkan org>
* libLBFGS 1.9:
- Fixed a mistake in checking the validity of the parameters "ftol" and "wolfe"; this mistake was discovered by Kevin S. Van Horn.
2009-07-13 Naoaki Okazaki <okazaki at chokkan org>
* libLBFGS 1.8:
- Accepted the patch submitted by Takashi Imamichi; the backtracking method now has three criteria for choosing the step length.
- Updated the documentation to explain the above three criteria.
2009-02-28 Naoaki Okazaki <okazaki at chokkan org>
* libLBFGS 1.7:
- Improved OWL-QN routines for stability.
- Removed the support of OWL-QN method in MoreThuente algorithm
because it accidentally fails in early stages of iterations for some
objectives. Because of this change, the OW-LQN method must be used
with the backtracking algorithm (LBFGS_LINESEARCH_BACKTRACKING), or
the library returns LBFGSERR_INVALID_LINESEARCH.
- Renamed line search algorithms as follows:
- LBFGS_LINESEARCH_BACKTRACKING: regular Wolfe condition.
- LBFGS_LINESEARCH_BACKTRACKING_LOOSE: regular Wolfe condition.
- LBFGS_LINESEARCH_BACKTRACKING_STRONG: strong Wolfe condition.
- Source code clean-up.
2008-11-02 Naoaki Okazaki <okazaki at chokkan org>
* libLBFGS 1.6:
- Improved line-search algorithm with strong Wolfe condition, which
was contributed by Takashi Imamichi. This routine is now default for
LBFGS_LINESEARCH_BACKTRACKING. The previous line search algorithm
with regular Wolfe condition is still available as
LBFGS_LINESEARCH_BACKTRACKING_LOOSE.
- Configurable stop index for L1-norm computation. A member variable
lbfgs_parameter_t::orthantwise_end was added to specify the index
number at which the library stops computing the L1 norm of the
variables. This is useful to prevent some variables from being
regularized by the OW-LQN method.
- A sample program written in C++ (sample/sample.cpp).
2008-07-10 Naoaki Okazaki <okazaki at chokkan org>
* libLBFGS 1.5:
- Configurable starting index for L1-norm computation. A member
variable lbfgs_parameter_t::orthantwise_start was added to specify
the index number from which the library computes the L1 norm of the
variables.
- Fixed a zero-division error when the initial variables have already
been a minimizer (reported by Takashi Imamichi). In this case, the
library returns LBFGS_ALREADY_MINIMIZED status code.
- Defined LBFGS_SUCCESS status code as zero; removed unused constants,
LBFGSFALSE and LBFGSTRUE.
- Fixed a compile error in an implicit down-cast.
2008-04-25 Naoaki Okazaki <okazaki at chokkan org>
* libLBFGS 1.4:
- Configurable line search algorithms. A member variable
lbfgs_parameter_t::linesearch was added to choose either MoreThuente
method (LBFGS_LINESEARCH_MORETHUENTE) or backtracking algorithm
(LBFGS_LINESEARCH_BACKTRACKING).
- Fixed a bug: the previous version did not compute psuedo-gradients
properly in the line search routines for OW-LQN. This bug might quit
an iteration process too early when the OW-LQN routine was activated
(0 < lbfgs_parameter_t::orthantwise_c).
- Configure script for POSIX environments.
- SSE/SSE2 optimizations with GCC.
- New functions lbfgs_malloc and lbfgs_free to use SSE/SSE2 routines
transparently. It is uncessary to use these functions for libLBFGS
built without SSE/SSE2 routines; you can still use any memory
allocators if SSE/SSE2 routines are disabled in libLBFGS.
2007-12-16 Naoaki Okazaki <okazaki at chokkan org>
* libLBFGS 1.3:
- An API change. An argument was added to lbfgs() function to receive
the final value of the objective function. This argument can be set
to NULL if the final value is unnecessary.
- Fixed a null-pointer bug in the sample code (reported by Takashi
Imamichi).
- Added build scripts for Microsoft Visual Studio 2005 and GCC.
- Added README file.
2007-12-13 Naoaki Okazaki <okazaki at chokkan org>
* libLBFGS 1.2:
- Fixed a serious bug in orthant-wise L-BFGS. An important variable
was used without initialization.
- Configurable L-BFGS parameters (number of limited memories, epsilon).
2007-12-01 Naoaki Okazaki <okazaki at chokkan org>
* libLBFGS 1.1:
- Implemented orthant-wise L-BFGS.
- Implemented lbfgs_parameter_init() function.
- Fixed several bugs.
- API documentation.
2007-09-20 Naoaki Okazaki <okazaki at chokkan org>
* libLBFGS 1.0
- Initial release.

View File

@ -1,12 +0,0 @@
# $Id$
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = lib sample
docdir = $(prefix)/share/doc/@PACKAGE@
doc_DATA = README INSTALL COPYING AUTHORS ChangeLog NEWS
EXTRA_DIST = \
autogen.sh \
lbfgs.sln

0
NEWS
View File

View File

@ -1,38 +0,0 @@
#!/bin/sh
# $Id$
if [ "$1" = "--force" ];
then
FORCE=--force
NOFORCE=
FORCE_MISSING=--force-missing
else
FORCE=
NOFORCE=--no-force
FORCE_MISSING=
fi
libtoolize --copy $FORCE 2>&1 | sed '/^You should/d' || {
echo "libtoolize failed!"
exit 1
}
aclocal $FORCE || {
echo "aclocal failed!"
exit 1
}
autoheader $FORCE || {
echo "autoheader failed!"
exit 1
}
automake -a -c $NOFORCE || {
echo "automake failed!"
exit 1
}
autoconf $FORCE || {
echo "autoconf failed!"
exit 1
}

View File

@ -1,15 +0,0 @@
## @PROJECT_NAME@ CMake configuration file
# library version information
set(@PROJECT_NAME@_VERSION_STRING "@PROJECT_VERSION@")
set(@PROJECT_NAME@_VERSION_MAJOR @PROJECT_VERSION_MAJOR@)
set(@PROJECT_NAME@_VERSION_MINOR @PROJECT_VERSION_MINOR@)
set(@PROJECT_NAME@_VERSION_PATCH @PROJECT_VERSION_PATCH@)
# import exported targets
if (NOT TARGET @PROJECT_NAME@::lib)
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
endif ()
# project libraries
set(@PROJECT_NAME@_LIBRARIES @PROJECT_NAME@::lib)

View File

@ -1,360 +0,0 @@
# ==============================================================================
# Utility CMake functions for standalone or subproject build configuration.
#
# This CMake source file is released into the public domain.
#
# Author: Andreas Schuh (andreas.schuh.84@gmail.com)
# ==============================================================================
include(CMakeParseArguments)
# ----------------------------------------------------------------------------
## Start (sub-)project
#
# This macro is for CMake versions 2.8.12 which did not have the VERSION
# argument yet. It additionally sets the PROJECT_SOVERSION to either the
# project major version number or ${PROJECT_NAME}_SOVERSION if set.
# When ${PROJECT_NAME}_IS_SUBPROJECT is not defined, PROJECT_IS_SUBPROJECT
# is set to TRUE when the source directory of this project is not the
# top-level source directory, and FALSE otherwise.
#
# Besides the PROJECT_NAME variable, this macro also sets PROJECT_NAME_LOWER
# and PROJECT_NAME_UPPER to the respective all lower- or uppercase strings.
macro (subproject name)
cmake_parse_arguments("" "" "VERSION;SOVERSION" "LANGUAGES" ${ARGN})
if (_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "Unrecognized arguments: ${_UNPARSED_ARGUMENTS}")
endif ()
if (NOT _VERSION)
set(_VERSION 0.0.0) # invalid version number
endif ()
unset(PROJECT_VERSION)
unset(PROJECT_VERSION_MAJOR)
unset(PROJECT_VERSION_MINOR)
unset(PROJECT_VERSION_PATCH)
unset(${name}_VERSION)
unset(${name}_VERSION_MAJOR)
unset(${name}_VERSION_MINOR)
unset(${name}_VERSION_PATCH)
project(${name} ${_LANGUAGES})
set(PROJECT_VERSION "${_VERSION}")
_subproject_split_version_numbers(${PROJECT_VERSION}
PROJECT_VERSION_MAJOR
PROJECT_VERSION_MINOR
PROJECT_VERSION_PATCH
)
set(${name}_VERSION ${PROJECT_VERSION})
set(${name}_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(${name}_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(${name}_VERSION_PATCH ${PROJECT_VERSION_PATCH})
if (NOT _SOVERSION)
set(_SOVERSION ${PROJECT_VERSION_MAJOR})
endif ()
_subproject_set_abi_version(PROJECT_SOVERSION ${_SOVERSION})
set(${name}_SOVERSION ${PROJECT_SOVERSION})
_subproject_check_if_subproject()
string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER)
string(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UPPER)
unset(_VERSION)
unset(_SOVERSION)
unset(_LANGUAGES)
unset(_UNPARSED_ARGUMENTS)
if (${PROJECT_NAME}_EXPORT_NAME)
set(PROJECT_EXPORT_NAME ${${PROJECT_NAME}_EXPORT_NAME})
else ()
set(PROJECT_EXPORT_NAME ${PROJECT_NAME})
endif ()
set_property(GLOBAL PROPERTY ${PROJECT_NAME}_HAVE_EXPORT FALSE)
endmacro ()
# ----------------------------------------------------------------------------
## Add configuration variable
#
# The default value of the (cached) configuration value can be overridden
# either on the CMake command-line or the super-project by setting the
# ${PROJECT_NAME}_${varname} variable. When this project is a subproject
# of another project, i.e., PROJECT_IS_SUBPROJECT is TRUE, the variable
# is not added to the CMake cache and set to the value of
# ${PROJECT_NAME}_${varname} regardless if the parent project defines
# a (cached) variable of the same name. Otherwise, when this project is
# a standalone project, the variable is cached.
macro (subproject_define type varname docstring default)
if (ARGC GREATER 5)
message (FATAL_ERROR "Too many macro arguments")
endif ()
if (NOT DEFINED ${PROJECT_NAME}_${varname})
if (PROJECT_IS_SUBPROJECT AND ARGC EQUAL 5)
set(${PROJECT_NAME}_${varname} "${ARGV4}")
else ()
set(${PROJECT_NAME}_${varname} "${default}")
endif ()
endif ()
if (PROJECT_IS_SUBPROJECT)
set(${varname} "${${PROJECT_NAME}_${varname}}")
else ()
set(${varname} "${${PROJECT_NAME}_${varname}}" CACHE ${type} "${docstring}")
endif ()
endmacro ()
# ----------------------------------------------------------------------------
## Set property of (cached) configuration variable
#
# This command does nothing when the previously defined variable was not added
# to the CMake cache because this project is build as subproject unless
# the property to be set is the VALUE of the configuration variable.
#
# @see subproject_define
macro (subproject_set_property varname property value)
_subproject_check_if_cached(_is_cached ${varname})
if (_is_cached)
if (property STREQUAL ADVANCED)
if (${value})
mark_as_advanced(FORCE ${varname})
else ()
mark_as_advanced(CLEAR ${varname})
endif ()
else ()
set_property(CACHE ${varname} PROPERTY "${property}" "${value}")
endif ()
elseif (property STREQUAL VALUE)
set(${varname} "${value}")
endif ()
unset(_is_cached)
endmacro ()
# ----------------------------------------------------------------------------
## Get unique target name
macro (subproject_target_name uid target)
if (${PROJECT_NAME}_${target}_TARGET_NAME)
set(${uid} ${${PROJECT_NAME}_${target}_TARGET_NAME})
elseif (PROJECT_IS_SUBPROJECT)
set(${uid} "${PROJECT_NAME_LOWER}_${target}")
else ()
set(${uid} "${target}")
endif ()
endmacro ()
# ----------------------------------------------------------------------------
## Add executable target
function (subproject_add_executable uid target)
subproject_target_name(_uid ${target})
add_executable(${_uid} ${ARGN})
if (NOT ${PROJECT_NAME}_NO_ALIASES)
add_executable(${PROJECT_NAME}::${target} ALIAS ${_uid})
endif ()
set(${uid} "${_uid}" PARENT_SCOPE)
endfunction ()
# ----------------------------------------------------------------------------
## Add library target
function (subproject_add_library uid target)
subproject_target_name(_uid ${target})
add_library(${_uid} ${ARGN})
if (NOT ${PROJECT_NAME}_NO_ALIASES)
add_library(${PROJECT_NAME}::${target} ALIAS ${_uid})
endif ()
set(${uid} "${_uid}" PARENT_SCOPE)
endfunction ()
# ----------------------------------------------------------------------------
## Install files of library target
function (subproject_install_library target)
# parse arguments
if (NOT TARGET ${target})
message(FATAL_ERROR "Unknown target: ${target}")
endif ()
get_target_property(type ${target} TYPE)
if (NOT PROJECT_IS_SUBPROJECT OR NOT "^${type}$" STREQUAL "^STATIC_LIBRARY$" OR ${PROJECT_NAME}_INSTALL_STATIC_LIBS)
cmake_parse_arguments(""
""
"INCLUDE_DESTINATION;LIBRARY_DESTINATION;RUNTIME_DESTINATION"
"PUBLIC_HEADER_FILES"
${ARGN}
)
if (_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "Too many or unrecognized arguments: ${_UNPARSED_ARGUMENTS}")
endif ()
# override (default) arguments
if (${PROJECT_NAME}_INSTALL_RUNTIME_DIR)
set(_RUNTIME_DESTINATION "${${PROJECT_NAME}_INSTALL_RUNTIME_DIR}")
elseif (NOT _RUNTIME_DESTINATION)
set(_RUNTIME_DESTINATION bin)
endif ()
if (${PROJECT_NAME}_INSTALL_INCLUDE_DIR)
set(_INCLUDE_DESTINATION "${${PROJECT_NAME}_INSTALL_INCLUDE_DIR}")
elseif (NOT _INCLUDE_DESTINATION)
set(_INCLUDE_DESTINATION include)
endif ()
if (${PROJECT_NAME}_INSTALL_LIBRARY_DIR)
set(_LIBRARY_DESTINATION "${${PROJECT_NAME}_INSTALL_LIBRARY_DIR}")
elseif (NOT _LIBRARY_DESTINATION)
set(_LIBRARY_DESTINATION lib)
endif ()
# skip installation of static subproject library
if (_PUBLIC_HEADER_FILES AND (NOT DEFINED ${PROJECT_NAME}_INSTALL_HEADERS OR ${PROJECT_NAME}_INSTALL_HEADERS))
install(FILES ${_PUBLIC_HEADER_FILES} DESTINATION ${_INCLUDE_DESTINATION} COMPONENT Development)
target_include_directories(${target} INTERFACE "$<INSTALL_INTERFACE:${_INCLUDE_DESTINATION}>")
endif ()
install(TARGETS ${target} EXPORT ${PROJECT_EXPORT_NAME}
RUNTIME DESTINATION ${_RUNTIME_DESTINATION} COMPONENT RuntimeLibraries
LIBRARY DESTINATION ${_LIBRARY_DESTINATION} COMPONENT RuntimeLibraries
ARCHIVE DESTINATION ${_LIBRARY_DESTINATION} COMPONENT Development
)
set_property(GLOBAL PROPERTY ${PROJECT_NAME}_HAVE_EXPORT TRUE)
endif ()
endfunction ()
# ----------------------------------------------------------------------------
## Whether to install package configuration files of (sub-)project
macro (subproject_get_install_config_option var)
if (PROJECT_IS_SUBPROJECT AND ${PROJECT_NAME}_INSTALL_CONFIG)
set (${var} 1)
elseif (NOT PROJECT_IS_SUBPROJECT AND (NOT DEFINED ${PROJECT_NAME}_INSTALL_CONFIG OR ${PROJECT_NAME}_INSTALL_CONFIG))
set (${var} 1)
else ()
set (${var} 0)
endif ()
endmacro ()
# ----------------------------------------------------------------------------
## Get relative path of package configuration installation directory
macro (subproject_get_install_config_dir config_dir)
if (${PROJECT_NAME}_INSTALL_CONFIG_DIR)
set(${config_dir} "${${PROJECT_NAME}_INSTALL_CONFIG_DIR}")
elseif (WIN32 AND NOT MINGW AND NOT CYGWIN)
set(${config_dir} "cmake")
else ()
set(${config_dir} "lib/cmake/${PROJECT_NAME_LOWER}")
endif ()
endmacro ()
# ----------------------------------------------------------------------------
## Install package configuration files
function (subproject_install_config_files)
subproject_get_install_config_option (_install_config)
if (_install_config)
# parse arguments
cmake_parse_arguments("" "" "DESTINATION" "FILES" ${ARGN})
if (_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "Unrecognized arguments: ${_UNPARSED_ARGUMENTS}")
endif ()
if (${PROJECT_NAME}_INSTALL_CONFIG_DIR OR NOT _DESTINATION)
subproject_get_install_config_dir(_DESTINATION)
endif ()
# install package configuration files if not overriden
install(FILES ${_FILES} DESTINATION ${_DESTINATION} COMPONENT Development)
endif ()
endfunction ()
# ----------------------------------------------------------------------------
## Generate build tree targets configuration file
function (subproject_export)
cmake_parse_arguments("" "" "" "TARGETS" ${ARGN})
export(TARGETS ${_TARGETS} ${_UNPARSED_ARGUMENTS}
FILE "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake"
NAMESPACE "${PROJECT_NAME}::"
)
endfunction ()
# ----------------------------------------------------------------------------
## Install exported targets configuration files
function (subproject_install_exports)
subproject_get_install_config_option (_install_config)
if (_install_config)
# parse arguments
cmake_parse_arguments("" "" "DESTINATION" "" ${ARGN})
if (_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "Unrecognized arguments: ${_UNPARSED_ARGUMENTS}")
endif ()
if (${PROJECT_NAME}_INSTALL_CONFIG_DIR OR NOT _DESTINATION)
subproject_get_install_config_dir(_DESTINATION)
endif ()
# install export sets
get_property(have_export GLOBAL PROPERTY ${PROJECT_NAME}_HAVE_EXPORT)
if (have_export)
install(EXPORT ${PROJECT_EXPORT_NAME}
FILE "${PROJECT_NAME}Targets.cmake"
NAMESPACE "${PROJECT_NAME}::"
DESTINATION "${_DESTINATION}"
COMPONENT Development
)
endif ()
endif ()
endfunction ()
# ==============================================================================
# Private auxiliary functions
# ==============================================================================
# ----------------------------------------------------------------------------
# Extract version numbers from version string
function (_subproject_split_version_numbers version major minor patch)
if (version MATCHES "([0-9]+)(\\.[0-9]+)?(\\.[0-9]+)?(rc[1-9][0-9]*|[a-z]+)?")
if (CMAKE_MATCH_1)
set(_major ${CMAKE_MATCH_1})
else ()
set(_major 0)
endif ()
if (CMAKE_MATCH_2)
set(_minor ${CMAKE_MATCH_2})
string (REGEX REPLACE "^\\." "" _minor "${_minor}")
else ()
set(_minor 0)
endif ()
if (CMAKE_MATCH_3)
set(_patch ${CMAKE_MATCH_3})
string(REGEX REPLACE "^\\." "" _patch "${_patch}")
else ()
set(_patch 0)
endif ()
else ()
set(_major 0)
set(_minor 0)
set(_patch 0)
endif ()
set("${major}" "${_major}" PARENT_SCOPE)
set("${minor}" "${_minor}" PARENT_SCOPE)
set("${patch}" "${_patch}" PARENT_SCOPE)
endfunction ()
# ----------------------------------------------------------------------------
# Set ABI version number
#
# When the variable ${PROJECT_NAME}_SOVERSION is set, it overrides the ABI
# version number argument.
macro (_subproject_set_abi_version varname number)
if (${PROJECT_NAME}_SOVERSION)
set(${varname} "${${PROJECT_NAME}_SOVERSION}")
else ()
set(${varname} "${number}")
endif ()
endmacro ()
# ----------------------------------------------------------------------------
# Determine if project is build as subproject
#
# When included as subproject (e.g., as Git submodule/subtree) in the source
# tree of a project that uses it, no variables should be added to the CMake cache;
# users may set the (non-cached) variable ${PROJECT_NAME}_IS_SUBPROJECT before
# the add_subdirectory command that adds this subdirectory to the build.
#
# @returns Sets PROJECT_IS_SUBPROJECT to either TRUE or FALSE.
macro (_subproject_check_if_subproject)
if (DEFINED ${PROJECT_NAME}_IS_SUBPROJECT)
set(PROJECT_IS_SUBPROJECT ${PROJECT_NAME}_IS_SUBPROJECT)
elseif ("^${CMAKE_SOURCE_DIR}$" STREQUAL "^${PROJECT_SOURCE_DIR}$")
set(PROJECT_IS_SUBPROJECT FALSE)
else ()
set(PROJECT_IS_SUBPROJECT TRUE)
endif ()
endmacro ()
# ----------------------------------------------------------------------------
# Determine if cache entry exists
macro (_subproject_check_if_cached retvar varname)
if (DEFINED ${varname})
get_property(${retvar} CACHE ${varname} PROPERTY TYPE SET)
else ()
set(${retvar} FALSE)
endif ()
endmacro ()

View File

@ -1,108 +0,0 @@
dnl $Id$
dnl
dnl
dnl Exported and configured variables:
dnl CFLAGS
dnl LDFLAGS
dnl INCLUDES
dnl ------------------------------------------------------------------
dnl Initialization for autoconf
dnl ------------------------------------------------------------------
AC_PREREQ([2.69])
AC_INIT(liblbfgs, 1.10)
AC_CONFIG_SRCDIR([lib/lbfgs.c])
AC_CONFIG_MACRO_DIR([m4])
dnl ------------------------------------------------------------------
dnl Initialization for automake
dnl ------------------------------------------------------------------
AM_INIT_AUTOMAKE
AC_CONFIG_HEADERS(config.h)
AM_MAINTAINER_MODE
dnl ------------------------------------------------------------------
dnl Checks for program
dnl ------------------------------------------------------------------
LT_INIT
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
dnl ------------------------------------------------------------------
dnl Initialization for variables
dnl ------------------------------------------------------------------
CFLAGS="${ac_save_CFLAGS} -Wall"
LDFLAGS="${ac_save_LDFLAGS}"
INCLUDES="-I\$(top_srcdir) -I\$(top_srcdir)/include"
dnl ------------------------------------------------------------------
dnl Checks for header files.
dnl ------------------------------------------------------------------
AC_HEADER_STDC
AC_CHECK_HEADERS(xmmintrin.h emmintrin.h)
dnl ------------------------------------------------------------------
dnl Checks for debugging mode
dnl ------------------------------------------------------------------
AC_ARG_ENABLE(
debug,
[AS_HELP_STRING(
[--enable-debug],
[build for debugging]
)],
[CFLAGS="-DDEBUG -O -g ${CFLAGS}"],
[CFLAGS="-O3 -ffast-math ${CFLAGS}"]
)
dnl ------------------------------------------------------------------
dnl Checks for profiling mode
dnl ------------------------------------------------------------------
AC_ARG_ENABLE(
profile,
[AS_HELP_STRING(
[--enable-profile],
[build for profiling]
)],
[CFLAGS="-DPROFILE -pg ${CFLAGS}"]
)
dnl ------------------------------------------------------------------
dnl Checks for SSE2 build
dnl ------------------------------------------------------------------
AC_ARG_ENABLE(
sse2,
[AS_HELP_STRING(
[--enable-sse2],
[enable SSE2 optimization routines]
)],
[CFLAGS="-msse2 -DUSE_SSE ${CFLAGS}"]
)
dnl ------------------------------------------------------------------
dnl Checks for library functions.
dnl ------------------------------------------------------------------
AC_CHECK_LIB(m, fabs)
dnl ------------------------------------------------------------------
dnl Export variables
dnl ------------------------------------------------------------------
AC_SUBST(CFLAGS)
AC_SUBST(LDFLAGS)
AC_SUBST(INCLUDES)
dnl ------------------------------------------------------------------
dnl Output the configure results.
dnl ------------------------------------------------------------------
AC_CONFIG_FILES(Makefile lib/Makefile sample/Makefile)
AC_OUTPUT

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +0,0 @@
<hr/>
<div>
Copyright (c) 2002-2014 by Naoaki Okazaki
<br /><i>$datetime</i>
</div>
</body>
</html>

View File

@ -1,13 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="author" content="Naoaki Okazaki">
<meta name="description" content="This library implements Limited-memory Broyden-Fletcher-Goldfarb-Shanno (L-BFGS) method.">
<meta name="keywords" content="libLBFGS,L-BFGS,LBFGS,OWL-QN,L1,L2,norm,C,library,SSE,SSE2">
<meta name="robots" content="index,follow">
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>libLBFGS: L-BFGS library written in C</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head>
<body>

View File

@ -1,26 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib", "lib\lib.vcxproj", "{C4405B73-A899-44BF-8681-04CE040B6705}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample", "sample\sample.vcxproj", "{B4D7D5F5-4A4E-49D5-B38A-E5673520DE66}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C4405B73-A899-44BF-8681-04CE040B6705}.Debug|Win32.ActiveCfg = Debug|Win32
{C4405B73-A899-44BF-8681-04CE040B6705}.Debug|Win32.Build.0 = Debug|Win32
{C4405B73-A899-44BF-8681-04CE040B6705}.Release|Win32.ActiveCfg = Release|Win32
{C4405B73-A899-44BF-8681-04CE040B6705}.Release|Win32.Build.0 = Release|Win32
{B4D7D5F5-4A4E-49D5-B38A-E5673520DE66}.Debug|Win32.ActiveCfg = Debug|Win32
{B4D7D5F5-4A4E-49D5-B38A-E5673520DE66}.Debug|Win32.Build.0 = Debug|Win32
{B4D7D5F5-4A4E-49D5-B38A-E5673520DE66}.Release|Win32.ActiveCfg = Release|Win32
{B4D7D5F5-4A4E-49D5-B38A-E5673520DE66}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -1,24 +0,0 @@
# $Id$
EXTRA_DIST = \
lib.vcxproj
liblbfgsincludedir = $(includedir)
liblbfgsinclude_HEADERS = \
../include/lbfgs.h
lib_LTLIBRARIES = liblbfgs.la
liblbfgs_la_SOURCES = \
arithmetic_ansi.h \
arithmetic_sse_double.h \
arithmetic_sse_float.h \
../include/lbfgs.h \
lbfgs.c
liblbfgs_la_LDFLAGS = \
-no-undefined \
-release @VERSION@
AM_CFLAGS = @CFLAGS@
INCLUDES = @INCLUDES@

View File

@ -1,97 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{C4405B73-A899-44BF-8681-04CE040B6705}</ProjectGuid>
<RootNamespace>lib</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionName)</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionName)_debug</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(SolutionDir)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<Lib />
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>$(SolutionDir)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Lib />
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="lbfgs.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="arithmetic_ansi.h" />
<ClInclude Include="arithmetic_sse_double.h" />
<ClInclude Include="arithmetic_sse_float.h" />
<ClInclude Include="..\include\lbfgs.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -1,15 +0,0 @@
# $Id$
EXTRA_DIST = \
sample.cpp \
sample.vcxproj
noinst_PROGRAMS = sample
sample_SOURCES = \
sample.c
sample_LDADD = ../lib/liblbfgs.la
AM_CFLAGS = @CFLAGS@
INCLUDES = @INCLUDES@

View File

@ -1,107 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{B4D7D5F5-4A4E-49D5-B38A-E5673520DE66}</ProjectGuid>
<RootNamespace>sample</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(SolutionDir)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>$(SolutionDir)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="sample.c" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\lib\lib.vcxproj">
<Project>{c4405b73-a899-44bf-8681-04ce040b6705}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

42
src/CMakeLists.txt Normal file
View File

@ -0,0 +1,42 @@
#
aux_source_directory(lib/ LIBLBFGS_SRC)
#
#
# libcmake
add_library(lbfgs SHARED ${LIBLBFGS_SRC})
#
add_library(lbfgs_static STATIC ${LIBLBFGS_SRC})
#
set_target_properties(lbfgs_static PROPERTIES OUTPUT_NAME "lbfgs")
#
set_target_properties(lbfgs PROPERTIES CLEAN_DIRECT_OUTPUT 1)
set_target_properties(lbfgs_static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
#
set_target_properties(lbfgs PROPERTIES VERSION 1.0 SOVERSION 1.0)
#
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
#
install(TARGETS lbfgs lbfgs_static
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
#
install(FILES lib/lbfgs.h DESTINATION include)
#
#
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
#
add_executable(lbfgs_sample sample/sample.c)
#
set_target_properties(lbfgs_sample PROPERTIES INSTALL_RPATH "/usr/local/lib")
#
target_link_libraries(lbfgs_sample PUBLIC lbfgs)
#
add_executable(lbfgs_sample2 sample/sample2.cpp)
#
set_target_properties(lbfgs_sample2 PROPERTIES INSTALL_RPATH "/usr/local/lib")
#
target_link_libraries(lbfgs_sample2 PUBLIC lbfgs)