Skip to content

Commit

Permalink
Update FindCyclus.cmake to find the cython generated libraries if the…
Browse files Browse the repository at this point in the history
…y exist
  • Loading branch information
bennibbelink committed Apr 18, 2024
1 parent d51aa95 commit f6da60a
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 14 deletions.
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

0 comments on commit f6da60a

Please sign in to comment.