Skip to content

Commit 559336e

Browse files
committed
Updates to Windows CI build
1 parent 3590a5c commit 559336e

File tree

3 files changed

+47
-31
lines changed

3 files changed

+47
-31
lines changed

.github/workflows/build.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,44 @@ jobs:
118118
- name: Build test binary
119119
shell: pwsh
120120
run: cmake --build "${{ github.workspace }}\\build" --config ${{ env.BUILD_TYPE }} --target gecode-test
121+
122+
build-autoconf-windows:
123+
runs-on: windows-latest
124+
125+
steps:
126+
- uses: actions/checkout@v4
127+
128+
- name: Setup MSYS2
129+
uses: msys2/setup-msys2@v2
130+
with:
131+
msystem: UCRT64
132+
update: true
133+
install: >-
134+
autoconf
135+
automake
136+
bison
137+
flex
138+
gcc
139+
make
140+
m4
141+
libtool
142+
perl
143+
mingw-w64-ucrt-x86_64-gcc
144+
mingw-w64-ucrt-x86_64-gmp
145+
mingw-w64-ucrt-x86_64-mpfr
146+
147+
- name: Stabilize generated configure script timestamp
148+
shell: msys2 {0}
149+
run: touch configure
150+
151+
- name: Configure
152+
shell: msys2 {0}
153+
run: ./configure --disable-qt --disable-gist
154+
155+
- name: Build
156+
shell: msys2 {0}
157+
run: make test -j4
158+
159+
- name: Check
160+
shell: msys2 {0}
161+
run: make check

CMakeLists.txt

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -403,40 +403,13 @@ foreach(i RANGE ${length})
403403
set(CONFIG_OUT "${CONFIG_OUT}${line}")
404404
endforeach()
405405

406-
set(GECODE_BUILD_DEFINES "/* Disable autolink because all dependencies are handled by CMake. */\n")
407-
foreach(component SUPPORT KERNEL)
408-
string(APPEND GECODE_BUILD_DEFINES "#define GECODE_BUILD_${component}\n")
409-
endforeach()
410-
if(GECODE_ENABLE_SEARCH)
411-
string(APPEND GECODE_BUILD_DEFINES "#define GECODE_BUILD_SEARCH\n")
412-
endif()
413-
if(GECODE_ENABLE_INT_VARS)
414-
string(APPEND GECODE_BUILD_DEFINES "#define GECODE_BUILD_INT\n")
415-
endif()
416-
if(GECODE_ENABLE_SET_VARS)
417-
string(APPEND GECODE_BUILD_DEFINES "#define GECODE_BUILD_SET\n")
418-
endif()
419-
if(GECODE_ENABLE_FLOAT_VARS)
420-
string(APPEND GECODE_BUILD_DEFINES "#define GECODE_BUILD_FLOAT\n")
421-
endif()
422-
if(GECODE_ENABLE_MINIMODEL)
423-
string(APPEND GECODE_BUILD_DEFINES "#define GECODE_BUILD_MINIMODEL\n")
424-
endif()
425-
if(GECODE_ENABLE_FLATZINC)
426-
string(APPEND GECODE_BUILD_DEFINES "#define GECODE_BUILD_FLATZINC\n")
427-
endif()
428-
if(GECODE_ENABLE_DRIVER)
429-
string(APPEND GECODE_BUILD_DEFINES "#define GECODE_BUILD_DRIVER\n")
430-
endif()
431-
if(GECODE_BUILD_GIST_TARGET)
432-
string(APPEND GECODE_BUILD_DEFINES "#define GECODE_BUILD_GIST\n")
433-
endif()
434-
435406
file(WRITE ${GECODE_BINARY_DIR}/gecode/support/config.hpp
436407
"/* gecode/support/config.hpp. Generated from config.hpp.in by configure. */
437408
/* gecode/support/config.hpp.in. Generated from configure.ac by autoheader. */
438409
439-
${GECODE_BUILD_DEFINES}
410+
/* Disable MSVC pragma-based auto-linking: CMake wires dependencies explicitly. */
411+
#define GECODE_NO_AUTOLINK 1
412+
440413
${CONFIG_OUT}")
441414

442415
# ---------------------------------------------------------------------------
@@ -567,6 +540,7 @@ function(add_gecode_component_library lib)
567540

568541
if(GECODE_BUILD_SHARED)
569542
add_library(gecode${lib}_shared SHARED ${sources})
543+
target_compile_definitions(gecode${lib}_shared PRIVATE GECODE_BUILD_${libupper})
570544
target_include_directories(gecode${lib}_shared
571545
PUBLIC
572546
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
@@ -585,6 +559,7 @@ function(add_gecode_component_library lib)
585559

586560
if(GECODE_BUILD_STATIC)
587561
add_library(gecode${lib}_static STATIC ${sources})
562+
target_compile_definitions(gecode${lib}_static PRIVATE GECODE_BUILD_${libupper})
588563
target_include_directories(gecode${lib}_static
589564
PUBLIC
590565
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>

gecode/support/auto-link.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
*
3737
*/
3838

39-
#if defined(_MSC_VER)
39+
#if defined(_MSC_VER) && !defined(GECODE_NO_AUTOLINK)
4040

4141
#if defined(_M_IX86)
4242
#define GECODE_DLL_PLATFORM "x86"

0 commit comments

Comments
 (0)