Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for 1.x MinGW 32/64 build. #61

Merged
merged 1 commit into from
Sep 15, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ ELSE(Boost_INCLUDE_DIRS)
MESSAGE(FATAL ERROR " Please check your Boost installation ")
ENDIF(Boost_INCLUDE_DIRS)

EXEC_PROGRAM(pg_config
EXEC_PROGRAM(${POSTGRESQL_EXECUTABLE}/pg_config
ARGS --pkglibdir
OUTPUT_VARIABLE LIB_DIR)

Expand Down Expand Up @@ -87,8 +87,8 @@ IF(WIN32)
LINK_LIBRARIES(postgres)
ENDIF(WIN32)

SET(CMAKE_C_FLAGS "-O2 -g -lgmp -frounding-math")
SET(CMAKE_CXX_FLAGS "-O2 -g -lgmp -frounding-math")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -g -frounding-math")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -g -frounding-math")

# Recurse into the subdirectories. This does not actually
# cause another cmake executable to run. The same process will walk through
Expand Down
42 changes: 33 additions & 9 deletions cmake/FindCGAL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
# CGAL_LIBRARIES, the libraries needed to use CGAL.
# CGAL_FOUND, If false, do not try to use CGAL.

if(CGAL_INCLUDE_DIR AND CGAL_LIBRARIES)
if(CGAL_INCLUDE_DIR AND CGAL_LIBRARIES AND BOOST_THREAD_LIBRARIES AND GMP_LIBRARIES)
set(CGAL_FOUND TRUE)

else(CGAL_INCLUDE_DIR AND CGAL_LIBRARIES)
else(CGAL_INCLUDE_DIR AND CGAL_LIBRARIES AND BOOST_THREAD_LIBRARIES AND GMP_LIBRARIES)

FIND_PATH(CGAL_INCLUDE_DIR CGAL/basic.h
/usr/include
Expand All @@ -28,16 +28,40 @@ else(CGAL_INCLUDE_DIR AND CGAL_LIBRARIES)
$ENV{ProgramFiles}/CGAL/*/lib
$ENV{SystemDrive}/CGAL/*/lib
)

if(CGAL_INCLUDE_DIR AND CGAL_LIBRARIES)

find_library(BOOST_THREAD_LIBRARIES NAMES boost_thread libboost_thread
PATHS
/usr/lib
/usr/local/lib
/usr/lib/boost
/usr/lib64
/usr/local/lib64
/usr/lib64/boost
$ENV{ProgramFiles}/boost/*/lib
$ENV{SystemDrive}/boost/*/lib
)

find_library(GMP_LIBRARIES NAMES gmp libgmp
PATHS
/usr/lib
/usr/local/lib
/usr/lib/gmp
/usr/lib64
/usr/local/lib64
/usr/lib64/gmp
$ENV{ProgramFiles}/gmp/*/lib
$ENV{SystemDrive}/gmp/*/lib
)

if(CGAL_INCLUDE_DIR AND CGAL_LIBRARIES AND BOOST_THREAD_LIBRARIES AND GMP_LIBRARIES)
set(CGAL_FOUND TRUE)
message(STATUS "Found CGAL: ${CGAL_INCLUDE_DIR}, ${CGAL_LIBRARIES}")
message(STATUS "Found CGAL: ${CGAL_INCLUDE_DIR}, ${CGAL_LIBRARIES}, ${BOOST_THREAD_LIBRARIES}, ${GMP_LIBRARIES}")
INCLUDE_DIRECTORIES(${CGAL_INCLUDE_DIR} $ENV{CGAL_CFG})
else(CGAL_INCLUDE_DIR AND CGAL_LIBRARIES)
else(CGAL_INCLUDE_DIR AND CGAL_LIBRARIES AND BOOST_THREAD_LIBRARIES AND GMP_LIBRARIES)
set(CGAL_FOUND FALSE)
message(STATUS "CGAL not found.")
endif(CGAL_INCLUDE_DIR AND CGAL_LIBRARIES)
endif(CGAL_INCLUDE_DIR AND CGAL_LIBRARIES AND BOOST_THREAD_LIBRARIES AND GMP_LIBRARIES)

mark_as_advanced(CGAL_INCLUDE_DIR CGAL_LIBRARIES)
mark_as_advanced(CGAL_INCLUDE_DIR CGAL_LIBRARIES BOOST_THREAD_LIBRARIES GMP_LIBRARIES)

endif(CGAL_INCLUDE_DIR AND CGAL_LIBRARIES)
endif(CGAL_INCLUDE_DIR AND CGAL_LIBRARIES AND BOOST_THREAD_LIBRARIES AND GMP_LIBRARIES)
5 changes: 3 additions & 2 deletions core/src/astar_boost_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
*
*/

// Include C header first for windows build issue
#include "astar.h"

#include <boost/config.hpp>

#include <boost/graph/graph_traits.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/astar_search.hpp>

#include "astar.h"

#include <cmath> // for sqrt

using namespace std;
Expand Down
5 changes: 3 additions & 2 deletions core/src/boost_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
*
*/

// Include C header first for windows build issue
#include "dijkstra.h"

#include <boost/config.hpp>

#include <boost/graph/graph_traits.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/dijkstra_shortest_paths.hpp>

#include "dijkstra.h"

using namespace std;
using namespace boost;

Expand Down
5 changes: 3 additions & 2 deletions core/src/shooting_star_boost_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@
*
*/

// Include C header first for windows build issue
#include "shooting_star.h"

#include <boost/config.hpp>

#include <boost/graph/graph_traits.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/property_map/vector_property_map.hpp>
#include <shooting_star_search.hpp>

#include "shooting_star.h"

#include <cmath> // for sqrt

using namespace std;
Expand Down
5 changes: 4 additions & 1 deletion extra/driving_distance/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
SET(LIBRARY_OUTPUT_PATH ../../../lib/)
LINK_LIBRARIES(${CGAL_LIBRARIES})
LINK_LIBRARIES(${CGAL_LIBRARIES} ${GMP_LIBRARIES} ${BOOST_THREAD_LIBRARIES})
ADD_LIBRARY(routing_dd SHARED alpha.c alpha_drivedist.cpp alpha.h boost_drivedist.cpp drivedist.c drivedist.h)
IF(WIN32)
SET_TARGET_PROPERTIES(routing_dd PROPERTIES COMPILE_FLAGS "-DBOOST_THREAD_USE_LIB -DBoost_USE_STATIC_LIBS -DBOOST_USE_WINDOWS_H")
ENDIF(WIN32)
INSTALL(TARGETS routing_dd DESTINATION ${LIBRARY_INSTALL_PATH})
3 changes: 3 additions & 0 deletions extra/driving_distance/src/alpha.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@

#define _ALPHA_H

#ifdef __MINGW64__
#define ELOG_H
#endif
#include "postgres.h"
#include "dijkstra.h"

Expand Down
7 changes: 6 additions & 1 deletion extra/driving_distance/src/alpha_drivedist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@
Takes a list of points and returns a list of segments
corresponding to the Alpha shape.
************************************************************************/

#ifdef __MINGW64__
#include <windows.h>
namespace boost {
void tss_cleanup_implemented() { }
}
#endif
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Filtered_kernel.h>
#include <CGAL/algorithm.h>
Expand Down
5 changes: 3 additions & 2 deletions extra/driving_distance/src/boost_drivedist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
*
*/

// Include C header first for windows build issue
#include "drivedist.h"

#include <boost/config.hpp>

#include <boost/graph/graph_traits.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/dijkstra_shortest_paths.hpp>

#include "drivedist.h"

using namespace std;
using namespace boost;

Expand Down
3 changes: 3 additions & 0 deletions extra/tsp/src/tsp_solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
extern "C"
{
#include <gaul.h>
#ifdef __MINGW64__
#define ELOG_H
#endif
#include <postgres.h>
}

Expand Down