Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ jobs:
set -eux

haxelib setup ~/haxelib
haxelib install hashlink
haxelib dev hashlink other/haxelib
haxelib list


Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ ReleaseStatic
/build*
/other/memory/*.dump
/src/_std
/src/hl
/src/haxe
/src/Makefile
/include/ffmpeg
Expand Down
51 changes: 48 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -173,20 +173,28 @@ set_target_properties(libhl
)

if (WITH_VM)
add_executable(hl
add_library(libhljit STATIC
src/code.c
src/jit.c
src/main.c
src/module.c
src/debugger.c
src/profile.c
)

set_target_properties(libhljit
PROPERTIES
PUBLIC_HEADER "src/hl/hlmodule.h;src/hl/opcodes.h"
)

add_executable(hl
src/main.c
)

if (UNIX AND NOT APPLE)
set_target_properties(hl PROPERTIES INSTALL_RPATH "$ORIGIN;${CMAKE_INSTALL_PREFIX}/lib")
endif()

target_link_libraries(hl libhl)
target_link_libraries(hl libhl libhljit)

if (WIN32)
target_link_libraries(hl user32)
Expand All @@ -206,6 +214,11 @@ if(BUILD_TESTING)
haxe
)

find_program(
HAXELIB
haxelib
)

#####################
# hello.hl

Expand Down Expand Up @@ -309,6 +322,27 @@ if(BUILD_TESTING)
uv.hdll
)

#####################
# hello.c (hashlink boot)
add_custom_command(OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test/hello_boot/hello.c
COMMAND ${HAXE_COMPILER}
-hl ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test/hello_boot/hello.hl
-cp ${CMAKE_SOURCE_DIR}/other/tests -main HelloWorld
COMMAND ${HAXELIB} run hashlink boot ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test/hello_boot/hello.hl
)
if (WITH_VM)
add_executable(hello_boot
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test/hello_boot/hello.c
)
set_target_properties(hello_boot
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test/hello_boot
)
target_link_libraries(hello_boot
libhl libhljit
)
endif()

#####################
# Tests
if (WITH_VM)
Expand All @@ -329,6 +363,9 @@ if(BUILD_TESTING)
add_test(NAME uvsample.hl
COMMAND hl ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test/uvsample.hl 6001
)
add_test(NAME hello_boot
COMMAND hello_boot
)
endif()

add_test(NAME hello
Expand Down Expand Up @@ -387,6 +424,14 @@ install(
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
if (WITH_VM)
install(
TARGETS libhljit
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/hl
)
endif()

install(
FILES src/hlc_main.c
TYPE INCLUDE
Expand Down
35 changes: 28 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ STD = src/std/array.o src/std/buffer.o src/std/bytes.o src/std/cast.o src/std/da
src/std/socket.o src/std/string.o src/std/sys.o src/std/types.o src/std/ucs2.o src/std/thread.o src/std/process.o \
src/std/track.o

HL = src/code.o src/jit.o src/main.o src/module.o src/debugger.o src/profile.o
LIBHLJIT = src/code.o src/jit.o src/module.o src/debugger.o src/profile.o

HL = src/main.o

FMT_INCLUDE = -I include/mikktspace -I include/minimp3

Expand Down Expand Up @@ -212,7 +214,7 @@ all: libhl libs
ifeq ($(ARCH),arm64)
$(warning HashLink vm is not supported on arm64, skipping)
else
all: hl
all: libhljit.a hl
endif

install:
Expand All @@ -224,12 +226,19 @@ endif
mkdir -p $(INSTALL_LIB_DIR)
cp *.hdll $(INSTALL_LIB_DIR)
cp libhl.${LIBEXT} $(INSTALL_LIB_DIR)
ifneq ($(ARCH),arm64)
cp libhljit.a $(INSTALL_LIB_DIR)
endif
mkdir -p $(INSTALL_INCLUDE_DIR)
cp src/hl.h src/hlc.h src/hlc_main.c $(INSTALL_INCLUDE_DIR)
ifneq ($(ARCH),arm64)
mkdir -p $(INSTALL_INCLUDE_DIR)/hl
cp src/hl/hlmodule.h src/hl/opcodes.h $(INSTALL_INCLUDE_DIR)/hl
endif

uninstall:
rm -f $(INSTALL_BIN_DIR)/hl $(INSTALL_LIB_DIR)/libhl.${LIBEXT} $(INSTALL_LIB_DIR)/*.hdll
rm -f $(INSTALL_INCLUDE_DIR)/hl.h $(INSTALL_INCLUDE_DIR)/hlc.h $(INSTALL_INCLUDE_DIR)/hlc_main.c
rm -f $(INSTALL_INCLUDE_DIR)/hl.h $(INSTALL_INCLUDE_DIR)/hlc.h $(INSTALL_INCLUDE_DIR)/hlc_main.c $(INSTALL_INCLUDE_DIR)/hl/hlmodule.h $(INSTALL_INCLUDE_DIR)/hl/opcodes.h

libs: $(LIBS)

Expand All @@ -245,8 +254,11 @@ libhl: ${LIB}
hlc: ${BOOT}
${CC} ${CFLAGS} -o hlc ${BOOT} ${LFLAGS} ${EXTRA_LFLAGS}

hl: ${HL} libhl
${CC} ${CFLAGS} -o hl ${HL} ${LFLAGS} ${EXTRA_LFLAGS} ${HLFLAGS}
libhljit.a: ${LIBHLJIT}
${AR} rcs $@ $^

hl: ${HL} libhljit.a libhl
${CC} ${CFLAGS} -o $@ ${HL} libhljit.a ${LFLAGS} ${EXTRA_LFLAGS} ${HLFLAGS}

libs/fmt/%.o: libs/fmt/%.c
${CC} ${CFLAGS} -o $@ -c $< ${FMT_INCLUDE}
Expand Down Expand Up @@ -314,16 +326,21 @@ release_haxelib:
ifeq ($(HLIB),hashlink)
HLDIR=other/haxelib
HLPACK=templates hlmem memory.hxml Run.hx

haxelib_prepackage:
cp src/main.c ${HLDIR}/templates/hlboot.c

else
HLDIR=libs/$(HLIB)
ifeq ($(HLIB),directx)
HLPACK=dx *.h *.c *.cpp
else
HLPACK=$(HLIB) *.h *.c
endif
haxelib_prepackage:
endif

release_haxelib_package:
release_haxelib_package: haxelib_prepackage
rm -rf $(HLIB)_release
mkdir $(HLIB)_release
(cd $(HLDIR) && cp -R $(HLPACK) haxelib.json $(CURDIR)/$(HLIB)_release | true)
Expand All @@ -339,6 +356,10 @@ release_prepare:
mkdir $(PACKAGE_NAME)
mkdir $(PACKAGE_NAME)/include
cp src/hl.h src/hlc.h src/hlc_main.c $(PACKAGE_NAME)/include
ifneq ($(ARCH),arm64)
mkdir $(PACKAGE_NAME)/include/hl
cp src/hl/hlmodule.h src/hl/opcodes.h $(PACKAGE_NAME)/include/hl
endif

release_win:
cp $(BUILD_DIR)/{hl.exe,libhl.dll,*.hdll,*.lib} $(PACKAGE_NAME)
Expand Down Expand Up @@ -376,6 +397,6 @@ clean_o:
rm -f ${STD} ${BOOT} ${RUNTIME} ${PCRE} ${HL} ${FMT} ${SDL} ${SSL} ${OPENAL} ${UI} ${UV} ${MYSQL} ${SQLITE} ${HEAPS} ${HL_DEBUG}

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

.PHONY: libhl hl hlc fmt sdl libs release
14 changes: 14 additions & 0 deletions hl.sln
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hl", "hl.vcxproj", "{BBF750
{E3F735ED-9701-46BE-A86C-C61D3CE0D525} = {E3F735ED-9701-46BE-A86C-C61D3CE0D525}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libhljit", "libhljit.vcxproj", "{CF700138-1C91-4481-9BB4-D272EF316CB2}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ui", "libs\ui\ui.vcxproj", "{6534D221-34DF-404A-AFCD-6DEC9BBC9798}"
ProjectSection(ProjectDependencies) = postProject
{C6213FBF-BC2B-4235-A827-84A60E848C52} = {C6213FBF-BC2B-4235-A827-84A60E848C52}
Expand Down Expand Up @@ -136,6 +138,18 @@ Global
{BBF750D2-6DD2-4A41-AC3A-07C070B94FA1}.ReleaseVS2013|Win32.Build.0 = ReleaseVS2013|Win32
{BBF750D2-6DD2-4A41-AC3A-07C070B94FA1}.ReleaseVS2013|x64.ActiveCfg = ReleaseVS2013|x64
{BBF750D2-6DD2-4A41-AC3A-07C070B94FA1}.ReleaseVS2013|x64.Build.0 = ReleaseVS2013|x64
{CF700138-1C91-4481-9BB4-D272EF316CB2}.Debug|Win32.ActiveCfg = Debug|Win32
{CF700138-1C91-4481-9BB4-D272EF316CB2}.Debug|Win32.Build.0 = Debug|Win32
{CF700138-1C91-4481-9BB4-D272EF316CB2}.Debug|x64.ActiveCfg = Debug|x64
{CF700138-1C91-4481-9BB4-D272EF316CB2}.Debug|x64.Build.0 = Debug|x64
{CF700138-1C91-4481-9BB4-D272EF316CB2}.Release|Win32.ActiveCfg = Release|Win32
{CF700138-1C91-4481-9BB4-D272EF316CB2}.Release|Win32.Build.0 = Release|Win32
{CF700138-1C91-4481-9BB4-D272EF316CB2}.Release|x64.ActiveCfg = Release|x64
{CF700138-1C91-4481-9BB4-D272EF316CB2}.Release|x64.Build.0 = Release|x64
{CF700138-1C91-4481-9BB4-D272EF316CB2}.ReleaseVS2013|Win32.ActiveCfg = Release|Win32
{CF700138-1C91-4481-9BB4-D272EF316CB2}.ReleaseVS2013|Win32.Build.0 = Release|Win32
{CF700138-1C91-4481-9BB4-D272EF316CB2}.ReleaseVS2013|x64.ActiveCfg = Release|x64
{CF700138-1C91-4481-9BB4-D272EF316CB2}.ReleaseVS2013|x64.Build.0 = Release|x64
{6534D221-34DF-404A-AFCD-6DEC9BBC9798}.Debug|Win32.ActiveCfg = Debug|Win32
{6534D221-34DF-404A-AFCD-6DEC9BBC9798}.Debug|Win32.Build.0 = Debug|Win32
{6534D221-34DF-404A-AFCD-6DEC9BBC9798}.Debug|x64.ActiveCfg = Debug|x64
Expand Down
4 changes: 2 additions & 2 deletions hl.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,8 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\hl.h" />
<ClInclude Include="src\hlmodule.h" />
<ClInclude Include="src\opcodes.h" />
<ClInclude Include="src\hl\hlmodule.h" />
<ClInclude Include="src\hl\opcodes.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
Expand Down
4 changes: 2 additions & 2 deletions hl.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<ClCompile Include="src\profile.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\hlmodule.h" />
<ClInclude Include="src\opcodes.h" />
<ClInclude Include="src\hl\hlmodule.h" />
<ClInclude Include="src\hl\opcodes.h" />
<ClInclude Include="src\hl.h" />
</ItemGroup>
</Project>
Loading