Skip to content

Commit daf9361

Browse files
committed
cmake default to Release, explicit SERIAL option
1 parent 5af4651 commit daf9361

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

CMakeLists.txt

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
# CMake version, project name, language
22
cmake_minimum_required(VERSION 3.20)
3-
project(neural-fortran Fortran)
3+
4+
# If build type not specified, default to release
5+
if(NOT CMAKE_BUILD_TYPE)
6+
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Default build Release")
7+
endif()
8+
9+
project(neural-fortran LANGUAGES Fortran)
10+
11+
option(SERIAL "Serial execution")
412

513
# Set output paths for modules, archives, and executables
614
set(CMAKE_Fortran_MODULE_DIRECTORY ${PROJECT_BINARY_DIR}/include)
715
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
816
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
917
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
1018

11-
# If build type not specified, default to release
12-
if(NOT CMAKE_BUILD_TYPE)
13-
set(CMAKE_BUILD_TYPE "release")
14-
endif()
15-
1619
if(SERIAL)
1720
message(STATUS "Configuring build for serial execution")
1821
else()
@@ -57,7 +60,7 @@ if(CMAKE_Fortran_COMPILER_ID MATCHES GNU)
5760
set(LIBS "${LIBS} blas")
5861
message(STATUS "Configuring build to use BLAS from ${BLAS}")
5962
endif()
60-
63+
6164
set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -g -fcheck=bounds -fbacktrace")
6265
set(CMAKE_Fortran_FLAGS_RELEASE "-Ofast -fno-frontend-optimize")
6366
endif()
@@ -140,7 +143,7 @@ foreach(execid input1d_layer input3d_layer dense_layer conv2d_layer maxpool2d_la
140143
target_link_libraries(test_${execid} PRIVATE neural h5fortran::h5fortran jsonfortran ${LIBS})
141144
add_test(test_${execid} bin/test_${execid})
142145
endforeach()
143-
146+
144147
foreach(execid cnn mnist mnist_from_keras simple sine)
145148
add_executable(${execid} example/${execid}.f90)
146149
target_link_libraries(${execid} PRIVATE neural h5fortran::h5fortran jsonfortran ${LIBS})

0 commit comments

Comments
 (0)