diff --git a/CMakeLists.txt b/CMakeLists.txt index 886c754af..16227dc4e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 @@ -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 @@ -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 @@ -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} diff --git a/Makefile b/Makefile index 1f7209853..37659649b 100644 --- a/Makefile +++ b/Makefile @@ -169,7 +169,7 @@ ifdef DEBUG CFLAGS += -g endif -all: libhl hl libs +all: libhl hl libs libhl.a install: $(UNAME)==Darwin && ${MAKE} uninstall @@ -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: @@ -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