Giter VIP home page Giter VIP logo

Comments (4)

KrishnaPG avatar KrishnaPG commented on September 15, 2024

Not sure about autotools, but here is a cmake file that would greatly help cross-platform development. As you might be aware, cmake is cross-platform build tools that is capable of generating the project/solution files for almost all major IDEs such as eclipse, codeblocks and MSVC. The below cmake file was tested to be working correctly with MS Visual studio.

Please include it in the code. (copy everything between the ------- lines and save it as 'CMakeLists.txt' in the root directory (case sensitive). To use it,

  1. create a new directory called 'build'
  2. cd build
  3. cmake ..

That should generate the 'h3 static library' and target application 'h3-test' inside the 'build\debug' directory.

CMakeLists.txt content

cmake_minimum_required(VERSION 2.8)

PROJECT( h3 )

if(CMAKE_COMPILER_IS_GNUCC)
SET(TARGET_COMPILE_FLAGS "-std=gnu++11") # Add C++11 support for GCC
endif()

set(TARGET_COMPILE_DEFS "_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_BIND_TO_CURRENT_CRT_VERSION")

set(h3ProjDir ${CMAKE_CURRENT_SOURCE_DIR})

set(h3_Header_Files
${h3ProjDir}/include/h3.h
${h3ProjDir}/src/hash.h
${h3ProjDir}/src/mempool.h
${h3ProjDir}/src/scanner.h)

set(h3_Source_Files
${h3ProjDir}/src/hash.c
${h3ProjDir}/src/header_field.c
${h3ProjDir}/src/header_field_list.c
${h3ProjDir}/src/mempool.c
${h3ProjDir}/src/request_header.c
${h3ProjDir}/src/scanner.c)

set(h3_Data_Files
${h3ProjDir}/t/data/01-chrome-github.txt
${h3ProjDir}/t/data/02-chrome-github.txt
${h3ProjDir}/t/data/03-firefox.txt)

set_source_files_properties(${h3ProjDir}/src/scanner.c PROPERTIES LANGUAGE CXX)

set(h3_Compile_Flags ${TARGET_COMPILE_FLAGS})
set(h3_Compile_Defs ${TARGET_COMPILE_DEFS})
set(h3_Include_Dirs ${h3ProjDir}/include ${h3ProjDir}/src)

set(h3_Dependencies )

add_library(h3
${h3_Source_Files}
${h3_Header_Files}
${h3_Data_Files})
set_target_properties(h3 PROPERTIES
COMPILE_DEFINITIONS "${h3_Compile_Defs}"
COMPILE_FLAGS "${h3_Compile_Flags}"
INCLUDE_DIRECTORIES "${h3_Include_Dirs}"
LINKER_LANGUAGE CXX)
target_link_libraries(h3 ${h3_Dependencies})

set(h3_test_Source_Files
${h3ProjDir}/parser.c)
set(h3_test_Header_Files )
set(h3_test_Data_Files )

set(h3_test_Compile_Flags ${TARGET_COMPILE_FLAGS})
set(h3_test_Compile_Defs ${TARGET_COMPILE_DEFS})
set(h3_test_Include_Dirs ${h3_Include_Dirs})

set(h3_test_Dependencies h3)

add_executable(h3-test
${h3_test_Source_Files}
${h3_test_Header_Files}
${h3_test_Data_Files})
set_target_properties(h3-test PROPERTIES
COMPILE_DEFINITIONS "${h3_test_Compile_Defs}"
COMPILE_FLAGS "${h3_test_Compile_Flags}"
INCLUDE_DIRECTORIES "${h3_test_Include_Dirs}")
target_link_libraries(h3-test ${h3_test_Dependencies})

from h3.

c9s avatar c9s commented on September 15, 2024

Hi! I'm very glad to have that cmake file, could you send me a pull request of the cmakefile that can build the project? because I am too busy to work on this project.

from h3.

KrishnaPG avatar KrishnaPG commented on September 15, 2024

Thank you - created pull-request (issue 7)

from h3.

c9s avatar c9s commented on September 15, 2024

use cmake instead of autotools.

from h3.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.