Skip to content

Commit

Permalink
🎉 (haxe-basic-cpp/) Add basic example in Haxe with C++.
Browse files Browse the repository at this point in the history
  • Loading branch information
Comamoca committed Jul 19, 2024
1 parent 288c8e8 commit c7a5adb
Show file tree
Hide file tree
Showing 17 changed files with 102 additions and 0 deletions.
1 change: 1 addition & 0 deletions haxe-basic-cpp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
4 changes: 4 additions & 0 deletions haxe-basic-cpp/.haxerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"version": "4.3.4",
"resolveLibs": "scoped"
}
3 changes: 3 additions & 0 deletions haxe-basic-cpp/build.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-cp src
-main Main
-cpp build/
3 changes: 3 additions & 0 deletions haxe-basic-cpp/haxe_libraries/ansi.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# @install: lix --silent download "haxelib:/ansi#1.0.0" into ansi/1.0.0/haxelib
-cp ${HAXE_LIBCACHE}/ansi/1.0.0/haxelib/src
-D ansi=1.0.0
3 changes: 3 additions & 0 deletions haxe-basic-cpp/haxe_libraries/tink_core.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# @install: lix --silent download "haxelib:/tink_core#2.1.1" into tink_core/2.1.1/haxelib
-cp ${HAXE_LIBCACHE}/tink_core/2.1.1/haxelib/src
-D tink_core=2.1.1
4 changes: 4 additions & 0 deletions haxe-basic-cpp/haxe_libraries/tink_macro.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# @install: lix --silent download "haxelib:/tink_macro#1.0.3" into tink_macro/1.0.3/haxelib
-lib tink_core
-cp ${HAXE_LIBCACHE}/tink_macro/1.0.3/haxelib/src
-D tink_macro=1.0.3
3 changes: 3 additions & 0 deletions haxe-basic-cpp/haxe_libraries/tink_priority.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# @install: lix --silent download "haxelib:/tink_priority#0.1.4" into tink_priority/0.1.4/haxelib
-cp ${HAXE_LIBCACHE}/tink_priority/0.1.4/haxelib/src
-D tink_priority=0.1.4
6 changes: 6 additions & 0 deletions haxe-basic-cpp/haxe_libraries/tink_streams.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# @install: lix --silent download "haxelib:/tink_streams#0.4.0" into tink_streams/0.4.0/haxelib
-lib tink_core
-cp ${HAXE_LIBCACHE}/tink_streams/0.4.0/haxelib/src
-D tink_streams=0.4.0
# temp for development, delete this file when pure branch merged
-D pure
6 changes: 6 additions & 0 deletions haxe-basic-cpp/haxe_libraries/tink_syntaxhub.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# @install: lix --silent download "haxelib:/tink_syntaxhub#0.6.1" into tink_syntaxhub/0.6.1/haxelib
-lib tink_macro
-lib tink_priority
-cp ${HAXE_LIBCACHE}/tink_syntaxhub/0.6.1/haxelib/src
-D tink_syntaxhub=0.6.1
--macro tink.SyntaxHub.use()
6 changes: 6 additions & 0 deletions haxe-basic-cpp/haxe_libraries/tink_testrunner.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# @install: lix --silent download "haxelib:/tink_testrunner#0.9.0" into tink_testrunner/0.9.0/haxelib
-lib ansi
-lib tink_macro
-lib tink_streams
-cp ${HAXE_LIBCACHE}/tink_testrunner/0.9.0/haxelib/src
-D tink_testrunner=0.9.0
6 changes: 6 additions & 0 deletions haxe-basic-cpp/haxe_libraries/tink_unittest.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# @install: lix --silent download "haxelib:/tink_unittest#0.8.0" into tink_unittest/0.8.0/haxelib
-lib tink_syntaxhub
-lib tink_testrunner
-cp ${HAXE_LIBCACHE}/tink_unittest/0.8.0/haxelib/src
-D tink_unittest=0.8.0
--macro tink.unit.AssertionBufferInjector.use()
10 changes: 10 additions & 0 deletions haxe-basic-cpp/haxelib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "haxe-basic-cpp",
"url": "",
"license": "MIT",
"tags": [""],
"description": "A template project of Haxe on C++.",
"version": "0.0.1",
"contributors": [""],
"dependencies": {}
}
5 changes: 5 additions & 0 deletions haxe-basic-cpp/hxformat.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"indentation": {
"character": " "
}
}
3 changes: 3 additions & 0 deletions haxe-basic-cpp/run.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-cp src
--run Main
-cpp bin/cpp/main.cpp
13 changes: 13 additions & 0 deletions haxe-basic-cpp/src/basic/Main.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package basic;

import Sys;

class Main {
static function main() {
Sys.println("Hello world!");
}

public static function add(a:Int, b:Int) {
return a + b;
}
}
8 changes: 8 additions & 0 deletions haxe-basic-cpp/test.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Shutout deprecated warning from tink_unittest.
-w -WDeprecated
-cp src
-cp test
-lib tink_unittest
-lib tink_testrunner
--run Main
-cpp bin/cpp/main.cpp
18 changes: 18 additions & 0 deletions haxe-basic-cpp/test/Main.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import tink.unit.*;
import tink.unit.Assert.*;
import tink.testrunner.*;
import basic.Main;

class Main {
static function main() {
Runner.run(TestBatch.make([new Test(),])).handle(Runner.exit);
}
}

class Test {
public function new() {}

public function test()
return assert(basic.Main.add(1, 2) == 3);
}

0 comments on commit c7a5adb

Please sign in to comment.