Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-organise #1251

Merged
merged 3 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 11 additions & 31 deletions src/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,8 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

# collect source files
file(GLOB WebIfcParsing parsing/*.cpp)
file(GLOB_RECURSE WebIfcGeometry geometry/*.cpp)
file(GLOB_RECURSE WebIfcGeometryH geometry/*.h)
file(GLOB WebIfcSchema schema/*.cpp)
file(GLOB WebIfcManager modelmanager/*.cpp)
file(GLOB WebIfcAPI web-ifc-wasm.cpp)
file(GLOB WebIfcUtility utility/*.cpp)
file(GLOB WebIfcTestSourceFiles test/*.cpp)
file(GLOB WebIfcTestingMain web-ifc-test.cpp)
file(GLOB_RECURSE web-ifc-source web-ifc/*.cpp)
file(GLOB_RECURSE web-ifc-wasm wasm/*.cpp)

# download the external projects and save their paths
Message("Downloading FastFloat")
Expand All @@ -38,8 +31,6 @@ FetchContent_MakeAvailable(fastfloat)
FetchContent_GetProperties(fastfloat)

Message("Downloading TinyNURBS")

# FetchContent_Declare(tinynurbs GIT_REPOSITORY "https://github.com/pradeep-pyro/tinynurbs" GIT_TAG "2fc6562d71665312c6298f7c340bace1bcf1b7a1" SOURCE_SUBDIR "../")
FetchContent_Declare(tinynurbs GIT_REPOSITORY "https://github.com/QuimMoya/tinynurbs" GIT_TAG "47115cd9b6e922b27bbc4ab01fdeac2e9ea597a4" SOURCE_SUBDIR "../")
FetchContent_MakeAvailable(tinynurbs)
FetchContent_GetProperties(tinynurbs)
Expand All @@ -61,8 +52,6 @@ FetchContent_GetProperties(earcut)

Message("Downloading CDT")
FetchContent_Declare(cdt GIT_REPOSITORY "https://github.com/artem-ogre/CDT" GIT_TAG "4d0c9026b8ec846fe544897e7111f8f9080d5f8a" SOURCE_SUBDIR "../")

# FetchContent_Declare(cdt GIT_REPOSITORY "https://github.com/artem-ogre/CDT" GIT_TAG "9d99b32ae56b26cd2781678dc4405c98b8679a9f" SOURCE_SUBDIR "../")
FetchContent_MakeAvailable(cdt)
FetchContent_GetProperties(cdt)

Expand All @@ -71,18 +60,6 @@ FetchContent_Declare(spdlog GIT_REPOSITORY "https://github.com/gabime/spdlog" GI
FetchContent_MakeAvailable(spdlog)
FetchContent_GetProperties(spdlog)

#Message("Downloading FUZZY")
# using a custom version of fuzzy-bools to silence some debug printf from the library that pollutes the output of the executables
# FetchContent_Declare(fuzzy GIT_REPOSITORY "https://github.com/CBenghi/fuzzy-bools" GIT_TAG "07faaad8cae623dd634b1c09b4b37b44bf645781" SOURCE_SUBDIR "../")
# FetchContent_Declare(fuzzy GIT_REPOSITORY "https://github.com/tomvandig/fuzzy-bools" GIT_TAG "a52c0f0c0667b7c875ae44e91e63a33c1813be64" SOURCE_SUBDIR "../")
# @pobr1 Improvement
# FetchContent_Declare(fuzzy GIT_REPOSITORY "https://github.com/QuimMoya/fuzzy-bools" GIT_TAG "2cf2885065dcf5359dc42b9934cd7d0acb62f431" SOURCE_SUBDIR "../")
# FetchContent_MakeAvailable(fuzzy)
# FetchContent_GetProperties(fuzzy)
# file(RENAME ${fuzzy_SOURCE_DIR}/src ${fuzzy_SOURCE_DIR}/fuzzy RESULT result) # specifying 'result' continues even if rename was already performed
# file(GLOB FuzzyHeaders ${fuzzy_SOURCE_DIR}/fuzzy/*.h)
message(${WebIfcGeometryH})

Message("Downloads Finished")

function(PARAM_SETTER THE_EXECUTABLE)
Expand All @@ -92,7 +69,6 @@ function(PARAM_SETTER THE_EXECUTABLE)
target_include_directories(${THE_EXECUTABLE} PUBLIC ${glm_SOURCE_DIR}/)
target_include_directories(${THE_EXECUTABLE} PUBLIC ${glm_SOURCE_DIR}/glm)
target_include_directories(${THE_EXECUTABLE} PUBLIC ${earcut_SOURCE_DIR}/include)
target_include_directories(${THE_EXECUTABLE} PUBLIC ${fuzzy_SOURCE_DIR}/)
target_include_directories(${THE_EXECUTABLE} PUBLIC ${spdlog_SOURCE_DIR}/include)

if(NOT MSVC)
Expand All @@ -116,32 +92,36 @@ endfunction()

if(EMSCRIPTEN)
# build parameters for web-ifc
add_executable(web-ifc ${WebIfcManager} ${WebIfcSchema} ${WebIfcParsing} ${WebIfcAPI} ${WebIfcUtility} ${WebIfcGeometry})
add_executable(web-ifc ${web-ifc-source} ${web-ifc-wasm})
param_setter(web-ifc)
set_target_properties(web-ifc PROPERTIES LINK_FLAGS "${DEBUG_FLAG} --bind -flto --define-macro=REAL_T_IS_DOUBLE -s ALLOW_MEMORY_GROWTH=1 -s MAXIMUM_MEMORY=4GB -sSTACK_SIZE=5MB -s EXPORT_NAME=WebIFCWasm -s MODULARIZE=1 -s ENVIRONMENT=web")

add_executable(web-ifc-node ${WebIfcManager} ${WebIfcSchema} ${WebIfcParsing} ${WebIfcAPI} ${WebIfcUtility} ${WebIfcGeometry})
add_executable(web-ifc-node ${web-ifc-source} ${web-ifc-wasm})
param_setter(web-ifc-node)
set_target_properties(web-ifc-node PROPERTIES LINK_FLAGS "${DEBUG_FLAG} --bind -flto --define-macro=REAL_T_IS_DOUBLE -s ALLOW_MEMORY_GROWTH=1 -s MAXIMUM_MEMORY=4GB -sSTACK_SIZE=5MB -s EXPORT_NAME=WebIFCWasm -s MODULARIZE=1 ")

# multi-treaded versions
add_executable(web-ifc-mt ${WebIfcManager} ${WebIfcSchema} ${WebIfcParsing} ${WebIfcAPI} ${WebIfcUtility} ${WebIfcGeometry})
add_executable(web-ifc-mt ${web-ifc-source} ${web-ifc-wasm})
param_setter(web-ifc-mt)
target_compile_options(web-ifc-mt PUBLIC "-pthread")
set_target_properties(web-ifc-mt PROPERTIES LINK_FLAGS "${DEBUG_FLAG} -pthread -s PTHREAD_POOL_SIZE=navigator.hardwareConcurrency --bind -flto --define-macro=REAL_T_IS_DOUBLE -sSTACK_SIZE=5MB -s ALLOW_MEMORY_GROWTH=1 -s MAXIMUM_MEMORY=4GB -s EXPORT_NAME=WebIFCWasm -s MODULARIZE=1 -s ENVIRONMENT=web,worker")
endif()

if(NOT EMSCRIPTEN)
# build web-ifc as a static library
add_library(web-ifc-library STATIC ${web-ifc-source})
param_setter(web-ifc-library)

# build parameters for web-ifc-test
add_executable(web-ifc-test ${WebIfcManager} ${WebIfcSchema} ${WebIfcParsing} ${WebIfcUtility} ${WebIfcGeometry} ${WebIfcTestSourceFiles})
add_executable(web-ifc-test ${web-ifc-source} "./test/encoding_test.cpp" "./test/main.cpp" "./test/io_helpers.cpp")
param_setter(web-ifc-test)
target_include_directories(web-ifc-test PUBLIC ${tinycpptest_SOURCE_DIR}/Sources)

add_test(web-ifc-test web-ifc-test)
set_tests_properties(web-ifc-test PROPERTIES LABELS "web-ifc")

# build parameters for web-ifc in testing environment
add_executable(web-ifc ${WebIfcManager} ${WebIfcSchema} ${WebIfcParsing} ${WebIfcUtility} ${WebIfcGeometry} ${WebIfcTestingMain} "./test/io_helpers.cpp")
add_executable(web-ifc ${web-ifc-source} "./test/web-ifc-test.cpp" "./test/io_helpers.cpp")
param_setter(web-ifc)
target_include_directories(web-ifc PUBLIC ${tinycpptest_SOURCE_DIR}/Sources)

Expand Down
6 changes: 3 additions & 3 deletions src/cpp/test/io_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

#include "io_helpers.h"
#include <fstream>
#include "../geometry/operations/boolean-utils/fuzzy-bools.h"
#include "../geometry/representation/IfcGeometry.h"
#include "../geometry/representation/geometry.h"
#include "../web-ifc/geometry/operations/boolean-utils/fuzzy-bools.h"
#include "../web-ifc/geometry/representation/IfcGeometry.h"
#include "../web-ifc/geometry/representation/geometry.h"

namespace webifc::io
{
Expand Down
8 changes: 4 additions & 4 deletions src/cpp/test/io_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
#include <sstream>
#include <cstdint>
#include <glm/glm.hpp>
#include "../geometry/representation/geometry.h"
#include "../geometry/representation/IfcGeometry.h"
#include "../geometry/IfcGeometryProcessor.h"
#include "../geometry/operations/geometryutils.h"
#include "../web-ifc/geometry/representation/geometry.h"
#include "../web-ifc/geometry/representation/IfcGeometry.h"
#include "../web-ifc/geometry/IfcGeometryProcessor.h"
#include "../web-ifc/geometry/operations/geometryutils.h"

namespace webifc::io
{
Expand Down
10 changes: 5 additions & 5 deletions src/cpp/web-ifc-test.cpp → src/cpp/test/web-ifc-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
#include <fstream>
#include <cstdint>
#include <filesystem>
#include "test/io_helpers.h"
#include "io_helpers.h"

#include "parsing/IfcLoader.h"
#include "schema/IfcSchemaManager.h"
#include "geometry/IfcGeometryProcessor.h"
#include "schema/ifc-schema.h"
#include "../web-ifc/parsing/IfcLoader.h"
#include "../web-ifc/schema/IfcSchemaManager.h"
#include "../web-ifc/geometry/IfcGeometryProcessor.h"
#include "../web-ifc/schema/ifc-schema.h"

using namespace webifc::io;

Expand Down
4 changes: 2 additions & 2 deletions src/cpp/web-ifc-wasm.cpp → src/cpp/wasm/web-ifc-wasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#include <memory>
#include <emscripten/bind.h>
#include <spdlog/spdlog.h>
#include "modelmanager/ModelManager.h"
#include "version.h"
#include "../web-ifc/modelmanager/ModelManager.h"
#include "../version.h"

namespace webifc::parsing {
void p21encode(std::string_view input, std::ostringstream &output);
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "../schema/IfcSchemaManager.h"
#include "../geometry/IfcGeometryProcessor.h"
#include "../parsing/IfcLoader.h"
#include "../version.h"
#include "../../version.h"

webifc::manager::ModelManager::ModelManager(bool _mt_enabled) {
mt_enabled = _mt_enabled;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <fast_float/fast_float.h>
#include <spdlog/spdlog.h>
#include "IfcLoader.h"
#include "../version.h"
#include "../../version.h"
#include "../schema/IfcSchemaManager.h"

namespace webifc::parsing {
Expand Down
File renamed without changes.
File renamed without changes.