Skip to content

Commit

Permalink
WIP: Zig Fixes and CMAKE for Testing and Comparison.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shabinder committed Aug 12, 2024
1 parent 618622f commit 7ce9af7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
4 changes: 1 addition & 3 deletions zipline/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ const targets: []const std.Target.Query = &.{
};

pub fn build(b: *std.Build) !void {
const mode = b.standardOptimizeOption(.{ .preferred_optimize_mode = .ReleaseSafe });

const al = std.heap.page_allocator;

var version_buf: [128]u8 = undefined;
Expand All @@ -23,7 +21,7 @@ pub fn build(b: *std.Build) !void {
.name = "quickjs",
.version = null,
.target = b.resolveTargetQuery(target),
.optimize = mode,
.optimize = .ReleaseSmall,
.pic = true, // Platform-independent code (i.e., relative jumps) to be safe.
});

Expand Down
25 changes: 25 additions & 0 deletions zipline/src/jvmMain/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
cmake_minimum_required(VERSION 3.4.1)
project(quickjs)

set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")

set(JAVA_AWT_LIBRARY NotNeeded)
set(JAVA_AWT_INCLUDE_PATH NotNeeded)
find_package(JNI REQUIRED)
include_directories(${JNI_INCLUDE_DIRS})

set(sources "")

file(GLOB_RECURSE sources "../../native/*.c" "../../native/*.cpp" "../../native/*.S")
file(GLOB_RECURSE pthread_sources "../../native/winpthreads/*.c" "../../native/winpthreads/*.S")

# Remove pthread sources from main sources list # Shall be done on all except windows
list(REMOVE_ITEM sources ${pthread_sources})

add_library(quickjs SHARED ${sources})
target_compile_definitions(quickjs PUBLIC CONFIG_VERSION="${QUICKJS_VERSION}")
target_link_libraries(quickjs)

0 comments on commit 7ce9af7

Please sign in to comment.