Skip to content

Commit

Permalink
merge to release (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
nam20485 authored Oct 13, 2023
2 parents fbbb6ec + 20da96e commit f6e99e6
Show file tree
Hide file tree
Showing 33 changed files with 530 additions and 176 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: docker build . --file Dockerfile --tag odbdesign:${{github.ref_name}}-${{github.run_number}}
run: docker build . --file Dockerfile_OdbDesignServer --tag odbdesign:${{github.ref_name}}-${{github.run_number}}
1 change: 1 addition & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
file: Dockerfile_OdbDesignServer


# Sign the resulting Docker image digest except on PRs.
Expand Down
8 changes: 0 additions & 8 deletions .idea/.gitignore

This file was deleted.

170 changes: 170 additions & 0 deletions .idea/workspace.xml

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

1 change: 0 additions & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@
"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"
}
},
Expand Down
67 changes: 67 additions & 0 deletions Dockerfile_OdbDesignServer
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
FROM debian:bookworm-20230522-slim AS build

# install dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
gpg \
curl \
apt-transport-https \
build-essential \
ca-certificates \
cmake \
g++ \
ninja-build \
python3-dev \
# mingw-w64 \
swig \
build-essential \
git \
cmake \
zip \
unzip \
tar \
pkg-config && \
rm -rf /var/lib/apt/lists/*

# install vcpkg
WORKDIR /root/src/github/microsoft
RUN git clone https://github.com/Microsoft/vcpkg.git
WORKDIR /root/src/github/microsoft/vcpkg
RUN ./bootstrap-vcpkg.sh

# pre-install vcpgk packages BEFORE cmake configure
RUN mkdir -p /src/OdbDesign
WORKDIR /src/OdbDesign
COPY ./vcpkg.json .
RUN /root/src/github/microsoft/vcpkg/vcpkg install

# copy source
COPY . .

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

# much smaller runtime image
FROM debian:bookworm-20230522-slim AS run

RUN mkdir --parents /OdbDesign/bin
WORKDIR /OdbDesign/bin

# copy binaries
COPY --from=build /src/OdbDesign/out/build/linux-release/OdbDesignLib/libOdbDesign.so .
COPY --from=build /src/OdbDesign/out/build/linux-release/Utils/libUtils.so .
COPY --from=build /src/OdbDesign/out/build/linux-release/OdbDesignServer/OdbDesignServer .
COPY --from=build /src/OdbDesign/out/build/linux-release/*.so .
# copy designs and templates directories
COPY --from=build /src/OdbDesign/designs ./designs
COPY --from=build /src/OdbDesign/templates ./templates

# run
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/OdbDesign/bin
RUN chmod +x ./OdbDesignServer
ENTRYPOINT [ "./OdbDesignServer" ]
File renamed without changes.
9 changes: 8 additions & 1 deletion OdbDesignLib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# CMakeList.txt : CMake project for OdbDesignLib
#

add_library(OdbDesign SHARED "odbdesign_export.h" "ComponentLayerDirectory.cpp" "ComponentLayerDirectory.h" "EdaDataFile.cpp" "EdaDataFile.h" "LayerDirectory.cpp" "LayerDirectory.h" "NetlistFile.cpp" "NetlistFile.h" "FileArchive.cpp" "FileArchive.h" "StepDirectory.cpp" "StepDirectory.h" "Net.h" "Net.cpp" "Component.h" "Component.cpp" "Pin.h" "Pin.cpp" "PinConnection.h" "PinConnection.cpp" "Package.h" "Package.cpp" "Part.h" "Part.cpp" "Via.h" "Via.cpp" "Design.h" "Design.cpp" "BoardSide.h" "OdbDesign.h" "DesignCache.h" "DesignCache.cpp" "win.h" "proto/edadatafile.pb.h" "proto/edadatafile.pb.cc" "IProtoBuffable.h" "crow_win.h" "OdbFile.h" "OdbFile.cpp" "OdbFileRecord.h" "OdbFileRecord.cpp" "IOdbServerApp.h" "IOdbServerApp.cpp")
add_library(OdbDesign SHARED "odbdesign_export.h" "ComponentLayerDirectory.cpp" "ComponentLayerDirectory.h" "EdaDataFile.cpp" "EdaDataFile.h" "LayerDirectory.cpp" "LayerDirectory.h" "NetlistFile.cpp" "NetlistFile.h" "FileArchive.cpp" "FileArchive.h" "StepDirectory.cpp" "StepDirectory.h" "Net.h" "Net.cpp" "Component.h" "Component.cpp" "Pin.h" "Pin.cpp" "PinConnection.h" "PinConnection.cpp" "Package.h" "Package.cpp" "Part.h" "Part.cpp" "Via.h" "Via.cpp" "Design.h" "Design.cpp" "BoardSide.h" "OdbDesign.h" "DesignCache.h" "DesignCache.cpp" "win.h" "proto/edadatafile.pb.h" "proto/edadatafile.pb.cc" "IProtoBuffable.h" "crow_win.h" "OdbFile.h" "OdbFile.cpp" "OdbFileRecord.h" "OdbFileRecord.cpp" "IOdbApp.h" "IOdbApp.cpp" "OdbAppBase.h" "OdbAppBase.cpp" "RouteController.h" "RouteController.cpp" "IOdbServerApp.h" "OdbServerAppBase.h" "OdbServerAppBase.cpp" "IOdbServerApp.cpp")

# required for SWIG
set_property(TARGET OdbDesign PROPERTY POSITION_INDEPENDENT_CODE ON)
Expand All @@ -12,6 +12,13 @@ target_include_directories(OdbDesign
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>)

# link to zlib (required for Crow HTTP compression)
find_package(ZLIB REQUIRED)
target_link_libraries(OdbDesign PRIVATE ZLIB::ZLIB)

# link to Crow
add_compile_definitions(CROW_ENABLE_COMPRESSION)

# Link to Protobuf
find_package(Protobuf CONFIG REQUIRED)
#protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS protoc/edadatafile.proto)
Expand Down
15 changes: 9 additions & 6 deletions OdbDesignLib/DesignCache.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "DesignCache.h"
#include <filesystem>
#include <utility>


namespace Odb::Lib
Expand All @@ -10,7 +11,7 @@ namespace Odb::Lib
}

DesignCache::DesignCache(std::string directory) :
m_directory(directory)
m_directory(std::move(directory))
{
}

Expand All @@ -19,7 +20,7 @@ namespace Odb::Lib
Clear();
}

std::shared_ptr<ProductModel::Design> DesignCache::GetDesign(std::string designName)
std::shared_ptr<ProductModel::Design> DesignCache::GetDesign(const std::string& designName)
{
auto findIt = m_designsByName.find(designName);
if (findIt == m_designsByName.end())
Expand All @@ -31,9 +32,11 @@ namespace Odb::Lib
return m_designsByName[designName];
}

std::shared_ptr<FileModel::Design::FileArchive> DesignCache::GetFileArchive(std::string designName)
std::shared_ptr<FileModel::Design::FileArchive> DesignCache::GetFileArchive(const std::string& designName)
{
std::cout << std::format("Retrieving \"{}\" from cache... ", designName) << std::endl;
std::stringstream ss;
ss << "Retrieving \"" << designName << "\" from cache... " << std::endl;
std::cout << ss.str();

auto findIt = m_fileArchivesByName.find(designName);
if (findIt == m_fileArchivesByName.end())
Expand All @@ -51,7 +54,7 @@ namespace Odb::Lib
m_designsByName.clear();
}

std::shared_ptr<ProductModel::Design> DesignCache::LoadDesign(std::string designName)
std::shared_ptr<ProductModel::Design> DesignCache::LoadDesign(const std::string& designName)
{
std::filesystem::path dir(m_directory);

Expand All @@ -74,7 +77,7 @@ namespace Odb::Lib
return nullptr;
}

std::shared_ptr<FileModel::Design::FileArchive> DesignCache::LoadFileArchive(std::string designName)
std::shared_ptr<FileModel::Design::FileArchive> DesignCache::LoadFileArchive(const std::string& designName)
{
std::filesystem::path dir(m_directory);

Expand Down
8 changes: 4 additions & 4 deletions OdbDesignLib/DesignCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ namespace Odb::Lib
DesignCache(std::string directory);
~DesignCache();

std::shared_ptr<ProductModel::Design> GetDesign(std::string designName);
std::shared_ptr<FileModel::Design::FileArchive> GetFileArchive(std::string designName);
std::shared_ptr<ProductModel::Design> GetDesign(const std::string& designName);
std::shared_ptr<FileModel::Design::FileArchive> GetFileArchive(const std::string& designName);

void Clear();

Expand All @@ -25,8 +25,8 @@ namespace Odb::Lib
FileModel::Design::FileArchive::StringMap m_fileArchivesByName;
ProductModel::Design::StringMap m_designsByName;

std::shared_ptr<ProductModel::Design> LoadDesign(std::string designName);
std::shared_ptr<FileModel::Design::FileArchive> LoadFileArchive(std::string designName);
std::shared_ptr<ProductModel::Design> LoadDesign(const std::string& designName);
std::shared_ptr<FileModel::Design::FileArchive> LoadFileArchive(const std::string& designName);

};
}
1 change: 1 addition & 0 deletions OdbDesignLib/IOdbApp.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "IOdbServerApp.h"
Loading

0 comments on commit f6e99e6

Please sign in to comment.