diff --git a/shared/CMakeLists.txt b/shared/CMakeLists.txt index ced97ed7c..917c19441 100644 --- a/shared/CMakeLists.txt +++ b/shared/CMakeLists.txt @@ -5,7 +5,7 @@ ##################################################################################################################### set(CMAKE_VERBOSE_MAKEFILE ON) -include_directories(. ../splinter/include ../) +include_directories(. ../splinter/include $ENV{ORTOOLSDIR}/include/eigen3 $ENV{ORTOOLSDIR}/include ../) set(SHARED_SRC 6par_gamma.h @@ -145,9 +145,6 @@ set( DEPENDENCIES splinter ) -find_package(re2 CONFIG REQUIRED) -find_package(Eigen3 CONFIG REQUIRED) - if (USE_XPRESS) if (NOT DEFINED XPRESS_ROOT AND DEFINED ENV{XPRESS_ROOT}) set(XPRESS_ROOT $ENV{XPRESS_ROOT}) @@ -175,8 +172,120 @@ if (USE_XPRESS) target_link_libraries(shared XPRESS::XPRESS) endif() -find_package(ortools CONFIG REQUIRED) -target_link_libraries(shared ortools::ortools) + +if (UNIX) + find_package(re2 + HINTS $ENV{ORTOOLSDIR} + CONFIG REQUIRED) + find_package(Eigen3 + HINTS $ENV{ORTOOLSDIR} + CONFIG REQUIRED) + find_package(ortools + HINTS $ENV{ORTOOLSDIR} + CONFIG REQUIRED) + target_link_libraries(shared ortools::ortools) +elseif(MSVC) + # get absl + find_package(absl + HINTS "$ENV{ORTOOLSDIR}/lib/cmake/absl" + REQUIRED + ) + foreach(_absl_target IN ITEMS absl::atomic_hook absl::errno_saver absl::log_severity absl::raw_logging_internal absl::spinlock_wait absl::config absl::dynamic_annotations absl::core_headers absl::malloc_internal absl::base_internal absl::base absl::throw_delegate absl::pretty_function absl::endian absl::scoped_set_env absl::strerror absl::fast_type_id absl::prefetch absl::algorithm absl::algorithm_container absl::cleanup_internal absl::cleanup absl::btree absl::compressed_tuple absl::fixed_array absl::inlined_vector_internal absl::inlined_vector absl::counting_allocator absl::flat_hash_map absl::flat_hash_set absl::node_hash_map absl::node_hash_set absl::container_memory absl::hash_function_defaults absl::hash_policy_traits absl::common_policy_traits absl::hashtablez_sampler absl::hashtable_debug absl::hashtable_debug_hooks absl::node_slot_policy absl::raw_hash_map absl::container_common absl::raw_hash_set absl::layout absl::crc_cpu_detect absl::crc_internal absl::crc32c absl::non_temporal_arm_intrinsics absl::non_temporal_memcpy absl::crc_cord_state absl::stacktrace absl::symbolize absl::examine_stack absl::failure_signal_handler absl::debugging_internal absl::demangle_internal absl::leak_check absl::debugging absl::flags_path_util absl::flags_program_name absl::flags_config absl::flags_marshalling absl::flags_commandlineflag_internal absl::flags_commandlineflag absl::flags_private_handle_accessor absl::flags_reflection absl::flags_internal absl::flags absl::flags_usage_internal absl::flags_usage absl::flags_parse absl::any_invocable absl::bind_front absl::function_ref absl::hash absl::city absl::low_level_hash absl::log_internal_check_impl absl::log_internal_check_op absl::log_internal_conditions absl::log_internal_config absl::log_internal_flags absl::log_internal_format absl::log_internal_globals absl::log_internal_log_impl absl::log_internal_proto absl::log_internal_message absl::log_internal_log_sink_set absl::log_internal_nullguard absl::log_internal_nullstream absl::log_internal_strip absl::log_internal_voidify absl::log_internal_append_truncated absl::absl_check absl::absl_log absl::check absl::die_if_null absl::log_flags absl::log_globals absl::log_initialize absl::log absl::log_entry absl::log_sink absl::log_sink_registry absl::log_streamer absl::log_internal_structured absl::log_structured absl::memory absl::type_traits absl::meta absl::bits absl::int128 absl::numeric absl::numeric_representation absl::sample_recorder absl::exponential_biased absl::periodic_sampler absl::random_random absl::random_bit_gen_ref absl::random_internal_mock_helpers absl::random_distributions absl::random_seed_gen_exception absl::random_seed_sequences absl::random_internal_traits absl::random_internal_distribution_caller absl::random_internal_fast_uniform_bits absl::random_internal_seed_material absl::random_internal_pool_urbg absl::random_internal_salted_seed_seq absl::random_internal_iostream_state_saver absl::random_internal_generate_real absl::random_internal_wide_multiply absl::random_internal_fastmath absl::random_internal_nonsecure_base absl::random_internal_pcg_engine absl::random_internal_randen_engine absl::random_internal_platform absl::random_internal_randen absl::random_internal_randen_slow absl::random_internal_randen_hwaes absl::random_internal_randen_hwaes_impl absl::random_internal_distribution_test_util absl::random_internal_uniform_helper absl::status absl::statusor absl::strings absl::strings_internal absl::str_format absl::str_format_internal absl::cord_internal absl::cordz_update_tracker absl::cordz_functions absl::cordz_statistics absl::cordz_handle absl::cordz_info absl::cordz_sample_token absl::cordz_update_scope absl::cord absl::graphcycles_internal absl::kernel_timeout_internal absl::synchronization absl::time absl::civil_time absl::time_zone absl::any absl::bad_any_cast absl::bad_any_cast_impl absl::span absl::optional absl::bad_optional_access absl::bad_variant_access absl::variant absl::compare absl::utility) + string(REPLACE "::" "_" _absl_target_name ${_absl_target}) + set(lib_release "LIB_${_absl_target_name}_RELEASE") + set(lib_debug "LIB_${_absl_target_name}_DEBUG") + set(lib_absl "LIB_${_absl_target_name}") + get_target_property(lib_release ${_absl_target} LOCATION) + if (NOT "${lib_release}" STREQUAL "lib_release-NOTFOUND") + #message("lib absl location ${lib_release}") + string(REPLACE release debug lib_debug ${lib_release}) + set(lib_absl + "$<$>:${lib_release}>" + "$<$:${lib_debug}>") + target_link_libraries(shared ${lib_absl}) + endif() + endforeach() + + # get re2 + find_package(re2 + HINTS "$ENV{ORTOOLSDIR}/lib/cmake/re2" + REQUIRED + ) + get_target_property(LIB_RE2_RELEASE re2::re2 LOCATION) + #message("lib re2 location ${LIB_RE2_RELEASE}") + string(REPLACE release debug LIB_RE2_DEBUG ${LIB_RE2_RELEASE}) + set(LIB_RE2_LIBS + "$<$>:${LIB_RE2_RELEASE}>" + "$<$:${LIB_RE2_DEBUG}>") + target_link_libraries(shared ${LIB_RE2_LIBS}) + + + # get utf8 + find_package(utf8_range + HINTS "$ENV{ORTOOLSDIR}/lib/cmake/utf8_range" + REQUIRED + ) + get_target_property(LIB_UTF8_RELEASE utf8_range::utf8_validity LOCATION) + #message("lib protobuf location ${LIB_UTF8_RELEASE}") + string(REPLACE release debug LIB_UTF8_DEBUG ${LIB_UTF8_RELEASE}) + set(LIB_UTF8_LIBS + "$<$>:${LIB_UTF8_RELEASE}>" + "$<$:${LIB_UTF8_DEBUG}>") + target_link_libraries(shared ${LIB_UTF8_LIBS}) + + # get protobuf + find_package(protobuf + HINTS "$ENV{ORTOOLSDIR}/cmake" + REQUIRED + ) + get_target_property(LIB_PROTOBUF_RELEASE protobuf::libprotobuf LOCATION) + #message("lib protobuf location ${LIB_PROTOBUF_RELEASE}") + string(REPLACE release debug LIB_PROTOBUF_DEBUG ${LIB_PROTOBUF_RELEASE}) + string(REPLACE ".lib" "d.lib" LIB_PROTOBUF_DEBUG ${LIB_PROTOBUF_DEBUG}) + set(LIB_PROTOBUF_LIBS + "$<$>:${LIB_PROTOBUF_RELEASE}>" + "$<$:${LIB_PROTOBUF_DEBUG}>") + target_link_libraries(shared ${LIB_PROTOBUF_LIBS}) + + # get SCIP + set(SCIP_ROOT "$ENV{ORTOOLSDIR}/bin") + find_package(scip + HINTS "$ENV{ORTOOLSDIR}/lib/cmake/scip" + REQUIRED + ) + get_target_property(LIB_SCIP_RELEASE libscip LOCATION) + #message("lib scip location ${LIB_SCIP_RELEASE}") + string(REPLACE release debug LIB_SCIP_DEBUG ${LIB_SCIP_RELEASE}) + set(LIB_SCIP_LIBRARIES + "$<$>:${LIB_SCIP_RELEASE}>" + "$<$:${LIB_SCIP_DEBUG}>" + ) + target_link_libraries(shared ${LIB_SCIP_LIBRARIES}) + + # get ZLIB + find_library( ZLIB + NAMES zlib.lib + PATHS $ENV{ORTOOLSDIR}/lib) + find_library( ZLIBD + NAMES zlibd.lib + PATHS $ENV{ORTOOLSDBDIR}/lib) + target_link_libraries(shared debug ${ZLIBD}) + target_link_libraries(shared optimized ${ZLIB}) + + # get or-tools + find_package(ortools + HINTS "$ENV{ORTOOLSDIR}/lib/cmake/ortools" + REQUIRED + ) + get_target_property(LIB_ORTOOLS_RELEASE ortools::ortools LOCATION) + #message("lib ortools location ${LIB_ORTOOLS_RELEASE}") + string(REPLACE release debug LIB_ORTOOLS_DEBUG ${LIB_ORTOOLS_RELEASE}) + set(LIB_ORTOOLS_LIBRARIES + "$<$>:${LIB_ORTOOLS_RELEASE}>" + "$<$:${LIB_ORTOOLS_DEBUG}>" + ) + target_link_libraries(shared ${LIB_ORTOOLS_LIBRARIES}) +endif() if (UNIX) set(CMAKE_SHARED_LINKER_FLAGS "-lm") diff --git a/splinter/include/definitions.h b/splinter/include/definitions.h index df68793a4..f788f70df 100644 --- a/splinter/include/definitions.h +++ b/splinter/include/definitions.h @@ -32,21 +32,21 @@ #pragma GCC diagnostic push // #pragma GCC diagnostic ignored "-Wignored-attributes" #endif -#include "Eigen/Core" -#include "Eigen/LU" -#include "Eigen/Cholesky" -#include "Eigen/QR" -#include "Eigen/SVD" -#include "Eigen/Geometry" -#include "Eigen/Eigenvalues" +#include +#include +#include +#include +#include +#include +#include //# include -#include "Eigen/SparseCore" -#include "Eigen/OrderingMethods" -#include "Eigen/SparseCholesky" -#include "Eigen/SparseLU" -#include "Eigen/SparseQR" -#include "Eigen/IterativeLinearSolvers" +#include +#include +#include +#include +#include +#include #include diff --git a/ssc/CMakeLists.txt b/ssc/CMakeLists.txt index 5fc54d82d..c2bad0ec9 100644 --- a/ssc/CMakeLists.txt +++ b/ssc/CMakeLists.txt @@ -6,7 +6,7 @@ # For CMake build option `SAMAPI_EXPORT`, see ../CMakeLists.txt -include_directories(. ../splinter/include ../shared ../nlopt ../lpsolve ../solarpilot ../tcs ../ssc) +include_directories(. ../splinter/include $ENV{ORTOOLSDIR}/include/eigen3 $ENV{ORTOOLSDIR}/include ../shared ../nlopt ../lpsolve ../solarpilot ../tcs ../ssc) set(SSC_SRC cmod_6parsolve.cpp