finally it works

- Do not use the current working directory, in cgal_create_release_with_cmake.cmake
- Fix the use of public_release_name
This commit is contained in:
Laurent Rineau 2018-10-02 14:21:31 +02:00
parent 4002d3d04b
commit 0c1b4f3ab7
2 changed files with 20 additions and 15 deletions

View File

@ -1,4 +1,5 @@
#option : #option :
# GIT_REPO the path to the Git repository, default is the current working directory
# DESTINATION the path where the release is created, default is /tmp # DESTINATION the path where the release is created, default is /tmp
# PUBLIC=[ON/OFF] indicates if a public release should be built, default is OFF # PUBLIC=[ON/OFF] indicates if a public release should be built, default is OFF
# VERBOSE=[ON/OFF] makes the script more verbose, default is OFF # VERBOSE=[ON/OFF] makes the script more verbose, default is OFF
@ -7,11 +8,15 @@
# CGAL_VERSION_NR=release string used to update version.h. Must be something like 1041200033 , or 10412009<beta number>0 # CGAL_VERSION_NR=release string used to update version.h. Must be something like 1041200033 , or 10412009<beta number>0
# TESTSUITE=indicate if the release is meant to be used by the testsuite, default if OFF # TESTSUITE=indicate if the release is meant to be used by the testsuite, default if OFF
if (NOT EXISTS ${CMAKE_BINARY_DIR}/Installation/include/CGAL/version.h) if (NOT GIT_REPO)
set(GIT_REPO ${CMAKE_BINARY_DIR})
endif()
if (NOT EXISTS ${GIT_REPO}/Installation/include/CGAL/version.h)
message(FATAL_ERROR "Cannot find Installation/include/CGAL/version.h. Make sure you are at the root of a CGAL branch") message(FATAL_ERROR "Cannot find Installation/include/CGAL/version.h. Make sure you are at the root of a CGAL branch")
endif() endif()
file(READ "${CMAKE_BINARY_DIR}/Installation/include/CGAL/version.h" version_file_content) file(READ "${GIT_REPO}/Installation/include/CGAL/version.h" version_file_content)
string(REGEX MATCH "define CGAL_VERSION (.*)\n#define CGAL_VERSION_NR" CGAL_VERSION_FOUND "${version_file_content}") string(REGEX MATCH "define CGAL_VERSION (.*)\n#define CGAL_VERSION_NR" CGAL_VERSION_FOUND "${version_file_content}")
if (CGAL_VERSION_FOUND) if (CGAL_VERSION_FOUND)
@ -41,10 +46,10 @@ else()
endif() endif()
file(MAKE_DIRECTORY "${release_dir}") file(MAKE_DIRECTORY "${release_dir}")
file(GLOB files RELATIVE ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/*) file(GLOB files RELATIVE ${GIT_REPO} ${GIT_REPO}/*)
foreach(pkg ${files}) foreach(pkg ${files})
set(pkg_dir ${CMAKE_BINARY_DIR}/${pkg}) # use absolute path set(pkg_dir ${GIT_REPO}/${pkg}) # use absolute path
if(IS_DIRECTORY ${pkg_dir} AND (NOT "${pkg}" STREQUAL "Maintenance") if(IS_DIRECTORY ${pkg_dir} AND (NOT "${pkg}" STREQUAL "Maintenance")
AND (EXISTS ${pkg_dir}/package_info AND (EXISTS ${pkg_dir}/package_info
OR "${pkg}" STREQUAL "Documentation" OR "${pkg}" STREQUAL "Documentation"
@ -73,9 +78,9 @@ foreach(pkg ${files})
if ("${fext}" STREQUAL ".h" OR "${fext}" STREQUAL ".hpp") if ("${fext}" STREQUAL ".h" OR "${fext}" STREQUAL ".hpp")
file(READ "${pkg_dir}/${f}" file_content) file(READ "${pkg_dir}/${f}" file_content)
string(REPLACE "$URL$" "$URL: ${GITHUB_PREFIX}/${pkg}/${f} $" file_content "${file_content}") string(REPLACE "$URL$" "$URL: ${GITHUB_PREFIX}/${pkg}/${f} $" file_content "${file_content}")
if(EXISTS ${CMAKE_BINARY_DIR}/.git) if(EXISTS ${GIT_REPO}/.git)
execute_process( execute_process(
COMMAND git --git-dir=${CMAKE_BINARY_DIR}/.git --work-tree=${CMAKE_BINARY_DIR} log -n1 "--format=format:%h %aI %an" -- "${pkg}/${f}" COMMAND git --git-dir=${GIT_REPO}/.git --work-tree=${GIT_REPO} log -n1 "--format=format:%h %aI %an" -- "${pkg}/${f}"
RESULT_VARIABLE RESULT_VAR RESULT_VARIABLE RESULT_VAR
OUTPUT_VARIABLE OUT_VAR OUTPUT_VARIABLE OUT_VAR
) )
@ -91,7 +96,7 @@ foreach(pkg ${files})
endforeach() endforeach()
if (EXISTS "${release_dir}/doc/${pkg}") if (EXISTS "${release_dir}/doc/${pkg}")
#generate filelist.txt used by doxygen ran on a release #generate filelist.txt used by doxygen ran on a release
file(GLOB_RECURSE includes LIST_DIRECTORIES false RELATIVE "${CMAKE_BINARY_DIR}/${pkg}/include" "${CMAKE_BINARY_DIR}/${pkg}/include/CGAL/*.h") file(GLOB_RECURSE includes LIST_DIRECTORIES false RELATIVE "${GIT_REPO}/${pkg}/include" "${GIT_REPO}/${pkg}/include/CGAL/*.h")
foreach(f ${includes}) foreach(f ${includes})
file(APPEND "${release_dir}/doc/${pkg}/filelist.txt" "${f}\n") file(APPEND "${release_dir}/doc/${pkg}/filelist.txt" "${f}\n")
endforeach() endforeach()
@ -109,7 +114,7 @@ file(WRITE ${release_dir}/VERSION "${CGAL_VERSION}")
#edit include/CGAL/version.h #edit include/CGAL/version.h
file(READ "${release_dir}/include/CGAL/version.h" file_content) file(READ "${release_dir}/include/CGAL/version.h" file_content)
# update CGAL_GIT_HASH # update CGAL_GIT_HASH
if(EXISTS ${CMAKE_BINARY_DIR}/.git) if(EXISTS ${GIT_REPO}/.git)
execute_process( execute_process(
COMMAND git rev-parse HEAD COMMAND git rev-parse HEAD
RESULT_VARIABLE RESULT_VAR RESULT_VARIABLE RESULT_VAR
@ -136,7 +141,7 @@ if (TESTSUITE)
if(IS_DIRECTORY "${release_dir}/test/${d}") if(IS_DIRECTORY "${release_dir}/test/${d}")
if(NOT EXISTS "${release_dir}/test/${d}/cgal_test_with_cmake") if(NOT EXISTS "${release_dir}/test/${d}/cgal_test_with_cmake")
execute_process( execute_process(
COMMAND ${CMAKE_BINARY_DIR}/Scripts/developer_scripts/create_cgal_test_with_cmake COMMAND ${GIT_REPO}/Scripts/developer_scripts/create_cgal_test_with_cmake
WORKING_DIRECTORY "${release_dir}/test/${d}" WORKING_DIRECTORY "${release_dir}/test/${d}"
RESULT_VARIABLE RESULT_VAR RESULT_VARIABLE RESULT_VAR
OUTPUT_VARIABLE OUT_VAR OUTPUT_VARIABLE OUT_VAR
@ -162,7 +167,7 @@ if (TESTSUITE)
file(RENAME "${release_dir}/tmp/${d}" "${release_dir}/test/${d}_Demo") file(RENAME "${release_dir}/tmp/${d}" "${release_dir}/test/${d}_Demo")
if(NOT EXISTS "${release_dir}/test/${d}_Demo/cgal_test_with_cmake") if(NOT EXISTS "${release_dir}/test/${d}_Demo/cgal_test_with_cmake")
execute_process( execute_process(
COMMAND ${CMAKE_BINARY_DIR}/Scripts/developer_scripts/create_cgal_test_with_cmake --no-run COMMAND ${GIT_REPO}/Scripts/developer_scripts/create_cgal_test_with_cmake --no-run
WORKING_DIRECTORY "${release_dir}/test/${d}_Demo" WORKING_DIRECTORY "${release_dir}/test/${d}_Demo"
RESULT_VARIABLE RESULT_VAR RESULT_VARIABLE RESULT_VAR
OUTPUT_VARIABLE OUT_VAR OUTPUT_VARIABLE OUT_VAR
@ -183,7 +188,7 @@ if (TESTSUITE)
file(RENAME "${release_dir}/tmp/${d}" "${release_dir}/test/${d}_Examples") file(RENAME "${release_dir}/tmp/${d}" "${release_dir}/test/${d}_Examples")
if(NOT EXISTS "${release_dir}/test/${d}_Examples/cgal_test_with_cmake") if(NOT EXISTS "${release_dir}/test/${d}_Examples/cgal_test_with_cmake")
execute_process( execute_process(
COMMAND ${CMAKE_BINARY_DIR}/Scripts/developer_scripts/create_cgal_test_with_cmake COMMAND ${GIT_REPO}/Scripts/developer_scripts/create_cgal_test_with_cmake
WORKING_DIRECTORY "${release_dir}/test/${d}_Examples" WORKING_DIRECTORY "${release_dir}/test/${d}_Examples"
RESULT_VARIABLE RESULT_VAR RESULT_VARIABLE RESULT_VAR
OUTPUT_VARIABLE OUT_VAR OUTPUT_VARIABLE OUT_VAR

View File

@ -251,8 +251,7 @@ function cleanup() {
trap cleanup EXIT trap cleanup EXIT
# Create the release # Create the release
cd ${SOURCES_DIR} cmake -DGIT_REPO=${SOURCES_DIR} -DPUBLIC=NO -DTESTSUITE=ON -DDESTINATION="${DESTINATION}" -DCGAL_VERSION="${release_version}" -DCGAL_VERSION_NR="${release_number}" -DVERBOSE="${VERBOSE}" -P ${SOURCES_DIR}/Scripts/developer_scripts/cgal_create_release_with_cmake.cmake
cmake -DPUBLIC=NO -DTESTSUITE=ON -DDESTINATION="${DESTINATION}" -DCGAL_VERSION="${release_version}" -DCGAL_VERSION_NR="${release_number}" -DVERBOSE="${VERBOSE}" -P ${SOURCES_DIR}/Scripts/developer_scripts/cgal_create_release_with_cmake.cmake
pushd "${DESTINATION}/${release_name}" pushd "${DESTINATION}/${release_name}"
sed -i -e "s/define CGAL_GIT_HASH .*/define CGAL_GIT_HASH $CGAL_GIT_HASH/" include/CGAL/version.h sed -i -e "s/define CGAL_GIT_HASH .*/define CGAL_GIT_HASH $CGAL_GIT_HASH/" include/CGAL/version.h
cd .. cd ..
@ -299,11 +298,12 @@ if [ -n "$DO_PUBLIC" ]; then
fi fi
if [ -r "${NUMBERS_DIR}/public_release_name" ]; then if [ -r "${NUMBERS_DIR}/public_release_name" ]; then
public_release_name=`cat "${NUMBERS_DIR}/public_release_name"` public_release_name=`cat "${NUMBERS_DIR}/public_release_name"`
public_release_version=${public_release_name#CGAL-}
else else
public_release_name="CGAL-${public_release_version}" public_release_name="CGAL-${public_release_version}"
fi fi
cmake -DPUBLIC="ON" -DDESTINATION="${DESTINATION}" -DCGAL_VERSION="${public_release_version}" -DCGAL_VERSION_NR="${release_number}" -DVERBOSE="${VERBOSE}" -P ${SOURCES_DIR}/Scripts/developer_scripts/cgal_create_release_with_cmake.cmake cmake -DGIT_REPO=${SOURCES_DIR} -DPUBLIC="ON" -DDESTINATION="${DESTINATION}" -DCGAL_VERSION="${public_release_version}" -DCGAL_VERSION_NR="${release_number}" -DVERBOSE="${VERBOSE}" -P ${SOURCES_DIR}/Scripts/developer_scripts/cgal_create_release_with_cmake.cmake
pushd "${DESTINATION}/${public_release_name}" pushd "${DESTINATION}/${public_release_name}"
# Modify the version numbers in <CGAL/version.h> # Modify the version numbers in <CGAL/version.h>
@ -333,7 +333,7 @@ if [ -n "$DO_PUBLIC" ]; then
if docker version > /dev/null; then if docker version > /dev/null; then
# Build the Windows installer # Build the Windows installer
docker pull cgal/cgal-nsis-dockerfile docker pull cgal/cgal-nsis-dockerfile
docker create -v `realpath ${public_release_name}`:/mnt/cgal_release:ro,z \ docker create -v `realpath ${DESTINATION}/${public_release_name}`:/mnt/cgal_release:ro,z \
-v ${SOURCES_DIR}:/mnt/cgal_sources:ro,z \ -v ${SOURCES_DIR}:/mnt/cgal_sources:ro,z \
cgal/cgal-nsis-dockerfile cgal/cgal-nsis-dockerfile
container_id=`docker ps -q -l` container_id=`docker ps -q -l`