[mlpack-svn] r11847 - in mlpack/trunk: . src/mlpack

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Tue Mar 13 14:16:40 EDT 2012


Author: rcurtin
Date: 2012-03-13 14:16:40 -0400 (Tue, 13 Mar 2012)
New Revision: 11847

Modified:
   mlpack/trunk/CMakeLists.txt
   mlpack/trunk/src/mlpack/CMakeLists.txt
Log:
Be a little pickier with how we build on Windows.  Static library because creating a DLL correctly would be a nightmare.

Modified: mlpack/trunk/CMakeLists.txt
===================================================================
--- mlpack/trunk/CMakeLists.txt	2012-03-13 18:05:42 UTC (rev 11846)
+++ mlpack/trunk/CMakeLists.txt	2012-03-13 18:16:40 UTC (rev 11847)
@@ -121,9 +121,20 @@
 
 include_directories(${CMAKE_SOURCE_DIR})
 
-set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/)
-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/)
-set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/)
+# On Windows, things end up under Debug/ or Release/.
+if (WIN32)
+  set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
+  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
+  set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
+else (WIN32)
+  # If not on Windows, put them under more standard UNIX-like places.  This is
+  # necessary, otherwise they would all end up in
+  # ${CMAKE_BINARY_DIR}/src/mlpack/methods/... or somewhere else random like
+  # that.
+  set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/)
+  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/)
+  set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/)
+endif (WIN32)
 
 # Recurse into the rest of the project.
 add_subdirectory(src/mlpack)

Modified: mlpack/trunk/src/mlpack/CMakeLists.txt
===================================================================
--- mlpack/trunk/src/mlpack/CMakeLists.txt	2012-03-13 18:05:42 UTC (rev 11846)
+++ mlpack/trunk/src/mlpack/CMakeLists.txt	2012-03-13 18:16:40 UTC (rev 11847)
@@ -15,7 +15,14 @@
 endforeach()
 
 # MLPACK_SRCS is set in the subdirectories.
-add_library(mlpack SHARED ${MLPACK_SRCS})
+# We don't use a DLL (shared) on Windows because it's a nightmare.  We can't
+# easily generate the .def file and we won't put __declspec(dllexport) next to
+# every function signature.
+if (WIN32)
+  add_library(mlpack ${MLPACK_SRCS})
+else (WIN32)
+  add_library(mlpack SHARED ${MLPACK_SRCS})
+endif (WIN32)
 target_link_libraries(mlpack
   ${ARMADILLO_LIBRARIES}
   ${Boost_LIBRARIES}




More information about the mlpack-svn mailing list