fix: windows multi config; version 1.0.9 [pypi]
All checks were successful
Deploy Tools / build-package (push) Successful in 34s
All checks were successful
Deploy Tools / build-package (push) Successful in 34s
This commit is contained in:
parent
3acb4c4856
commit
8d055580a5
377
README.md
377
README.md
@ -79,382 +79,7 @@ with pl.project("tutorial"):
|
||||
pl.add_compiler_flags("-g", "--debug")
|
||||
pl.add_linker_flags("-Wl,-rpath,/usr/local/lib")
|
||||
|
||||
win32.generate_build("build_win32.bat", {"dev env setup" : True})
|
||||
win32.generate_build("build_win32.bat")
|
||||
linux.generate_build("build_linux.sh")
|
||||
macos.generate_build("build_macos.sh")
|
||||
```
|
||||
|
||||
#### output - build_win32.bat
|
||||
```batch
|
||||
|
||||
:: Project: tutorial
|
||||
:: Auto Generated by:
|
||||
:: "pl_build.py" version: 1.0.4
|
||||
|
||||
:: Project: tutorial
|
||||
|
||||
:: ################################################################################
|
||||
:: # Development Setup #
|
||||
:: ################################################################################
|
||||
|
||||
:: keep environment variables modifications local
|
||||
@setlocal
|
||||
|
||||
:: make script directory CWD
|
||||
@pushd %~dp0
|
||||
@set dir=%~dp0
|
||||
|
||||
:: modify PATH to find vcvarsall.bat
|
||||
@set PATH=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build;%PATH%
|
||||
@set PATH=C:\Program Files\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build;%PATH%
|
||||
@set PATH=C:\Program Files (x86)\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build;%PATH%
|
||||
@set PATH=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build;%PATH%
|
||||
@set PATH=C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise/VC\Auxiliary\Build;%PATH%
|
||||
|
||||
:: setup environment for MSVC dev tools
|
||||
@call vcvarsall.bat amd64 > nul
|
||||
|
||||
:: default compilation result
|
||||
@set PL_RESULT=[1m[92mSuccessful.[0m
|
||||
|
||||
:: default configuration
|
||||
@set PL_CONFIG=debug
|
||||
|
||||
:: check command line args for configuration
|
||||
:CheckConfiguration
|
||||
@if "%~1"=="-c" (@set PL_CONFIG=%2) & @shift & @shift & @goto CheckConfiguration
|
||||
@if "%PL_CONFIG%" equ "debug" ( goto debug )
|
||||
|
||||
:: ################################################################################
|
||||
:: # configuration | debug #
|
||||
:: ################################################################################
|
||||
|
||||
:debug
|
||||
|
||||
:: create output directories
|
||||
@if not exist "out" @mkdir "out"
|
||||
|
||||
:: create lock file(s)
|
||||
@echo LOCKING > "out/lock.tmp"
|
||||
|
||||
@if exist "out/tutorial.exe" del "out\tutorial.exe"
|
||||
@if exist "out/tutorial_*.pdb" del "out\tutorial_*.pdb"
|
||||
|
||||
::~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tutorial | debug ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@set PL_LINKER_FLAGS=-incremental:no
|
||||
@set PL_SOURCES="main.c"
|
||||
|
||||
:: run compiler (and linker)
|
||||
@echo.
|
||||
@echo [1m[93mStep: tutorial[0m
|
||||
@echo [1m[93m~~~~~~~~~~~~~~~~~~~~~~[0m
|
||||
@echo [1m[36mCompiling and Linking...[0m
|
||||
|
||||
:: call compiler
|
||||
cl %PL_SOURCES% -Fe"out/tutorial.exe" -Fo"out/" -link %PL_LINKER_FLAGS% -PDB:"out/tutorial_%random%.pdb"
|
||||
|
||||
:: check build status
|
||||
@set PL_BUILD_STATUS=%ERRORLEVEL%
|
||||
|
||||
:: failed
|
||||
@if %PL_BUILD_STATUS% NEQ 0 (
|
||||
@echo [1m[91mCompilation Failed with error code[0m: %PL_BUILD_STATUS%
|
||||
@set PL_RESULT=[1m[91mFailed.[0m
|
||||
goto Cleanupdebug
|
||||
)
|
||||
|
||||
:: print results
|
||||
@echo [36mResult: [0m %PL_RESULT%
|
||||
@echo [36m~~~~~~~~~~~~~~~~~~~~~~[0m
|
||||
|
||||
:Exit_tutorial
|
||||
|
||||
:Cleanupdebug
|
||||
|
||||
@echo [1m[36mCleaning...[0m
|
||||
|
||||
:: delete obj files(s)
|
||||
@del "out\*.obj" > nul 2> nul
|
||||
|
||||
:: delete lock file(s)
|
||||
@if exist "out/lock.tmp" del "out\lock.tmp"
|
||||
|
||||
:: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
:: end of debug configuration
|
||||
goto ExitLabel
|
||||
|
||||
:ExitLabel
|
||||
|
||||
:: return CWD to previous CWD
|
||||
@popd
|
||||
|
||||
```
|
||||
|
||||
#### output - build_macos.sh
|
||||
|
||||
```bash
|
||||
|
||||
# Auto Generated by:
|
||||
# "pl_build.py" version: 1.0.4
|
||||
|
||||
# Project: tutorial
|
||||
|
||||
# ################################################################################
|
||||
# # Development Setup #
|
||||
# ################################################################################
|
||||
|
||||
# colors
|
||||
BOLD=$'\e[0;1m'
|
||||
RED=$'\e[0;31m'
|
||||
RED_BG=$'\e[0;41m'
|
||||
GREEN=$'\e[0;32m'
|
||||
GREEN_BG=$'\e[0;42m'
|
||||
CYAN=$'\e[0;36m'
|
||||
MAGENTA=$'\e[0;35m'
|
||||
YELLOW=$'\e[0;33m'
|
||||
WHITE=$'\e[0;97m'
|
||||
NC=$'\e[0m'
|
||||
|
||||
# find directory of this script
|
||||
SOURCE=${BASH_SOURCE[0]}
|
||||
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
||||
DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
|
||||
SOURCE=$(readlink "$SOURCE")
|
||||
[[ $SOURCE != /* ]] && SOURCE=$DIR/$SOURCE # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
|
||||
done
|
||||
DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
|
||||
|
||||
# get architecture (intel or apple silicon)
|
||||
ARCH="$(uname -m)"
|
||||
|
||||
# make script directory CWD
|
||||
pushd $DIR >/dev/null
|
||||
|
||||
# default configuration
|
||||
PL_CONFIG=debug
|
||||
|
||||
# check command line args for configuration
|
||||
while getopts ":c:" option; do
|
||||
case $option in
|
||||
c) # set conf
|
||||
PL_CONFIG=$OPTARG;;
|
||||
\?) # Invalid option
|
||||
echo "Error: Invalid option"
|
||||
exit;;
|
||||
esac
|
||||
done
|
||||
|
||||
# ################################################################################
|
||||
# # configuration | debug #
|
||||
# ################################################################################
|
||||
|
||||
if [[ "$PL_CONFIG" == "debug" ]]; then
|
||||
|
||||
# create output directory(s)
|
||||
mkdir -p "out"
|
||||
|
||||
# create lock file(s)
|
||||
echo LOCKING > "out/lock.tmp"
|
||||
|
||||
# check if this is a reload
|
||||
PL_HOT_RELOAD_STATUS=0
|
||||
|
||||
# # let user know if hot reloading
|
||||
running_count=$(ps aux | grep -v grep | grep -ci "pilot_light")
|
||||
if [ $running_count -gt 0 ]
|
||||
then
|
||||
PL_HOT_RELOAD_STATUS=1
|
||||
echo
|
||||
echo echo ${BOLD}${WHITE}${RED_BG}--------${GREEN_BG} HOT RELOADING ${RED_BG}--------${NC}
|
||||
echo echo
|
||||
else
|
||||
# cleanup binaries if not hot reloading
|
||||
echo PL_HOT_RELOAD_STATUS=0
|
||||
rm -f "out/tutorial"
|
||||
|
||||
fi
|
||||
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tutorial | debug ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
# skip during hot reload
|
||||
if [ $PL_HOT_RELOAD_STATUS -ne 1 ]; then
|
||||
|
||||
PL_RESULT=${BOLD}${GREEN}Successful.${NC}
|
||||
PL_DEFINES=""
|
||||
PL_INCLUDE_DIRECTORIES=""
|
||||
PL_LINK_DIRECTORIES=""
|
||||
PL_COMPILER_FLAGS="-g --debug "
|
||||
PL_LINKER_FLAGS="-Wl,-rpath,/usr/local/lib "
|
||||
PL_STATIC_LINK_LIBRARIES=""
|
||||
PL_DYNAMIC_LINK_LIBRARIES=""
|
||||
PL_SOURCES="main.c "
|
||||
PL_LINK_FRAMEWORKS=""
|
||||
|
||||
# add flags for specific hardware
|
||||
if [[ "$ARCH" == "arm64" ]]; then
|
||||
PL_COMPILER_FLAGS+="-arch arm64 "
|
||||
else
|
||||
PL_COMPILER_FLAGS+="-arch x86_64 "
|
||||
fi
|
||||
|
||||
# run compiler (and linker)
|
||||
echo
|
||||
echo ${YELLOW}Step: tutorial${NC}
|
||||
echo ${YELLOW}~~~~~~~~~~~~~~~~~~~${NC}
|
||||
echo ${CYAN}Compiling and Linking...${NC}
|
||||
clang $PL_SOURCES $PL_INCLUDE_DIRECTORIES $PL_DEFINES $PL_COMPILER_FLAGS $PL_INCLUDE_DIRECTORIES $PL_LINK_DIRECTORIES $PL_LINKER_FLAGS $PL_STATIC_LINK_LIBRARIES $PL_DYNAMIC_LINK_LIBRARIES -o "./out/tutorial"
|
||||
|
||||
# check build status
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
PL_RESULT=${BOLD}${RED}Failed.${NC}
|
||||
fi
|
||||
|
||||
# print results
|
||||
echo ${CYAN}Results: ${NC} ${PL_RESULT}
|
||||
echo ${CYAN}~~~~~~~~~~~~~~~~~~~~~~${NC}
|
||||
|
||||
# hot reload skip
|
||||
fi
|
||||
|
||||
# delete lock file(s)
|
||||
rm -f "out/lock.tmp"
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# end of debug
|
||||
fi
|
||||
|
||||
|
||||
# return CWD to previous CWD
|
||||
popd >/dev/null
|
||||
|
||||
```
|
||||
|
||||
#### output - build_linux.sh
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
|
||||
# Auto Generated by:
|
||||
# "pl_build.py" version: 1.0.4
|
||||
|
||||
# Project: tutorial
|
||||
|
||||
# ################################################################################
|
||||
# # Development Setup #
|
||||
# ################################################################################
|
||||
|
||||
# colors
|
||||
BOLD=$'\e[0;1m'
|
||||
RED=$'\e[0;31m'
|
||||
RED_BG=$'\e[0;41m'
|
||||
GREEN=$'\e[0;32m'
|
||||
GREEN_BG=$'\e[0;42m'
|
||||
CYAN=$'\e[0;36m'
|
||||
MAGENTA=$'\e[0;35m'
|
||||
YELLOW=$'\e[0;33m'
|
||||
WHITE=$'\e[0;97m'
|
||||
NC=$'\e[0m'
|
||||
|
||||
# find directory of this script
|
||||
SOURCE=${BASH_SOURCE[0]}
|
||||
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
||||
DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
|
||||
SOURCE=$(readlink "$SOURCE")
|
||||
[[ $SOURCE != /* ]] && SOURCE=$DIR/$SOURCE # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
|
||||
done
|
||||
DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
|
||||
|
||||
# make script directory CWD
|
||||
pushd $DIR >/dev/null
|
||||
|
||||
# default configuration
|
||||
PL_CONFIG=debug
|
||||
|
||||
# check command line args for configuration
|
||||
while getopts ":c:" option; do
|
||||
case $option in
|
||||
c) # set conf
|
||||
PL_CONFIG=$OPTARG;;
|
||||
\?) # Invalid option
|
||||
echo "Error: Invalid option"
|
||||
exit;;
|
||||
esac
|
||||
done
|
||||
|
||||
# ################################################################################
|
||||
# # configuration | debug #
|
||||
# ################################################################################
|
||||
|
||||
if [[ "$PL_CONFIG" == "debug" ]]; then
|
||||
|
||||
# create output directory(s)
|
||||
mkdir -p "out"
|
||||
|
||||
# create lock file(s)
|
||||
echo LOCKING > "out/lock.tmp"
|
||||
|
||||
# check if this is a reload
|
||||
PL_HOT_RELOAD_STATUS=0
|
||||
|
||||
# # let user know if hot reloading
|
||||
if pidof -x "pilot_light" -o $$ >/dev/null;then
|
||||
PL_HOT_RELOAD_STATUS=1
|
||||
echo
|
||||
echo echo ${BOLD}${WHITE}${RED_BG}--------${GREEN_BG} HOT RELOADING ${RED_BG}--------${NC}
|
||||
echo echo
|
||||
else
|
||||
# cleanup binaries if not hot reloading
|
||||
echo PL_HOT_RELOAD_STATUS=0
|
||||
rm -f "out/tutorial"
|
||||
|
||||
|
||||
fi
|
||||
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tutorial | debug ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
# skip during hot reload
|
||||
if [ $PL_HOT_RELOAD_STATUS -ne 1 ]; then
|
||||
|
||||
PL_RESULT=${BOLD}${GREEN}Successful.${NC}
|
||||
PL_DEFINES=""
|
||||
PL_INCLUDE_DIRECTORIES=""
|
||||
PL_LINK_DIRECTORIES=""
|
||||
PL_COMPILER_FLAGS="-g "
|
||||
PL_LINKER_FLAGS="-ldl "
|
||||
PL_STATIC_LINK_LIBRARIES=""
|
||||
PL_DYNAMIC_LINK_LIBRARIES=""
|
||||
PL_SOURCES="main.c "
|
||||
|
||||
# run compiler (and linker)
|
||||
echo
|
||||
echo ${YELLOW}Step: tutorial${NC}
|
||||
echo ${YELLOW}~~~~~~~~~~~~~~~~~~~${NC}
|
||||
echo ${CYAN}Compiling and Linking...${NC}
|
||||
gcc $PL_SOURCES $PL_INCLUDE_DIRECTORIES $PL_DEFINES $PL_COMPILER_FLAGS $PL_INCLUDE_DIRECTORIES $PL_LINK_DIRECTORIES $PL_LINKER_FLAGS $PL_STATIC_LINK_LIBRARIES $PL_DYNAMIC_LINK_LIBRARIES -o "./out/tutorial"
|
||||
|
||||
# check build status
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
PL_RESULT=${BOLD}${RED}Failed.${NC}
|
||||
fi
|
||||
|
||||
# print results
|
||||
echo ${CYAN}Results: ${NC} ${PL_RESULT}
|
||||
echo ${CYAN}~~~~~~~~~~~~~~~~~~~~~~${NC}
|
||||
|
||||
# hot reload skip
|
||||
fi
|
||||
|
||||
# delete lock file(s)
|
||||
rm -f "out/lock.tmp"
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# end of debug
|
||||
fi
|
||||
|
||||
|
||||
# return CWD to previous CWD
|
||||
popd >/dev/null
|
||||
|
||||
|
||||
```
|
@ -105,9 +105,6 @@ def generate_build(name, user_options = None):
|
||||
helper.add_spacing()
|
||||
|
||||
# try to setup dev environment
|
||||
if isinstance(user_options, dict):
|
||||
if "dev env setup" in user_options:
|
||||
if user_options["dev env setup"] == True:
|
||||
helper.add_comment("modify PATH to find vcvarsall.bat")
|
||||
helper.add_line('@if exist "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build" @set PATH=C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Auxiliary\\Build;%PATH%')
|
||||
helper.add_line('@if exist "C:/Program Files/Microsoft Visual Studio/2019/Community/VC/Auxiliary/Build" @set PATH=C:\Program Files\Microsoft Visual Studio\\2019\\Community\\VC\\Auxiliary\\Build;%PATH%')
|
||||
|
@ -14,7 +14,7 @@
|
||||
# [SECTION] version
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
__version__ = "1.0.7"
|
||||
__version__ = "1.0.9"
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# [SECTION] imports
|
||||
|
Loading…
Reference in New Issue
Block a user