Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update FindCyclus.cmake #596

Merged
merged 3 commits into from
Apr 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ cycamore Change Log

**Changed:**

* Updated build procedure to use newer versions of packages in 2023 (#549)
* Updated build procedure to use newer versions of packages in 2023 (#549, #596)
* Added active/dormant and request size variation from buy policy to Storage (#546, #568, #586, #587)
* Update build procedure to force a rebuild when a test file is changed (#584)
* Define the version number in `CMakeLists.txt` and rely on CMake to propagate the version throughout the code (#589)
* Update version numbers in documentation and fix references to `master` branch (#591)
* Update build procedure to link against Cyclus' cython generated libraries if needed (#596)

v1.5.5
====================
Expand Down
30 changes: 16 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,16 @@ IF(NOT CYCLUS_DOC_ONLY)
MESSAGE("-- HDF5 High Level Libraries: ${HDF5_C_HL_LIBRARIES}")

# find coin and link to it
FIND_PACKAGE(COIN)
if(COIN_FOUND)
SET(CYCAMORE_INCLUDE_DIRS ${CYCAMORE_INCLUDE_DIRS} ${COIN_INCLUDE_DIRS})
SET(LIBS ${LIBS} ${COIN_LIBRARIES})
if(DEFAULT_ALLOW_MILPS)
FIND_PACKAGE(COIN REQUIRED)
if(COIN_FOUND)
SET(CYCAMORE_INCLUDE_DIRS ${CYCAMORE_INCLUDE_DIRS} ${COIN_INCLUDE_DIRS})
SET(LIBS ${LIBS} ${COIN_LIBRARIES})
endif()
MESSAGE("-- COIN Root: ${COIN_ROOT}")
MESSAGE("-- COIN Include directories: ${COIN_INCLUDE_DIRS}")
MESSAGE("-- COIN Libraries: ${COIN_LIBRARIES}")
endif()
MESSAGE("-- COIN Root: ${COIN_ROOT}")
MESSAGE("-- COIN Include directories: ${COIN_INCLUDE_DIRS}")
MESSAGE("-- COIN Libraries: ${COIN_LIBRARIES}")

# find SQLite
FIND_PACKAGE( SQLite3 REQUIRED )
Expand Down Expand Up @@ -249,13 +251,13 @@ IF(NOT CYCLUS_DOC_ONLY)
ENDIF(ICUUC_LIBRARIES)

# Python
find_package(PythonInterp)
message("-- PYTHON_EXECUTABLE: ${PYTHON_EXECUTABLE}")
find_package(PythonLibs)
MESSAGE("-- Found Python Libraries (optional): ${PYTHON_LIBRARIES}")
IF(PYTHON_LIBRARIES)
set(LIBS ${LIBS} ${PYTHON_LIBRARIES})
ENDIF(PYTHON_LIBRARIES)
find_package(Python3 COMPONENTS Interpreter Development)
message("-- PYTHON_EXECUTABLE: ${Python3_EXECUTABLE}")
MESSAGE("-- Found Python Libraries (optional): ${Python3_LIBRARIES}")
IF(Python3_FOUND)
set(LIBS ${LIBS} ${Python3_LIBRARIES})
message("libs set with ${Python3_LIBRARIES}")
ENDIF(Python3_FOUND)

# include all the directories we just found
INCLUDE_DIRECTORIES(${CYCAMORE_INCLUDE_DIRS})
Expand Down
35 changes: 35 additions & 0 deletions cmake/FindCyclus.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,30 @@ FIND_LIBRARY(CYCLUS_CORE_LIBRARY NAMES cyclus
/opt/local /opt/local/cyclus
PATH_SUFFIXES cyclus/lib lib)

# Look for the library
FIND_LIBRARY(CYCLUS_EVENTHOOKS_LIBRARY NAMES eventhooks.so
HINTS "${CYCLUS_ROOT_DIR}" "${CYCLUS_ROOT_DIR}/cyclus"
${DEPS_CYCLUS}
/usr/local/cyclus/lib /usr/local/cyclus
/opt/local /opt/local/cyclus
PATH_SUFFIXES cyclus/lib lib)

# Look for the library
FIND_LIBRARY(CYCLUS_PYINFILE_LIBRARY NAMES pyinfile.so
HINTS "${CYCLUS_ROOT_DIR}" "${CYCLUS_ROOT_DIR}/cyclus"
${DEPS_CYCLUS}
/usr/local/cyclus/lib /usr/local/cyclus
/opt/local /opt/local/cyclus
PATH_SUFFIXES cyclus/lib lib)

# Look for the library
FIND_LIBRARY(CYCLUS_PYMODULE_LIBRARY NAMES pymodule.so
HINTS "${CYCLUS_ROOT_DIR}" "${CYCLUS_ROOT_DIR}/cyclus"
${DEPS_CYCLUS}
/usr/local/cyclus/lib /usr/local/cyclus
/opt/local /opt/local/cyclus
PATH_SUFFIXES cyclus/lib lib)

# Look for the library
FIND_LIBRARY(CYCLUS_AGENT_TEST_LIBRARY NAMES baseagentunittests
HINTS "${CYCLUS_ROOT_DIR}" "${CYCLUS_ROOT_DIR}/cyclus"
Expand All @@ -112,6 +136,17 @@ IF(CYCLUS_CORE_INCLUDE_DIR AND CYCLUS_CORE_TEST_INCLUDE_DIR
AND CYCLUS_AGENT_TEST_LIBRARY)
SET(CYCLUS_CORE_FOUND 1)
SET(CYCLUS_CORE_LIBRARIES "${CYCLUS_CORE_LIBRARY}")
# if Cyclus was installed without Cython these three libraries won't be found because they don't exist
# if Cyclus was installed WITH Cython we need to link against them
if(NOT ${CYCLUS_EVENTHOOKS_LIBRARY} STREQUAL "CYCLUS_EVENTHOOKS_LIBRARY-NOTFOUND")
SET(CYCLUS_CORE_LIBRARIES "${CYCLUS_CORE_LIBRARIES}" "${CYCLUS_EVENTHOOKS_LIBRARY}")
endif()
if(NOT ${CYCLUS_PYINFILE_LIBRARY} STREQUAL "CYCLUS_PYINFILE_LIBRARY-NOTFOUND")
SET(CYCLUS_CORE_LIBRARIES "${CYCLUS_CORE_LIBRARIES}" "${CYCLUS_PYINFILE_LIBRARY}")
endif()
if(NOT ${CYCLUS_PYMODULE_LIBRARY} STREQUAL "CYCLUS_PYMODULE_LIBRARY-NOTFOUND")
SET(CYCLUS_CORE_LIBRARIES "${CYCLUS_CORE_LIBRARIES}" "${CYCLUS_PYMODULE_LIBRARY}")
endif()
SET(CYCLUS_TEST_LIBRARIES "${CYCLUS_GTEST_LIBRARY}" "${CYCLUS_AGENT_TEST_LIBRARY}")
SET(CYCLUS_AGENT_TEST_LIBRARIES "${CYCLUS_AGENT_TEST_LIBRARY}")
SET(CYCLUS_CORE_INCLUDE_DIRS "${CYCLUS_CORE_INCLUDE_DIR}")
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ARG make_cores=2
COPY . /cycamore
WORKDIR /cycamore

RUN python install.py -j ${make_cores} --build-type=Release
RUN python install.py -j ${make_cores} --build-type=Release --allow-milps

FROM cycamore as deb-generation
WORKDIR /cycamore/build
Expand Down
Loading