Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
hoffstadt committed Oct 31, 2024
1 parent 2709f06 commit 156cf75
Show file tree
Hide file tree
Showing 20 changed files with 3,852 additions and 2,499 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ jobs:
if not exist ../out/example_5.dll exit 1
if not exist ../out/example_6.dll exit 1
if not exist ../out/example_8.dll exit 1
if not exist ../out/example_9.dll exit 1
if not exist ../out/pilot_light.exe exit 1
if not exist ../out/pilot_light.dll exit 1
if not exist ../out/pl_script_camera.dll exit 1
Expand Down Expand Up @@ -88,6 +89,7 @@ jobs:
if not exist ../out/example_5.dll exit 1
if not exist ../out/example_6.dll exit 1
if not exist ../out/example_8.dll exit 1
if not exist ../out/example_9.dll exit 1
if not exist ../out/pilot_light.exe exit 1
if not exist ../out/pilot_light.dll exit 1
if not exist ../out/pl_script_camera.dll exit 1
Expand Down Expand Up @@ -154,6 +156,7 @@ jobs:
test -f ./out/example_5.dylib || exit 1
test -f ./out/example_6.dylib || exit 1
test -f ./out/example_8.dylib || exit 1
test -f ./out/example_9.dylib || exit 1
test -f ./out/pilot_light.dylib || exit 1
test -f ./out/pl_script_camera.dylib || exit 1
Expand Down Expand Up @@ -185,6 +188,7 @@ jobs:
test -f ./out/example_5.dylib || exit 1
test -f ./out/example_6.dylib || exit 1
test -f ./out/example_8.dylib || exit 1
test -f ./out/example_9.dylib || exit 1
test -f ./out/pilot_light.dylib || exit 1
test -f ./out/pl_script_camera.dylib || exit 1
Expand Down Expand Up @@ -257,6 +261,7 @@ jobs:
test -f ./out/example_5.so || exit 1
test -f ./out/example_6.so || exit 1
test -f ./out/example_8.so || exit 1
test -f ./out/example_9.so || exit 1
test -f ./out/pilot_light.so || exit 1
test -f ./out/pl_script_camera.so || exit 1
Expand Down Expand Up @@ -288,6 +293,7 @@ jobs:
test -f ./out/example_5.so || exit 1
test -f ./out/example_6.so || exit 1
test -f ./out/example_8.so || exit 1
test -f ./out/example_9.so || exit 1
test -f ./out/pilot_light.so || exit 1
test -f ./out/pl_script_camera.so || exit 1
Expand Down
62 changes: 62 additions & 0 deletions examples/build_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ else
rm -f ../out/example_6_*.so
rm -f ../out/example_8.so
rm -f ../out/example_8_*.so
rm -f ../out/example_9.so
rm -f ../out/example_9_*.so


fi
Expand Down Expand Up @@ -322,6 +324,35 @@ fi
echo ${CYAN}Results: ${NC} ${PL_RESULT}
echo ${CYAN}~~~~~~~~~~~~~~~~~~~~~~${NC}

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ example_9 | debug ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

PL_RESULT=${BOLD}${GREEN}Successful.${NC}
PL_DEFINES="-D_USE_MATH_DEFINES -DPL_PROFILING_ON -DPL_ALLOW_HOT_RELOAD -DPL_ENABLE_VALIDATION_LAYERS "
PL_INCLUDE_DIRECTORIES="-I../examples -I../src -I../libs -I../extensions -I../out -I../dependencies/stb "
PL_LINK_DIRECTORIES="-L../out -L/usr/lib/x86_64-linux-gnu "
PL_COMPILER_FLAGS="-std=gnu11 -fPIC --debug -g "
PL_LINKER_FLAGS="-ldl -lm "
PL_STATIC_LINK_LIBRARIES=""
PL_DYNAMIC_LINK_LIBRARIES=""
PL_SOURCES="example_9.c "

# run compiler (and linker)
echo
echo ${YELLOW}Step: example_9${NC}
echo ${YELLOW}~~~~~~~~~~~~~~~~~~~${NC}
echo ${CYAN}Compiling and Linking...${NC}
gcc -shared $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/example_9.so"

# 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}

# delete lock file(s)
rm -f ../out/lock.tmp

Expand Down Expand Up @@ -369,6 +400,8 @@ else
rm -f ../out/example_6_*.so
rm -f ../out/example_8.so
rm -f ../out/example_8_*.so
rm -f ../out/example_9.so
rm -f ../out/example_9_*.so


fi
Expand Down Expand Up @@ -604,6 +637,35 @@ fi
echo ${CYAN}Results: ${NC} ${PL_RESULT}
echo ${CYAN}~~~~~~~~~~~~~~~~~~~~~~${NC}

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ example_9 | release ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

PL_RESULT=${BOLD}${GREEN}Successful.${NC}
PL_DEFINES="-D_USE_MATH_DEFINES -DPL_PROFILING_ON -DPL_ALLOW_HOT_RELOAD -DPL_ENABLE_VALIDATION_LAYERS "
PL_INCLUDE_DIRECTORIES="-I../examples -I../src -I../libs -I../extensions -I../out -I../dependencies/stb "
PL_LINK_DIRECTORIES="-L../out -L/usr/lib/x86_64-linux-gnu "
PL_COMPILER_FLAGS="-std=gnu11 -fPIC "
PL_LINKER_FLAGS="-ldl -lm "
PL_STATIC_LINK_LIBRARIES=""
PL_DYNAMIC_LINK_LIBRARIES=""
PL_SOURCES="example_9.c "

# run compiler (and linker)
echo
echo ${YELLOW}Step: example_9${NC}
echo ${YELLOW}~~~~~~~~~~~~~~~~~~~${NC}
echo ${CYAN}Compiling and Linking...${NC}
gcc -shared $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/example_9.so"

# 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}

# delete lock file(s)
rm -f ../out/lock.tmp

Expand Down
78 changes: 78 additions & 0 deletions examples/build_macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ else
rm -f ../out/example_6_*.dylib
rm -f ../out/example_8.dylib
rm -f ../out/example_8_*.dylib
rm -f ../out/example_9.dylib
rm -f ../out/example_9_*.dylib

fi
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ example_0 | debug ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -389,6 +391,43 @@ fi
echo ${CYAN}Results: ${NC} ${PL_RESULT}
echo ${CYAN}~~~~~~~~~~~~~~~~~~~~~~${NC}

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ example_9 | debug ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

PL_RESULT=${BOLD}${GREEN}Successful.${NC}
PL_DEFINES="-D_USE_MATH_DEFINES -DPL_PROFILING_ON -DPL_ALLOW_HOT_RELOAD -DPL_ENABLE_VALIDATION_LAYERS "
PL_INCLUDE_DIRECTORIES="-I../examples -I../src -I../libs -I../extensions -I../out -I../dependencies/stb "
PL_LINK_DIRECTORIES="-L../out "
PL_COMPILER_FLAGS="-std=c99 --debug -g -fmodules -ObjC -fPIC "
PL_LINKER_FLAGS="-Wl,-rpath,/usr/local/lib "
PL_STATIC_LINK_LIBRARIES=""
PL_DYNAMIC_LINK_LIBRARIES=""
PL_SOURCES="example_9.c "
PL_LINK_FRAMEWORKS="-framework Metal -framework MetalKit -framework Cocoa -framework IOKit -framework CoreVideo -framework QuartzCore "

# 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: example_9${NC}
echo ${YELLOW}~~~~~~~~~~~~~~~~~~~${NC}
echo ${CYAN}Compiling and Linking...${NC}
clang -shared $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 $PL_LINK_FRAMEWORKS -o "./../out/example_9.dylib"

# 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}

# delete lock file(s)
rm -f ../out/lock.tmp

Expand Down Expand Up @@ -438,6 +477,8 @@ else
rm -f ../out/example_6_*.dylib
rm -f ../out/example_8.dylib
rm -f ../out/example_8_*.dylib
rm -f ../out/example_9.dylib
rm -f ../out/example_9_*.dylib

fi
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ example_0 | release ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -736,6 +777,43 @@ fi
echo ${CYAN}Results: ${NC} ${PL_RESULT}
echo ${CYAN}~~~~~~~~~~~~~~~~~~~~~~${NC}

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ example_9 | release ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

PL_RESULT=${BOLD}${GREEN}Successful.${NC}
PL_DEFINES="-D_USE_MATH_DEFINES -DPL_PROFILING_ON -DPL_ALLOW_HOT_RELOAD -DPL_ENABLE_VALIDATION_LAYERS "
PL_INCLUDE_DIRECTORIES="-I../examples -I../src -I../libs -I../extensions -I../out -I../dependencies/stb "
PL_LINK_DIRECTORIES="-L../out "
PL_COMPILER_FLAGS="-std=c99 -fmodules -ObjC -fPIC "
PL_LINKER_FLAGS="-Wl,-rpath,/usr/local/lib "
PL_STATIC_LINK_LIBRARIES=""
PL_DYNAMIC_LINK_LIBRARIES=""
PL_SOURCES="example_9.c "
PL_LINK_FRAMEWORKS="-framework Metal -framework MetalKit -framework Cocoa -framework IOKit -framework CoreVideo -framework QuartzCore "

# 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: example_9${NC}
echo ${YELLOW}~~~~~~~~~~~~~~~~~~~${NC}
echo ${CYAN}Compiling and Linking...${NC}
clang -shared $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 $PL_LINK_FRAMEWORKS -o "./../out/example_9.dylib"

# 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}

# delete lock file(s)
rm -f ../out/lock.tmp

Expand Down
66 changes: 66 additions & 0 deletions examples/build_win32.bat
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@
@if exist "../out/example_8.dll" del "..\out\example_8.dll"
@if exist "../out/example_8_*.dll" del "..\out\example_8_*.dll"
@if exist "../out/example_8_*.pdb" del "..\out\example_8_*.pdb"
@if exist "../out/example_9.dll" del "..\out\example_9.dll"
@if exist "../out/example_9_*.dll" del "..\out\example_9_*.dll"
@if exist "../out/example_9_*.pdb" del "..\out\example_9_*.pdb"

)

Expand Down Expand Up @@ -339,6 +342,36 @@ cl %PL_INCLUDE_DIRECTORIES% %PL_DEFINES% %PL_COMPILER_FLAGS% %PL_SOURCES% -Fe"..
@echo Result:  %PL_RESULT%
@echo ~~~~~~~~~~~~~~~~~~~~~~

::~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ example_9 | debug ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

@set PL_DEFINES=-D_USE_MATH_DEFINES -DPL_PROFILING_ON -DPL_ALLOW_HOT_RELOAD -DPL_ENABLE_VALIDATION_LAYERS
@set PL_INCLUDE_DIRECTORIES=-I"../examples" -I"../src" -I"../libs" -I"../extensions" -I"../out" -I"../dependencies/stb"
@set PL_LINK_DIRECTORIES=-LIBPATH:"../out"
@set PL_COMPILER_FLAGS=-Zc:preprocessor -nologo -std:c11 -W4 -WX -wd4201 -wd4100 -wd4996 -wd4505 -wd4189 -wd5105 -wd4115 -permissive- -Od -MDd -Zi
@set PL_LINKER_FLAGS=-noimplib -noexp -incremental:no
@set PL_SOURCES="example_9.c"

:: run compiler (and linker)
@echo.
@echo Step: example_9
@echo ~~~~~~~~~~~~~~~~~~~~~~
@echo Compiling and Linking...
cl %PL_INCLUDE_DIRECTORIES% %PL_DEFINES% %PL_COMPILER_FLAGS% %PL_SOURCES% -Fe"../out/example_9.dll" -Fo"../out/" -LD -link %PL_LINKER_FLAGS% -PDB:"../out/example_9_%random%.pdb" %PL_LINK_DIRECTORIES%

:: check build status
@set PL_BUILD_STATUS=%ERRORLEVEL%

:: failed
@if %PL_BUILD_STATUS% NEQ 0 (
@echo Compilation Failed with error code: %PL_BUILD_STATUS%
@set PL_RESULT=Failed.
goto Cleanupdebug
)

:: print results
@echo Result:  %PL_RESULT%
@echo ~~~~~~~~~~~~~~~~~~~~~~

:Cleanupdebug

@echo Cleaning...
Expand Down Expand Up @@ -404,6 +437,9 @@ goto ExitLabel
@if exist "../out/example_8.dll" del "..\out\example_8.dll"
@if exist "../out/example_8_*.dll" del "..\out\example_8_*.dll"
@if exist "../out/example_8_*.pdb" del "..\out\example_8_*.pdb"
@if exist "../out/example_9.dll" del "..\out\example_9.dll"
@if exist "../out/example_9_*.dll" del "..\out\example_9_*.dll"
@if exist "../out/example_9_*.pdb" del "..\out\example_9_*.pdb"

)

Expand Down Expand Up @@ -647,6 +683,36 @@ cl %PL_INCLUDE_DIRECTORIES% %PL_DEFINES% %PL_COMPILER_FLAGS% %PL_SOURCES% -Fe"..
@echo Result:  %PL_RESULT%
@echo ~~~~~~~~~~~~~~~~~~~~~~

::~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ example_9 | release ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

@set PL_DEFINES=-D_USE_MATH_DEFINES -DPL_PROFILING_ON -DPL_ALLOW_HOT_RELOAD -DPL_ENABLE_VALIDATION_LAYERS
@set PL_INCLUDE_DIRECTORIES=-I"../examples" -I"../src" -I"../libs" -I"../extensions" -I"../out" -I"../dependencies/stb"
@set PL_LINK_DIRECTORIES=-LIBPATH:"../out"
@set PL_COMPILER_FLAGS=-Zc:preprocessor -nologo -std:c11 -W4 -WX -wd4201 -wd4100 -wd4996 -wd4505 -wd4189 -wd5105 -wd4115 -permissive- -O2 -MD
@set PL_LINKER_FLAGS=-noimplib -noexp -incremental:no
@set PL_SOURCES="example_9.c"

:: run compiler (and linker)
@echo.
@echo Step: example_9
@echo ~~~~~~~~~~~~~~~~~~~~~~
@echo Compiling and Linking...
cl %PL_INCLUDE_DIRECTORIES% %PL_DEFINES% %PL_COMPILER_FLAGS% %PL_SOURCES% -Fe"../out/example_9.dll" -Fo"../out/" -LD -link %PL_LINKER_FLAGS% -PDB:"../out/example_9_%random%.pdb" %PL_LINK_DIRECTORIES%

:: check build status
@set PL_BUILD_STATUS=%ERRORLEVEL%

:: failed
@if %PL_BUILD_STATUS% NEQ 0 (
@echo Compilation Failed with error code: %PL_BUILD_STATUS%
@set PL_RESULT=Failed.
goto Cleanuprelease
)

:: print results
@echo Result:  %PL_RESULT%
@echo ~~~~~~~~~~~~~~~~~~~~~~

:Cleanuprelease

@echo Cleaning...
Expand Down
Loading

0 comments on commit 156cf75

Please sign in to comment.