Skip to content

Instantly share code, notes, and snippets.

@jbae11
Created August 2, 2017 19:19
Show Gist options
  • Save jbae11/ee275628b0fd277d4b998966081483e4 to your computer and use it in GitHub Desktop.
Save jbae11/ee275628b0fd277d4b998966081483e4 to your computer and use it in GitHub Desktop.
dkadkf@arfc-100 ~/github/cyborg (master) $ python install.py --orglib_root=~/SCALE-6.2.2/data/arplibs
/usr/bin/cmake
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- CMake Build type: 
-- Using /home/dkadkf/.local as CYCLUS_ROOT_DIR.
-- Found Cyclus Core Headers : /home/dkadkf/.local/include/cyclus
-- Found Cyclus Core Test Headers : /home/dkadkf/.local/include/cyclus
-- Found Cyclus Core Shared Data : /home/dkadkf/.local/share/cyclus
-- Found Cyclus Core Library : /home/dkadkf/.local/lib/libcyclus.so
-- Found Cyclus Test Libraries : /home/dkadkf/.local/lib/cyclus/libgtest.so/home/dkadkf/.local/lib/cyclus/libbaseagentunittests.so
-- LibXML++ find package args: LibXml2;REQUIRED
-- Found LibXml2: /usr/lib/x86_64-linux-gnu/libxml2.so (found version "2.9.3") 
-- LibXML++ find package args: Glibmm;REQUIRED
-- Glibmm find package args: Glib;REQUIRED
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Checking for module 'glib-2.0'
--   Found glib-2.0, version 2.48.2
-- Found glib-2.0: /home/dkadkf/anaconda3/include/glib-2.0, /home/dkadkf/anaconda3/lib/libglib-2.0.so
-- Glibmm find package args: SigC++;REQUIRED
-- Checking for module 'sigc++-2.0'
--   Found sigc++-2.0, version 2.6.2
-- Found SigC++ 
-- Checking for module 'glibmm-2.4'
--   Found glibmm-2.4, version 2.46.3
-- Found Glibmm 
-- Checking for module 'libxml++-2.6'
--   Found libxml++-2.6, version 2.40.1
-- Found LibXML++ 
--LIBS: /home/dkadkf/.local/lib/libcyclus.so;/usr/lib/x86_64-linux-gnu/libxml++-2.6.so;/usr/lib/x86_64-linux-gnu/libxml2.so;/usr/lib/x86_64-linux-gnu/libglibmm-2.4.so;/home/dkadkf/anaconda3/lib/libglib-2.0.so;/usr/lib/x86_64-linux-gnu/libsigc-2.0.so
--LD_LIBRARY_PATH: 
-- Boost version: 1.58.0
-- Found the following Boost libraries:
--   program_options
--   filesystem
--   system
--    Boost Root: 
--    Boost Include directory: /usr/include
--    Boost Library directories: /usr/lib/x86_64-linux-gnu
--    Boost Program Options location: /usr/lib/x86_64-linux-gnu/libboost_program_options.so
--    Boost Filesystem location: /usr/lib/x86_64-linux-gnu/libboost_filesystem.so
--    Boost Serialization location: 
-- Looking for sgemm_
-- Looking for sgemm_ - found
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- A library with BLAS API found.
-- Looking for cheev_
-- Looking for cheev_ - found
-- A library with LAPACK API found.
	Found LAPACK Libraries: /usr/lib/liblapack.so;/usr/lib/libblas.so
-- Found HDF5: /home/dkadkf/anaconda3/lib/libhdf5_hl.so;/home/dkadkf/anaconda3/lib/libhdf5.so;/usr/lib/x86_64-linux-gnu/librt.so;/usr/lib/x86_64-linux-gnu/libpthread.so;/home/dkadkf/anaconda3/lib/libz.so;/usr/lib/x86_64-linux-gnu/libdl.so;/usr/lib/x86_64-linux-gnu/libm.so  
--    HDF5 Root: 
--    HDF5 Include directory: /home/dkadkf/anaconda3/include
--    HDF5 Library directories: /home/dkadkf/anaconda3/lib
--    HDF5 Libraries: /home/dkadkf/anaconda3/lib/libhdf5_hl.so;/home/dkadkf/anaconda3/lib/libhdf5.so;/usr/lib/x86_64-linux-gnu/librt.so;/usr/lib/x86_64-linux-gnu/libpthread.so;/home/dkadkf/anaconda3/lib/libz.so;/usr/lib/x86_64-linux-gnu/libdl.so;/usr/lib/x86_64-linux-gnu/libm.so
-- Found Sqlite3 header file in /home/dkadkf/anaconda3/include
-- Found Sqlite3 libraries: /home/dkadkf/anaconda3/lib/libsqlite3.so
--    SQLITE3 Include directories: /home/dkadkf/anaconda3/include
--    SQLITE3 Libraries: /home/dkadkf/anaconda3/lib/libsqlite3.so
CMake Error at CMakeLists.txt:155 (include):
  include called with wrong number of arguments.  include() only takes one
  file.


-- Using /home/dkadkf/SCALE-6.2.2 as SCALE_ROOT_DIR.
SCALE_INCLUDE_DIR: /home/dkadkf/SCALE-6.2.2/include
SCALE JSON LIBRARY: /home/dkadkf/SCALE-6.2.2/lib/libStandard_Json.so
-- Found SCALE Headers: /home/dkadkf/SCALE-6.2.2/include
-- Found SCALE Libraries: /home/dkadkf/SCALE-6.2.2/lib/libScaleUtils_IO.so/home/dkadkf/SCALE-6.2.2/lib/libStandard_Json.so/home/dkadkf/SCALE-6.2.2/lib/libOrigenCore.so/home/dkadkf/SCALE-6.2.2/lib/libOrigenSolver.so
-- Setting ORGLIB_DIR to: /home/dkadkf/SCALE-6.2.2/data/arplibs
-- Starting construction of build files for agent: reactor
-- Copying /home/dkadkf/github/cyborg/src/cyclus_origen_interface.h to /home/dkadkf/github/cyborg/build/cyborg/cyclus_origen_interface.h.
-- Copying /home/dkadkf/github/cyborg/src/orglib_default_location.h to /home/dkadkf/github/cyborg/build/cyborg/orglib_default_location.h.
dstcustomheaders: cyclus_origen_interface.h;orglib_default_location.h
-- Executing /home/dkadkf/.local/include/cyclus/../../bin/cycpp.py /home/dkadkf/github/cyborg/src/reactor.cc --cpp-path=cpp -o=/home/dkadkf/github/cyborg/build/cyborg/reactor.cc --pass3-use-orig -I=:/home/dkadkf/SCALE-6.2.2/include:/home/dkadkf/.local/include/cyclus:/usr/include/libxml++-2.6:/usr/include/glibmm-2.4:/usr/lib/x86_64-linux-gnu/glibmm-2.4/include:/home/dkadkf/anaconda3/include/glib-2.0:/usr/lib/x86_64-linux-gnu/glib-2.0/include:/usr/include/sigc++-2.0:/usr/lib/x86_64-linux-gnu/sigc++-2.0/include:/usr/lib/x86_64-linux-gnu/libxml++-2.6/include:/usr/include:/home/dkadkf/anaconda3/include:/home/dkadkf/anaconda3/include:/home/dkadkf/github/cyborg/src
Traceback (most recent call last):
  File "/home/dkadkf/.local/include/cyclus/../../bin/cycpp.py", line 2369, in <module>
    main()
  File "/home/dkadkf/.local/include/cyclus/../../bin/cycpp.py", line 2353, in main
    context, superclasses = accumulate_state(canon)   # pass 2
  File "/home/dkadkf/.local/include/cyclus/../../bin/cycpp.py", line 908, in accumulate_state
    state.accumulate(statement, sep)
  File "/home/dkadkf/.local/include/cyclus/../../bin/cycpp.py", line 714, in accumulate
    filter.transform(statement, sep)
  File "/home/dkadkf/.local/include/cyclus/../../bin/cycpp.py", line 475, in transform
    state.var_annotations = self._eval()
  File "/home/dkadkf/.local/include/cyclus/../../bin/cycpp.py", line 454, in _eval
    self._add_gbl_proxies(glb, clspaths, val['vars'])
KeyError: 'vars'
CMake Error at /home/dkadkf/.local/share/cyclus/cmake/UseCyclus.cmake:128 (message):
  cycpp failed on '/home/dkadkf/github/cyborg/src/reactor.cc' with exit code
  '1'
Call Stack (most recent call first):
  src/CMakeLists.txt:53 (USE_CYCLUS)


-- Configuring incomplete, errors occurred!
See also "/home/dkadkf/github/cyborg/build/CMakeFiles/CMakeOutput.log".
See also "/home/dkadkf/github/cyborg/build/CMakeFiles/CMakeError.log".
Traceback (most recent call last):
  File "install.py", line 142, in <module>
    main()
  File "install.py", line 139, in main
    install(args)
  File "install.py", line 64, in install
    shell=(os.name == 'nt'))
  File "/home/dkadkf/anaconda3/lib/python3.6/subprocess.py", line 291, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '/home/dkadkf/github/cyborg', '-DCMAKE_INSTALL_PREFIX=/home/dkadkf/.local', '-DCYCLUS_ROOT_DIR=/home/dkadkf/.local', '-DUSER_ORGLIB_DIR=/home/dkadkf/SCALE-6.2.2/data/arplibs']' returned non-zero exit status 1.

#
# The USE_CYCLUS, INSTALL_CYCLUS_STANDALONE, INSTALL_CYCLUS_MODULE macros builds
# agent libraries for Cyclus given some source files.
#
# INSTALL_CYCLUS_STANDALONE is meant to build a single agent into its own
# module.  It implicitly calls USE_CYCLUS.  For example,
#
#   install_cyclus_standalone("TestFacility" "test_facility" "tests")
#
# INSTALL_CYCLUS_MODULE meanwhile is meant to be able to build many agents into
# the same module.  To do this the environment must first be prepared with
# USE_CYCLUS on all of the agents that will go into this module.  Then this
# macro need only be called once.  For example,
#
#   use_cyclus("agents" "sink")
#   use_cyclus("agents" "source")
#   use_cyclus("agents" "k_facility")
#   use_cyclus("agents" "prey")
#   use_cyclus("agents" "predator")
#   install_cyclus_module("agents" "")
#
# If test files (named *_tests.[h|cc]) are present, a unit test executable will
# be automatically generated. A custom test driver (i.e., a source file that
# contains a main() function for gtest to run) can optionally be provided to the
# INSTALL_CYCLUS_STANDALONE or INSTALL_CYCLUS_MODULE macros. If the driver
# supplied is NONE, then a test executable will *NOT* be created.
#
# Signtaures:
#   use_cyclus(lib_root src_root)
#   install_cyclus_standalone(lib_root src_root lib_dir [test_driver])
#   install_cyclus_module(lib_root lib_dir [test_driver])
#
# Arguments:
#   lib_root : the root library name, e.g., MyAgent
#   src_root : the root name of source files, e.g., my_agent for my_agent.h
#              and my_agent.cc
#   lib_dir : the directory to install the module or agent into.
#   test_driver : (optional) the custom test driver to use with unit tests,
#                 or NONE
#
# The CYCLUS_CUSTOM_HEADERS variable can optionally be set to contain one or
# more (space separated) header files before calling the USE_CYCLUS
# macro to add shared headers used by the archetype library being built.
#
# The following vars are updated.
#
# CYCLUS_LIBRARIES   : updated to include <lib_root>_LIB
#
# The following vars are set.
#
# <lib_root>_H       : the headers used for the agent
# <lib_root>_CC      : the srcs used for the agent
# <lib_root>_TEST_H  : the headers used for the agent tests, if it exists
# <lib_root>_TEST_CC : the srcs used for the agent tests, if it exists
#
# Target names that are valid:
#
# <lib_root>_LIB        : the name of the library target
# <lib_root>_unit_tests : the name of the unit test executable, if test source
#                         exists
#
MACRO(USE_CYCLUS lib_root src_root)
    MESSAGE(STATUS "Starting construction of build files for agent: ${src_root}")

    # output directory
    SET(AGENT_PATH "cyclus/${lib_root}")
    IF(NOT "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}" MATCHES
            ".*${AGENT_PATH}$")
        SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY
            ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${AGENT_PATH})
    ENDIF(NOT "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}" MATCHES
        ".*${AGENT_PATH}$")

    # get preprocessor script
    IF(NOT DEFINED CYCPP)
        SET(CYCPP "${CYCLUS_CORE_INCLUDE_DIRS}/../../bin/cycpp.py")
    ENDIF(NOT DEFINED CYCPP)

    # make a build directory
    SET(BUILD_DIR ${PROJECT_BINARY_DIR}/${lib_root})
    FILE(MAKE_DIRECTORY ${BUILD_DIR})

    # collect include directories argument
    GET_PROPERTY(DIRS DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
    SET(INCL_ARGS "-I=")
    FOREACH(DIR ${DIRS})
        SET(INCL_ARGS "${INCL_ARGS}:${DIR}")
    ENDFOREACH(DIR ${DIRS})


    # set cpp path
    IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
        SET(PREPROCESSOR "--cpp-path=clang++")
    ELSE()
        SET(PREPROCESSOR "--cpp-path=cpp")
    ENDIF()

    # copy custom headers
    FOREACH(fname ${CYCLUS_CUSTOM_HEADERS})
        SET(src "${CMAKE_CURRENT_SOURCE_DIR}/${fname}")
        SET(dst "${BUILD_DIR}/${fname}")
        MESSAGE(STATUS "Copying ${src} to ${dst}.")
        EXECUTE_PROCESS(COMMAND "cp" "${src}" "${dst}")
        ADD_CUSTOM_COMMAND(
            OUTPUT "${dst}"
            COMMAND "cp" "${src}" "${dst}"
            DEPENDS "${src}"
            COMMENT "Copying ${src} to ${dst}."
            )
    ENDFOREACH()
    MESSAGE("dstcustomheaders: ${CYCLUS_CUSTOM_HEADERS}")

    # process header
    SET(ORIG "--pass3-use-orig")
    SET(HIN "${CMAKE_CURRENT_SOURCE_DIR}/${src_root}.h")
    SET(HOUT "${BUILD_DIR}/${src_root}.h")
    SET(HFLAG "-o=${HOUT}")
    SET(CCIN "${CMAKE_CURRENT_SOURCE_DIR}/${src_root}.cc")
    SET(CCOUT "${BUILD_DIR}/${src_root}.cc")
    SET(CCFLAG "-o=${CCOUT}")

    # not sure if needed..
    IF(NOT EXISTS ${CCOUT})
        MESSAGE(STATUS "Executing ${CYCPP} ${CCIN} ${PREPROCESSOR} ${CCFLAG} ${ORIG} ${INCL_ARGS}")
        EXECUTE_PROCESS(COMMAND ${CYCPP} ${CCIN} ${PREPROCESSOR} ${CCFLAG}
                        ${ORIG} ${INCL_ARGS} RESULT_VARIABLE res_var)
        IF(NOT "${res_var}" STREQUAL "0")
            message(FATAL_ERROR "cycpp failed on '${CCIN}' with exit code '${res_var}'")
        ENDIF()
    ENDIF(NOT EXISTS ${CCOUT})
    SET(
        "${lib_root}_CC"
        "${${lib_root}_CC}" "${CCOUT}"
        CACHE INTERNAL "Agent impl" FORCE
        )
    IF(EXISTS "${HIN}")
        # not sure if we still need this...
        IF(NOT EXISTS ${HOUT})
            MESSAGE(STATUS "Executing ${CYCPP} ${HIN} ${PREPROCESSOR} ${HFLAG} ${ORIG} ${INCL_ARGS}")
            EXECUTE_PROCESS(COMMAND ${CYCPP} ${HIN} ${PREPROCESSOR} ${HFLAG} ${ORIG} ${INCL_ARGS}
                            RESULT_VARIABLE res_var)

            IF(NOT "${res_var}" STREQUAL "0")
                message(FATAL_ERROR "archetype preprocessing failed for ${HIN}, res_var = '${res_var}'")
            ENDIF()

        ENDIF(NOT EXISTS ${HOUT})
        ADD_CUSTOM_COMMAND(
            OUTPUT ${CCOUT}
            OUTPUT ${HOUT}
            COMMAND ${CYCPP} ${HIN} ${PREPROCESSOR} ${HFLAG} ${ORIG} ${INCL_ARGS}
            COMMAND ${CYCPP} ${CCIN} ${PREPROCESSOR} ${CCFLAG} ${ORIG} ${INCL_ARGS}
            DEPENDS ${HIN}
            DEPENDS ${CCIN}
            DEPENDS ${CYCPP}
            DEPENDS ${CYCLUS_CUSTOM_HEADERS}
            COMMENT "Executing ${CYCPP} ${HIN} ${PREPROCESSOR} ${HFLAG} ${ORIG} ${INCL_ARGS}"
            COMMENT "Executing ${CYCPP} ${CCIN} ${PREPROCESSOR} ${CCFLAG} ${ORIG} ${INCL_ARGS}"
            )
        SET(
            "${lib_root}_H"
            "${${lib_root}_H}" "${HOUT}"
            CACHE INTERNAL "Agent header" FORCE
            )
    ELSE(EXISTS "${HIN}")
        ADD_CUSTOM_COMMAND(
            OUTPUT ${CCOUT}
            COMMAND ${CYCPP} ${CCIN} ${PREPROCESSOR} ${CCFLAG} ${ORIG} ${INCL_ARGS}
            DEPENDS ${CCIN}
            DEPENDS ${CYCPP}
            DEPENDS ${CYCLUS_CUSTOM_HEADERS}
            COMMENT "Executing ${CYCPP} ${CCIN} ${PREPROCESSOR} ${CCFLAG} ${ORIG} ${INCL_ARGS}"
            )
    ENDIF(EXISTS "${HIN}")

    # add tests
    SET(CCTIN "${CMAKE_CURRENT_SOURCE_DIR}/${src_root}_tests.cc")
    SET(CCTOUT "${BUILD_DIR}/${src_root}_tests.cc")
    SET(HTIN "${CMAKE_CURRENT_SOURCE_DIR}/${src_root}_tests.h")
    SET(HTOUT "${BUILD_DIR}/${src_root}_tests.h")
    SET(CMD "cp")
    IF(EXISTS "${CCTIN}")
        IF(EXISTS "${HTIN}")
            # install test headers
            MESSAGE(STATUS "Copying ${HTIN} to ${HTOUT}.")
            EXECUTE_PROCESS(COMMAND ${CMD} ${HTIN} ${HTOUT})
            ADD_CUSTOM_COMMAND(
                OUTPUT ${HTOUT}
                OUTPUT ${CCTOUT}
                COMMAND ${CMD} ${HTIN} ${HTOUT}
                COMMAND ${CMD} ${CCTIN} ${CCTOUT}
                DEPENDS ${HIN}
                DEPENDS ${CCIN}
                DEPENDS ${HTIN}
                DEPENDS ${CCTIN}
                DEPENDS ${CYCLUS_CUSTOM_HEADERS}
                COMMENT "Copying ${HTIN} to ${HTOUT}."
                COMMENT "Copying ${CCTIN} to ${CCTOUT}."
                )
            SET("${lib_root}_TEST_H" "${${lib_root}_TEST_H}" "${HTOUT}"
                CACHE INTERNAL "Agent test headers" FORCE)
        ENDIF(EXISTS "${HTIN}")

        # install test impl
        MESSAGE(STATUS "Copying ${CCTIN} to ${CCTOUT}.")
        EXECUTE_PROCESS(COMMAND ${CMD} ${CCTIN} ${CCTOUT})
        ADD_CUSTOM_COMMAND(
            OUTPUT ${CCTOUT}
            COMMAND ${CMD} ${CCTIN} ${CCTOUT}
            DEPENDS ${CCTIN}
            DEPENDS ${CCIN}
            DEPENDS ${CYCLUS_CUSTOM_HEADERS}
            COMMENT "Copying ${CCTIN} to ${CCTOUT}."
            )
        SET("${lib_root}_TEST_CC" "${${lib_root}_TEST_CC}" "${CCOUT}" "${CCTOUT}"
            CACHE INTERNAL "Agent test source" FORCE)
    ENDIF(EXISTS "${CCTIN}")
    MESSAGE(STATUS "Finished construction of build files for agent: ${src_root}")
ENDMACRO()

MACRO(INSTALL_CYCLUS_STANDALONE lib_root src_root lib_dir)
    # clear variables before starting
    SET("${lib_root}_H" "" CACHE INTERNAL "Agent header" FORCE)
    SET("${lib_root}_CC" "" CACHE INTERNAL "Agent source" FORCE)
    SET("${lib_root}_LIB" "" CACHE INTERNAL "Agent library alias." FORCE)
    SET("${lib_root}_TEST_H" "" CACHE INTERNAL "Agent test headers" FORCE)
    SET("${lib_root}_TEST_CC" "" CACHE INTERNAL "Agent test source" FORCE)
    SET("${lib_root}_TEST_LIB" "" CACHE INTERNAL "Agent test library alias." FORCE)

    # check if a test driver was provided, otherwise use the default
    IF(${ARGC} GREATER 3 AND NOT "${ARGV4}" STREQUAL "")
        SET(DRIVER "${ARGV4}")
    ELSE(${ARGC} GREATER 3  AND NOT "${ARGV4}" STREQUAL "")
        SET(DRIVER "${CYCLUS_DEFAULT_TEST_DRIVER}")
    ENDIF(${ARGC} GREATER 3  AND NOT "${ARGV4}" STREQUAL "")

    USE_CYCLUS("${lib_root}" "${src_root}")
    INSTALL_CYCLUS_MODULE("${lib_root}" "${lib_dir}" ${DRIVER})
ENDMACRO()

MACRO(INSTALL_CYCLUS_MODULE lib_root lib_dir)
    SET(LIB_NAME "${lib_root}")
    SET(LIB_SRC "${${lib_root}_CC}")
    SET(LIB_H "${${lib_root}_H}")
    SET(TEST_SRC "${${lib_root}_TEST_CC}")
    SET(TEST_H "${${lib_root}_TEST_H}")
    SET(INST_DIR "${lib_dir}")

    # check if a test driver was provided, otherwise use the default
    IF(${ARGC} GREATER 2 AND NOT "${ARGV2}" STREQUAL "")
        SET(DRIVER "${ARGV2}")
    ELSE(${ARGC} GREATER 2 AND NOT "${ARGV2}" STREQUAL "")
        SET(DRIVER "${CYCLUS_DEFAULT_TEST_DRIVER}")
    ENDIF(${ARGC} GREATER 2 AND NOT "${ARGV2}" STREQUAL "")

    INSTALL_AGENT_LIB_("${LIB_NAME}" "${LIB_SRC}" "${LIB_H}" "${INST_DIR}")
    INSTALL_AGENT_TESTS_("${LIB_NAME}" "${TEST_SRC}" "${TEST_H}" "${DRIVER}" "${INST_DIR}")
ENDMACRO()

MACRO(INSTALL_AGENT_LIB_ lib_name lib_src lib_h inst_dir)
    # add lib
    ADD_LIBRARY(${lib_name} ${lib_src})
    TARGET_LINK_LIBRARIES(${lib_name} dl ${LIBS})
    SET(CYCLUS_LIBRARIES ${CYCLUS_LIBRARIES} ${lib_root})
    ADD_DEPENDENCIES(${lib_name} ${lib_src} ${lib_h})

    # install library
    INSTALL(
        TARGETS ${lib_name}
        LIBRARY DESTINATION lib/cyclus/${inst_dir}
        COMPONENT ${lib_name}
        )
    SET(${lib_name}_LIB ${lib_name} CACHE INTERNAL "Agent library alias." FORCE)

ENDMACRO()

MACRO(INSTALL_AGENT_TESTS_ lib_name test_src test_h driver inst_dir)

    # build & install test impl
    IF(NOT "${test_src}" STREQUAL "" AND NOT "${driver}" STREQUAL "NONE")
        SET(TGT ${lib_name}_unit_tests)
        MESSAGE(STATUS "Building agent unit test binary: ${TGT}")
        MESSAGE(STATUS "Using source: ${test_src}")
        MESSAGE(STATUS "And test driver: ${driver}")
        ADD_EXECUTABLE(
            ${TGT}
            ${driver}
            ${test_src}
            )
        TARGET_LINK_LIBRARIES(
            ${TGT} dl
            ${LIBS}
            ${CYCLUS_TEST_LIBRARIES}
            )
        INSTALL(
            TARGETS ${TGT}
            RUNTIME DESTINATION bin
            COMPONENT ${lib_name}_testing
            )
    ENDIF(NOT "${test_src}" STREQUAL "" AND NOT "${driver}" STREQUAL "NONE")
ENDMACRO()



macro(add_all_subdirs)
    file(GLOB all_valid_subdirs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*/CMakeLists.txt")

    foreach(dir ${all_valid_subdirs})
        if(${dir} MATCHES "^([^/]*)//CMakeLists.txt")
            string(REGEX REPLACE "^([^/]*)//CMakeLists.txt" "\\1" dir_trimmed ${dir})
            add_subdirectory(${dir_trimmed})
        endif()
    endforeach(dir)
endmacro()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment