summarylogtreecommitdiffstats
path: root/lpsolve-CMakeLists.txt
blob: d59735c9b9f92c33ff81368f8b880217d41bd873 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#
# CMakeLists.txt for "lp_solve_5.5.2.0_source.tar.gz"
#
# Copyright 2012-2013 Benjamin Eikel
# License: Public Domain
#

cmake_minimum_required(VERSION 3.2)

if (NOT DEFINED CMAKE_BUILD_TYPE)
  set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type")
endif ()

project(lpsolve C)

set(LPSOLVE_VERSION_MAJOR 5)
set(LPSOLVE_VERSION_MINOR 5)
set(LPSOLVE_VERSION_PATCH 2)
set(LPSOLVE_VERSION ${LPSOLVE_VERSION_MAJOR}.${LPSOLVE_VERSION_MINOR}.${LPSOLVE_VERSION_PATCH})

# Set up install directories
include(GNUInstallDirs)
set(CMAKE_INSTALL_CMAKECONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/lpsolve)

add_library(lpsolve55
	lp_MDO.c
	shared/commonlib.c
	shared/mmio.c
	shared/myblas.c
	ini.c
	fortify.c
	colamd/colamd.c
	lp_rlp.c
	lp_crash.c
	bfp/bfp_LUSOL/lp_LUSOL.c
	bfp/bfp_LUSOL/LUSOL/lusol.c
	lp_Hash.c
	lp_lib.c
	lp_wlp.c
	lp_matrix.c
	lp_mipbb.c
	lp_MPS.c
	lp_params.c
	lp_presolve.c
	lp_price.c
	lp_pricePSE.c
	lp_report.c
	lp_scale.c
	lp_simplex.c
	lp_SOS.c
	lp_utils.c
	yacc_read.c
)

set_property(TARGET lpsolve55 PROPERTY PUBLIC_HEADER
	lp_bit.h
	lp_crash.h
	lp_explicit.h
	lp_fortify.h
	lp_Hash.h
	lp_lib.h
	lp_matrix.h
	lp_MDO.h
	lp_mipbb.h
	lp_MPS.h
	lp_presolve.h
	lp_price.h
	lp_pricePSE.h
	lp_report.h
	lp_rlp.h
	lp_scale.h
	lp_simplex.h
	lp_solveDLL.h
	lp_SOS.h
	lp_types.h
	lp_utils.h
	lp_wlp.h
)

target_include_directories(lpsolve55 PRIVATE
	"${CMAKE_CURRENT_SOURCE_DIR}"
	"${CMAKE_CURRENT_SOURCE_DIR}/shared"
	"${CMAKE_CURRENT_SOURCE_DIR}/bfp"
	"${CMAKE_CURRENT_SOURCE_DIR}/bfp/bfp_LUSOL"
	"${CMAKE_CURRENT_SOURCE_DIR}/bfp/bfp_LUSOL/LUSOL"
	"${CMAKE_CURRENT_SOURCE_DIR}/colamd"
)

target_compile_definitions(lpsolve55 PUBLIC
	YY_NEVER_INTERACTIVE
	PARSER_LP
	INVERSE_ACTIVE=INVERSE_LUSOL
	RoleIsExternalInvEngine
)

if(WIN32)
	target_compile_definitions(lpsolve55 PUBLIC
		INLINE=static
		_USRDLL
		WIN32
	)
endif()

include(CheckSymbolExists)
check_symbol_exists(isnan math.h HAVE_ISNAN)
if(NOT HAVE_ISNAN)
	set_property(TARGET lpsolve55 APPEND PROPERTY COMPILE_DEFINITIONS NOISNAN)
endif()

# Set version of library
set_target_properties(lpsolve55 PROPERTIES VERSION ${LPSOLVE_VERSION}
                                           SOVERSION ${LPSOLVE_VERSION_MAJOR})

# Install the library
install(TARGETS lpsolve55 EXPORT LibraryExport
	RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
	LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
	ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
	PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/lpsolve
)

# Set include directories for users of this library
target_include_directories(lpsolve55 INTERFACE ${CMAKE_INSTALL_FULL_INCLUDEDIR}/lpsolve)

# Library export
install(EXPORT LibraryExport DESTINATION ${CMAKE_INSTALL_CMAKECONFIGDIR} FILE lpsolveTargets.cmake)

# # Create the configuration files
# include(CMakePackageConfigHelpers)
# get_property(LPSOLVE_DEFINITIONS TARGET lpsolve55 PROPERTY COMPILE_DEFINITIONS)
# configure_package_config_file(lpsolveConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/lpsolveConfig.cmake
#                               INSTALL_DESTINATION ${CMAKE_INSTALL_CMAKECONFIGDIR}
#                               PATH_VARS CMAKE_INSTALL_CMAKECONFIGDIR
#                               NO_SET_AND_CHECK_MACRO
#                               NO_CHECK_REQUIRED_COMPONENTS_MACRO)
# write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/lpsolveConfigVersion.cmake
#                                  VERSION ${LPSOLVE_VERSION}
#                                  COMPATIBILITY SameMajorVersion)
# 
# # Install the configuration files
# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/lpsolveConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/lpsolveConfigVersion.cmake
#         DESTINATION ${CMAKE_INSTALL_CMAKECONFIGDIR})