2017-02-14 11:49:54 +00:00
|
|
|
# Copyright (C) 2017 Ortega Froysa, Nicolás <deathsbreed@themusicinnoise.net>
|
|
|
|
# Author: Ortega Froysa, Nicolás <deathsbreed@themusicinnoise.net>
|
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2018-10-18 13:26:02 +00:00
|
|
|
cmake_minimum_required(VERSION 3.0)
|
|
|
|
project(Indivisible C)
|
2016-11-30 13:32:06 +00:00
|
|
|
|
|
|
|
set(TARGET_NAME indivisible)
|
2018-10-18 10:04:07 +00:00
|
|
|
set(TARGET_VERSION "v2.0")
|
2016-11-30 13:32:06 +00:00
|
|
|
|
|
|
|
if(NOT CMAKE_BUILD_TYPE)
|
2018-10-18 10:00:32 +00:00
|
|
|
set(CMAKE_BUILD_TYPE "release")
|
2016-11-30 13:32:06 +00:00
|
|
|
endif()
|
2017-03-16 13:59:26 +00:00
|
|
|
string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE)
|
|
|
|
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
|
2016-11-30 13:32:06 +00:00
|
|
|
|
2016-12-02 15:31:12 +00:00
|
|
|
set(CMAKE_MODULE_PATH
|
|
|
|
${CMAKE_MODULE_PATH}
|
|
|
|
${CMAKE_SOURCE_DIR}/cmake/)
|
|
|
|
|
|
|
|
find_package(GMP REQUIRED)
|
2018-10-18 13:26:02 +00:00
|
|
|
find_package(MPI REQUIRED)
|
2016-11-30 21:20:46 +00:00
|
|
|
|
2016-12-02 15:34:12 +00:00
|
|
|
include_directories(
|
2018-10-18 13:26:02 +00:00
|
|
|
${MPI_C_INCLUDE_PATH}
|
2016-12-02 15:34:12 +00:00
|
|
|
${GMP_INCLUDE_DIR})
|
|
|
|
|
2016-11-30 13:32:06 +00:00
|
|
|
set(SRCS
|
2018-10-18 10:50:57 +00:00
|
|
|
"src/linked_list.c"
|
|
|
|
"src/main.c")
|
2016-12-09 22:02:51 +00:00
|
|
|
|
|
|
|
# Define the C flags.
|
2018-10-18 13:26:02 +00:00
|
|
|
set(CMAKE_C_FLAGS "-std=gnu99 ${MPI_C_COMPILE_FLAGS} -Wall -Wextra -Werror -Wfatal-errors -Wmissing-declarations -pedantic-errors")
|
2016-12-14 16:58:12 +00:00
|
|
|
set(CMAKE_C_FLAGS_DEBUG "-g -O0")
|
|
|
|
set(CMAKE_C_FLAGS_RELEASE "-O3")
|
|
|
|
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -O3")
|
|
|
|
set(CMAKE_C_FLAGS_MINSIZEREL "-Os")
|
2016-11-30 13:32:06 +00:00
|
|
|
|
2017-03-16 13:59:26 +00:00
|
|
|
if(NOT CMAKE_BUILD_TYPE MATCHES "debug" AND NOT CMAKE_BUILD_TYPE MATCHES "relwithdebinfo")
|
|
|
|
add_definitions("-DNDEBUG")
|
2018-10-18 10:00:32 +00:00
|
|
|
else()
|
|
|
|
add_definitions("-DDEBUG")
|
2016-11-30 13:32:06 +00:00
|
|
|
endif()
|
|
|
|
|
2018-10-18 10:04:07 +00:00
|
|
|
add_definitions("-DVERSION=\"${TARGET_VERSION}\"")
|
|
|
|
|
2016-11-30 13:32:06 +00:00
|
|
|
add_executable(${TARGET_NAME} ${SRCS})
|
2016-12-02 15:34:12 +00:00
|
|
|
|
|
|
|
target_link_libraries(${TARGET_NAME}
|
2018-10-18 13:26:02 +00:00
|
|
|
${MPI_C_LIBRARIES}
|
2016-12-02 15:34:12 +00:00
|
|
|
${GMP_LIBRARY})
|
2017-03-27 14:22:16 +00:00
|
|
|
|
|
|
|
install(TARGETS ${TARGET_NAME}
|
|
|
|
RUNTIME DESTINATION "bin")
|