Changeset View
Changeset View
Standalone View
Standalone View
source/creator/CMakeLists.txt
| Show First 20 Lines • Show All 147 Lines • ▼ Show 20 Lines | if(WIN32 AND NOT UNIX) | ||||
| ) | ) | ||||
| endif() | endif() | ||||
| if(WITH_BUILDINFO) | if(WITH_BUILDINFO) | ||||
| add_definitions(-DWITH_BUILDINFO) | add_definitions(-DWITH_BUILDINFO) | ||||
| # -------------------------------------------------------------------------- | # -------------------------------------------------------------------------- | ||||
| # These defines could all be moved into the header below | # These defines could all be moved into the header below | ||||
| set(BUILDINFO_CFLAGS "${CMAKE_C_FLAGS}") | # Write stings into a separate header since we can escape C-strings | ||||
| set(BUILDINFO_CXXFLAGS "${CMAKE_CXX_FLAGS}") | # in a way that's not practical when passing defines. | ||||
| set(BUILDINFO_LINKFLAGS "${PLATFORM_LINKFLAGS}") | set(BUILD_PLATFORM "${CMAKE_SYSTEM_NAME}") | ||||
| set(BUILD_TYPE "${CMAKE_BUILD_TYPE}") | |||||
ankitm: Multi-config generators don't have `CMAKE_BUILD_TYPE` defined.
use generator expression… | |||||
Not Done Inline Actions+1 to do this, however this can be a separate patch, as this limitation exists already. campbellbarton: +1 to do this, however this can be a separate patch, as this limitation exists already.
On… | |||||
| set(BUILD_CFLAGS "${CMAKE_C_FLAGS}") | |||||
| set(BUILD_CXXFLAGS "${CMAKE_CXX_FLAGS}") | |||||
| set(BUILD_LINKFLAGS "${PLATFORM_LINKFLAGS}") | |||||
| set(BUILD_SYSTEM "CMake") | |||||
Not Done Inline ActionsTypo stings. ankitm: Typo `stings`. | |||||
| if(WITH_COMPILER_SHORT_FILE_MACRO) | if(WITH_COMPILER_SHORT_FILE_MACRO) | ||||
| # Needed because currently including quotes isn't supported. | # It's not necessary to include path information | ||||
| # Besides this it's not necessary to include path information | |||||
| # about the system building Blender in the executable. | # about the system building Blender in the executable. | ||||
| string(REPLACE "${PLATFORM_CFLAGS_FMACRO_PREFIX_MAP}" " " BUILDINFO_CFLAGS "${BUILDINFO_CFLAGS}") | string(REPLACE "${PLATFORM_CFLAGS_FMACRO_PREFIX_MAP}" " " BUILD_CFLAGS "${BUILD_CFLAGS}") | ||||
| string(REPLACE "${PLATFORM_CFLAGS_FMACRO_PREFIX_MAP}" " " BUILDINFO_CXXFLAGS "${BUILDINFO_CXXFLAGS}") | string(REPLACE "${PLATFORM_CFLAGS_FMACRO_PREFIX_MAP}" " " BUILD_CXXFLAGS "${BUILD_CXXFLAGS}") | ||||
| endif() | endif() | ||||
| string(REPLACE " " "\ " BUILDINFO_CFLAGS "${BUILDINFO_CFLAGS}") | configure_file( | ||||
| string(REPLACE " " "\ " BUILDINFO_CXXFLAGS "${BUILDINFO_CXXFLAGS}") | "${CMAKE_SOURCE_DIR}/build_files/cmake/buildinfo_static.h.in" | ||||
| string(REPLACE " " "\ " BUILDINFO_LINKFLAGS "${BUILDINFO_LINKFLAGS}") | "${CMAKE_CURRENT_BINARY_DIR}/buildinfo_static.h" | ||||
| ESCAPE_QUOTES | |||||
| add_definitions( | @ONLY | ||||
| # # define in header now, else these get out of date on rebuilds. | ) | ||||
| # -DBUILD_DATE="${BUILD_DATE}" | |||||
| # -DBUILD_TIME="${BUILD_TIME}" | unset(BUILD_PLATFORM) | ||||
Not Done Inline Actionshow about adding the .h file to SRC, so that it shows up in IDEs ? list(APPEND SRC
"${CMAKE_CURRENT_BINARY_DIR}/buildinfo_static.h"
)It's static, unlike buildinfo.h, so safe from unnecessary rebuilds I guess. ankitm: how about adding the .h file to `SRC`, so that it shows up in IDEs ?
```
list(APPEND SRC… | |||||
Done Inline ActionsI'm not sure of the logic here, buildinfo.h uses buildinfo_static.h, so adding only buildinfo_static.h doesn't make so much sense. If we add one we might as well add both. campbellbarton: I'm not sure of the logic here, `buildinfo.h` uses `buildinfo_static.h`, so adding only… | |||||
| # -DBUILD_COMMIT_TIMESTAMP="${BUILD_COMMIT_TIMESTAMP}" | unset(BUILD_TYPE) | ||||
| # -DBUILD_COMMIT_TIME="${BUILD_COMMIT_TIME}" | unset(BUILD_CFLAGS) | ||||
| # -DBUILD_COMMIT_DATE="${BUILD_COMMIT_DATE}" | unset(BUILD_CXXFLAGS) | ||||
| # -DBUILD_HASH="${BUILD_HASH}" | unset(BUILD_LINKFLAGS) | ||||
| # -DBUILD_BRANCH="${BUILD_BRANCH}" | unset(BUILD_SYSTEM) | ||||
| -DWITH_BUILDINFO_HEADER # alternative to lines above | |||||
| -DBUILD_PLATFORM="${CMAKE_SYSTEM_NAME}" | |||||
| -DBUILD_TYPE="${CMAKE_BUILD_TYPE}" | |||||
| -DBUILD_CFLAGS="${BUILDINFO_CFLAGS}" | |||||
| -DBUILD_CXXFLAGS="${BUILDINFO_CXXFLAGS}" | |||||
| -DBUILD_LINKFLAGS="${BUILDINFO_LINKFLAGS}" | |||||
| -DBUILD_SYSTEM="CMake" | |||||
| ) | |||||
| # -------------------------------------------------------------------------- | # -------------------------------------------------------------------------- | ||||
| # write header for values that change each build | # write header for values that change each build | ||||
| # note, generaed file is in build dir's source/creator | # note, generaed file is in build dir's source/creator | ||||
| # except when used as an include path. | # except when used as an include path. | ||||
| add_definitions(-DWITH_BUILDINFO_HEADER) | |||||
| # include the output directory, where the buildinfo.h file is generated | # include the output directory, where the buildinfo.h file is generated | ||||
| include_directories(${CMAKE_CURRENT_BINARY_DIR}) | include_directories(${CMAKE_CURRENT_BINARY_DIR}) | ||||
| # XXX, ${buildinfo_h_fake} is used here, | # XXX, ${buildinfo_h_fake} is used here, | ||||
| # because we rely on that file being detected as missing | # because we rely on that file being detected as missing | ||||
| # every build so that the real header "buildinfo.h" is updated. | # every build so that the real header "buildinfo.h" is updated. | ||||
| # | # | ||||
| ▲ Show 20 Lines • Show All 983 Lines • Show Last 20 Lines | |||||
Multi-config generators don't have CMAKE_BUILD_TYPE defined.
use generator expression CONFIG maybe ?
https://developer.blender.org/diffusion/B/browse/master/CMakeLists.txt;7bc7b7da2d2f$132-137