1 | cmake_minimum_required(VERSION 2.6) |
---|
2 | |
---|
3 | # This will install a pyinstaller-generated sasview |
---|
4 | project(sasview C) |
---|
5 | |
---|
6 | # Define the version of sasview being packaged |
---|
7 | option(SAS_VERSION "Define SASView version to package" off) |
---|
8 | |
---|
9 | if (NOT ${SAS_VERSION}) |
---|
10 | message(FATAL_ERROR "SASView version unspecified!\n" |
---|
11 | "Please use e.g. -DSAS_VERSION=4.1 ") |
---|
12 | endif() |
---|
13 | |
---|
14 | # main install work is done in this function |
---|
15 | macro(installDir path) |
---|
16 | # Main install location is defined via CMAKE_INSTALL_PREFIX |
---|
17 | # - what is chosen here is a subdirectory |
---|
18 | install ( |
---|
19 | DIRECTORY "${path}/" |
---|
20 | DESTINATION "sasview/${SAS_VERSION}" |
---|
21 | PATTERN "Makefile*" EXCLUDE # skip makefiles |
---|
22 | PATTERN "#*" EXCLUDE # skip backup files |
---|
23 | PATTERN ".*" EXCLUDE # skip hidden files |
---|
24 | PATTERN "*.out" EXCLUDE # skip binary files |
---|
25 | PATTERN "*.*.in" EXCLUDE # skip configure processed template files |
---|
26 | PATTERN "*" |
---|
27 | PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ |
---|
28 | GROUP_EXECUTE GROUP_READ |
---|
29 | WORLD_EXECUTE WORLD_READ |
---|
30 | ) |
---|
31 | endmacro() |
---|
32 | |
---|
33 | # CPack configuration |
---|
34 | set(CPACK_PACKAGE_NAME "sasview-${SAS_VERSION}") |
---|
35 | set(CPACK_RESOURCE_FilE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}../../LICENSE.TXT") |
---|
36 | set(CPACK_PACKAGE_CONTACT "pkwi@fysik.dtu.dk") |
---|
37 | |
---|
38 | set(CPACK_PACKAGE_VERSION "1.0") |
---|
39 | set(CPACK_PACKAGE_VERSION_MAJOR "1") |
---|
40 | set(CPACK_PACKAGE_VERSION_MINOR "0") |
---|
41 | |
---|
42 | # Have CPack respect install prefix |
---|
43 | set(CPACK_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") |
---|
44 | set(CPACK_PACKAGING_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") |
---|
45 | |
---|
46 | # Avoid e.g. /usr/local being "part" of the RPMs |
---|
47 | set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST |
---|
48 | ${CMAKE_INSTALL_PREFIX} |
---|
49 | ${CMAKE_INSTALL_PREFIX}/bin |
---|
50 | ${CMAKE_INSTALL_PREFIX}/sasview |
---|
51 | ) |
---|
52 | |
---|
53 | installDir("${PROJECT_SOURCE_DIR}/sasview") |
---|
54 | |
---|
55 | execute_process(COMMAND ln -s ${CMAKE_INSTALL_PREFIX}/sasview/${SAS_VERSION}/sasview sasview) |
---|
56 | install(FILES ${CMAKE_BINARY_DIR}/sasview DESTINATION ${CMAKE_INSTALL_PREFIX}/bin/) |
---|
57 | |
---|
58 | include(CPack) |
---|