blob: b45f249dba382a68dd14223c3084dddc38503bee [file] [log] [blame]
From 4fcc76f6fa702fb9943a956391db503fdbec93c0 Mon Sep 17 00:00:00 2001
From: Julien Schueller <schueller@phimeca.com>
Date: Fri, 4 Jul 2014 12:29:00 +0200
Subject: [PATCH] Fix MinGW build.
---
CMakeLists.txt | 1 +
cmake/Modules/DefineInstallationPaths.cmake | 8 ++++----
src/CMakeLists.txt | 24 ++++++++++++++++--------
src/include/CMakeLists.txt | 2 +-
4 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b91f6fb..74fd738 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,6 +7,7 @@ SET(CMAKE_MODULE_PATH
)
SET(VERSION 2.2.0)
+option(BUILD_SHARED_LIBS "build shared/static libs" ON)
INCLUDE(DefineInstallationPaths)
diff --git a/cmake/Modules/DefineInstallationPaths.cmake b/cmake/Modules/DefineInstallationPaths.cmake
index 644cf1b..d5dd9c5 100644
--- a/cmake/Modules/DefineInstallationPaths.cmake
+++ b/cmake/Modules/DefineInstallationPaths.cmake
@@ -1,4 +1,4 @@
-if (UNIX)
+if (UNIX OR MINGW)
IF (NOT APPLICATION_NAME)
MESSAGE(STATUS "${PROJECT_NAME} is used as APPLICATION_NAME")
SET(APPLICATION_NAME ${PROJECT_NAME})
@@ -122,9 +122,9 @@ if (UNIX)
CACHE PATH "The ${APPLICATION_NAME} info install dir (default prefix/info)"
FORCE
)
-endif (UNIX)
+endif ()
-if (WIN32)
+if (MSCV)
# Same same
SET(BIN_INSTALL_DIR .)
SET(SBIN_INSTALL_DIR .)
@@ -134,5 +134,5 @@ if (WIN32)
SET(ICON_INSTALL_DIR .)
SET(SOUND_INSTALL_DIR .)
SET(LOCALE_INSTALL_DIR lang)
-endif (WIN32)
+endif (MSCV)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index fade00c..de0abd4 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -11,10 +11,12 @@ SET(floatfann_LIB_SRCS
floatfann.c
)
-ADD_LIBRARY(floatfann SHARED ${floatfann_LIB_SRCS})
+ADD_LIBRARY(floatfann ${floatfann_LIB_SRCS})
SET_TARGET_PROPERTIES(floatfann PROPERTIES VERSION ${VERSION} SOVERSION 2 )
-INSTALL(TARGETS floatfann DESTINATION ${LIB_INSTALL_DIR} )
+INSTALL(TARGETS floatfann LIBRARY DESTINATION ${LIB_INSTALL_DIR}
+ ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
+ RUNTIME DESTINATION ${BIN_INSTALL_DIR} )
########### next target ###############
@@ -23,10 +25,12 @@ SET(doublefann_LIB_SRCS
doublefann.c
)
-ADD_LIBRARY(doublefann SHARED ${doublefann_LIB_SRCS})
+ADD_LIBRARY(doublefann ${doublefann_LIB_SRCS})
SET_TARGET_PROPERTIES(doublefann PROPERTIES VERSION ${VERSION} SOVERSION 2 )
-INSTALL(TARGETS doublefann DESTINATION ${LIB_INSTALL_DIR} )
+INSTALL(TARGETS doublefann LIBRARY DESTINATION ${LIB_INSTALL_DIR}
+ ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
+ RUNTIME DESTINATION ${BIN_INSTALL_DIR} )
########### next target ###############
@@ -35,10 +39,12 @@ SET(fixedfann_LIB_SRCS
fixedfann.c
)
-ADD_LIBRARY(fixedfann SHARED ${fixedfann_LIB_SRCS})
+ADD_LIBRARY(fixedfann ${fixedfann_LIB_SRCS})
SET_TARGET_PROPERTIES(fixedfann PROPERTIES VERSION ${VERSION} SOVERSION 2 )
-INSTALL(TARGETS fixedfann DESTINATION ${LIB_INSTALL_DIR} )
+INSTALL(TARGETS fixedfann LIBRARY DESTINATION ${LIB_INSTALL_DIR}
+ ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
+ RUNTIME DESTINATION ${BIN_INSTALL_DIR} )
########### next target ###############
@@ -47,8 +53,10 @@ SET(fann_LIB_SRCS
floatfann.c
)
-ADD_LIBRARY(fann SHARED ${fann_LIB_SRCS})
+ADD_LIBRARY(fann ${fann_LIB_SRCS})
SET_TARGET_PROPERTIES(fann PROPERTIES VERSION ${VERSION} SOVERSION 2 )
-INSTALL(TARGETS fann DESTINATION ${LIB_INSTALL_DIR} )
+INSTALL(TARGETS fann LIBRARY DESTINATION ${LIB_INSTALL_DIR}
+ ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
+ RUNTIME DESTINATION ${BIN_INSTALL_DIR} )
diff --git a/src/include/CMakeLists.txt b/src/include/CMakeLists.txt
index 3a69da4..451a0b4 100644
--- a/src/include/CMakeLists.txt
+++ b/src/include/CMakeLists.txt
@@ -1,4 +1,4 @@
########### install files ###############
-INSTALL_FILES( /include FILES fann.h doublefann.h fann_internal.h floatfann.h fann_data.h fixedfann.h compat_time.h fann_activation.h fann_cascade.h fann_error.h fann_train.h fann_io.h fann_cpp.h )
+INSTALL_FILES( /include FILES fann.h doublefann.h fann_internal.h floatfann.h fann_data.h fixedfann.h fann_activation.h fann_cascade.h fann_error.h fann_train.h fann_io.h fann_cpp.h )
--
1.7.9.5