Skip to content

Commit

Permalink
Merge branch 'development' into nam20485-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
nam20485 authored Oct 6, 2023
2 parents c41963b + 6eb9f72 commit 3919e54
Show file tree
Hide file tree
Showing 42 changed files with 563 additions and 107 deletions.
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
###############################################################################
* text=auto

# Force bash scripts to always use LF line endings so that if a repo is accessed
# in Unix via a file share from Windows, the scripts will work.
*.sh text eol=lf

###############################################################################
# Set default behavior for command prompt diff.
#
Expand Down
17 changes: 10 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ PyOdbDesignLib/_PyOdbDesignLib.dll
PyOdbDesignLib/PyOdbDesignLib.py
PyOdbDesignLib/_PyOdbDesignLib.pyd
PyOdbDesignLib/__pycache__/
OdbDesignServer/Lib/
OdbDesignServer/OdbDesignServer/__pycache__/
OdbDesignServer/pyvenv.cfg
OdbDesignServer/db.sqlite3
OdbDesignServer/Scripts/
OdbDesignServer/api/__pycache__/
OdbDesignServer/PyOdbDesignLib/
PyOdbDesignServer/Lib/
PyOdbDesignServer/PyOdbDesignServer/__pycache__/
PyOdbDesignServer/pyvenv.cfg
PyOdbDesignServer/db.sqlite3
PyOdbDesignServer/Scripts/
PyOdbDesignServer/api/__pycache__/
PyOdbDesignServer/PyOdbDesignLib/
/cmake-build-debug
build/
/vcpkg_installed
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .idea/OdbDesign.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ if (MSVC)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
endif()

# increase warnings in a compiler-specific manner
if (MSVC)
# warning level 4
add_compile_options(/W4)
Expand All @@ -53,4 +54,6 @@ endif()
add_subdirectory("OdbDesignApp")
add_subdirectory("OdbDesignLib")

# link to OdbDesign library in both executable targets
target_link_libraries(OdbDesignApp PUBLIC OdbDesign)
target_link_libraries(OdbDesignApp PUBLIC OdbDesign)
83 changes: 78 additions & 5 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "python-x64-debug",
"displayName": "Python x64 Debug",
"inherits": "x64-debug",
"cacheVariables": {
"PYTHON_MODULE_BUILD": true
}
},
{
"name": "x64-release",
"displayName": "x64 Release",
Expand All @@ -45,6 +53,14 @@
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "python-x64-release",
"displayName": "Python x64 Release",
"inherits": "x64-release",
"cacheVariables": {
"PYTHON_MODULE_BUILD": true
}
},
{
"name": "x86-debug",
"displayName": "x86 Debug",
Expand Down Expand Up @@ -72,7 +88,12 @@
"binaryDir": "${sourceDir}/out/build/${presetName}",
"installDir": "${sourceDir}/out/install/${presetName}",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_TOOLCHAIN_FILE": {
"value": "$env{HOME}/src/github/microsoft/vcpkg/scripts/buildsystems/vcpkg.cmake",
//"value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"type": "FILEPATH"
}
},
"condition": {
"type": "equals",
Expand All @@ -92,7 +113,11 @@
"binaryDir": "${sourceDir}/out/build/${presetName}",
"installDir": "${sourceDir}/out/install/${presetName}",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_TOOLCHAIN_FILE": {
"value": "$env{HOME}/src/github/microsoft/vcpkg/scripts/buildsystems/vcpkg.cmake",
"type": "FILEPATH"
}
},
"condition": {
"type": "equals",
Expand All @@ -105,6 +130,22 @@
}
}
},
{
"name": "python-linux-release",
"displayName": "Python Linux Release",
"inherits": "linux-release",
"cacheVariables": {
"PYTHON_MODULE_BUILD": true
}
},
{
"name": "python-linux-debug",
"displayName": "Python Linux Debug",
"inherits": "linux-debug",
"cacheVariables": {
"PYTHON_MODULE_BUILD": true
}
},
{
"name": "linux-mingw-w64-debug",
"displayName": "Linux MinGW-w64 Debug",
Expand All @@ -115,7 +156,11 @@
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_C_COMPILER": "x86_64-w64-mingw32-gcc",
"CMAKE_CXX_COMPILER": "x86_64-w64-mingw32-g++",
"CMAKE_CXX_FLAGS": "-static-libgcc -static-libstdc++"
"CMAKE_CXX_FLAGS": "-static-libgcc -static-libstdc++",
"CMAKE_TOOLCHAIN_FILE": {
"value": "$env{HOME}/src/github/microsoft/vcpkg/scripts/buildsystems/vcpkg.cmake",
"type": "FILEPATH"
}
},
"condition": {
"type": "equals",
Expand All @@ -138,7 +183,11 @@
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_C_COMPILER": "x86_64-w64-mingw32-gcc",
"CMAKE_CXX_COMPILER": "x86_64-w64-mingw32-g++",
"CMAKE_CXX_FLAGS": "-static-libgcc -static-libstdc++"
"CMAKE_CXX_FLAGS": "-static-libgcc -static-libstdc++",
"CMAKE_TOOLCHAIN_FILE": {
"value": "$env{HOME}/src/github/microsoft/vcpkg/scripts/buildsystems/vcpkg.cmake",
"type": "FILEPATH"
}
},
"condition": {
"type": "equals",
Expand Down Expand Up @@ -194,7 +243,7 @@
"displayName": "x64 Release",
"inherits": "windows-base",
"configurePreset": "x64-release"
},
},
{
"name": "x86-debug",
"displayName": "x86 Debug",
Expand All @@ -207,6 +256,18 @@
"inherits": "windows-base",
"configurePreset": "x86-release"
},
{
"name": "python-x64-debug",
"displayName": "Python x64 Debug",
"inherits": "windows-base",
"configurePreset": "python-x64-debug"
},
{
"name": "python-x64-release",
"displayName": "Python x64 Release",
"inherits": "windows-base",
"configurePreset": "python-x64-release"
},
{
"name": "linux-base",
"hidden": true,
Expand All @@ -229,6 +290,18 @@
"configurePreset": "linux-release",
"inherits": "linux-base"
},
{
"name": "python-linux-debug",
"displayName": "Python Linux Debug",
"configurePreset": "python-linux-debug",
"inherits": "linux-base"
},
{
"name": "python-linux-release",
"displayName": "Python Linux Release",
"configurePreset": "python-linux-release",
"inherits": "linux-base"
},
{
"name": "linux-mingw-w64-base",
"hidden": true,
Expand Down
24 changes: 12 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,33 +22,33 @@ WORKDIR /src/OdbDesign

# generate SWIG python bindings
RUN chmod +x scripts/generate-python-module.sh
RUN scripts/generate-python-module.sh
RUN ./scripts/generate-python-module.sh

# configure & build using presets
# linux-release
RUN cmake --preset linux-release
RUN cmake --build --preset linux-release
RUN cmake --preset python-linux-release
RUN cmake --build --preset python-linux-release

# much smaller runtime image
#FROM python:3.11.4-bullseye AS run
FROM debian:bookworm-20230522-slim
FROM debian:bookworm-20230522-slim as run

# copy PyOdbDesignServer files
COPY --from=build /src/OdbDesign/OdbDesignServer OdbDesignServer
# copy PyPyPyOdbDesignServer files
COPY --from=build /src/OdbDesign/PyOdbDesignServer PyOdbDesignServer

# copy PyOdbDesignLib files
COPY --from=build /src/OdbDesign/out/build/linux-release/OdbDesignLib/libOdbDesign.so /OdbDesignServer/PyOdbDesignLib/_PyOdbDesignLib.so
COPY --from=build /src/OdbDesign/PyOdbDesignLib/PyOdbDesignLib.py /OdbDesignServer/PyOdbDesignLib/
RUN touch /OdbDesignServer/PyOdbDesignLib/__init__.py
COPY --from=build /src/OdbDesign/out/build/python-linux-release/OdbDesignLib/_PyOdbDesignLib.so /PyOdbDesignServer/PyOdbDesignLib/
COPY --from=build /src/OdbDesign/PyOdbDesignLib/PyOdbDesignLib.py /PyOdbDesignServer/PyOdbDesignLib/
RUN touch /PyOdbDesignServer/PyOdbDesignLib/__init__.py

RUN apt-get update && \
apt-get install -y --no-install-recommends \
python3-dev \
python3-pip

RUN python3 -m pip install -r /OdbDesignServer/requirements.txt --break-system-packages
RUN python3 -m pip install -r /PyOdbDesignServer/requirements.txt --break-system-packages

# run
WORKDIR /OdbDesignServer
WORKDIR /PyOdbDesignServer
EXPOSE 8000
CMD ["gunicorn", "--bind", ":8000", "--workers", "3", "OdbDesignServer.wsgi:application"]
CMD ["gunicorn", "--bind", ":8000", "--workers", "3", "PyOdbDesignServer.wsgi:application"]
2 changes: 1 addition & 1 deletion OdbDesignApp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
#

# Add source to this project's executable.
add_executable (OdbDesignApp "OdbDesignApp.cpp" "OdbDesignApp.h" )
add_executable (OdbDesignApp "OdbDesignApp.cpp" "OdbDesignApp.h" "ExitCode.h")

# TODO: Add tests and install targets if needed.
7 changes: 7 additions & 0 deletions OdbDesignApp/ExitCode.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

enum class ExitCode
{
Success = 0,
UnknownError
};
Loading

0 comments on commit 3919e54

Please sign in to comment.