Skip to content

Commit 47ed468

Browse files
committed
Update cmake files using target features.
1 parent 31b06e8 commit 47ed468

File tree

19 files changed

+178
-188
lines changed

19 files changed

+178
-188
lines changed

CMakeLists.txt

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,36 +38,31 @@ if(FREETYPE_FOUND)
3838
endif()
3939
# ================================
4040

41-
set(CMAKE_DEBUG_POSTFIX "-debug")
42-
set(CMAKE_RELWITHDEBINFO_POSTFIX "-reldeb")
43-
4441
# platform specific configure
4542
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
46-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
47-
4843
# build type
4944
if(NOT CMAKE_BUILD_TYPE)
5045
set(CMAKE_BUILD_TYPE "Release" CACHE STRING
5146
"Choose the type of build, options are: None Debug Release."
5247
FORCE)
5348
endif()
5449
message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}")
55-
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
56-
if(MSVC)
57-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /wd\"4251\"")
58-
endif()
59-
else()
60-
message(WARNING "Unsupported system: ${CMAKE_SYSTEM_NAME}")
6150
endif()
6251

6352
# set input files
6453
include("${PROJECT_SOURCE_DIR}/files.cmake")
6554
# ==================================================================================================
6655

67-
# === build & install===============================================================================
68-
# create library
56+
# === target =======================================================================================
6957
add_library(${PROJECT_NAME} SHARED ${render_pipeline_sources} ${render_pipeline_headers})
7058

59+
target_compile_features(${PROJECT_NAME} PUBLIC cxx_final PRIVATE cxx_auto_type)
60+
if(MSVC)
61+
target_compile_options(${PROJECT_NAME} PRIVATE /MP /wd4251)
62+
else()
63+
target_compile_options(${PROJECT_NAME} PRIVATE -Wall)
64+
endif()
65+
7166
target_include_directories(${PROJECT_NAME}
7267
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
7368
$<INSTALL_INTERFACE:include>
@@ -85,8 +80,12 @@ target_link_libraries(${PROJECT_NAME}
8580
${FREETYPE_LIBRARIES} yaml-cpp spdlog::spdlog
8681
)
8782

88-
set_target_properties(${PROJECT_NAME} PROPERTIES DEFINE_SYMBOL "RPCPP_BUILD")
89-
set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${PROJECT_VERSION})
83+
set_target_properties(${PROJECT_NAME} PROPERTIES
84+
DEFINE_SYMBOL "RPCPP_BUILD"
85+
DEBUG_POSTFIX "-debug"
86+
RELWITHDEBINFO_POSTFIX "-reldeb"
87+
VERSION ${PROJECT_VERSION}
88+
)
9089

9190
# configure package
9291
set(PACKAGE_VERSION_CONFIG_FILE "${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake")
@@ -102,8 +101,9 @@ configure_package_config_file("${PROJECT_SOURCE_DIR}/CMake/${PROJECT_NAME}-confi
102101
${PACKAGE_CONFIG_FILE}
103102
INSTALL_DESTINATION ${PACKAGE_CMAKE_INSTALL_DIR})
104103
export(TARGETS ${PROJECT_NAME} FILE ${PROJECT_BINARY_DIR}/${TARGET_EXPORT_NAME}.cmake)
104+
# ==================================================================================================
105105

106-
# install
106+
# === install ======================================================================================
107107
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME ${PROJECT_NAME})
108108

109109
install(TARGETS ${PROJECT_NAME}

src/rpplugins/CMakeLists.txt

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,23 @@
11
# Author: Younguk Kim (bluekyu)
22
# Date : 2016-08-02
33

4-
cmake_minimum_required(VERSION 3.5)
4+
cmake_minimum_required(VERSION 3.6)
55

66
# === configure ====================================================================================
77
# rpplugins
88
set(RPPLUGINS_FOLDER_NAME "rpplugins")
99

10-
# subdirectory
11-
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/ao")
12-
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/bloom")
13-
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/clouds")
14-
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/color_correction")
15-
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/dof")
16-
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/env_probes")
17-
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/forward_shading")
18-
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/motion_blur")
19-
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/pssm")
20-
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/scattering")
21-
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/skin_shading")
22-
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/sky_ao")
23-
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/smaa")
24-
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/ssr")
25-
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/volumetrics")
26-
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/vxgi")
10+
set(RPCPP_PLUGINS "ao" "bloom" "clouds" "color_correction" "dof" "env_probes" "forward_shading"
11+
"motion_blur" "pssm" "scattering" "skin_shading" "sky_ao" "smaa" "ssr" "volumetrics" "vxgi")
2712

2813
# optional plugin
2914
option(RPCPP_PLUGIN_BUILD_OPENVR "Build OpenVR Plugin" OFF)
3015
if(RPCPP_PLUGIN_BUILD_OPENVR)
31-
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/openvr")
16+
list(APPEND RPCPP_PLUGINS "openvr")
3217
endif()
18+
19+
# subdirectory
20+
foreach(plugin_id ${RPCPP_PLUGINS})
21+
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/${plugin_id}")
22+
endforeach()
3323
# ==================================================================================================

src/rpplugins/ao/CMakeLists.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Author: Younguk Kim (bluekyu)
22
# Date : 2016-08-02
33

4-
cmake_minimum_required(VERSION 3.5)
4+
cmake_minimum_required(VERSION 3.6)
55
project(ao)
66

77
# === configure ====================================================================================
@@ -12,19 +12,13 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) # Project Grouping
1212

1313
# platform specific configure
1414
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
15-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
16-
1715
# build type
1816
if(NOT CMAKE_BUILD_TYPE)
1917
set(CMAKE_BUILD_TYPE "Release" CACHE STRING
2018
"Choose the type of build, options are: None Debug RelWithDebInfo Release."
2119
FORCE)
2220
endif()
2321
message("${PROJECT_NAME} Build Type: ${CMAKE_BUILD_TYPE}")
24-
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
25-
if(MSVC)
26-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /wd\"4251\"")
27-
endif()
2822
endif()
2923

3024
# set input files
@@ -35,10 +29,16 @@ set(plugin_sources
3529
"${PROJECT_SOURCE_DIR}/src/ao_stage.cpp")
3630
# ==================================================================================================
3731

38-
# === build & install===============================================================================
39-
# create library
32+
# === target =======================================================================================
4033
add_library(${PROJECT_NAME} MODULE ${plugin_sources})
4134

35+
target_compile_features(${PROJECT_NAME} PRIVATE cxx_auto_type)
36+
if(MSVC)
37+
target_compile_options(${PROJECT_NAME} PRIVATE /MP /wd4251)
38+
else()
39+
target_compile_options(${PROJECT_NAME} PRIVATE -Wall)
40+
endif()
41+
4242
target_compile_definitions(${PROJECT_NAME}
4343
PRIVATE RPCPP_PLUGIN_ID_STRING="${PROJECT_NAME}"
4444
)

src/rpplugins/bloom/CMakeLists.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Author: Younguk Kim (bluekyu)
22
# Date : 2016-08-02
33

4-
cmake_minimum_required(VERSION 3.5)
4+
cmake_minimum_required(VERSION 3.6)
55
project(bloom)
66

77
# === configure ====================================================================================
@@ -12,19 +12,13 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) # Project Grouping
1212

1313
# platform specific configure
1414
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
15-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
16-
1715
# build type
1816
if(NOT CMAKE_BUILD_TYPE)
1917
set(CMAKE_BUILD_TYPE "Release" CACHE STRING
2018
"Choose the type of build, options are: None Debug RelWithDebInfo Release."
2119
FORCE)
2220
endif()
2321
message("${PROJECT_NAME} Build Type: ${CMAKE_BUILD_TYPE}")
24-
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
25-
if(MSVC)
26-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /wd\"4251\"")
27-
endif()
2822
endif()
2923

3024
# set input files
@@ -35,10 +29,16 @@ set(plugin_sources
3529
"${PROJECT_SOURCE_DIR}/src/bloom_stage.cpp")
3630
# ==================================================================================================
3731

38-
# === build & install===============================================================================
39-
# create library
32+
# === target =======================================================================================
4033
add_library(${PROJECT_NAME} MODULE ${plugin_sources})
4134

35+
target_compile_features(${PROJECT_NAME} PRIVATE cxx_auto_type)
36+
if(MSVC)
37+
target_compile_options(${PROJECT_NAME} PRIVATE /MP /wd4251)
38+
else()
39+
target_compile_options(${PROJECT_NAME} PRIVATE -Wall)
40+
endif()
41+
4242
target_compile_definitions(${PROJECT_NAME}
4343
PRIVATE RPCPP_PLUGIN_ID_STRING="${PROJECT_NAME}"
4444
)

src/rpplugins/clouds/CMakeLists.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Author: Younguk Kim (bluekyu)
22
# Date : 2016-08-02
33

4-
cmake_minimum_required(VERSION 3.5)
4+
cmake_minimum_required(VERSION 3.6)
55
project(clouds)
66

77
# === configure ====================================================================================
@@ -12,19 +12,13 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) # Project Grouping
1212

1313
# platform specific configure
1414
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
15-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
16-
1715
# build type
1816
if(NOT CMAKE_BUILD_TYPE)
1917
set(CMAKE_BUILD_TYPE "Release" CACHE STRING
2018
"Choose the type of build, options are: None Debug RelWithDebInfo Release."
2119
FORCE)
2220
endif()
2321
message("${PROJECT_NAME} Build Type: ${CMAKE_BUILD_TYPE}")
24-
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
25-
if(MSVC)
26-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /wd\"4251\"")
27-
endif()
2822
endif()
2923

3024
# set input files
@@ -35,10 +29,16 @@ set(plugin_sources
3529
"${PROJECT_SOURCE_DIR}/src/apply_clouds_stage.cpp")
3630
# ==================================================================================================
3731

38-
# === build & install===============================================================================
39-
# create library
32+
# === target =======================================================================================
4033
add_library(${PROJECT_NAME} MODULE ${plugin_sources})
4134

35+
target_compile_features(${PROJECT_NAME} PRIVATE cxx_auto_type)
36+
if(MSVC)
37+
target_compile_options(${PROJECT_NAME} PRIVATE /MP /wd4251)
38+
else()
39+
target_compile_options(${PROJECT_NAME} PRIVATE -Wall)
40+
endif()
41+
4242
target_compile_definitions(${PROJECT_NAME}
4343
PRIVATE RPCPP_PLUGIN_ID_STRING="${PROJECT_NAME}"
4444
)

src/rpplugins/color_correction/CMakeLists.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Author: Younguk Kim (bluekyu)
22
# Date : 2016-08-02
33

4-
cmake_minimum_required(VERSION 3.5)
4+
cmake_minimum_required(VERSION 3.6)
55
project(color_correction)
66

77
# === configure ====================================================================================
@@ -12,19 +12,13 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) # Project Grouping
1212

1313
# platform specific configure
1414
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
15-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
16-
1715
# build type
1816
if(NOT CMAKE_BUILD_TYPE)
1917
set(CMAKE_BUILD_TYPE "Release" CACHE STRING
2018
"Choose the type of build, options are: None Debug RelWithDebInfo Release."
2119
FORCE)
2220
endif()
2321
message("${PROJECT_NAME} Build Type: ${CMAKE_BUILD_TYPE}")
24-
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
25-
if(MSVC)
26-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /wd\"4251\"")
27-
endif()
2822
endif()
2923

3024
# set input files
@@ -43,10 +37,16 @@ set(plugin_sources
4337
"${PROJECT_SOURCE_DIR}/src/tonemapping_stage.h")
4438
# ==================================================================================================
4539

46-
# === build & install===============================================================================
47-
# create library
40+
# === target =======================================================================================
4841
add_library(${PROJECT_NAME} MODULE ${plugin_sources})
4942

43+
target_compile_features(${PROJECT_NAME} PRIVATE cxx_auto_type)
44+
if(MSVC)
45+
target_compile_options(${PROJECT_NAME} PRIVATE /MP /wd4251)
46+
else()
47+
target_compile_options(${PROJECT_NAME} PRIVATE -Wall)
48+
endif()
49+
5050
target_compile_definitions(${PROJECT_NAME}
5151
PRIVATE RPCPP_PLUGIN_ID_STRING="${PROJECT_NAME}"
5252
)

src/rpplugins/dof/CMakeLists.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Author: Younguk Kim (bluekyu)
22
# Date : 2016-08-02
33

4-
cmake_minimum_required(VERSION 3.5)
4+
cmake_minimum_required(VERSION 3.6)
55
project(dof)
66

77
# === configure ====================================================================================
@@ -12,19 +12,13 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) # Project Grouping
1212

1313
# platform specific configure
1414
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
15-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
16-
1715
# build type
1816
if(NOT CMAKE_BUILD_TYPE)
1917
set(CMAKE_BUILD_TYPE "Release" CACHE STRING
2018
"Choose the type of build, options are: None Debug RelWithDebInfo Release."
2119
FORCE)
2220
endif()
2321
message("${PROJECT_NAME} Build Type: ${CMAKE_BUILD_TYPE}")
24-
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
25-
if(MSVC)
26-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /wd\"4251\"")
27-
endif()
2822
endif()
2923

3024
# set input files
@@ -35,10 +29,16 @@ set(plugin_sources
3529
"${PROJECT_SOURCE_DIR}/src/dof_stage.cpp")
3630
# ==================================================================================================
3731

38-
# === build & install===============================================================================
39-
# create library
32+
# === target =======================================================================================
4033
add_library(${PROJECT_NAME} MODULE ${plugin_sources})
4134

35+
target_compile_features(${PROJECT_NAME} PRIVATE cxx_auto_type)
36+
if(MSVC)
37+
target_compile_options(${PROJECT_NAME} PRIVATE /MP /wd4251)
38+
else()
39+
target_compile_options(${PROJECT_NAME} PRIVATE -Wall)
40+
endif()
41+
4242
target_compile_definitions(${PROJECT_NAME}
4343
PRIVATE RPCPP_PLUGIN_ID_STRING="${PROJECT_NAME}"
4444
)

0 commit comments

Comments
 (0)