瀏覽代碼

added fmt.hdll target in cmake

Andy Li 8 年之前
父節點
當前提交
cb16d3a0b0
共有 1 個文件被更改,包括 162 次插入0 次删除
  1. 162 0
      CMakeLists.txt

+ 162 - 0
CMakeLists.txt

@@ -104,6 +104,9 @@ else()
     target_link_libraries(libhl m dl)
     target_link_libraries(libhl m dl)
 endif()
 endif()
 
 
+#####################
+# hello.hl
+
 find_program(
 find_program(
     HAXE_COMPILER
     HAXE_COMPILER
     haxe
     haxe
@@ -116,6 +119,9 @@ add_custom_target(hello.hl ALL
     DEPENDS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/hello.hl
     DEPENDS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/hello.hl
 )
 )
 
 
+#####################
+# sdl.hdll
+
 if (WIN32)
 if (WIN32)
     set(SDL2_PATH ${CMAKE_SOURCE_DIR}/include/sdl)
     set(SDL2_PATH ${CMAKE_SOURCE_DIR}/include/sdl)
 endif()
 endif()
@@ -148,6 +154,162 @@ if(WIN32)
     )
     )
 endif()
 endif()
 
 
+#####################
+# fmt.hdll
+
+if(WIN32)
+    set(ZLIB_INCLUDE_DIRS include/zlib)
+    set(PNG_INCLUDE_DIRS include/png)
+
+    if(CMAKE_SIZEOF_VOID_P EQUAL 8) 
+        set(TurboJPEG_INCLUDE_DIRS include/turbojpeg include/turbojpeg/x64)
+        find_library(TurboJPEG_LIBRARIES simd PATHS include/turbojpeg/x64)
+    else() 
+        set(TurboJPEG_INCLUDE_DIRS include/turbojpeg include/turbojpeg/x86)
+        find_library(TurboJPEG_LIBRARIES simd PATHS include/turbojpeg/x86)
+    endif()
+
+    file(GLOB zlib_srcs
+        include/zlib/*.c
+    )
+
+    file(GLOB png_srcs
+        include/png/*.c
+    )
+
+    file(GLOB turbojpeg_srcs
+        include/turbojpeg/*.c
+    )
+    if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+        file(GLOB turbojpeg_srcs
+            include/turbojpeg/*.c
+            include/turbojpeg/x64/*.c
+        )
+    else()
+        file(GLOB turbojpeg_srcs
+            include/turbojpeg/*.c
+            include/turbojpeg/x86/*.c
+        )
+    endif()
+
+    add_library(fmt.hdll MODULE
+        include/png/png.c
+        include/png/pngerror.c
+        include/png/pngget.c
+        include/png/pngmem.c
+        include/png/pngpread.c
+        include/png/pngread.c
+        include/png/pngrio.c
+        include/png/pngrtran.c
+        include/png/pngrutil.c
+        include/png/pngset.c
+        include/png/pngtrans.c
+        include/png/pngwio.c
+        include/png/pngwrite.c
+        include/png/pngwtran.c
+        include/png/pngwutil.c
+        include/turbojpeg/jaricom.c
+        include/turbojpeg/jcapimin.c
+        include/turbojpeg/jcapistd.c
+        include/turbojpeg/jcarith.c
+        include/turbojpeg/jccoefct.c
+        include/turbojpeg/jccolor.c
+        include/turbojpeg/jcdctmgr.c
+        include/turbojpeg/jchuff.c
+        include/turbojpeg/jcinit.c
+        include/turbojpeg/jcmainct.c
+        include/turbojpeg/jcmarker.c
+        include/turbojpeg/jcmaster.c
+        include/turbojpeg/jcomapi.c
+        include/turbojpeg/jcparam.c
+        include/turbojpeg/jcphuff.c
+        include/turbojpeg/jcprepct.c
+        include/turbojpeg/jcsample.c
+        include/turbojpeg/jctrans.c
+        include/turbojpeg/jdapimin.c
+        include/turbojpeg/jdapistd.c
+        include/turbojpeg/jdarith.c
+        include/turbojpeg/jdatadst-tj.c
+        include/turbojpeg/jdatadst.c
+        include/turbojpeg/jdatasrc-tj.c
+        include/turbojpeg/jdatasrc.c
+        include/turbojpeg/jdcoefct.c
+        include/turbojpeg/jdcolor.c
+        include/turbojpeg/jddctmgr.c
+        include/turbojpeg/jdhuff.c
+        include/turbojpeg/jdinput.c
+        include/turbojpeg/jdmainct.c
+        include/turbojpeg/jdmarker.c
+        include/turbojpeg/jdmaster.c
+        include/turbojpeg/jdmerge.c
+        include/turbojpeg/jdphuff.c
+        include/turbojpeg/jdpostct.c
+        include/turbojpeg/jdsample.c
+        include/turbojpeg/jdtrans.c
+        include/turbojpeg/jerror.c
+        include/turbojpeg/jfdctflt.c
+        include/turbojpeg/jfdctfst.c
+        include/turbojpeg/jfdctint.c
+        include/turbojpeg/jidctflt.c
+        include/turbojpeg/jidctfst.c
+        include/turbojpeg/jidctint.c
+        include/turbojpeg/jidctred.c
+        include/turbojpeg/jmemmgr.c
+        include/turbojpeg/jmemnobs.c
+        include/turbojpeg/jquant1.c
+        include/turbojpeg/jquant2.c
+        include/turbojpeg/jsimd.c
+        include/turbojpeg/jutils.c
+        include/turbojpeg/transupp.c
+        include/turbojpeg/turbojpeg.c
+        include/zlib/adler32.c
+        include/zlib/crc32.c
+        include/zlib/deflate.c
+        include/zlib/inffast.c
+        include/zlib/inflate.c
+        include/zlib/inftrees.c
+        include/zlib/trees.c
+        include/zlib/zutil.c
+        libs/fmt/fmt.c
+    )
+else()
+    find_package(ZLIB REQUIRED)
+    find_package(PNG REQUIRED)
+    find_package(TurboJPEG REQUIRED)
+
+    add_library(fmt.hdll MODULE
+        libs/fmt/fmt.c
+    )
+endif()
+
+
+set_target_properties(fmt.hdll
+    PROPERTIES
+    PREFIX ""
+    OUTPUT_NAME fmt
+    SUFFIX .hdll
+)
+target_include_directories(fmt.hdll
+	PRIVATE
+	${ZLIB_INCLUDE_DIRS}
+	${PNG_INCLUDE_DIRS}
+	${TurboJPEG_INCLUDE_DIRS}
+)
+target_link_libraries(fmt.hdll
+    libhl
+    ${ZLIB_LIBRARIES}
+    ${PNG_LIBRARIES}
+    ${TurboJPEG_LIBRARIES}
+)
+target_compile_definitions(fmt.hdll
+    PRIVATE
+    ${PNG_DEFINITIONS}
+)
+
+
+#####################
+# Tests
+
 include(CTest)
 include(CTest)
 add_test(NAME hello.hl
 add_test(NAME hello.hl
 	COMMAND hl ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/hello.hl
 	COMMAND hl ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/hello.hl