CMake Integration

If you are using Scapix Language Bridge, you don’t need to do anything else - Java Link is already integrated. This example shows how to integrate Java Link if you are not using Scapix Language Bridge.

include(FetchContent)
FetchContent_Declare(
  cmodule
  URL "https://github.com/scapix-com/cmodule/archive/v1.0.29.tar.gz"
  URL_HASH SHA256=b49019b355423aebacd927e99541b146c900ef416ae1da6a8343a2a274dd4876
)
FetchContent_MakeAvailable(cmodule)

set(SCAPIX_BRIDGE "java" CACHE STRING "")
set(SCAPIX_JAVA_API "jdk-11.0.2" CACHE STRING "")

add_executable(example example.cpp)

find_package(Scapix REQUIRED)
target_link_libraries(example PRIVATE scapix)

Dependency management

Scapix uses cmodule for CMake dependency management.

You can also add additional dependencies to your project and cmodule will automatically download and build these libraries for any target platform like iOS, Android, WebAssembly, etc.

include(FetchContent)
FetchContent_Declare(
  cmodule
  URL "https://github.com/scapix-com/cmodule/archive/v1.0.29.tar.gz"
  URL_HASH SHA256=b49019b355423aebacd927e99541b146c900ef416ae1da6a8343a2a274dd4876
)
FetchContent_MakeAvailable(cmodule)

find_package(Boost REQUIRED COMPONENTS filesystem iostreams context)
target_link_libraries(${target} PUBLIC Boost::filesystem Boost::iostreams Boost::context)

find_package(ZLIB REQUIRED)
target_link_libraries(${target} PRIVATE ZLIB::ZLIB)

find_package(BZip2 REQUIRED)
target_link_libraries(${target} PRIVATE BZip2::BZip2)