Skip to content

Commit

Permalink
fix: build files
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasrothenberger committed Nov 14, 2024
1 parent a89c874 commit 70e3750
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 3 deletions.
35 changes: 33 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,17 @@ else()
# install DiscoPoP python modules
find_package(Python3 REQUIRED COMPONENTS Interpreter)

# setup DiscoPoP venv
message(STATUS "Setting up DiscoPoP python venv: ${DiscoPoP_SOURCE_DIR}/venv")
execute_process(
COMMAND ${Python3_EXECUTABLE} -m venv ${DiscoPoP_SOURCE_DIR}/venv
)
set(Python3_VENV_EXECUTABLE ${DiscoPoP_SOURCE_DIR}/venv/bin/python3)


# check if python tkinter module is available
execute_process(
COMMAND ${Python3_EXECUTABLE} -c "import tkinter"
COMMAND ${Python3_VENV_EXECUTABLE} -c "import tkinter"
RESULT_VARIABLE TKINTER_AVAILABLE_EXIT_CODE
)
if(${TKINTER_AVAILABLE_EXIT_CODE})
Expand All @@ -126,12 +134,35 @@ else()
# install DiscoPoP python modules
message(STATUS "Installing DiscoPoP python modules")
execute_process(
COMMAND ${Python3_EXECUTABLE} -m pip install ${DiscoPoP_SOURCE_DIR}
COMMAND ${Python3_VENV_EXECUTABLE} -m pip install ${DiscoPoP_SOURCE_DIR}
RESULT_VARIABLE DP_INSTALLATION_EXIT_CODE
OUTPUT_VARIABLE DP_INSTALLATION_OUTPUT
)
# check if installation of DiscoPoP Modules was successful
if(${DP_INSTALLATION_EXIT_CODE})
message(FATAL_ERROR "${DP_INSTALLATION_OUTPUT}")
endif()

# create symlinks for python executables
message(STATUS "Creating symlinks for DiscoPoP python executables")
set(DP_LOCAL_BIN_DIR "$ENV{HOME}/.local/bin")
execute_process(COMMAND rm -f ${DP_LOCAL_BIN_DIR}/discopop_auto_tuner)
execute_process(COMMAND rm -f ${DP_LOCAL_BIN_DIR}/discopop_config_provider)
execute_process(COMMAND rm -f ${DP_LOCAL_BIN_DIR}/discopop_explorer)
execute_process(COMMAND rm -f ${DP_LOCAL_BIN_DIR}/discopop_optimizer)
execute_process(COMMAND rm -f ${DP_LOCAL_BIN_DIR}/discopop_patch_applicator)
execute_process(COMMAND rm -f ${DP_LOCAL_BIN_DIR}/discopop_patch_generator)
message(STATUS "--> discopop_auto_tuner")
execute_process(COMMAND ln -sf ${DiscoPoP_SOURCE_DIR}/venv/bin/discopop_auto_tuner ${DP_LOCAL_BIN_DIR}/discopop_auto_tuner)
message(STATUS "--> discopop_config_provider")
execute_process(COMMAND ln -sf ${DiscoPoP_SOURCE_DIR}/venv/bin/discopop_config_provider ${DP_LOCAL_BIN_DIR}/discopop_config_provider)
message(STATUS "--> discopop_explorer")
execute_process(COMMAND ln -sf ${DiscoPoP_SOURCE_DIR}/venv/bin/discopop_explorer ${DP_LOCAL_BIN_DIR}/discopop_explorer)
message(STATUS "--> discopop_optimizer")
execute_process(COMMAND ln -sf ${DiscoPoP_SOURCE_DIR}/venv/bin/discopop_optimizer ${DP_LOCAL_BIN_DIR}/discopop_optimizer)
message(STATUS "--> discopop_patch_applicator")
execute_process(COMMAND ln -sf ${DiscoPoP_SOURCE_DIR}/venv/bin/discopop_patch_applicator ${DP_LOCAL_BIN_DIR}/discopop_patch_applicator)
message(STATUS "--> discopop_patch_generator")
execute_process(COMMAND ln -sf ${DiscoPoP_SOURCE_DIR}/venv/bin/discopop_patch_generator ${DP_LOCAL_BIN_DIR}/discopop_patch_generator)

endif()
12 changes: 11 additions & 1 deletion scripts/dev/create_package.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# This file is part of the DiscoPoP software (http://www.discopop.tu-darmstadt.de)
#
# Copyright (c) 2020, Technische Universitaet Darmstadt, Germany
#
# This software may be modified and distributed under the terms of
# the 3-Clause BSD License. See the LICENSE file in the package base
# directory for details.

# create a temporary copy of the code to build the package
rm -rf tmp_package_build_dir
mkdir -p tmp_package_build_dir
Expand All @@ -20,6 +28,8 @@ echo "" >> DEBIAN/control
rm -rf opt/DiscoPoP/build
# delete packages folder if exists
rm -rf opt/DiscoPoP/packages
# delete venv folder if exists
rm -rf opt/DiscoPoP/venv
# cleanup
rm -rf opt/DiscoPoP/tmp_packages_build_dir

Expand All @@ -31,4 +41,4 @@ dpkg-deb --build tmp_package_build_dir packages/DiscoPoP.deb
chmod 775 packages/DiscoPoP.deb

# cleanup
rm -rf tmp_package_build_dir
rm -rf tmp_package_build_dir

0 comments on commit 70e3750

Please sign in to comment.