blue_noise_generation/CMakeLists.txt

78 lines
2.7 KiB
Text
Raw Normal View History

cmake_minimum_required(VERSION 3.9)
2023-04-01 12:48:19 +00:00
project(blueNoiseGen)
2023-04-01 12:48:19 +00:00
set(blueNoiseGen_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/src/blue_noise.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/image.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/arg_parse.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/utility.cpp
)
2023-07-23 08:34:38 +00:00
add_compile_options(
-Wall -Wextra -Wpedantic
$<$<COMPILE_LANGUAGE:CXX>:-Weffc++>
$<$<CONFIG:DEBUG>:-O0>
)
if(NOT DEFINED CMAKE_BUILD_TYPE OR NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Debug")
message("Set build type to Debug by default")
endif()
find_package(Threads REQUIRED)
2023-03-31 09:55:36 +00:00
if(NOT DEFINED DISABLE_OPENCL OR NOT DISABLE_OPENCL)
find_package(OpenCL)
if(NOT DEFINED OpenCL_FOUND)
set(DISABLE_OPENCL True)
message(WARNING "OpenCL not found, OpenCL usage is disabled.")
endif()
2023-03-31 09:55:36 +00:00
else()
message(STATUS "Not checking for OpenCL")
endif()
if(NOT DEFINED DISABLE_VULKAN OR NOT DISABLE_VULKAN)
find_package(Vulkan)
if(NOT DEFINED Vulkan_FOUND)
set(DISABLE_VULKAN True)
message(WARNING "Vulkan not found, Vulkan usage is disabled.")
endif()
else()
message(STATUS "Not checking for Vulkan")
endif()
2021-11-08 11:04:58 +00:00
find_package(PNG REQUIRED)
2023-04-01 12:48:19 +00:00
add_executable(blueNoiseGen ${blueNoiseGen_SOURCES})
target_compile_features(blueNoiseGen PUBLIC cxx_std_17)
2023-07-23 08:34:38 +00:00
target_compile_definitions(blueNoiseGen PRIVATE CL_TARGET_OPENCL_VERSION=300)
target_include_directories(blueNoiseGen PUBLIC Threads::Threads ${PNG_INCLUDE_DIRS})
target_link_libraries(blueNoiseGen PUBLIC Threads::Threads ${PNG_LIBRARIES})
if(DEFINED DISABLE_OPENCL AND DISABLE_OPENCL)
message(STATUS "OpenCL usage is disabled.")
2023-04-01 12:48:19 +00:00
target_compile_definitions(blueNoiseGen PRIVATE DITHERING_OPENCL_ENABLED=0)
else()
message(STATUS "OpenCL usage is enabled.")
2023-04-01 12:48:19 +00:00
target_include_directories(blueNoiseGen PUBLIC
${OpenCL_INCLUDE_DIRS})
2023-04-01 12:48:19 +00:00
target_link_libraries(blueNoiseGen PUBLIC
${OpenCL_LIBRARIES})
2023-04-01 12:48:19 +00:00
target_compile_definitions(blueNoiseGen PRIVATE DITHERING_OPENCL_ENABLED=1)
endif()
if(DEFINED DISABLE_VULKAN AND DISABLE_VULKAN)
message(STATUS "Vulkan usage is disabled.")
target_compile_definitions(blueNoiseGen PRIVATE DITHERING_VULKAN_ENABLED=0)
else()
message(STATUS "Vulkan usage is enabled.")
target_include_directories(blueNoiseGen PUBLIC
${Vulkan_INCLUDE_DIRS})
target_link_libraries(blueNoiseGen PUBLIC
${Vulkan_LIBRARIES})
target_compile_definitions(blueNoiseGen PRIVATE DITHERING_VULKAN_ENABLED=1)
if(CMAKE_BUILD_TYPE MATCHES "Debug")
target_compile_definitions(blueNoiseGen PRIVATE VULKAN_VALIDATION=1)
else()
target_compile_definitions(blueNoiseGen PRIVATE VULKAN_VALIDATION=0)
endif()
endif()