mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-28 12:26:59 +00:00
Cmake build:
Cleanup the use of path-variables
This commit is contained in:
parent
7ede020a02
commit
d91d6e3343
@ -6,17 +6,20 @@
|
||||
|
||||
cmake_minimum_required(VERSION 2.6.4)
|
||||
|
||||
|
||||
set(LYX_PROJECT LyX)
|
||||
|
||||
enable_testing()
|
||||
|
||||
set(LYX_CMAKE_DIR "development/cmake")
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/${LYX_CMAKE_DIR}/modules")
|
||||
|
||||
get_filename_component(lyx_dir_readme ${CMAKE_SOURCE_DIR}/README ABSOLUTE)
|
||||
get_filename_component(TOP_SRC_DIR ${lyx_dir_readme} PATH)
|
||||
|
||||
set(LYX_CMAKE_DIR "development/cmake")
|
||||
set(TOP_CMAKE_PATH "${TOP_SRC_DIR}/${LYX_CMAKE_DIR}")
|
||||
set(TOP_MODULE_PATH "${TOP_CMAKE_PATH}/modules")
|
||||
set(TOP_SCRIPT_PATH "${TOP_CMAKE_PATH}/scripts")
|
||||
|
||||
set(CMAKE_MODULE_PATH "${TOP_MODULE_PATH}")
|
||||
|
||||
set(CMAKE_PROJECT_NAME ${LYX_PROJECT})
|
||||
|
||||
message(STATUS)
|
||||
@ -289,7 +292,7 @@ else()
|
||||
endif()
|
||||
|
||||
add_custom_target(lyx_version ALL
|
||||
COMMAND ${CMAKE_COMMAND} -DTOP_SRC_DIR=${TOP_SRC_DIR} -DLYX_CMAKE_DIR=${LYX_CMAKE_DIR} -DTOP_BINARY_DIR=${TOP_BINARY_DIR} -DLYX_DATE=${LYX_DATE} -P ${TOP_SRC_DIR}/${LYX_CMAKE_DIR}/modules/LyXGetVersion.cmake
|
||||
COMMAND ${CMAKE_COMMAND} -DTOP_SRC_DIR=${TOP_SRC_DIR} -DTOP_CMAKE_PATH=${TOP_CMAKE_PATH} -DTOP_BINARY_DIR=${TOP_BINARY_DIR} -DLYX_DATE=${LYX_DATE} -P ${TOP_SCRIPT_PATH}/LyXGetVersion.cmake
|
||||
)
|
||||
|
||||
if(APPLE)
|
||||
@ -565,8 +568,8 @@ if(LYX_PCH)
|
||||
# PCHs not supported by cmake: http://www.cmake.org/Bug/view.php?id=1260
|
||||
# Not sure if it works for all non-msvc compilers
|
||||
include(PCHSupport_26)
|
||||
configure_file(${TOP_SRC_DIR}/${LYX_CMAKE_DIR}/pcheaders.h ${TOP_BINARY_DIR}/pcheaders.h)
|
||||
configure_file(${TOP_SRC_DIR}/${LYX_CMAKE_DIR}/config.cpp.cmake ${TOP_BINARY_DIR}/config_pch.cpp)
|
||||
configure_file(${TOP_CMAKE_PATH}/pcheaders.h ${TOP_BINARY_DIR}/pcheaders.h)
|
||||
configure_file(${TOP_CMAKE_PATH}/config.cpp.cmake ${TOP_BINARY_DIR}/config_pch.cpp)
|
||||
add_definitions(-DLYX_ENABLE_PCH)
|
||||
|
||||
if(MSVC)
|
||||
@ -736,6 +739,6 @@ if(LYX_NLS)
|
||||
message(STATUS)
|
||||
endif()
|
||||
|
||||
include("${TOP_SRC_DIR}/${LYX_CMAKE_DIR}/LyxPackaging.cmake")
|
||||
include("${TOP_CMAKE_PATH}/LyxPackaging.cmake")
|
||||
|
||||
message(STATUS)
|
||||
|
@ -27,7 +27,7 @@ endif()
|
||||
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR "${LYX_MAJOR_VERSION}")
|
||||
set(CPACK_PACKAGE_VERSION_MINOR "${LYX_MINOR_VERSION}")
|
||||
FILE(STRINGS "${TOP_SRC_DIR}/${LYX_CMAKE_DIR}/LyX_summary.txt" CPACK_PACKAGE_DESCRIPTION_SUMMARY)
|
||||
FILE(STRINGS "${TOP_CMAKE_PATH}/LyX_summary.txt" CPACK_PACKAGE_DESCRIPTION_SUMMARY)
|
||||
|
||||
|
||||
set(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${LYX_INSTALL_SUFFIX}")
|
||||
@ -35,7 +35,7 @@ set(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${LYX_INSTALL_SUFFIX}")
|
||||
#
|
||||
# needed by rpm
|
||||
set(CPACK_SET_DESTDIR "ON")
|
||||
FILE(READ "${TOP_SRC_DIR}/${LYX_CMAKE_DIR}/LyX_license.txt" CPACK_RPM_PACKAGE_LICENSE)
|
||||
FILE(READ "${TOP_CMAKE_PATH}/LyX_license.txt" CPACK_RPM_PACKAGE_LICENSE)
|
||||
set(CPACK_RPM_PACKAGE_GROUP "Applications/Publishing")
|
||||
set(CPACK_RPM_PACKAGE_VENDOR "The LyX team")
|
||||
#
|
||||
@ -51,8 +51,8 @@ set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
|
||||
|
||||
#
|
||||
# for the next ones, cpack insists on data with values in some file
|
||||
set(CPACK_PACKAGE_DESCRIPTION_FILE "${TOP_SRC_DIR}/${LYX_CMAKE_DIR}/LyX_description.txt")
|
||||
set(CPACK_RESOURCE_FILE_LICENSE "${TOP_SRC_DIR}/${LYX_CMAKE_DIR}/LyX_license.txt")
|
||||
set(CPACK_PACKAGE_DESCRIPTION_FILE "${TOP_CMAKE_PATH}/LyX_description.txt")
|
||||
set(CPACK_RESOURCE_FILE_LICENSE "${TOP_CMAKE_PATH}/LyX_license.txt")
|
||||
|
||||
# Use the revision number saved in ${LYX_PACKAGE_RELEASE}
|
||||
# as the release in rpm-package-build.
|
||||
|
@ -27,8 +27,8 @@ foreach(_rel_doc ${_rel_lyx_docs})
|
||||
SET_SOURCE_FILES_PROPERTIES(${_created_doc} GENERATED)
|
||||
add_custom_command(
|
||||
OUTPUT "${_created_doc}"
|
||||
COMMAND ${LYX_PYTHON_EXECUTABLE} "${TOP_SRC_DIR}/development/cmake/doc/ReplaceValues.py" "LYX_USERDIR_VER=${LYX_USERDIR_VER}" "LYX_DIR_VER=${LYX_DIR_VER}" "${TOP_SRC_DIR}/lib/doc/${_rel_doc}" > "${_created_doc}"
|
||||
DEPENDS "${TOP_SRC_DIR}/lib/doc/${_rel_doc}" "${TOP_SRC_DIR}/development/cmake/doc/ReplaceValues.py"
|
||||
COMMAND ${LYX_PYTHON_EXECUTABLE} "${TOP_CMAKE_PATH}/doc/ReplaceValues.py" "LYX_USERDIR_VER=${LYX_USERDIR_VER}" "LYX_DIR_VER=${LYX_DIR_VER}" "${TOP_SRC_DIR}/lib/doc/${_rel_doc}" > "${_created_doc}"
|
||||
DEPENDS "${TOP_SRC_DIR}/lib/doc/${_rel_doc}" "${TOP_CMAKE_PATH}/doc/ReplaceValues.py"
|
||||
)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${_rel_doc}" DESTINATION "${LYX_DATA_SUBDIR}doc/${_rel_dir_part}")
|
||||
LIST(APPEND _docs "${_created_doc}")
|
||||
|
@ -25,7 +25,7 @@
|
||||
#
|
||||
# To call this script, one has to provide following parameters
|
||||
# TOP_SRC_DIR
|
||||
# LYX_CMAKE_DIR
|
||||
# TOP_CMAKE_PATH
|
||||
# TOP_BINARY_DIR
|
||||
# LYX_DATE: to be used if not under git control
|
||||
|
||||
@ -46,7 +46,7 @@ if(LYX_GITVERSION)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
configure_file(${TOP_SRC_DIR}/${LYX_CMAKE_DIR}/lyx_date.h.cmake ${TOP_BINARY_DIR}/lyx_date.tmp)
|
||||
configure_file(${TOP_CMAKE_PATH}/lyx_date.h.cmake ${TOP_BINARY_DIR}/lyx_date.tmp)
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${TOP_BINARY_DIR}/lyx_date.tmp ${TOP_BINARY_DIR}/lyx_date.h
|
||||
COMMAND ${CMAKE_COMMAND} -E remove ${TOP_BINARY_DIR}/lyx_date.tmp
|
||||
|
@ -88,9 +88,9 @@ add_gettext_python(layouttranslations lib/layouts *.layout *.inc *.module)
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.cat.pot"
|
||||
COMMAND ${LYX_PYTHON_EXECUTABLE}
|
||||
ARGS "${TOP_SRC_DIR}/development/cmake/po/cat.py" ${_py_sources} > "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.cat.pot"
|
||||
ARGS "${TOP_CMAKE_PATH}/po/cat.py" ${_py_sources} > "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.cat.pot"
|
||||
COMMAND ${LYX_PYTHON_EXECUTABLE}
|
||||
ARGS "${TOP_SRC_DIR}/development/cmake/po/dos2unix.py" "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.cat.pot"
|
||||
ARGS "${TOP_CMAKE_PATH}/po/dos2unix.py" "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.cat.pot"
|
||||
DEPENDS ${_py_sources}
|
||||
)
|
||||
|
||||
@ -170,7 +170,7 @@ foreach(_pofile ${LYX_BASE_PO_FILES})
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_pofile}.copied
|
||||
COMMAND ${LYX_PYTHON_EXECUTABLE}
|
||||
ARGS "${TOP_SRC_DIR}/development/cmake/po/unix2dos.py" "${CMAKE_CURRENT_BINARY_DIR}/${_pofile}"
|
||||
ARGS "${TOP_CMAKE_PATH}/po/unix2dos.py" "${CMAKE_CURRENT_BINARY_DIR}/${_pofile}"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/${_pofile} ${LYX_DEST_PO}/${_pofile}
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${_pofile}.copied
|
||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_pofile}
|
||||
|
@ -88,16 +88,17 @@ if (LYX_VLD)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
set(FILE_RC ${TOP_SRC_DIR}/development/cmake/lyx.rc)
|
||||
set(FILE_RC ${TOP_CMAKE_PATH}/lyx.rc)
|
||||
message(STATUS "Using icon defined in resource file: ${FILE_RC}")
|
||||
endif()
|
||||
|
||||
lyx_find_info_files(LyXInfoFiles ${TOP_SRC_DIR}/*)
|
||||
lyx_find_info_files(LyXCMakeFiles ${TOP_SRC_DIR}/development/cmake/*.txt)
|
||||
lyx_find_info_files(LyXCMakeFiles ${TOP_SRC_DIR}/development/cmake/*.cmake)
|
||||
lyx_find_info_files(LyXCMakeFiles ${TOP_SRC_DIR}/development/cmake/*.h)
|
||||
lyx_find_info_files(LyXCMakeFiles ${TOP_SRC_DIR}/development/cmake/*.msvc)
|
||||
lyx_find_info_files(LyXCMakeFiles ${TOP_SRC_DIR}/development/cmake/modules/*)
|
||||
lyx_find_info_files(LyXCMakeFiles ${TOP_CMAKE_PATH}/*.txt)
|
||||
lyx_find_info_files(LyXCMakeFiles ${TOP_CMAKE_PATH}/*.cmake)
|
||||
lyx_find_info_files(LyXCMakeFiles ${TOP_CMAKE_PATH}/*.h)
|
||||
lyx_find_info_files(LyXCMakeFiles ${TOP_CMAKE_PATH}/*.msvc)
|
||||
lyx_find_info_files(LyXCMakeFiles ${TOP_MODULE_PATH}/*)
|
||||
lyx_find_info_files(LyXCMakeFiles ${TOP_SCRIPT_PATH}/*)
|
||||
lyx_find_info_files(LyXUiFiles ${TOP_SRC_DIR}/lib/ui/*)
|
||||
|
||||
if (APPLE AND LYX_BUNDLE)
|
||||
|
@ -30,7 +30,7 @@ add_custom_command(
|
||||
-DIMAGES_DIR=${TOP_SRC_DIR}/lib/images
|
||||
-DRESOURCE_NAME=${resource_name}
|
||||
-DMAPPED_DIR=${TOP_SRC_DIR}/lib/
|
||||
-P ${TOP_SRC_DIR}/development/cmake/modules/LyXCreateImagesResource.cmake
|
||||
-P ${TOP_SCRIPT_PATH}/LyXCreateImagesResource.cmake
|
||||
)
|
||||
|
||||
qt4_add_resources(resource_files ${resource_name})
|
||||
|
@ -33,7 +33,7 @@ include_directories(BEFORE
|
||||
add_definitions(-DTEX2LYX)
|
||||
|
||||
if(WIN32)
|
||||
set(FILE_RC ${TOP_SRC_DIR}/development/cmake/lyx.rc)
|
||||
set(FILE_RC ${TOP_CMAKE_PATH}/lyx.rc)
|
||||
message(STATUS "Using icon defined in resource file: ${FILE_RC}")
|
||||
endif()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user