3 CMAKE_MINIMUM_REQUIRED(VERSION 2.4.0)
5 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -fmessage-length=0 -Wdisabled-optimization")
9 # Set default build type to "Release", change it in the GUI if you need to build with debug.
10 IF(NOT CMAKE_BUILD_TYPE)
11 SET(CMAKE_BUILD_TYPE Release CACHE STRING
12 "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
14 ENDIF(NOT CMAKE_BUILD_TYPE)
16 # Use CMake's 2.6 new policy for library paths.
17 IF(COMMAND CMAKE_POLICY)
18 CMAKE_POLICY(SET CMP0003 NEW)
19 ENDIF(COMMAND CMAKE_POLICY)
21 INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}")
22 INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/AstroToolbox")
23 INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/Functions/rng")
24 INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/Functions/objfuns")
25 INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/GOclasses/algorithms")
26 INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/GOclasses/basic")
27 INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/GOclasses/problems")
28 INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/SolversThreads")
30 # Let's include Boost's headers.
31 INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/external_headers")
33 # Suggested for multithreaded code.
34 ADD_DEFINITIONS(-D_REENTRANT)
36 SET(MANDATORY_LIBRARIES "")
38 CHECK_TYPE_SIZE("void *" POINTER_SIZE)
39 MESSAGE(STATUS "Pointer size = ${POINTER_SIZE}")
41 SET(PAGMO_LIB_SRC_LIST
42 ${CMAKE_SOURCE_DIR}/AstroToolbox/Astro_Functions.cpp
43 ${CMAKE_SOURCE_DIR}/AstroToolbox/Lambert.cpp
44 ${CMAKE_SOURCE_DIR}/AstroToolbox/mga.cpp
45 ${CMAKE_SOURCE_DIR}/AstroToolbox/mga_dsm.cpp
46 ${CMAKE_SOURCE_DIR}/AstroToolbox/misc4Tandem.cpp
47 ${CMAKE_SOURCE_DIR}/AstroToolbox/Pl_Eph_An.cpp
48 ${CMAKE_SOURCE_DIR}/AstroToolbox/PowSwingByInv.cpp
49 ${CMAKE_SOURCE_DIR}/AstroToolbox/propagateKEP.cpp
50 ${CMAKE_SOURCE_DIR}/AstroToolbox/time2distance.cpp
51 ${CMAKE_SOURCE_DIR}/Functions/objfuns/trajobjfuns.cpp
52 ${CMAKE_SOURCE_DIR}/GOclasses/algorithms/ASA.cpp
53 ${CMAKE_SOURCE_DIR}/GOclasses/algorithms/DE.cpp
54 ${CMAKE_SOURCE_DIR}/GOclasses/algorithms/MPSO.cpp
55 ${CMAKE_SOURCE_DIR}/GOclasses/algorithms/PSO.cpp
56 ${CMAKE_SOURCE_DIR}/GOclasses/algorithms/SGA.cpp
57 ${CMAKE_SOURCE_DIR}/GOclasses/basic/individual.cpp
58 ${CMAKE_SOURCE_DIR}/GOclasses/basic/population.cpp
59 ${CMAKE_SOURCE_DIR}/GOclasses/problems/GOproblem.cpp
60 ${CMAKE_SOURCE_DIR}/GOclasses/problems/TrajectoryProblems.cpp
61 ${CMAKE_SOURCE_DIR}/SolversThreads/SolversThreads.cpp
65 ADD_DEFINITIONS(-DBOOST_THREAD_BUILD_LIB)
66 SET(PAGMO_LIB_SRC_LIST ${PAGMO_LIB_SRC_LIST} boost_thread/tss_null.cpp)
68 SET(PAGMO_LIB_SRC_LIST ${PAGMO_LIB_SRC_LIST}
69 boost_thread/win32/exceptions.cpp
70 boost_thread/win32/thread.cpp
71 boost_thread/win32/tss_dll.cpp
72 boost_thread/win32/tss_pe.cpp
75 # If we are not in Windows, let's require pthread.
76 FIND_LIBRARY(PTHREAD_LIBRARY pthread)
77 IF(NOT PTHREAD_LIBRARY)
78 MESSAGE(FATAL_ERROR "pthread library not found, please specify manually where it is located.")
79 ENDIF(NOT PTHREAD_LIBRARY)
80 # TODO: check about the dl library here.
81 SET(MANDATORY_LIBRARIES ${MANDATORY_LIBRARIES} pthread)
82 SET(PAGMO_LIB_SRC_LIST ${PAGMO_LIB_SRC_LIST}
83 boost_thread/pthread/exceptions.cpp
84 boost_thread/pthread/once.cpp
85 boost_thread/pthread/thread.cpp
89 ADD_LIBRARY(pagmo STATIC ${PAGMO_LIB_SRC_LIST})
91 ADD_EXECUTABLE(main main.cpp)
93 TARGET_LINK_LIBRARIES(main pagmo ${MANDATORY_LIBRARIES})