File tree Expand file tree Collapse file tree 4 files changed +33
-11
lines changed Expand file tree Collapse file tree 4 files changed +33
-11
lines changed Original file line number Diff line number Diff line change @@ -69,15 +69,10 @@ install(TARGETS neural)
6969# Remove leading or trailing whitespace
7070string (REGEX REPLACE "^ | $" "" LIBS "${LIBS} " )
7171
72- # tests
73-
74- foreach (execid input1d_layer input3d_layer dense_layer conv2d_layer maxpool2d_layer flatten_layer dense_network dense_network_from_keras conv2d_network io_hdf5 keras_read_model)
75- add_executable (test_${execid} test /test_${execid} .f90)
76- target_link_libraries (test_${execid} PRIVATE neural h5fortran::h5fortran jsonfortran::jsonfortran ${LIBS} )
77- add_test (test_${execid} bin/test_${execid} )
78- endforeach ()
72+ if (${PROJECT_NAME} _BUILD_TESTING)
73+ add_subdirectory (test )
74+ endif ()
7975
80- foreach (execid cnn mnist mnist_from_keras simple sine)
81- add_executable (${execid} example/${execid} .f90)
82- target_link_libraries (${execid} PRIVATE neural h5fortran::h5fortran jsonfortran::jsonfortran ${LIBS} )
83- endforeach ()
76+ if (${PROJECT_NAME} _BUILD_EXAMPLES)
77+ add_subdirectory (example)
78+ endif ()
Original file line number Diff line number Diff line change 11option (SERIAL "Serial execution" )
2+ option (${PROJECT_NAME} _BUILD_TESTING "build ${PROJECT_NAME} tests" true )
3+ option (${PROJECT_NAME} _BUILD_EXAMPLES "build ${PROJECT_NAME} examples" true )
24
35# Set output paths for modules, archives, and executables
46set (CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR} /include )
@@ -11,3 +13,18 @@ if(SERIAL)
1113else ()
1214 message (STATUS "Configuring build for parallel execution" )
1315endif ()
16+
17+ # --- Generally useful CMake project options
18+
19+ # Rpath options necessary for shared library install to work correctly in user projects
20+ set (CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX} /lib)
21+ set (CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX} /lib)
22+ set (CMAKE_INSTALL_RPATH_USE_LINK_PATH true )
23+
24+ # Necessary for shared library with Visual Studio / Windows oneAPI
25+ set (CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS true )
26+
27+ # --- auto-ignore build directory
28+ if (NOT EXISTS ${PROJECT_BINARY_DIR} /.gitignore)
29+ file (WRITE ${PROJECT_BINARY_DIR} /.gitignore "*" )
30+ endif ()
Original file line number Diff line number Diff line change 1+ foreach (execid cnn mnist mnist_from_keras simple sine)
2+ add_executable (${execid} ${execid} .f90)
3+ target_link_libraries (${execid} PRIVATE neural h5fortran::h5fortran jsonfortran::jsonfortran ${LIBS} )
4+ endforeach ()
Original file line number Diff line number Diff line change 1+ foreach (execid input1d_layer input3d_layer dense_layer conv2d_layer maxpool2d_layer flatten_layer dense_network dense_network_from_keras conv2d_network io_hdf5 keras_read_model)
2+ add_executable (test_${execid} test_${execid} .f90)
3+ target_link_libraries (test_${execid} PRIVATE neural h5fortran::h5fortran jsonfortran::jsonfortran ${LIBS} )
4+
5+ add_test (NAME test_${execid} COMMAND test_${execid} )
6+ endforeach ()
You can’t perform that action at this time.
0 commit comments