@@ -41,193 +41,39 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
4141 set (LINK_NO_AS_NEEDED "-Wl,--no-as-needed" )
4242endif ()
4343
44-
45-
4644########################################################################
4745# System libraries #
4846########################################################################
4947include (CheckLibraryExists )
5048
51- check_library_exists (dl dlopen "" LIB_DL )
52- if (LIB_DL)
53- set (SYSTEM_LIBRARIES ${SYSTEM_LIBRARIES} dl)
54- else (LIB_DL )
49+ check_library_exists (dl dlopen "" HAVE_DL )
50+ if (NOT HAVE_DL)
5551 message (FATAL_ERROR "TREX requires lib dl" )
56- endif (LIB_DL )
57-
58- check_library_exists (pthread pthread_self "" LIB_PTHREAD )
59- if (LIB_PTHREAD)
60- set (SYSTEM_LIBRARIES ${SYSTEM_LIBRARIES} pthread)
61- endif (LIB_PTHREAD )
62-
63- check_library_exists (rt shm_unlink "" LIB_RT )
64- if (LIB_RT)
65- set (SYSTEM_LIBRARIES ${SYSTEM_LIBRARIES} rt)
66- endif (LIB_RT )
67-
68- ########################################################################
69- # Boost C++ general requirement
70- ########################################################################
71-
72- #set(Boost_USE_STATIC_LIBS ON)
73- #set(Boost_USE_MULTITHREADED ON)
74- #set(Boost_USE_STATIC_RUNTIME OFF)
52+ endif (NOT HAVE_DL )
7553
76- option (WITH_CPP11 "Compile with C++11 support" OFF )
54+ find_package (Boost 1.70 REQUIRED COMPONENTS
55+ system regex date_time program_options thread )
7756
78- # The minimum requirement
79- find_package (Boost 1.46.1 REQUIRED COMPONENTS
80- system filesystem thread regex signals date_time program_options )
8157
8258if (NOT Boost_FOUND)
8359 message (ERROR "Unable to find Boost (>=1.46.1) library" )
8460endif (NOT Boost_FOUND )
8561
86- include_directories (${Boost_INCLUDE_DIRS} )
87- find_package (Boost COMPONENTS chrono )
88- message (STATUS "Checking for Boost.Chrono: ${Boost_CHRONO_LIBRARY} " )
89-
90-
91- if (Boost_CHRONO_LIBRARY)
92- set (CHRONO_LIB ${Boost_CHRONO_LIBRARY} CACHE PATH "Boost chrono library path" FORCE )
93- else (Boost_CHRONO_LIBRARY )
94- set (CHRONO_LIB "" CACHE PATH "Boost chrono not found" FORCE )
95- if (NOT WITH_CPP11)
96- message (FATAL_ERROR "Boost.Chrono was not found and WITH_CPP11 is false."
97- "Try to enable WITH_CPP11 in order to find C++11 chrono implementation." )
98- endif (NOT WITH_CPP11 )
99- endif (Boost_CHRONO_LIBRARY )
100-
101- ########################################################################
102- # C++11 capabilities #
103- ########################################################################
104- if (WITH_CPP11)
105- include (${PROJECT_SOURCE_DIR } /cmake/cpp11/cpp11.cmake )
106-
107- if (NOT CHRONO_LIB)
108- cpp11_feature_detection (CHRONO )
109- if (NOT CPP11_HAS_CHRONO)
110- message (ERROR "Did not find required chrono support" )
111- endif (NOT CPP11_HAS_CHRONO )
112- endif (NOT CHRONO_LIB )
113- # Helpers to refine the code when cpp11 enabled
114- cpp11_feature_detection (UNIQUE_PTR )
115- cpp11_feature_detection (SHARED_PTR )
116- cpp11_feature_detection (DELETED_FUNCTIONS )
117- #cpp11_feature_detection(THREAD)
118-
119- if (CPP11_ENABLED)
120- set (boost_flags -I${Boost_INCLUDE_DIRS} )
121- # A simple date_time program : will fail to compile if boost
122- # was linked to a non c++11 compatible standard library
123- # this handle Clang that links against different lib*c++ depending
124- # on c++11 flags
125- cpp11_lib_support (Boost_DATE_TIME "#include <boost/date_time/posix_time/posix_time.hpp>
126- #include <iostream>
127-
128- using namespace boost::posix_time\;
129-
130- int main(int argc, char *argv[]) {
131- ptime today(second_clock::local_time())\;
132- std::cout<<today<<std::endl\;
133- return 0\;
134- }" ${boost_flags} ${Boost_DATE_TIME_LIBRARY} )
135-
136-
137- if (NOT ${CPP11_SUPPORT_Boost_DATE_TIME} )
138- message (FATAL_ERROR " Boost.DATE_TIME library cannot be used with C++11" )
139- endif (NOT ${CPP11_SUPPORT_Boost_DATE_TIME} )
140-
141- cpp11_lib_support (Boost_PROGRAM_OPTIONS "#include <boost/program_options.hpp>
142- #include <iostream>
143-
144- namespace po=boost::program_options\;
145-
146- namespace {
147- po::options_description opt(\" Test:\" )\;
148- }
149-
150- int main(int argc, char *argv[]) {
151- opt.add_options()
152- (\" help,h\" , \" should print help\" )
153- (\" val,v\" , po::value< std::vector<std::string> >(), \" A set of strings\" )
154- (\" int,i\" , po::value<int>()->implicit_value(0), \" An integer\" )\;
155-
156- po::variables_map vals\;
157-
158- try {
159- po::store(po::command_line_parser(argc,argv).options(opt).run(), vals)\;
160- po::notify(vals)\;
161- } catch(po::error) {
162- return 1\;
163- }
164- return 0\;
165- }" ${boost_flags} ${Boost_PROGRAM_OPTIONS_LIBRARY} )
166-
167- # this test if boost/get_pointer defines get_pointer for std::shared_ptr
168- if (CPP11_HAS_SHARED_PTR)
169- file (WRITE ${CMAKE_BINARY_DIR } /boost_get_pointer_test.cc "#include <memory>
170- #include <boost/get_pointer.hpp>
171-
172- int main(int argv, char *argc[]) {
173- std::shared_ptr<int> foo = std::make_shared<int>(0);
174- return boost::get_pointer(foo)==foo.get()?0:1;
175- }
176- " )
177- try_compile (success
178- ${CMAKE_BINARY_DIR }
179- ${CMAKE_BINARY_DIR } /boost_get_pointer_test.cc
180- COMPILE_DEFINITIONS ${CPP11_COMPILER_SWITCH} ${boost_flags}
181- CMAKE_FLAGS
182- -DCMAKE_EXE_LINKER_FLAGS:STRING=${CPP11_link_flags}
183- -DLINK_LIBRARIES:STRING=${LIBS}
184- OUTPUT_VARIABLE OUT )
185- set (CPP11_BOOST_GET_POINTER_STD ${success} )
186- if (NOT success)
187- file (WRITE ${CMAKE_BINARY_DIR } /boost_get_pointer_test.out ${OUT} )
188- endif (NOT success )
189- message (STATUS "Test if boost::get_pointer support std::shared_ptr: ${CPP11_BOOST_GET_POINTER_STD} " )
190- endif (CPP11_HAS_SHARED_PTR )
191-
192-
193- if (NOT ${CPP11_SUPPORT_Boost_PROGRAM_OPTIONS} )
194- message (FATAL_ERROR " Boost.Program_Options library cannot be used with C++11" )
195- endif (NOT ${CPP11_SUPPORT_Boost_PROGRAM_OPTIONS} )
196-
197- add_definitions (${CPP11_COMPILER_SWITCH} )
198- # SET (CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS_INIT} $ENV{LDFLAGS}
199- # CACHE STRING "Flags used by the linker during the creation of dll's.")
200- # set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} ${CPP11_LINK_FLAGS})
201- # set(CMAKE_LINK_LIBRARY_FLAGS ${CMAKE_LINK_LIBRARY_FLAGS} ${CPP11_LINK_FLAGS})
202- # message(STATUS "CPP11_LINK_FLAGS=${CPP11_LINK_FLAGS}")
203- # message(STATUS "CMAKE_LINK_LIBRARY_FLAGS=${CMAKE_LINK_LIBRARY_FLAGS}")
204- # # The xcode stuff
205- # set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++0x")
206- # set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
207- endif (CPP11_ENABLED )
208- else (WITH_CPP11 )
209- # ensure that cpp11 is not enabled
210- set (CPP11_ENABLED FALSE )
211- endif (WITH_CPP11 )
212-
213- message (STATUS "CPP11 enabled: ${CPP11_ENABLED} " )
214- message (STATUS "CHRONO_LIB: ${CHRONO_LIB} " )
215-
21662########################################################################
21763# Europa #
21864########################################################################
219-
22065option (WITH_EUROPA "Enable Europa plugin." ON )
22166
222- if (WITH_EUROPA)
67+ if (WITH_EUROPA)
22368 find_package (Europa
22469 COMPONENTS PlanDatabase ConstraintEngine TemporalNetwork Utils TinyXml
225- NDDL RulesEngine Solvers System )
70+ NDDL RulesEngine Solvers System )
22671 if (NOT EUROPA_FOUND)
227- message (FATAL_ERROR "Failed to find Europa while WITH_EUROPA is ON" )
72+ message (FATAL_ERROR "Failed to find Europa while WITH_EUROPA is ON" )
22873 endif (NOT EUROPA_FOUND )
22974endif (WITH_EUROPA )
23075
76+
23177########################################################################
23278# Doxygen #
23379########################################################################
0 commit comments