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 INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}")
17 INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/AstroToolbox")
18 INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/Functions/rng")
19 INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/Functions/objfuns")
20 INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/GOclasses/algorithms")
21 INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/GOclasses/basic")
22 INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/GOclasses/problems")
23 INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/SolversThreads")
25 # Let's include Boost's headers.
26 INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/external_headers")
28 # Suggested for multithreaded code.
29 ADD_DEFINITIONS(-D_REENTRANT)
31 SET(MANDATORY_LIBRARIES "")
33 CHECK_TYPE_SIZE("void *" POINTER_SIZE)
34 MESSAGE(STATUS "Pointer size = ${POINTER_SIZE}")
36 SET(PAGMO_LIB_SRC_LIST
37 ${CMAKE_SOURCE_DIR}/AstroToolbox/Astro_Functions.cpp
38 ${CMAKE_SOURCE_DIR}/AstroToolbox/Lambert.cpp
39 ${CMAKE_SOURCE_DIR}/AstroToolbox/mga.cpp
40 ${CMAKE_SOURCE_DIR}/AstroToolbox/mga_dsm.cpp
41 ${CMAKE_SOURCE_DIR}/AstroToolbox/misc4Tandem.cpp
42 ${CMAKE_SOURCE_DIR}/AstroToolbox/Pl_Eph_An.cpp
43 ${CMAKE_SOURCE_DIR}/AstroToolbox/PowSwingByInv.cpp
44 ${CMAKE_SOURCE_DIR}/AstroToolbox/propagateKEP.cpp
45 ${CMAKE_SOURCE_DIR}/AstroToolbox/time2distance.cpp
46 ${CMAKE_SOURCE_DIR}/Functions/objfuns/trajobjfuns.cpp
47 ${CMAKE_SOURCE_DIR}/GOclasses/algorithms/ASA.cpp
48 ${CMAKE_SOURCE_DIR}/GOclasses/algorithms/DE.cpp
49 ${CMAKE_SOURCE_DIR}/GOclasses/algorithms/MPSO.cpp
50 ${CMAKE_SOURCE_DIR}/GOclasses/algorithms/PSO.cpp
51 ${CMAKE_SOURCE_DIR}/GOclasses/algorithms/SGA.cpp
52 ${CMAKE_SOURCE_DIR}/GOclasses/basic/individual.cpp
53 ${CMAKE_SOURCE_DIR}/GOclasses/basic/population.cpp
54 ${CMAKE_SOURCE_DIR}/GOclasses/problems/GOproblem.cpp
55 ${CMAKE_SOURCE_DIR}/GOclasses/problems/TrajectoryProblems.cpp
56 ${CMAKE_SOURCE_DIR}/SolversThreads/SolversThreads.cpp
60 ADD_DEFINITIONS(-DBOOST_THREAD_BUILD_LIB)
61 SET(PAGMO_LIB_SRC_LIST ${PAGMO_LIB_SRC_LIST} boost_thread/tss_null.cpp)
63 SET(PAGMO_LIB_SRC_LIST ${PAGMO_LIB_SRC_LIST}
64 boost_thread/win32/exceptions.cpp
65 boost_thread/win32/thread.cpp
66 boost_thread/win32/tss_dll.cpp
67 boost_thread/win32/tss_pe.cpp
70 # If we are not in Windows, let's require pthread.
71 FIND_LIBRARY(PTHREAD_LIBRARY pthread)
72 IF(NOT PTHREAD_LIBRARY)
73 MESSAGE(FATAL_ERROR "pthread library not found, please specify manually where it is located.")
74 ENDIF(NOT PTHREAD_LIBRARY)
75 # TODO: check about the dl library here.
76 SET(MANDATORY_LIBRARIES ${MANDATORY_LIBRARIES} pthread)
77 SET(PAGMO_LIB_SRC_LIST ${PAGMO_LIB_SRC_LIST}
78 boost_thread/pthread/exceptions.cpp
79 boost_thread/pthread/once.cpp
80 boost_thread/pthread/thread.cpp
84 ADD_LIBRARY(pagmo STATIC ${PAGMO_LIB_SRC_LIST})
86 ADD_EXECUTABLE(main main.cpp)
88 TARGET_LINK_LIBRARIES(main pagmo ${MANDATORY_LIBRARIES})