Skip to content

Commit

Permalink
优化复用的变量
Browse files Browse the repository at this point in the history
  • Loading branch information
owent committed Apr 14, 2018
1 parent 378d0d2 commit ddbf84e
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 26 deletions.
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ include_macro_recurse(${CMAKE_CURRENT_LIST_DIR})
# feature detect
include(WriteCompilerDetectionHeader)

if (NOT EXISTS "${PROJECT_ROOT_INC_DIR}/libcopp/utils/config")
file(MAKE_DIRECTORY "${PROJECT_ROOT_INC_DIR}/libcopp/utils/config")
if (NOT EXISTS "${PROJECT_LIBCOPP_ROOT_INC_DIR}/libcopp/utils/config")
file(MAKE_DIRECTORY "${PROJECT_LIBCOPP_ROOT_INC_DIR}/libcopp/utils/config")
endif()

# generate check header
write_compiler_detection_header(
FILE "${PROJECT_ROOT_INC_DIR}/libcopp/utils/config/compiler_features.h"
FILE "${PROJECT_LIBCOPP_ROOT_INC_DIR}/libcopp/utils/config/compiler_features.h"
PREFIX UTIL_CONFIG
COMPILERS GNU Clang AppleClang MSVC
FEATURES cxx_auto_type cxx_constexpr cxx_decltype cxx_decltype_auto cxx_defaulted_functions cxx_deleted_functions cxx_final cxx_override cxx_range_for cxx_noexcept cxx_nullptr cxx_rvalue_references cxx_static_assert cxx_thread_local cxx_variadic_templates cxx_lambdas
Expand All @@ -47,8 +47,8 @@ else()
endif()

configure_file(
"${PROJECT_ROOT_INC_DIR}/libcopp/utils/config/build_feature.h.in"
"${PROJECT_ROOT_INC_DIR}/libcopp/utils/config/build_feature.h"
"${PROJECT_LIBCOPP_ROOT_INC_DIR}/libcopp/utils/config/build_feature.h.in"
"${PROJECT_LIBCOPP_ROOT_INC_DIR}/libcopp/utils/config/build_feature.h"
@ONLY
)

Expand Down
4 changes: 2 additions & 2 deletions include/include.macro.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# =========== include - macro ===========
set (PROJECT_ROOT_INC_DIR ${CMAKE_CURRENT_LIST_DIR})
set (PROJECT_LIBCOPP_ROOT_INC_DIR ${CMAKE_CURRENT_LIST_DIR})

include_directories(${PROJECT_ROOT_INC_DIR})
include_directories(${PROJECT_LIBCOPP_ROOT_INC_DIR})
2 changes: 1 addition & 1 deletion include/libcopp/utils/config/compiler_features.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
# undef UTIL_CONFIG_COMPILER_IS_zOS
# define UTIL_CONFIG_COMPILER_IS_zOS 1

#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800
#elif defined(__ibmxl__) || (defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800)
# undef UTIL_CONFIG_COMPILER_IS_XL
# define UTIL_CONFIG_COMPILER_IS_XL 1

Expand Down
1 change: 1 addition & 0 deletions sample/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

EchoWithColor(COLOR GREEN "-- Configure Sample Projects")

include ("${CMAKE_CURRENT_LIST_DIR}/sample.custom-macro.cmake")
# ============ sample - [...] ============

file(GLOB SAMPLE_SRC_LIST RELATIVE "${PROJECT_SAMPLE_SRC_DIR}"
Expand Down
5 changes: 5 additions & 0 deletions sample/sample.custom-macro.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# =========== sample ===========
set (PROJECT_SAMPLE_BAS_DIR ${CMAKE_CURRENT_LIST_DIR})
set (PROJECT_SAMPLE_INC_DIR ${PROJECT_SAMPLE_BAS_DIR})
set (PROJECT_SAMPLE_SRC_DIR ${PROJECT_SAMPLE_BAS_DIR})

5 changes: 0 additions & 5 deletions sample/sample.macro.cmake

This file was deleted.

4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

EchoWithColor(COLOR GREEN "-- Configure libraries")

add_subdirectory("${PROJECT_ROOT_SRC_DIR}/libcopp")
add_subdirectory("${PROJECT_LIBCOPP_ROOT_SRC_DIR}/libcopp")

# ========= libcotask =========
if (LIBCOTASK_ENABLE)
add_subdirectory("${PROJECT_ROOT_SRC_DIR}/libcotask")
add_subdirectory("${PROJECT_LIBCOPP_ROOT_SRC_DIR}/libcotask")
endif()
6 changes: 3 additions & 3 deletions src/libcopp.macro.cmake
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# =========== libcopp/src ===========
set (PROJECT_ROOT_SRC_DIR "${CMAKE_CURRENT_LIST_DIR}")
set (PROJECT_LIBCOPP_ROOT_SRC_DIR "${CMAKE_CURRENT_LIST_DIR}")

include("${PROJECT_ROOT_SRC_DIR}/libcopp/libcopp.lib.cmake")
include("${PROJECT_LIBCOPP_ROOT_SRC_DIR}/libcopp/libcopp.lib.cmake")

# ========= libcotask =========
if (LIBCOTASK_ENABLE)
include("${PROJECT_ROOT_SRC_DIR}/libcotask/libcotask.lib.cmake")
include("${PROJECT_LIBCOPP_ROOT_SRC_DIR}/libcotask/libcotask.lib.cmake")
endif()
2 changes: 1 addition & 1 deletion src/libcopp/libcopp.lib.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# =========== libcopp/src ===========
set (PROJECT_LIBCOPP_INC_DIR "${PROJECT_ROOT_INC_DIR}/libcopp")
set (PROJECT_LIBCOPP_INC_DIR "${PROJECT_LIBCOPP_ROOT_INC_DIR}/libcopp")
set (PROJECT_LIBCOPP_SRC_DIR "${CMAKE_CURRENT_LIST_DIR}")
set (PROJECT_LIBCOPP_LIB_LINK copp)

Expand Down
2 changes: 1 addition & 1 deletion src/libcotask/libcotask.lib.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# =========== libcopp/src ===========
set (PROJECT_LIBCOTASK_INC_DIR "${PROJECT_ROOT_INC_DIR}/libcotask")
set (PROJECT_LIBCOTASK_INC_DIR "${PROJECT_LIBCOPP_ROOT_INC_DIR}/libcotask")
set (PROJECT_LIBCOTASK_SRC_DIR "${CMAKE_CURRENT_LIST_DIR}")
set (PROJECT_LIBCOTASK_LIB_LINK cotask)

Expand Down
3 changes: 2 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ elseif(LIBCOPP_TEST_ENABLE_BOOST_UNIT_TEST)
endif()
endif()

include("${CMAKE_CURRENT_LIST_DIR}/test.custom-macro.cmake")
include_directories(${PROJECT_TEST_INC_DIR})

file(GLOB_RECURSE COPP_TEST_SRC_LIST
file(GLOB_RECURSE COPP_TEST_SRC_LIST
${PROJECT_TEST_SRC_DIR}/*.h
${PROJECT_TEST_SRC_DIR}/*.hpp
${PROJECT_TEST_SRC_DIR}/*.c
Expand Down
5 changes: 5 additions & 0 deletions test/test.custom-macro.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# =========== test ===========
set (PROJECT_TEST_BAS_DIR ${CMAKE_CURRENT_LIST_DIR})
set (PROJECT_TEST_SRC_DIR ${PROJECT_TEST_BAS_DIR})
set (PROJECT_TEST_INC_DIR ${PROJECT_TEST_BAS_DIR})

5 changes: 0 additions & 5 deletions test/test.macro.cmake

This file was deleted.

0 comments on commit ddbf84e

Please sign in to comment.