Coder Social home page Coder Social logo

Comments (4)

vtharmalingam avatar vtharmalingam commented on July 22, 2024

@leemaguire : Could I request you to please throw some lights here, I am really stuck. Thanks for your help, in advance.

from realm-cpp.

leemaguire avatar leemaguire commented on July 22, 2024

Hi @vtharmalingam can you share your CMakeLists.txt file showing how you are using realm as a dependancy?

from realm-cpp.

vtharmalingam avatar vtharmalingam commented on July 22, 2024

This is the simplified view of my project setting:

.
├── Project/
│   └── src/
│       ├── realm-db/
│       │   ├── a.cpp
│       │   ├── b.cpp
│       │   └── CMakeLists.txt  <-------------- (3)  
│       ├── grpc_server.cpp
│       ├── grpc_client.cpp
│       └── CMakeLists.txt  <-------------- (2)  : add_subdirectory(3) / [Links realm-db.lib]
└── CMakeLists.txt  <--------------  (1) : add_subdirectory(2)

CMakeListstxt (1)

cmake_minimum_required(VERSION 3.28)

# Visual Studio 17 2022
set(CMAKE_GENERATOR "Visual Studio 17 2022" CACHE INTERNAL "" FORCE)


cmake_policy(SET CMP0091 NEW)
project(example)

 # This variable is crucial if you do not define built type...
if(MSVC)
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:preprocessor /bigobj")
endif()


# REFER: https://stackoverflow.com/questions/14172856/compile-with-mt-instead-of-md-using-cmake
set(CompilerFlags
        CMAKE_CXX_FLAGS
        CMAKE_CXX_FLAGS_DEBUG
        CMAKE_CXX_FLAGS_RELEASE
        CMAKE_C_FLAGS
        CMAKE_C_FLAGS_DEBUG
        CMAKE_C_FLAGS_RELEASE
        )
foreach(CompilerFlag ${CompilerFlags})
  string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
endforeach()


find_package(asio-grpc CONFIG REQUIRED)
find_package(Boost REQUIRED)

add_subdirectory(src)

CMakeListstxt (2)

add_subdirectory(realm-db)

add_executable(server)

target_sources(server PRIVATE grpc_server.cpp)


target_include_directories(server
    PRIVATE
)


target_link_libraries(server PRIVATE 
                        asio-grpc::asio-grpc 

                        Boost::headers
                        
                        example_grpc_proto      # Proto Building & Linking it as Lib
                        realm_db              # Real DB Interface
                        )

target_include_directories(server PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}")

target_compile_features(server PRIVATE cxx_std_20)

CMakeListstxt (3)

# ZLIP
find_package(ZLIB REQUIRED)
find_package(nlohmann_json REQUIRED)
find_package(OpenSSL)

# We are not going to run tests
set (REALM_CPP_NO_TESTS ON )

add_library(realm_db STATIC)

target_sources(realm_db PRIVATE 
    # ${CMAKE_CURRENT_SOURCE_DIR}

    my_realm.hpp
    db_structs.hpp
    db_instance.cpp
    db_reader.cpp
    db_writer.cpp
)

target_compile_features(realm_db PUBLIC cxx_std_20)

Include(FetchContent)

# Declare the version of the Realm C++ SDK you want to download
FetchContent_Declare(
  cpprealm
  GIT_REPOSITORY https://github.com/realm/realm-cpp.git
  GIT_TAG        v1.0.0
)

FetchContent_MakeAvailable(cpprealm)


if(MSVC)
    set_property(TARGET cpprealm PROPERTY
        MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()

target_link_libraries(realm_db 

        PUBLIC 

        cpprealm

        nlohmann_json::nlohmann_json

        OpenSSL::SSL OpenSSL::Crypto
 
        # Realm required this as well
        ZLIB::ZLIB
        )

from realm-cpp.

vtharmalingam avatar vtharmalingam commented on July 22, 2024

After digging bit more tweaking, I landed in another issue i guess on grpc side. So let me close this issue. Thanks for your help.

from realm-cpp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.