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

Add static library build to Make and Cmake #478

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
25 changes: 25 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ add_library(libhl SHARED
${std_srcs}
)

add_library(libhl-static STATIC
${pcre_srcs}
src/gc.c
${std_srcs}
)

set(public_headers
src/hl.h
src/hlc.h
Expand All @@ -146,16 +152,29 @@ set_target_properties(libhl
PUBLIC_HEADER "${public_headers}"
)

set_target_properties(libhl-static
PROPERTIES
PUBLIC_HEADER "${public_headers}"
)

if(WIN32)
set_target_properties(libhl
PROPERTIES
OUTPUT_NAME libhl
)
set_target_properties(libhl-static
PROPERTIES
OUTPUT_NAME libhl-static
)
else()
set_target_properties(libhl
PROPERTIES
OUTPUT_NAME hl
)
set_target_properties(libhl-static
PROPERTIES
OUTPUT_NAME hl
)
endif()

set_target_properties(libhl
Expand All @@ -165,6 +184,11 @@ set_target_properties(libhl
COMPILE_DEFINITIONS "_USRDLL;LIBHL_EXPORTS;HAVE_CONFIG_H;PCRE2_CODE_UNIT_WIDTH=16"
)

set_target_properties(libhl-static
PROPERTIES
COMPILE_DEFINITIONS "_USRDLL;LIBHL_EXPORTS;HAVE_CONFIG_H;PCRE2_CODE_UNIT_WIDTH=16"
)

add_executable(hl
src/code.c
src/jit.c
Expand Down Expand Up @@ -355,6 +379,7 @@ install(
TARGETS
hl
libhl
libhl-static
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
Expand Down
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ ifdef DEBUG
CFLAGS += -g
endif

all: libhl hl libs
all: libhl hl libs libhl.a

install:
$(UNAME)==Darwin && ${MAKE} uninstall
Expand Down Expand Up @@ -232,6 +232,9 @@ sqlite: ${SQLITE} libhl
mesa:
(cd libs/mesa && ${MAKE})

libhl.a: ${LIB} ${FMT} ${SDL} ${SSL} ${OPENAL} ${UI} ${UV} ${MYSQL}
ar rcs $@ $^

release: release_prepare release_$(RELEASE_NAME)

release_haxelib:
Expand Down Expand Up @@ -290,10 +293,13 @@ codesign_osx:
.c.o :
${CC} ${CFLAGS} -o $@ -c $<

clean_a:
rm -f libhl.a

clean_o:
rm -f ${STD} ${BOOT} ${RUNTIME} ${PCRE} ${HL} ${FMT} ${SDL} ${SSL} ${OPENAL} ${UI} ${UV} ${MYSQL} ${SQLITE} ${HL_DEBUG}

clean: clean_o
clean: clean_o clean_a
rm -f hl hl.exe libhl.$(LIBEXT) *.hdll

.PHONY: libhl hl hlc fmt sdl libs release