@@ -25,11 +25,12 @@ set(CMAKE_CXX_STANDARD_REQUIRED YES)
2525if (MSVC )
2626 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHs-c- /GR-" )
2727else ()
28- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-rtti " )
28+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -frtti " )
2929endif ()
3030
3131include (FindPackageHandleStandardArgs )
3232find_package (Python3 3.6 REQUIRED COMPONENTS Interpreter )
33+ find_package (Boost REQUIRED COMPONENTS )
3334
3435# Build Dynamatic with ccache if the package is present
3536set (DYNAMATIC_CCACHE_BUILD OFF CACHE BOOL "Set to ON for a ccache enabled build" )
@@ -143,13 +144,62 @@ endfunction()
143144find_package (GUROBI )
144145if (GUROBI_FOUND)
145146 include_directories (${GUROBI_INCLUDE_DIRS} )
147+
148+ # [START Check if the gurobi license is correctly set]
149+ execute_process (
150+ COMMAND gurobi_cl --license
151+ OUTPUT_VARIABLE GRB_LICENSE_VERSION
152+ RESULT_VARIABLE GRB_LICENSE_RESULT
153+ OUTPUT_STRIP_TRAILING_WHITESPACE
154+ )
155+
156+ if (GRB_LICENSE_RESULT EQUAL 0)
157+ message (STATUS "gurobi_cl found and the license is correctly set." )
158+ else ()
159+ message (FATAL_ERROR "gurobi_cl not found or the license is not correctly
160+ set. Please check out
161+ https://github.com/EPFL-LAP/dynamatic/blob/main/docs/UserGuide/AdvancedBuild.md#1-gurobi" )
162+ endif ()
163+ # [END Check if the gurobi license is correctly set]
164+
146165else ()
147166 message (WARNING "Gurobi wasn't found, the buffer placement algorithms \
148167 that requires solving MILPs will not be built with the \
149168 project." )
150169 add_compile_definitions (DYNAMATIC_GUROBI_NOT_INSTALLED )
151170endif ()
152171
172+ #-------------------------------------------------------------------------------
173+ # CBC solver setup
174+ #-------------------------------------------------------------------------------
175+
176+ # Find the CBC, Osi, Clp libraries
177+ find_package (PkgConfig REQUIRED )
178+
179+ # Use pkg-config to get include dirs and libs
180+ # This command sets
181+ # - *_INCLUDE_DIRS
182+ # - *_LIBRARY_DIRS
183+ # But these variable will not be automatically discovered by the target.
184+ pkg_check_modules (CBC REQUIRED cbc )
185+ pkg_check_modules (CLPCORE REQUIRED clp )
186+ pkg_check_modules (OSI REQUIRED osi )
187+
188+ # This command makes the include directory of CBC discoverable
189+ include_directories (dynamatic-opt PRIVATE
190+ ${CBC_INCLUDE_DIRS}
191+ ${CLPCORE_INCLUDE_DIRS}
192+ ${OSI_INCLUDE_DIRS}
193+ )
194+
195+ # This command makes the link directory of CBC discoverable
196+ # Without this, -lCbc would not work on some distros
197+ link_directories (dynamatic-opt PRIVATE
198+ ${CBC_LIBRARY_DIRS}
199+ ${CLPCORE_LIBRARY_DIRS}
200+ ${OSI_LIBRARY_DIRS}
201+ )
202+
153203#-------------------------------------------------------------------------------
154204# XLS Integration (experimental)
155205#-------------------------------------------------------------------------------
@@ -218,3 +268,4 @@ add_subdirectory(${DYNAMATIC_SOURCE_DIR}/lib)
218268add_subdirectory (${DYNAMATIC_SOURCE_DIR} /test )
219269add_subdirectory (${DYNAMATIC_SOURCE_DIR} /tools )
220270add_subdirectory (${DYNAMATIC_SOURCE_DIR} /tutorials )
271+ add_subdirectory (${DYNAMATIC_SOURCE_DIR} /unittests )
0 commit comments