Merge branch 'master' into boost.thread
[PaGMO.git] / CMakeLists.txt
blobb057338b4bb41e55823ee939cfa21d37890518ed
1 PROJECT(PaGMO)
3 CMAKE_MINIMUM_REQUIRED(VERSION 2.4.0)
5 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -fmessage-length=0 -Wdisabled-optimization")
6 SET(CMAKE_BUILD_TYPE "Release")
8 INCLUDE(CheckTypeSize)
10 INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}")
11 INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/AstroToolbox")
12 INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/Functions/rng")
13 INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/Functions/objfuns")
14 INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/GOclasses/algorithms")
15 INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/GOclasses/basic")
16 INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/GOclasses/problems")
17 INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/SolversThreads")
19 # Let's include Boost's headers.
20 INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/external_headers")
22 SET(MANDATORY_LIBRARIES "")
24 CHECK_TYPE_SIZE("void *" POINTER_SIZE)
25 MESSAGE(STATUS "Pointer size = ${POINTER_SIZE}")
27 SET(PAGMO_LIB_SRC_LIST
28         ${CMAKE_SOURCE_DIR}/AstroToolbox/Astro_Functions.cpp
29         ${CMAKE_SOURCE_DIR}/AstroToolbox/Lambert.cpp
30         ${CMAKE_SOURCE_DIR}/AstroToolbox/mga.cpp
31         ${CMAKE_SOURCE_DIR}/AstroToolbox/mga_dsm.cpp
32         ${CMAKE_SOURCE_DIR}/AstroToolbox/misc4Tandem.cpp
33         ${CMAKE_SOURCE_DIR}/AstroToolbox/Pl_Eph_An.cpp
34         ${CMAKE_SOURCE_DIR}/AstroToolbox/PowSwingByInv.cpp
35         ${CMAKE_SOURCE_DIR}/AstroToolbox/propagateKEP.cpp
36         ${CMAKE_SOURCE_DIR}/AstroToolbox/time2distance.cpp
37         ${CMAKE_SOURCE_DIR}/Functions/rng/PkRandom.cpp
38         ${CMAKE_SOURCE_DIR}/Functions/objfuns/trajobjfuns.cpp
39         ${CMAKE_SOURCE_DIR}/GOclasses/algorithms/ASA.cpp
40         ${CMAKE_SOURCE_DIR}/GOclasses/algorithms/DE.cpp
41         ${CMAKE_SOURCE_DIR}/GOclasses/algorithms/MPSO.cpp
42         ${CMAKE_SOURCE_DIR}/GOclasses/algorithms/PSO.cpp
43         ${CMAKE_SOURCE_DIR}/GOclasses/algorithms/SGA.cpp
44         ${CMAKE_SOURCE_DIR}/GOclasses/basic/individual.cpp
45         ${CMAKE_SOURCE_DIR}/GOclasses/basic/population.cpp
46         ${CMAKE_SOURCE_DIR}/GOclasses/problems/GOproblem.cpp
47         ${CMAKE_SOURCE_DIR}/GOclasses/problems/TrajectoryProblems.cpp
48         ${CMAKE_SOURCE_DIR}/SolversThreads/SolversThreads.cpp
51 # Boost thread setup.
52 ADD_DEFINITIONS(-DBOOST_THREAD_BUILD_LIB)
53 SET(PAGMO_LIB_SRC_LIST ${PAGMO_LIB_SRC_LIST} boost_thread/tss_null.cpp)
54 IF(WIN32)
55         SET(PAGMO_LIB_SRC_LIST ${PAGMO_LIB_SRC_LIST}
56                 boost_thread/win32/exceptions.cpp
57                 boost_thread/win32/thread.cpp
58                 boost_thread/win32/tss_dll.cpp
59                 boost_thread/win32/tss_pe.cpp
60         )
61 ELSE(WIN32)
62     # If we are not in Windows, let's require pthread.
63     FIND_LIBRARY(PTHREAD_LIBRARY pthread)
64     IF(NOT PTHREAD_LIBRARY)
65         MESSAGE(FATAL_ERROR "pthread library not found, please specify manually where it is located.")
66     ENDIF(NOT PTHREAD_LIBRARY)
67     # TODO: check about the dl library here.
68     SET(MANDATORY_LIBRARIES ${MANDATORY_LIBRARIES} pthread)
69         SET(PAGMO_LIB_SRC_LIST ${PAGMO_LIB_SRC_LIST}
70                 boost_thread/pthread/exceptions.cpp
71                 boost_thread/pthread/once.cpp
72                 boost_thread/pthread/thread.cpp
73         )
74 ENDIF(WIN32)
76 ADD_LIBRARY(pagmo STATIC ${PAGMO_LIB_SRC_LIST})
78 ADD_EXECUTABLE(main main.cpp)
80 TARGET_LINK_LIBRARIES(main pagmo ${MANDATORY_LIBRARIES})